/[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 31 - (hide annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 11 months ago) by william
File MIME type: text/plain
File size: 3963 byte(s)
committing r3113 initial commit again...
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    
29     // --------------------------------------------------------------------------------------
30     // ModalButtonPanel
31     // --------------------------------------------------------------------------------------
32     class ModalButtonPanel : public wxPanelWithHelpers
33     {
34     public:
35     ModalButtonPanel( wxWindow* window, const MsgButtons& buttons );
36     virtual ~ModalButtonPanel() throw() { }
37    
38     virtual void AddActionButton( wxWindowID id );
39     virtual void AddCustomButton( wxWindowID id, const wxString& label );
40    
41     virtual void OnActionButtonClicked( wxCommandEvent& evt );
42     };
43    
44     #ifdef _MSC_VER
45     typedef std::list< wxEvent*, wxObjectAllocator<wxEvent*> > wxEventList;
46     #else
47     typedef std::list< wxEvent* > wxEventList;
48     #endif
49    
50     // --------------------------------------------------------------------------------------
51     // wxAppWithHelpers
52     // --------------------------------------------------------------------------------------
53     class wxAppWithHelpers : public wxApp
54     {
55     typedef wxApp _parent;
56    
57     DECLARE_DYNAMIC_CLASS(wxAppWithHelpers)
58    
59     protected:
60     wxEventList m_IdleEventQueue;
61     Threading::MutexRecursive m_IdleEventMutex;
62     wxTimer m_IdleEventTimer;
63    
64     public:
65     wxAppWithHelpers();
66     virtual ~wxAppWithHelpers() {}
67    
68     void CleanUp();
69    
70     void DeleteObject( BaseDeletableObject& obj );
71     void DeleteObject( BaseDeletableObject* obj )
72     {
73     if( obj == NULL ) return;
74     DeleteObject( *obj );
75     }
76    
77     void DeleteThread( Threading::PersistentThread& obj );
78     void DeleteThread( Threading::PersistentThread* obj )
79     {
80     if( obj == NULL ) return;
81     DeleteThread( *obj );
82     }
83    
84     void PostCommand( void* clientData, int evtType, int intParam=0, long longParam=0, const wxString& stringParam=wxEmptyString );
85     void PostCommand( int evtType, int intParam=0, long longParam=0, const wxString& stringParam=wxEmptyString );
86     void PostMethod( FnType_Void* method );
87     void PostIdleMethod( FnType_Void* method );
88     void ProcessMethod( void (*method)() );
89    
90     sptr ProcessCommand( void* clientData, int evtType, int intParam=0, long longParam=0, const wxString& stringParam=wxEmptyString );
91     sptr ProcessCommand( int evtType, int intParam=0, long longParam=0, const wxString& stringParam=wxEmptyString );
92    
93     void ProcessAction( pxInvokeActionEvent& evt );
94     void PostAction( const pxInvokeActionEvent& evt );
95    
96     bool PostMethodMyself( void (*method)() );
97    
98     void Ping();
99     bool OnInit();
100     //int OnExit();
101    
102     void AddIdleEvent( const wxEvent& evt );
103    
104     void PostEvent( const wxEvent& evt );
105     bool ProcessEvent( wxEvent& evt );
106     bool ProcessEvent( wxEvent* evt );
107    
108     bool ProcessEvent( pxInvokeActionEvent& evt );
109     bool ProcessEvent( pxInvokeActionEvent* evt );
110    
111     protected:
112     void IdleEventDispatcher( const wxChar* action );
113    
114     void OnIdleEvent( wxIdleEvent& evt );
115     void OnStartIdleEventTimer( wxEvent& evt );
116     void OnIdleEventTimeout( wxTimerEvent& evt );
117     void OnDeleteObject( wxCommandEvent& evt );
118     void OnDeleteThread( wxCommandEvent& evt );
119     void OnSynchronousCommand( pxSynchronousCommandEvent& evt );
120     void OnInvokeAction( pxInvokeActionEvent& evt );
121    
122     };
123    
124     namespace Msgbox
125     {
126     extern int ShowModal( BaseMessageBoxEvent& evt );
127     }

  ViewVC Help
Powered by ViewVC 1.1.22