2010-01-08 07:11:33 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
2010-05-03 14:08:02 +00:00
|
|
|
* Copyright (C) 2002-2010 PCSX2 Dev Team
|
2010-01-08 07:11:33 +00:00
|
|
|
*
|
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <wx/wx.h>
|
|
|
|
|
2010-01-22 15:22:01 +00:00
|
|
|
#include "Threading.h"
|
|
|
|
#include "wxGuiTools.h"
|
2010-04-27 13:12:03 +00:00
|
|
|
#include "pxEvents.h"
|
2014-11-22 17:51:05 +00:00
|
|
|
#include "AppTrait.h"
|
2010-01-08 07:11:33 +00:00
|
|
|
|
|
|
|
using namespace Threading;
|
|
|
|
|
2010-04-27 13:12:03 +00:00
|
|
|
class pxSynchronousCommandEvent;
|
2010-01-08 07:11:33 +00:00
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// pxAppLog / ConsoleLogSource_App
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class ConsoleLogSource_App : public ConsoleLogSource
|
|
|
|
{
|
2016-11-12 15:28:37 +00:00
|
|
|
typedef ConsoleLogSource _parent;
|
2010-08-06 05:46:09 +00:00
|
|
|
|
|
|
|
public:
|
2016-11-12 15:28:37 +00:00
|
|
|
ConsoleLogSource_App();
|
2010-08-06 05:46:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern ConsoleLogSource_App pxConLog_App;
|
|
|
|
|
2010-08-16 15:01:13 +00:00
|
|
|
#define pxAppLog pxConLog_App.IsActive() && pxConLog_App
|
2010-08-06 05:46:09 +00:00
|
|
|
|
2010-01-08 07:11:33 +00:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// ModalButtonPanel
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
class ModalButtonPanel : public wxPanelWithHelpers
|
|
|
|
{
|
|
|
|
public:
|
2016-11-12 15:28:37 +00:00
|
|
|
ModalButtonPanel(wxWindow *window, const MsgButtons &buttons);
|
2017-05-06 12:53:02 +00:00
|
|
|
virtual ~ModalButtonPanel() = default;
|
2010-01-08 07:11:33 +00:00
|
|
|
|
2016-11-12 15:28:37 +00:00
|
|
|
virtual void AddActionButton(wxWindowID id);
|
|
|
|
virtual void AddCustomButton(wxWindowID id, const wxString &label);
|
2010-01-08 07:11:33 +00:00
|
|
|
|
2016-11-12 15:28:37 +00:00
|
|
|
virtual void OnActionButtonClicked(wxCommandEvent &evt);
|
2010-01-08 07:11:33 +00:00
|
|
|
};
|
|
|
|
|
2016-11-12 15:28:37 +00:00
|
|
|
typedef std::list<wxEvent *> wxEventList;
|
2010-05-07 03:20:58 +00:00
|
|
|
|
2010-01-08 07:11:33 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// wxAppWithHelpers
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
class wxAppWithHelpers : public wxApp
|
|
|
|
{
|
2016-11-12 15:28:37 +00:00
|
|
|
typedef wxApp _parent;
|
|
|
|
|
2019-05-12 03:43:47 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxAppWithHelpers);
|
2010-01-08 07:11:33 +00:00
|
|
|
|
|
|
|
protected:
|
2016-11-12 15:28:37 +00:00
|
|
|
wxEventList m_IdleEventQueue;
|
|
|
|
Threading::MutexRecursive m_IdleEventMutex;
|
|
|
|
wxTimer m_IdleEventTimer;
|
2010-01-08 07:11:33 +00:00
|
|
|
|
|
|
|
public:
|
2016-11-12 15:28:37 +00:00
|
|
|
wxAppWithHelpers();
|
|
|
|
virtual ~wxAppWithHelpers() {}
|
2010-04-27 13:12:03 +00:00
|
|
|
|
2016-11-12 15:28:37 +00:00
|
|
|
wxAppTraits *CreateTraits();
|
|
|
|
|
|
|
|
void CleanUp();
|
|
|
|
|
|
|
|
void DeleteObject(BaseDeletableObject &obj);
|
|
|
|
void DeleteObject(BaseDeletableObject *obj)
|
|
|
|
{
|
|
|
|
if (obj == NULL)
|
|
|
|
return;
|
|
|
|
DeleteObject(*obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DeleteThread(Threading::pxThread &obj);
|
|
|
|
void DeleteThread(Threading::pxThread *obj)
|
|
|
|
{
|
|
|
|
if (obj == NULL)
|
|
|
|
return;
|
|
|
|
DeleteThread(*obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PostCommand(void *clientData, int evtType, int intParam = 0, long longParam = 0, const wxString &stringParam = wxEmptyString);
|
|
|
|
void PostCommand(int evtType, int intParam = 0, long longParam = 0, const wxString &stringParam = wxEmptyString);
|
|
|
|
void PostMethod(FnType_Void *method);
|
|
|
|
void PostIdleMethod(FnType_Void *method);
|
|
|
|
void ProcessMethod(FnType_Void *method);
|
|
|
|
|
|
|
|
bool Rpc_TryInvoke(FnType_Void *method);
|
|
|
|
bool Rpc_TryInvokeAsync(FnType_Void *method);
|
2010-01-22 15:22:01 +00:00
|
|
|
|
2016-11-12 15:28:37 +00:00
|
|
|
sptr ProcessCommand(void *clientData, int evtType, int intParam = 0, long longParam = 0, const wxString &stringParam = wxEmptyString);
|
|
|
|
sptr ProcessCommand(int evtType, int intParam = 0, long longParam = 0, const wxString &stringParam = wxEmptyString);
|
2010-04-27 13:12:03 +00:00
|
|
|
|
2016-11-12 15:28:37 +00:00
|
|
|
void ProcessAction(pxActionEvent &evt);
|
|
|
|
void PostAction(const pxActionEvent &evt);
|
|
|
|
|
|
|
|
void Ping();
|
|
|
|
bool OnInit();
|
|
|
|
//int OnExit();
|
|
|
|
|
|
|
|
void AddIdleEvent(const wxEvent &evt);
|
|
|
|
|
|
|
|
void PostEvent(const wxEvent &evt);
|
|
|
|
bool ProcessEvent(wxEvent &evt);
|
|
|
|
bool ProcessEvent(wxEvent *evt);
|
|
|
|
|
|
|
|
bool ProcessEvent(pxActionEvent &evt);
|
|
|
|
bool ProcessEvent(pxActionEvent *evt);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void IdleEventDispatcher(const wxChar *action = wxEmptyString);
|
|
|
|
|
|
|
|
void OnIdleEvent(wxIdleEvent &evt);
|
|
|
|
void OnStartIdleEventTimer(wxCommandEvent &evt);
|
|
|
|
void OnIdleEventTimeout(wxTimerEvent &evt);
|
|
|
|
void OnDeleteObject(wxCommandEvent &evt);
|
|
|
|
void OnDeleteThread(wxCommandEvent &evt);
|
|
|
|
void OnSynchronousCommand(pxSynchronousCommandEvent &evt);
|
|
|
|
void OnInvokeAction(pxActionEvent &evt);
|
2010-01-08 07:11:33 +00:00
|
|
|
};
|
2010-01-22 15:22:01 +00:00
|
|
|
|
|
|
|
namespace Msgbox
|
|
|
|
{
|
2016-11-12 15:28:37 +00:00
|
|
|
extern int ShowModal(BaseMessageBoxEvent &evt);
|
|
|
|
extern int ShowModal(const wxString &title, const wxString &content, const MsgButtons &buttons);
|
2010-01-22 15:22:01 +00:00
|
|
|
}
|