/[pcsx2_0.9.7]/trunk/pcsx2/gui/MainFrame.h
ViewVC logotype

Contents of /trunk/pcsx2/gui/MainFrame.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 280 - (show annotations) (download)
Thu Dec 23 12:02:12 2010 UTC (9 years, 1 month ago) by william
File MIME type: text/plain
File size: 6720 byte(s)
re-commit (had local access denied errors when committing)
1 /* 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 "App.h"
19 #include "AppSaveStates.h"
20
21 #include <wx/image.h>
22 #include <wx/docview.h>
23
24 struct PluginMenuAddition
25 {
26 wxString Text;
27 wxString HelpText;
28 PS2E_MenuItemStyle Flags;
29
30 wxMenuItem* Item;
31 int ItemId;
32
33 // Optional user data pointer (or typecast integer value)
34 void* UserPtr;
35
36 void (PS2E_CALLBACK *OnClicked)( PS2E_THISPTR* thisptr, void* userptr );
37 };
38
39 // --------------------------------------------------------------------------------------
40 // PerPluginMenuInfo
41 // --------------------------------------------------------------------------------------
42 class PerPluginMenuInfo
43 {
44 protected:
45 typedef std::vector<PluginMenuAddition> MenuItemAddonList;
46
47 // A list of menu items belonging to this plugin's menu.
48 MenuItemAddonList m_PluginMenuItems;
49
50 // Base index for inserting items, usually points to the position
51 // after the heading entry and separator.
52 int m_InsertIndexBase;
53
54 // Current index for inserting menu items; increments with each item
55 // added by a plugin.
56 int m_InsertIndexCur;
57
58 public:
59 PluginsEnum_t PluginId;
60 wxMenu& MyMenu;
61
62 public:
63 PerPluginMenuInfo() : MyMenu( *new wxMenu() )
64 {
65 }
66
67 virtual ~PerPluginMenuInfo() throw();
68
69 void Populate( PluginsEnum_t pid );
70 void OnUnloaded();
71 void OnLoaded();
72
73 operator wxMenu*() { return &MyMenu; }
74 operator const wxMenu*() const { return &MyMenu; }
75 };
76
77 // --------------------------------------------------------------------------------------
78 // InvokeMenuCommand_OnSysStateUnlocked
79 // --------------------------------------------------------------------------------------
80 class InvokeMenuCommand_OnSysStateUnlocked
81 : public IEventListener_SysState
82 , public BaseDeletableObject
83 {
84 protected:
85 MenuIdentifiers m_menu_cmd;
86
87 public:
88 InvokeMenuCommand_OnSysStateUnlocked( MenuIdentifiers menu_command )
89 {
90 m_menu_cmd = menu_command;
91 }
92
93 virtual ~InvokeMenuCommand_OnSysStateUnlocked() throw() {}
94
95 virtual void SaveStateAction_OnCreateFinished()
96 {
97 wxGetApp().PostMenuAction( m_menu_cmd );
98 }
99 };
100
101 // --------------------------------------------------------------------------------------
102 // MainEmuFrame
103 // --------------------------------------------------------------------------------------
104 class MainEmuFrame : public wxFrame,
105 public EventListener_Plugins,
106 public EventListener_CoreThread,
107 public EventListener_AppStatus
108 {
109 typedef wxFrame _parent;
110
111 protected:
112 bool m_RestartEmuOnDelete;
113
114 wxStatusBar& m_statusbar;
115 wxStaticBitmap m_background;
116
117 wxMenuBar& m_menubar;
118
119 wxMenu& m_menuCDVD;
120 wxMenu& m_menuSys;
121 wxMenu& m_menuConfig;
122 wxMenu& m_menuMisc;
123 wxMenu& m_menuDebug;
124
125 wxMenu& m_LoadStatesSubmenu;
126 wxMenu& m_SaveStatesSubmenu;
127
128 wxMenuItem& m_MenuItem_Console;
129 wxMenuItem& m_MenuItem_Console_Stdio;
130
131 PerPluginMenuInfo m_PluginMenuPacks[PluginId_Count];
132
133 virtual void DispatchEvent( const PluginEventType& plugin_evt );
134 virtual void DispatchEvent( const CoreThreadStatus& status );
135 virtual void AppStatusEvent_OnSettingsLoadSave();
136 virtual void AppStatusEvent_OnSettingsApplied();
137
138 public:
139 MainEmuFrame(wxWindow* parent, const wxString& title);
140 virtual ~MainEmuFrame() throw();
141
142 void OnLogBoxHidden();
143
144 bool IsPaused() const { return GetMenuBar()->IsChecked( MenuId_Sys_SuspendResume ); }
145 void UpdateIsoSrcSelection();
146 void RemoveCdvdMenu();
147 void EnableMenuItem( int id, bool enable );
148
149 bool Destroy();
150
151 protected:
152 void DoGiveHelp(const wxString& text, bool show);
153
154 void ApplySettings();
155 void ApplyCoreStatus();
156 void SaveEmuOptions();
157
158 void InitLogBoxPosition( AppConfig::ConsoleLogOptions& conf );
159
160 void OnCloseWindow( wxCloseEvent& evt );
161 void OnMoveAround( wxMoveEvent& evt );
162 void OnFocus( wxFocusEvent& evt );
163 void OnActivate( wxActivateEvent& evt );
164
165 void Menu_SysSettings_Click(wxCommandEvent &event);
166 void Menu_McdSettings_Click(wxCommandEvent &event);
167 void Menu_GameDatabase_Click(wxCommandEvent &event);
168 void Menu_WindowSettings_Click(wxCommandEvent &event);
169 void Menu_GSSettings_Click(wxCommandEvent &event);
170 void Menu_SelectPluginsBios_Click(wxCommandEvent &event);
171 void Menu_Language_Click(wxCommandEvent &event);
172 void Menu_ResetAllSettings_Click(wxCommandEvent &event);
173
174 void Menu_IsoBrowse_Click(wxCommandEvent &event);
175 void Menu_EnablePatches_Click(wxCommandEvent &event);
176 void Menu_EnableCheats_Click(wxCommandEvent &event);
177 void Menu_EnableHostFs_Click(wxCommandEvent &event);
178
179 void Menu_BootCdvd_Click(wxCommandEvent &event);
180 void Menu_BootCdvd2_Click(wxCommandEvent &event);
181 void Menu_OpenELF_Click(wxCommandEvent &event);
182 void Menu_CdvdSource_Click(wxCommandEvent &event);
183 void Menu_LoadStates_Click(wxCommandEvent &event);
184 void Menu_SaveStates_Click(wxCommandEvent &event);
185 void Menu_LoadStateOther_Click(wxCommandEvent &event);
186 void Menu_SaveStateOther_Click(wxCommandEvent &event);
187 void Menu_Exit_Click(wxCommandEvent &event);
188
189 void Menu_SuspendResume_Click(wxCommandEvent &event);
190 void Menu_SysReset_Click(wxCommandEvent &event);
191 void Menu_SysShutdown_Click(wxCommandEvent &event);
192
193 void Menu_ConfigPlugin_Click(wxCommandEvent &event);
194
195 void Menu_MultitapToggle_Click(wxCommandEvent &event);
196
197 void Menu_Debug_Open_Click(wxCommandEvent &event);
198 void Menu_Debug_MemoryDump_Click(wxCommandEvent &event);
199 void Menu_Debug_Logging_Click(wxCommandEvent &event);
200
201 void Menu_ShowConsole(wxCommandEvent &event);
202 void Menu_ShowConsole_Stdio(wxCommandEvent &event);
203 void Menu_PrintCDVD_Info(wxCommandEvent &event);
204 void Menu_ShowAboutBox(wxCommandEvent &event);
205
206 void _DoBootCdvd();
207 bool _DoSelectIsoBrowser( wxString& dest );
208 bool _DoSelectELFBrowser();
209
210 // ------------------------------------------------------------------------
211 // MainEmuFram Internal API for Populating Main Menu Contents
212 // ------------------------------------------------------------------------
213
214 wxMenu* MakeStatesSubMenu( int baseid ) const;
215 wxMenu* MakeStatesMenu();
216 wxMenu* MakeLanguagesMenu() const;
217
218 void ConnectMenus();
219
220 friend class Pcsx2App;
221 };
222

  ViewVC Help
Powered by ViewVC 1.1.22