2013-04-18 03:43:35 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <cstddef>
|
|
|
|
#include <string>
|
2008-12-08 04:46:09 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/event.h>
|
|
|
|
#include <wx/gdicmn.h>
|
2008-12-08 04:46:09 +00:00
|
|
|
#include <wx/listctrl.h>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/string.h>
|
2009-09-25 16:29:00 +00:00
|
|
|
#include <wx/tipwin.h>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/windowid.h>
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/ISOFile.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
|
|
|
|
class wxListEvent;
|
|
|
|
class wxWindow;
|
2009-09-25 16:29:00 +00:00
|
|
|
|
|
|
|
class wxEmuStateTip : public wxTipWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxEmuStateTip(wxWindow* parent, const wxString& text, wxEmuStateTip** windowPtr)
|
2014-11-09 00:26:20 +00:00
|
|
|
: wxTipWindow(parent, text, 70, (wxTipWindow**)windowPtr)
|
|
|
|
{
|
|
|
|
Bind(wxEVT_KEY_DOWN, &wxEmuStateTip::OnKeyDown, this);
|
|
|
|
}
|
|
|
|
|
2009-09-25 16:29:00 +00:00
|
|
|
// wxTipWindow doesn't correctly handle KeyEvents and crashes... we must overload that.
|
|
|
|
void OnKeyDown(wxKeyEvent& event) { event.StopPropagation(); Close(); }
|
|
|
|
};
|
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
class CGameListCtrl : public wxListCtrl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
|
|
|
|
~CGameListCtrl();
|
|
|
|
|
2014-03-08 00:54:44 +00:00
|
|
|
void Update() override;
|
2009-04-15 20:19:25 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
void BrowseForDirectory();
|
|
|
|
const GameListItem *GetSelectedISO();
|
2011-03-22 07:27:23 +00:00
|
|
|
const GameListItem *GetISO(size_t index) const;
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2012-12-17 11:08:45 +00:00
|
|
|
COLUMN_DUMMY = 0,
|
|
|
|
COLUMN_PLATFORM,
|
2009-09-25 16:29:00 +00:00
|
|
|
COLUMN_BANNER,
|
2008-12-08 04:46:09 +00:00
|
|
|
COLUMN_TITLE,
|
2015-04-20 11:00:15 +00:00
|
|
|
COLUMN_MAKER,
|
2014-06-04 13:54:48 +00:00
|
|
|
COLUMN_ID,
|
2008-12-08 04:46:09 +00:00
|
|
|
COLUMN_COUNTRY,
|
|
|
|
COLUMN_SIZE,
|
|
|
|
COLUMN_EMULATION_STATE,
|
|
|
|
NUMBER_OF_COLUMN
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
std::vector<int> m_FlagImageIndex;
|
2009-05-27 06:41:01 +00:00
|
|
|
std::vector<int> m_PlatformImageIndex;
|
2009-09-25 16:29:00 +00:00
|
|
|
std::vector<int> m_EmuStateImageIndex;
|
2011-03-22 07:27:23 +00:00
|
|
|
std::vector<GameListItem*> m_ISOFiles;
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2011-03-23 04:31:00 +00:00
|
|
|
void ClearIsoFiles()
|
|
|
|
{
|
2014-02-17 04:51:41 +00:00
|
|
|
while (!m_ISOFiles.empty()) // so lazy
|
2011-03-23 04:31:00 +00:00
|
|
|
{
|
|
|
|
delete m_ISOFiles.back();
|
|
|
|
m_ISOFiles.pop_back();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
int last_column;
|
|
|
|
int last_sort;
|
2009-07-27 04:26:56 +00:00
|
|
|
wxSize lastpos;
|
2009-09-25 16:29:00 +00:00
|
|
|
wxEmuStateTip *toolTip;
|
2008-12-08 04:46:09 +00:00
|
|
|
void InitBitmaps();
|
|
|
|
void InsertItemInReportView(long _Index);
|
|
|
|
void SetBackgroundColor();
|
2009-02-03 15:03:34 +00:00
|
|
|
void ScanForISOs();
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
// events
|
2010-01-19 13:43:51 +00:00
|
|
|
void OnLeftClick(wxMouseEvent& event);
|
2008-12-08 04:46:09 +00:00
|
|
|
void OnRightClick(wxMouseEvent& event);
|
2009-09-25 16:29:00 +00:00
|
|
|
void OnMouseMotion(wxMouseEvent& event);
|
2008-12-08 04:46:09 +00:00
|
|
|
void OnColumnClick(wxListEvent& event);
|
|
|
|
void OnColBeginDrag(wxListEvent& event);
|
2009-09-25 16:29:00 +00:00
|
|
|
void OnKeyPress(wxListEvent& event);
|
2008-12-08 04:46:09 +00:00
|
|
|
void OnSize(wxSizeEvent& event);
|
|
|
|
void OnProperties(wxCommandEvent& event);
|
2011-02-25 23:33:11 +00:00
|
|
|
void OnWiki(wxCommandEvent& event);
|
2008-12-08 04:46:09 +00:00
|
|
|
void OnOpenContainingFolder(wxCommandEvent& event);
|
2009-05-02 18:06:42 +00:00
|
|
|
void OnOpenSaveFolder(wxCommandEvent& event);
|
2010-01-14 07:19:10 +00:00
|
|
|
void OnExportSave(wxCommandEvent& event);
|
2014-09-28 23:05:27 +00:00
|
|
|
void OnSetDefaultISO(wxCommandEvent& event);
|
|
|
|
void OnDeleteISO(wxCommandEvent& event);
|
|
|
|
void OnCompressISO(wxCommandEvent& event);
|
|
|
|
void OnMultiCompressISO(wxCommandEvent& event);
|
|
|
|
void OnMultiDecompressISO(wxCommandEvent& event);
|
2009-06-17 06:37:34 +00:00
|
|
|
void OnInstallWAD(wxCommandEvent& event);
|
2014-06-24 04:07:46 +00:00
|
|
|
void OnChangeDisc(wxCommandEvent& event);
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
|
|
void CompressSelection(bool _compress);
|
|
|
|
void AutomaticColumnWidth();
|
|
|
|
void UnselectAll();
|
|
|
|
|
|
|
|
static size_t m_currentItem;
|
|
|
|
static std::string m_currentFilename;
|
|
|
|
static size_t m_numberItem;
|
2014-11-27 15:53:28 +00:00
|
|
|
static bool CompressCB(const std::string& text, float percent, void* arg);
|
|
|
|
static bool MultiCompressCB(const std::string& text, float percent, void* arg);
|
2008-12-08 04:46:09 +00:00
|
|
|
};
|