Main Page   Namespace List   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

/cygdrive/d/Eigene Dateien/!DProcs/code_gen/src/QCheckBox.cpp

Go to the documentation of this file.
00001 // Class QCheckBox
00002 // Check Box
00003 // Filename QCheckBox.cpp
00004 // FaPra 2003-2004, A5,  Alexander Kramer
00005 
00006 
00007 #include "QCheckBox.h"
00008 
00009 
00010 #include <iostream>
00011 using namespace std;
00012 
00013 
00014 // implementation of QCheckBox
00015 
00016 //! draws itself with OpenGL. Here is the OpenGL drawing code
00017 void QCheckBox::draw( QEvent*  e )
00018 {
00019 
00020  LookAndFeel->drawCheckBox(State == cbChecked);
00021 
00022  glTranslatef(BoxSize+2,(BoxSize-Font->getSize())/2,0);
00023  Font->drawInternal(Caption.c_str(),-1);
00024 
00025 } // end of draw()
00026 
00027 //! layout the children widgets. This method is called every time the size is changed. Have to be overwritten for respond on size changes
00028 void QCheckBox::layout()
00029 {
00030   if (Height < BoxSize) Height = BoxSize;
00031 } // end of layout()
00032 
00033 //! 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
00034 bool QCheckBox::canDrag( QEvent*  e )
00035 {
00036  return false;
00037 } // end of canDrag()
00038 
00039 //! processing mouse/keyboard events which are in widgets region. Mouse coordinates are relative to Owner
00040 bool QCheckBox::processEvent( QEvent*  e )
00041 {
00042  if (e->getType() == etMouseDown)
00043  {
00044    if (State == cbChecked) State = cbUnchecked;
00045    else State = cbChecked;
00046  }
00047  return false;
00048 } // end of processEvent()
00049 
00050 //! processing mouse events which are in Owner widget region. Mouse coordinates are relative to Owner
00051 bool QCheckBox::processMouseOwner( QEvent*  e )
00052 {
00053  return false;
00054 } // end of processMouseOwner()
00055 
00056 //! called if a child is added/removed
00057 void QCheckBox::childrenChanged()
00058 {
00059 } // end of childrenChanged()
00060 
00061 //! defines whether control can have keyboard focus. Should return true if Widget wants to get keyboard focus
00062 bool QCheckBox::canFocus( QEvent*  e )
00063 {
00064  return true;
00065 } // end of canFocus()
00066 
00067 //! initialization code
00068 void QCheckBox::Init()
00069 {
00070   Font->copyFrom(LookAndFeel->getFont());
00071   QWidget::Init();
00072 } // end of Init()
00073 
00074 //! clean up code
00075 void QCheckBox::CleanUp()
00076 {
00077 } // end of CleanUp()
00078 
00079 //! getter method for State
00080 QCheckBoxState QCheckBox::getState()
00081 {
00082 return State;
00083 } // end of getState()
00084 
00085 //! setter method for State
00086 void QCheckBox::setState( QCheckBoxState  newValue )
00087 {
00088 State = newValue;
00089 } // end of setState()
00090 
00091 //! getter method for BoxSize
00092 int QCheckBox::getBoxSize()
00093 {
00094 return BoxSize;
00095 } // end of getBoxSize()
00096 
00097 //! setter method for BoxSize
00098 void QCheckBox::setBoxSize( int  newValue )
00099 {
00100 BoxSize = newValue;
00101 } // end of setBoxSize()
00102 
00103 //! getter method for Caption
00104 string QCheckBox::getCaption()
00105 {
00106 return Caption;
00107 } // end of getCaption()
00108 
00109 //! setter method for Caption
00110 void QCheckBox::setCaption( string  newValue )
00111 {
00112  Caption = newValue;
00113  setWidth((int)Font->getTextWidth(newValue.c_str())+BoxSize+2);
00114 } // end of setCaption()
00115 
00116 //! getter method for Font
00117 QFont* QCheckBox::getFont()
00118 {
00119 return Font;
00120 } // end of getFont()
00121 
00122 // WARNING : The implementation of this method will be automatically generated with code generator.
00123 // To prevent this add '//KEEP' at the first line of the implementation.(first line after '{')
00124 //! prints itself to the cout
00125 void QCheckBox::print()
00126 {
00127 cout << "Class : QCheckBox" << endl;
00128 cout << "State = " << State << endl;
00129 cout << "BoxSize = " << BoxSize << endl;
00130 cout << "Caption = " << Caption << endl;
00131 } // end of print()
00132 
00133 // WARNING : The implementation of this method will be automatically generated with code generator.
00134 // To prevent this add '//KEEP' at the first line of the implementation.(first line after '{')
00135 //! Constructor
00136  QCheckBox::QCheckBox( QWidget*  aOwner ):QWidget(aOwner)
00137 {
00138 State = cbUnchecked;
00139 BoxSize = 16;
00140 Font = new QFont;
00141 Init();
00142 layout();
00143 } // end of QCheckBox()
00144 
00145 // WARNING : The implementation of this method will be automatically generated with code generator.
00146 // To prevent this add '//KEEP' at the first line of the implementation.(first line after '{')
00147 //! Destructor
00148  QCheckBox::~QCheckBox()
00149 {
00150 delete Font;
00151 CleanUp();
00152 } // end of ~QCheckBox()
00153 
00154 // end of implementation of QCheckBox
00155 
00156 

Generated on Thu Mar 18 18:33:48 2004 for miniQT by doxygen1.2.18