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"
|
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
|
|
|
|
{
|
|
|
|
typedef ConsoleLogSource _parent;
|
|
|
|
|
|
|
|
public:
|
2010-08-16 15:01:13 +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:
|
|
|
|
ModalButtonPanel( wxWindow* window, const MsgButtons& buttons );
|
|
|
|
virtual ~ModalButtonPanel() throw() { }
|
|
|
|
|
|
|
|
virtual void AddActionButton( wxWindowID id );
|
|
|
|
virtual void AddCustomButton( wxWindowID id, const wxString& label );
|
|
|
|
|
|
|
|
virtual void OnActionButtonClicked( wxCommandEvent& evt );
|
|
|
|
};
|
|
|
|
|
2010-05-28 16:50:49 +00:00
|
|
|
#ifdef _MSC_VER
|
2012-08-19 19:36:59 +00:00
|
|
|
typedef std::list< wxEvent*, WXObjectAllocator(wxEvent*) > wxEventList;
|
2010-05-28 16:50:49 +00:00
|
|
|
#else
|
|
|
|
typedef std::list< wxEvent* > wxEventList;
|
|
|
|
#endif
|
2010-05-07 03:20:58 +00:00
|
|
|
|
2010-01-08 07:11:33 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// wxAppWithHelpers
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
class wxAppWithHelpers : public wxApp
|
|
|
|
{
|
|
|
|
typedef wxApp _parent;
|
2010-04-27 13:12:03 +00:00
|
|
|
|
2010-01-22 15:22:01 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxAppWithHelpers)
|
2010-01-08 07:11:33 +00:00
|
|
|
|
|
|
|
protected:
|
2010-05-07 03:20:58 +00:00
|
|
|
wxEventList m_IdleEventQueue;
|
|
|
|
Threading::MutexRecursive m_IdleEventMutex;
|
|
|
|
wxTimer m_IdleEventTimer;
|
2010-01-08 07:11:33 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
wxAppWithHelpers();
|
|
|
|
virtual ~wxAppWithHelpers() {}
|
|
|
|
|
2010-01-22 15:22:01 +00:00
|
|
|
void CleanUp();
|
2010-04-27 13:12:03 +00:00
|
|
|
|
|
|
|
void DeleteObject( BaseDeletableObject& obj );
|
|
|
|
void DeleteObject( BaseDeletableObject* obj )
|
2010-01-22 15:22:01 +00:00
|
|
|
{
|
|
|
|
if( obj == NULL ) return;
|
|
|
|
DeleteObject( *obj );
|
|
|
|
}
|
|
|
|
|
2010-06-19 13:42:32 +00:00
|
|
|
void DeleteThread( Threading::pxThread& obj );
|
|
|
|
void DeleteThread( Threading::pxThread* obj )
|
2010-04-27 13:12:03 +00:00
|
|
|
{
|
|
|
|
if( obj == NULL ) return;
|
|
|
|
DeleteThread( *obj );
|
|
|
|
}
|
|
|
|
|
2010-01-08 07:11:33 +00:00
|
|
|
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 );
|
2010-04-27 13:12:03 +00:00
|
|
|
void PostMethod( FnType_Void* method );
|
|
|
|
void PostIdleMethod( FnType_Void* method );
|
2010-06-19 13:42:32 +00:00
|
|
|
void ProcessMethod( FnType_Void* method );
|
|
|
|
|
|
|
|
bool Rpc_TryInvoke( FnType_Void* method );
|
|
|
|
bool Rpc_TryInvokeAsync( FnType_Void* method );
|
2010-04-27 13:12:03 +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-06-19 13:42:32 +00:00
|
|
|
void ProcessAction( pxActionEvent& evt );
|
|
|
|
void PostAction( const pxActionEvent& evt );
|
2010-01-08 07:11:33 +00:00
|
|
|
|
|
|
|
void Ping();
|
|
|
|
bool OnInit();
|
|
|
|
//int OnExit();
|
|
|
|
|
2010-04-27 13:12:03 +00:00
|
|
|
void AddIdleEvent( const wxEvent& evt );
|
|
|
|
|
|
|
|
void PostEvent( const wxEvent& evt );
|
|
|
|
bool ProcessEvent( wxEvent& evt );
|
|
|
|
bool ProcessEvent( wxEvent* evt );
|
|
|
|
|
2010-06-19 13:42:32 +00:00
|
|
|
bool ProcessEvent( pxActionEvent& evt );
|
|
|
|
bool ProcessEvent( pxActionEvent* evt );
|
2010-04-27 13:12:03 +00:00
|
|
|
|
2010-01-08 07:11:33 +00:00
|
|
|
protected:
|
2010-08-06 05:46:09 +00:00
|
|
|
void IdleEventDispatcher( const wxChar* action=wxEmptyString );
|
2010-01-22 15:22:01 +00:00
|
|
|
|
2010-01-08 07:11:33 +00:00
|
|
|
void OnIdleEvent( wxIdleEvent& evt );
|
2010-04-27 13:12:03 +00:00
|
|
|
void OnStartIdleEventTimer( wxEvent& evt );
|
2010-03-05 14:24:44 +00:00
|
|
|
void OnIdleEventTimeout( wxTimerEvent& evt );
|
2010-01-22 15:22:01 +00:00
|
|
|
void OnDeleteObject( wxCommandEvent& evt );
|
2010-04-27 13:12:03 +00:00
|
|
|
void OnDeleteThread( wxCommandEvent& evt );
|
|
|
|
void OnSynchronousCommand( pxSynchronousCommandEvent& evt );
|
2010-06-19 13:42:32 +00:00
|
|
|
void OnInvokeAction( pxActionEvent& evt );
|
2010-04-27 13:12:03 +00:00
|
|
|
|
2010-01-08 07:11:33 +00:00
|
|
|
};
|
2010-01-22 15:22:01 +00:00
|
|
|
|
|
|
|
namespace Msgbox
|
|
|
|
{
|
|
|
|
extern int ShowModal( BaseMessageBoxEvent& evt );
|
2010-08-06 05:46:09 +00:00
|
|
|
extern int ShowModal( const wxString& title, const wxString& content, const MsgButtons& buttons );
|
2010-01-22 15:22:01 +00:00
|
|
|
}
|