/[pcsx2_0.9.7]/trunk/common/include/Utilities/wxAppWithHelpers.h
ViewVC logotype

Annotation of /trunk/common/include/Utilities/wxAppWithHelpers.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (hide annotations) (download)
Tue Sep 7 11:08:22 2010 UTC (9 years, 11 months ago) by william
File MIME type: text/plain
File size: 4529 byte(s)
Auto Commited Import of: pcsx2-0.9.7-r3738-debug in ./trunk
1 william 31 /* PCSX2 - PS2 Emulator for PCs
2     * Copyright (C) 2002-2010 PCSX2 Dev Team
3     *
4     * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5     * of the GNU Lesser General Public License as published by the Free Software Found-
6     * ation, either version 3 of the License, or (at your option) any later version.
7     *
8     * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9     * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10     * PURPOSE. See the GNU General Public License for more details.
11     *
12     * You should have received a copy of the GNU General Public License along with PCSX2.
13     * If not, see <http://www.gnu.org/licenses/>.
14     */
15    
16     #pragma once
17    
18     #include <wx/wx.h>
19    
20     #include "Threading.h"
21     #include "wxGuiTools.h"
22     #include "pxEvents.h"
23    
24     using namespace Threading;
25    
26     class pxSynchronousCommandEvent;
27    
28 william 62 // --------------------------------------------------------------------------------------
29     // pxAppLog / ConsoleLogSource_App
30     // --------------------------------------------------------------------------------------
31 william 31
32 william 62 class ConsoleLogSource_App : public ConsoleLogSource
33     {
34     typedef ConsoleLogSource _parent;
35    
36     public:
37     ConsoleLogSource_App();
38     };
39    
40     extern ConsoleLogSource_App pxConLog_App;
41    
42     #define pxAppLog pxConLog_App.IsActive() && pxConLog_App
43    
44    
45 william 31 // --------------------------------------------------------------------------------------
46     // ModalButtonPanel
47     // --------------------------------------------------------------------------------------
48     class ModalButtonPanel : public wxPanelWithHelpers
49     {
50     public:
51     ModalButtonPanel( wxWindow* window, const MsgButtons& buttons );
52     virtual ~ModalButtonPanel() throw() { }
53    
54     virtual void AddActionButton( wxWindowID id );
55     virtual void AddCustomButton( wxWindowID id, const wxString& label );
56    
57     virtual void OnActionButtonClicked( wxCommandEvent& evt );
58     };
59    
60     #ifdef _MSC_VER
61     typedef std::list< wxEvent*, wxObjectAllocator<wxEvent*> > wxEventList;
62     #else
63     typedef std::list< wxEvent* > wxEventList;
64     #endif
65    
66     // --------------------------------------------------------------------------------------
67     // wxAppWithHelpers
68     // --------------------------------------------------------------------------------------
69     class wxAppWithHelpers : public wxApp
70     {
71     typedef wxApp _parent;
72    
73     DECLARE_DYNAMIC_CLASS(wxAppWithHelpers)
74    
75     protected:
76     wxEventList m_IdleEventQueue;
77     Threading::MutexRecursive m_IdleEventMutex;
78     wxTimer m_IdleEventTimer;
79    
80     public:
81     wxAppWithHelpers();
82     virtual ~wxAppWithHelpers() {}
83    
84     void CleanUp();
85    
86     void DeleteObject( BaseDeletableObject& obj );
87     void DeleteObject( BaseDeletableObject* obj )
88     {
89     if( obj == NULL ) return;
90     DeleteObject( *obj );
91     }
92    
93 william 62 void DeleteThread( Threading::pxThread& obj );
94     void DeleteThread( Threading::pxThread* obj )
95 william 31 {
96     if( obj == NULL ) return;
97     DeleteThread( *obj );
98     }
99    
100     void PostCommand( void* clientData, int evtType, int intParam=0, long longParam=0, const wxString& stringParam=wxEmptyString );
101     void PostCommand( int evtType, int intParam=0, long longParam=0, const wxString& stringParam=wxEmptyString );
102     void PostMethod( FnType_Void* method );
103     void PostIdleMethod( FnType_Void* method );
104 william 62 void ProcessMethod( FnType_Void* method );
105 william 31
106 william 62 bool Rpc_TryInvoke( FnType_Void* method );
107     bool Rpc_TryInvokeAsync( FnType_Void* method );
108    
109 william 31 sptr ProcessCommand( void* clientData, int evtType, int intParam=0, long longParam=0, const wxString& stringParam=wxEmptyString );
110     sptr ProcessCommand( int evtType, int intParam=0, long longParam=0, const wxString& stringParam=wxEmptyString );
111    
112 william 62 void ProcessAction( pxActionEvent& evt );
113     void PostAction( const pxActionEvent& evt );
114 william 31
115     void Ping();
116     bool OnInit();
117     //int OnExit();
118    
119     void AddIdleEvent( const wxEvent& evt );
120    
121     void PostEvent( const wxEvent& evt );
122     bool ProcessEvent( wxEvent& evt );
123     bool ProcessEvent( wxEvent* evt );
124    
125 william 62 bool ProcessEvent( pxActionEvent& evt );
126     bool ProcessEvent( pxActionEvent* evt );
127 william 31
128     protected:
129 william 62 void IdleEventDispatcher( const wxChar* action=wxEmptyString );
130 william 31
131     void OnIdleEvent( wxIdleEvent& evt );
132     void OnStartIdleEventTimer( wxEvent& evt );
133     void OnIdleEventTimeout( wxTimerEvent& evt );
134     void OnDeleteObject( wxCommandEvent& evt );
135     void OnDeleteThread( wxCommandEvent& evt );
136     void OnSynchronousCommand( pxSynchronousCommandEvent& evt );
137 william 62 void OnInvokeAction( pxActionEvent& evt );
138 william 31
139     };
140    
141     namespace Msgbox
142     {
143     extern int ShowModal( BaseMessageBoxEvent& evt );
144 william 62 extern int ShowModal( const wxString& title, const wxString& content, const MsgButtons& buttons );
145 william 31 }

  ViewVC Help
Powered by ViewVC 1.1.22