tools/*: remove bcc and as86 as they are no longer required to compile the system...
[virtualbox.git] / src / VBox / Debugger / VBoxDbgBase.h
blobfe7c305a5c1461c551849888895fbd383c3a7e95
1 /* $Id$ */
2 /** @file
3 * VBox Debugger GUI - Base classes.
4 */
6 /*
7 * Copyright (C) 2006-2010 Oracle Corporation
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19 #ifndef ___Debugger_VBoxDbgBase_h
20 #define ___Debugger_VBoxDbgBase_h
23 #include <VBox/vmm/stam.h>
24 #include <VBox/vmm/vmapi.h>
25 #include <VBox/dbg.h>
26 #include <iprt/thread.h>
27 #include <QString>
28 #include <QWidget>
30 class VBoxDbgGui;
33 /**
34 * VBox Debugger GUI Base Class.
36 * The purpose of this class is to hide the VM handle, abstract VM
37 * operations, and finally to make sure the GUI won't crash when
38 * the VM dies.
40 class VBoxDbgBase
42 public:
43 /**
44 * Construct the object.
46 * @param pDbgGui Pointer to the debugger gui object.
48 VBoxDbgBase(VBoxDbgGui *a_pDbgGui);
50 /**
51 * Destructor.
53 virtual ~VBoxDbgBase();
56 /**
57 * Checks if the VM is OK for normal operations.
58 * @returns true if ok, false if not.
60 bool isVMOk() const
62 return m_pVM != NULL;
65 /**
66 * Checks if the current thread is the GUI thread or not.
67 * @return true/false accordingly.
69 bool isGUIThread() const
71 return m_hGUIThread == RTThreadNativeSelf();
74 /** @name Operations
75 * @{ */
76 /**
77 * Wrapper for STAMR3Reset().
79 int stamReset(const QString &rPat);
80 /**
81 * Wrapper for STAMR3Enum().
83 int stamEnum(const QString &rPat, PFNSTAMR3ENUM pfnEnum, void *pvUser);
84 /**
85 * Wrapper for DBGCCreate().
87 int dbgcCreate(PDBGCBACK pBack, unsigned fFlags);
88 /** @} */
91 protected:
92 /** @name Signals
93 * @{ */
94 /**
95 * Called when the VM is being destroyed.
97 virtual void sigDestroying();
98 /**
99 * Called when the VM has been terminated.
101 virtual void sigTerminated();
102 /** @} */
105 private:
107 * VM state callback function.
109 * You are not allowed to call any function which changes the VM state from a
110 * state callback, except VMR3Destroy().
112 * @param pVM The VM handle.
113 * @param enmState The new state.
114 * @param enmOldState The old state.
115 * @param pvUser The user argument.
117 static DECLCALLBACK(void) atStateChange(PVM pVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
119 private:
120 /** Pointer to the debugger GUI object. */
121 VBoxDbgGui *m_pDbgGui;
122 /** The VM handle. */
123 PVM volatile m_pVM;
124 /** The handle of the GUI thread. */
125 RTNATIVETHREAD m_hGUIThread;
130 * VBox Debugger GUI Base Window Class.
132 * This is just a combination of QWidget and VBoxDbgBase with some additional
133 * functionality for window management. This class is not intended for control
134 * widgets, only normal top-level windows.
136 class VBoxDbgBaseWindow : public QWidget, public VBoxDbgBase
138 public:
140 * Construct the object.
142 * @param pDbgGui Pointer to the debugger gui object.
144 VBoxDbgBaseWindow(VBoxDbgGui *a_pDbgGui, QWidget *a_pParent);
147 * Destructor.
149 virtual ~VBoxDbgBaseWindow();
152 * Shows the window and gives it focus.
154 void vShow();
157 * Repositions the window, taking the frame decoration into account.
159 * @param a_x The new x coordinate.
160 * @param a_y The new x coordinate.
161 * @param a_cx The total width.
162 * @param a_cy The total height.
163 * @param a_fResize Whether to resize it as well.
165 void vReposition(int a_x, int a_y, unsigned a_cx, unsigned a_cy, bool a_fResize);
167 protected:
169 * For polishing the window size (X11 mess).
171 * @returns true / false.
172 * @param a_pEvt The event.
174 virtual bool event(QEvent *a_pEvt);
177 * Internal worker for polishing the size and position (X11 hacks).
179 void vPolishSizeAndPos();
182 * Internal worker that guesses the border sizes.
184 QSize vGuessBorderSizes();
187 private:
188 /** Whether we've done the size polishing in showEvent or not. */
189 bool m_fPolished;
190 /** The desired x coordinate. */
191 int m_x;
192 /** The desired y coordinate. */
193 int m_y;
194 /** The desired width. */
195 unsigned m_cx;
196 /** The desired height. */
197 unsigned m_cy;
199 /** Best effort x border size (for X11). */
200 static unsigned m_cxBorder;
201 /** Best effort y border size (for X11). */
202 static unsigned m_cyBorder;
205 #endif