Remove favorites panel, the last opened virtual machines can be found in the file...
[qemu-gui.git] / mainframe.h
blob55d98a61c57f1dcec7639be6308aaa38cf2daf44
1 #ifndef QEMU_GUI_MAINFRAME_H
2 #define QEMU_GUI_MAINFRAME_H
4 #include <wx/splitter.h>
5 #include <wx/notebook.h>
6 #include <wx/dynarray.h>
7 #include <wx/frame.h>
9 class VNCPanel;
11 class QemuVM;
12 class QemuUIMenuBar;
13 class QemuUIToolBar;
14 class QemuUINotebook;
15 class QemuUINotebookPage;
16 class QemuUIStatusBar;
17 class wxConfigBase;
18 class wxScrolledWindow;
19 class wxFileHistory;
21 WX_DEFINE_ARRAY_PTR(QemuVM *,VMArray);
23 class QemuMainFrame : public wxFrame
25 public:
26 QemuMainFrame(const wxString& title);
28 /**
29 * shows the homepage by selecting the corresponding tab
30 * or calls CreateHomepage() to create a new one.
32 void ShowHomepage();
33 /**
34 * returns the currently active vm tab or NULL if the homepage
35 * is active
37 QemuUINotebookPage* GetCurrentVMTab();
38 /**
39 * returns the currently active virtual machine or NULL
41 QemuVM* GetCurrentVM();
43 /**
44 * opens a vm, creates a new tab and updates the vms array,
45 * returns false if the vm is already open.
47 bool OpenVM(QemuVM *vm);
48 void OpenVM(const wxString& config);
49 //void CloseVM(QemuVM *vm);
51 void SaveFileHistory(wxConfigBase*);
52 void LoadFileHistory(wxConfigBase*);
54 /**
55 * enables / disables the toolbar buttons and the statusbar
56 * according to the vm state
58 void UpdateState();
61 /**
62 * gets called when a radio item from the windows menu is selected
63 * has to be public because the event handler is dynamically added
64 * in menubar.cpp
66 void OnChangeWindow(wxCommandEvent&);
67 private:
68 /* various event handlers */
69 void OnNewVM(wxCommandEvent &event);
70 void OnOpenVM(wxCommandEvent &event);
71 void OnQuitCommandEvent(wxCommandEvent& event);
72 /**
73 * quit's the application, checks if there are still vm running
74 * and if so asks the user what to do.
76 void OnQuit(wxCloseEvent& event);
78 void OnShowHomepage(wxCommandEvent& event);
79 void OnFullScreen(wxCommandEvent& event);
80 void OnToggleToolBar(wxCommandEvent& event);
81 void OnToolBarSettingChange(wxCommandEvent& event);
82 void OnToggleStatusBar(wxCommandEvent& event);
84 void OnVMSettings(wxCommandEvent& event);
86 void OnPowerOnVM(wxCommandEvent& event);
87 void OnPowerOffVM(wxCommandEvent& event);
88 void OnPauseVM(wxCommandEvent& event);
89 void OnResetVM(wxCommandEvent& event);
90 void OnKillVM(wxCommandEvent& event);
92 void OnSnapshot(wxCommandEvent& event);
93 void OnRevertSnapshot(wxCommandEvent& event);
95 void OnToggleDisplay(wxCommandEvent& event);
97 void OnSendCommandToVM(wxCommandEvent& event);
99 void OnNextWindow(wxCommandEvent&);
100 void OnPrevWindow(wxCommandEvent&);
102 * notebook related event handlers
104 void OnNotebookPageChanged(wxNotebookEvent& event);
105 void OnNotebookPageClosed(wxCommandEvent&);
106 void CloseNotebookPage(const int pos);
108 void OnConnectCdRom(wxCommandEvent&);
111 * creates the homepage tab and prepends an entry to the
112 * window menu
114 void CreateHomepage();
117 * gets called from the filehistory menu items
119 void OnReOpenVM(wxCommandEvent& event);
121 void OnOpenQemuDoc(wxCommandEvent& event);
122 void OnAbout(wxCommandEvent& event);
125 * Sets up some sizers which make sure that the notebook
126 * widget takes all available space.
128 void DoLayout();
130 QemuUIMenuBar *menubar;
131 QemuUIToolBar *toolbar;
132 QemuUIStatusBar *statusbar;
134 wxScrolledWindow *mainwindow;
135 QemuUINotebook *notebook;
137 wxFileHistory *filehistory;
139 // holds all currently opened vm's
140 VMArray vms;
141 // used to store the current toolbar style before toogling
142 long toolbarStyle;
144 DECLARE_EVENT_TABLE()
147 #endif