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