00001 // Class QWindow 00002 // Filename QWindow.h 00003 // FaPra 2003-2004, A5, Alexander Kramer 00004 00005 #ifndef QWindow_h 00006 #define QWindow_h 00007 00008 #include "QWidget.h" 00009 00010 //! Pre-declaration of QWindow 00011 class QWindow; 00012 00013 #include "QButton.h" 00014 00015 00016 #include "QFont.h" 00017 #include "QColor.h" 00018 00019 //! Widget which is a GUI-Window. 00020 class QWindow : public QWidget 00021 { 00022 private: 00023 //! indicates whether the window is currently resizing 00024 bool Resizing; 00025 00026 //! old position for restore from maximize 00027 int OldLeft; 00028 00029 //! old position for restore from maximize 00030 int OldTop; 00031 00032 //! old position for restore from maximize 00033 int OldWidth; 00034 00035 //! old position for restore from maximize 00036 int OldHeight; 00037 00038 //! position x at the beginning of the resizing 00039 int ResizeStartX; 00040 00041 //! position y at the beginning of the resizing 00042 int ResizeStartY; 00043 00044 protected: 00045 //! titlebar height 00046 int TitleBarHeight; 00047 00048 //! titlebar border 00049 int TitleBarBorder; 00050 00051 //! caption of the window 00052 string Caption; 00053 00054 //! minimum allowed width if resizing with mouse 00055 int MinResizeWidth; 00056 00057 //! minimum allowed height if resizing with mouse 00058 int MinResizeHeight; 00059 00060 //! indicates whether the window is currently maximized 00061 bool Maximized; 00062 00063 //! defines whether the window can be resized by mouse 00064 bool Resizable; 00065 00066 //! Button for close 00067 QButton* CloseButton; 00068 00069 //! Button for maximize 00070 QButton* MaximizeButton; 00071 00072 //! widget for caption text 00073 QFont* Font; 00074 00075 //! color of Title bar 00076 QColor* TitleBarColor; 00077 00078 //! color of title bar if window is not active 00079 QColor* TitleBarColorInactive; 00080 00081 public: 00082 //! draws frame 00083 virtual void drawFrame(); 00084 00085 //! draws frame 00086 void drawCoordInfos( int x , int y , const char* Text ); 00087 00088 //! draws close button 00089 void drawCloseButton(); 00090 00091 //! draws maximize button 00092 void drawMaximizeButton(); 00093 00094 //! maximize window 00095 void maximize(); 00096 00097 //! draws itself with OpenGL. Here is the OpenGL drawing code 00098 virtual void draw( QEvent* e ); 00099 00100 //! layout the children widgets. This method is called every time the size is changed. Have to be overwritten for respond on size changes 00101 virtual void layout(); 00102 00103 //! have to return true if widget should be dragged with mouse. This method is overwritten in sub classes. If returns true, widget will be dragged 00104 virtual bool canDrag( QEvent* e ); 00105 00106 //! processing mouse/keyboard events which are in widgets region. Mouse coordinates are relative to Owner 00107 virtual bool processEvent( QEvent* e ); 00108 00109 //! processing mouse events which are in Owner widget region. Mouse coordinates are relative to Owner 00110 virtual bool processMouseOwner( QEvent* e ); 00111 00112 //! called if a child is added/removed 00113 virtual void childrenChanged(); 00114 00115 //! defines whether control can have keyboard focus. Should return true if Widget wants to get keyboard focus 00116 virtual bool canFocus( QEvent* e ); 00117 00118 //! initialization code 00119 virtual void Init(); 00120 00121 //! clean up code 00122 virtual void CleanUp(); 00123 00124 //! getter method for TitleBarHeight 00125 virtual int getTitleBarHeight(); 00126 00127 //! setter method for TitleBarHeight 00128 virtual void setTitleBarHeight( int newValue ); 00129 00130 //! getter method for TitleBarBorder 00131 virtual int getTitleBarBorder(); 00132 00133 //! setter method for TitleBarBorder 00134 virtual void setTitleBarBorder( int newValue ); 00135 00136 //! getter method for Caption 00137 virtual string getCaption(); 00138 00139 //! setter method for Caption 00140 virtual void setCaption( string newValue ); 00141 00142 //! getter method for MinResizeWidth 00143 virtual int getMinResizeWidth(); 00144 00145 //! setter method for MinResizeWidth 00146 virtual void setMinResizeWidth( int newValue ); 00147 00148 //! getter method for MinResizeHeight 00149 virtual int getMinResizeHeight(); 00150 00151 //! setter method for MinResizeHeight 00152 virtual void setMinResizeHeight( int newValue ); 00153 00154 //! getter method for Maximized 00155 virtual bool getMaximized(); 00156 00157 //! setter method for Maximized 00158 virtual void setMaximized( bool newValue ); 00159 00160 //! getter method for Resizable 00161 virtual bool getResizable(); 00162 00163 //! setter method for Resizable 00164 virtual void setResizable( bool newValue ); 00165 00166 //! getter method for CloseButton 00167 virtual QButton* getCloseButton(); 00168 00169 //! getter method for MaximizeButton 00170 virtual QButton* getMaximizeButton(); 00171 00172 //! getter method for Font 00173 QFont* getFont(); 00174 00175 //! getter method for TitleBarColor 00176 QColor* getTitleBarColor(); 00177 00178 //! getter method for TitleBarColorInactive 00179 QColor* getTitleBarColorInactive(); 00180 00181 //! prints itself to the cout 00182 void print(); 00183 00184 //! Constructor 00185 QWindow( QWidget* aOwner ); 00186 00187 //! Destructor 00188 virtual ~QWindow(); 00189 00190 00191 }; 00192 #endif 00193
1.2.18