Added some temporary icons to the repository
[qemu-gui.git] / toolbar.cpp
bloba0a85822317b3c01952e7347a57280c87b50a2e7
1 #include <wx/intl.h>
2 #include "toolbar.h"
3 #include "events.h"
5 //#if USE_XPM_BITMAPS
6 #include "icons/new.xpm"
7 #include "icons/open.xpm"
8 #include "icons/save.xpm"
9 #include "icons/copy.xpm"
10 #include "icons/cut.xpm"
11 #include "icons/preview.xpm"
12 #include "icons/print.xpm"
13 #include "icons/help.xpm"
14 //#endif // USE_XPM_BITMAPS
16 QemuUIToolBar::QemuUIToolBar(wxWindow *parent,long style)
17 :wxToolBar(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,style){
19 SetWindowStyle(style);
21 AddTool(
22 QEMU_VM_START,
23 _("Power on"),
24 wxBitmap(QEMU_XPM_SHUTDOWN),
25 _("Power on this VM")
28 AddTool(
29 QEMU_VM_PAUSE,
30 _("Pause"),
31 wxBitmap(QEMU_XPM_PAUSE),
32 _("Pause this VM")
35 AddTool(
36 QEMU_VM_SHUTDOWN,
37 _("Power off"),
38 wxBitmap(QEMU_XPM_START),
39 _("Power off this VM")
42 AddTool(
43 QEMU_VM_RESET,
44 _("Reset"),
45 wxBitmap(QEMU_XPM_RESET),
46 _("Reset this VM")
49 AddTool(
50 QEMU_VM_KILL,
51 _("Kill VM"),
52 wxBitmap(QEMU_XPM_RESET),
53 _("Kill this VM")
56 AddSeparator();
58 AddTool(
59 QEMU_VM_SNAPSHOT,
60 _("Snapshot"),
61 wxBitmap(QEMU_XPM_RESET),
62 _("Take a snapshot of the current vm state")
65 AddTool(
66 QEMU_VM_REVERT_SNAPSHOT,
67 _("Revert"),
68 wxBitmap(QEMU_XPM_RESET),
69 _("Revert to last snapshot")
72 AddSeparator();
74 AddTool(
75 QEMU_TOOLBAR_DISPLAY_INFO,
76 _("Info"),
77 wxBitmap(QEMU_XPM_RESET),
78 _("Show information about this vm"),
79 wxITEM_CHECK
82 AddTool(
83 QEMU_TOOLBAR_DISPLAY_SCREEN,
84 _("Screen"),
85 wxBitmap(QEMU_XPM_RESET),
86 _("Show the screen of this vm."),
87 wxITEM_CHECK
90 AddTool(
91 QEMU_TOOLBAR_DISPLAY_CONSOLE,
92 _("Console"),
93 wxBitmap(QEMU_XPM_RESET),
94 _("Show the console of this vm."),
95 wxITEM_CHECK
98 AddSeparator();
100 AddTool(
101 QEMU_TOOLBAR_SEND_VM_COMMAND,
102 _("VM command"),
103 wxBitmap(QEMU_XPM_RESET),
104 _("Send a command to the qemu monitor.")
107 SetToolBitmapSize(wxSize(24,24));
108 Realize();
111 QemuUIToolBar::~QemuUIToolBar(){};
113 void QemuUIToolBar::Disable(){
114 PowerOn(false);
115 PowerOff(false);
116 Pause(false);
117 Reset(false);
118 Kill(false);
119 Snapshot(false);
120 RevertSnapshot(false);
121 DisableDisplayArea();
122 SendVMCommand(false);
125 void QemuUIToolBar::EnableDisplayArea(){
126 EnableTool(QEMU_TOOLBAR_DISPLAY_INFO,true);
127 EnableTool(QEMU_TOOLBAR_DISPLAY_SCREEN,true);
128 EnableTool(QEMU_TOOLBAR_DISPLAY_CONSOLE,true);
131 void QemuUIToolBar::DisableDisplayArea(){
132 ToggleTool(QEMU_TOOLBAR_DISPLAY_INFO,false);
133 ToggleTool(QEMU_TOOLBAR_DISPLAY_SCREEN,false);
134 ToggleTool(QEMU_TOOLBAR_DISPLAY_CONSOLE,false);
135 EnableTool(QEMU_TOOLBAR_DISPLAY_INFO,false);
136 EnableTool(QEMU_TOOLBAR_DISPLAY_SCREEN,false);
137 EnableTool(QEMU_TOOLBAR_DISPLAY_CONSOLE,false);
140 void QemuUIToolBar::PowerOn(bool state){
141 EnableTool(QEMU_VM_START,state);
144 void QemuUIToolBar::PowerOff(bool state){
145 EnableTool(QEMU_VM_SHUTDOWN,state);
148 void QemuUIToolBar::Pause(bool state){
149 EnableTool(QEMU_VM_PAUSE,state);
152 void QemuUIToolBar::Reset(bool state){
153 EnableTool(QEMU_VM_RESET,state);
156 void QemuUIToolBar::Kill(bool state){
157 EnableTool(QEMU_VM_KILL,state);
160 void QemuUIToolBar::Snapshot(bool state){
161 EnableTool(QEMU_VM_SNAPSHOT,state);
164 void QemuUIToolBar::RevertSnapshot(bool state){
165 EnableTool(QEMU_VM_REVERT_SNAPSHOT,state);
168 void QemuUIToolBar::ShowInfo(){
169 ToggleTool(QEMU_TOOLBAR_DISPLAY_INFO,true);
170 ToggleTool(QEMU_TOOLBAR_DISPLAY_SCREEN,false);
171 ToggleTool(QEMU_TOOLBAR_DISPLAY_CONSOLE,false);
174 void QemuUIToolBar::ShowScreen(){
175 ToggleTool(QEMU_TOOLBAR_DISPLAY_INFO,false);
176 ToggleTool(QEMU_TOOLBAR_DISPLAY_SCREEN,true);
177 ToggleTool(QEMU_TOOLBAR_DISPLAY_CONSOLE,false);
180 void QemuUIToolBar::ShowConsole(){
181 ToggleTool(QEMU_TOOLBAR_DISPLAY_INFO,false);
182 ToggleTool(QEMU_TOOLBAR_DISPLAY_SCREEN,false);
183 ToggleTool(QEMU_TOOLBAR_DISPLAY_CONSOLE,true);
186 void QemuUIToolBar::SendVMCommand(bool state){
187 EnableTool(QEMU_TOOLBAR_SEND_VM_COMMAND,state);
190 void QemuUIToolBar::EnableDisplayScreen(bool state){
191 EnableTool(QEMU_TOOLBAR_DISPLAY_SCREEN,state);