00001 // Class QCheckBox 00002 // Filename QCheckBox.h 00003 // FaPra 2003-2004, A5, Alexander Kramer 00004 00005 #ifndef QCheckBox_h 00006 #define QCheckBox_h 00007 00008 #include "QWidget.h" 00009 00010 //! Pre-declaration of QCheckBox 00011 class QCheckBox; 00012 00013 00014 00015 #include "QFont.h" 00016 //! enumeration of mouse buttons 00017 enum QCheckBoxState {cbChecked, cbUnchecked}; 00018 00019 00020 //! Check Box 00021 class QCheckBox : public QWidget 00022 { 00023 protected: 00024 //! checked status 00025 QCheckBoxState State; 00026 00027 //! size of the box picture 00028 int BoxSize; 00029 00030 //! caption of the checkbox 00031 string Caption; 00032 00033 //! used to draw caption 00034 QFont* Font; 00035 00036 public: 00037 //! draws itself with OpenGL. Here is the OpenGL drawing code 00038 virtual void draw( QEvent* e ); 00039 00040 //! layout the children widgets. This method is called every time the size is changed. Have to be overwritten for respond on size changes 00041 virtual void layout(); 00042 00043 //! 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 00044 virtual bool canDrag( QEvent* e ); 00045 00046 //! processing mouse/keyboard events which are in widgets region. Mouse coordinates are relative to Owner 00047 virtual bool processEvent( QEvent* e ); 00048 00049 //! processing mouse events which are in Owner widget region. Mouse coordinates are relative to Owner 00050 virtual bool processMouseOwner( QEvent* e ); 00051 00052 //! called if a child is added/removed 00053 virtual void childrenChanged(); 00054 00055 //! defines whether control can have keyboard focus. Should return true if Widget wants to get keyboard focus 00056 virtual bool canFocus( QEvent* e ); 00057 00058 //! initialization code 00059 virtual void Init(); 00060 00061 //! clean up code 00062 virtual void CleanUp(); 00063 00064 //! getter method for State 00065 virtual QCheckBoxState getState(); 00066 00067 //! setter method for State 00068 virtual void setState( QCheckBoxState newValue ); 00069 00070 //! getter method for BoxSize 00071 virtual int getBoxSize(); 00072 00073 //! setter method for BoxSize 00074 virtual void setBoxSize( int newValue ); 00075 00076 //! getter method for Caption 00077 virtual string getCaption(); 00078 00079 //! setter method for Caption 00080 virtual void setCaption( string newValue ); 00081 00082 //! getter method for Font 00083 QFont* getFont(); 00084 00085 //! prints itself to the cout 00086 void print(); 00087 00088 //! Constructor 00089 QCheckBox( QWidget* aOwner ); 00090 00091 //! Destructor 00092 virtual ~QCheckBox(); 00093 00094 00095 }; 00096 #endif 00097
1.2.18