Better looking toolbar styles (especially on Windows)
[qemu-gui.git] / mainframe.h
blob57ab6e1d6bdb76a8308aa858bcd90fa71a026057
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);
85 void OnVMSendCtrlAltDel(wxCommandEvent& event);
87 void OnPowerOnVM(wxCommandEvent& event);
88 void OnPowerOffVM(wxCommandEvent& event);
89 void OnPauseVM(wxCommandEvent& event);
90 void OnResetVM(wxCommandEvent& event);
91 void OnKillVM(wxCommandEvent& event);
93 void OnSnapshot(wxCommandEvent& event);
94 void OnRevertSnapshot(wxCommandEvent& event);
96 void OnToggleDisplay(wxCommandEvent& event);
98 void OnSendCommandToVM(wxCommandEvent& event);
100 void OnNextWindow(wxCommandEvent&);
101 void OnPrevWindow(wxCommandEvent&);
103 * notebook related event handlers
105 void OnNotebookPageChanged(wxNotebookEvent& event);
106 void OnNotebookPageClosed(wxCommandEvent&);
107 void CloseNotebookPage(const int pos);
109 void OnConnectCdRom(wxCommandEvent&);
112 * creates the homepage tab and prepends an entry to the
113 * window menu
115 void CreateHomepage();
118 * gets called from the filehistory menu items
120 void OnReOpenVM(wxCommandEvent& event);
122 void OnOpenQemuDoc(wxCommandEvent& event);
123 void OnAbout(wxCommandEvent& event);
126 * Sets up some sizers which make sure that the notebook
127 * widget takes all available space.
129 void DoLayout();
131 QemuUIMenuBar *menubar;
132 QemuUIToolBar *toolbar;
133 QemuUIStatusBar *statusbar;
135 wxScrolledWindow *mainwindow;
136 QemuUINotebook *notebook;
138 wxFileHistory *filehistory;
140 // holds all currently opened vm's
141 VMArray vms;
142 // used to store the current toolbar style before toogling
143 long toolbarStyle;
145 DECLARE_EVENT_TABLE()
148 #endif