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