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