Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

sdllineedit.h

Go to the documentation of this file.
00001 /*
00002     ParaGUI - crossplatform widgetset
00003     Copyright (C) 2000  Alexander Pipelka
00004  
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009  
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014  
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  
00019     Alexander Pipelka
00020     pipelka@teleweb.at
00021  
00022     Last Update:      $Author: pipelka $
00023     Update Date:      $Date: 2001/01/31 17:23:16 $
00024     Source File:      $Source: /usr/local/CVSROOT/linux/paragui/doc/html/sdllineedit_h-source.html,v $
00025     CVS/RCS Revision: $Revision: 1.34 $
00026     Status:           $State: Exp $
00027 */
00028 
00029 #ifndef SDL_LINEEDIT
00030 #define SDL_LINEEDIT
00031 
00032 #ifdef SWIG
00033 %include "swigcommon.h"
00034 %module sdllineedit
00035 %{
00036 #include "sdllineedit.h"
00037 %}
00038 #endif
00039 
00040 #include "sdlgradientwidget.h"
00041 
00053 class DECLSPEC SDLLineEdit : public SDLGradientWidget {
00054 public:
00055 
00057     SDLLineEdit(SDLWidget* parent, SDL_Rect& r);
00058 
00060     ~SDLLineEdit();
00061 
00062     void LoadThemeStyle(const char* widgettype);
00063 
00065     void LoadThemeStyle(const char* widgettype, const char* objectname);
00066 
00068     void EditBegin();
00069 
00071     void EditEnd();
00072 
00074     void SetCursorPos(int p);
00075 
00077     int GetCursorPos();
00078 
00080     char* GetText();
00081 
00083     void SetText(char* new_text);
00084 
00085 #ifndef SWIG
00086 
00087     void SetTextFormat(char* text, ...);
00088 #endif
00089 
00091     bool IsCursorVisible();
00092 
00098     void SendChar(char c);
00099 
00103     void SendDel();
00104 
00108     void SendBackspace();
00109 
00115     void SetValidKeys(char* keys);
00116 
00117 protected:
00118 
00120     virtual void eventEditBegin(int id, SDLWidget* widget, unsigned long data, void *clientdata);
00121 
00123     virtual void eventEditEnd(int id, SDLWidget* widget, unsigned long data, void *clientdata);
00124 
00126     void eventDraw(SDL_Surface* surface, SDL_Rect* rect);
00127 
00129     bool eventKeyDown(const SDL_KeyboardEvent* key);
00130 
00132     bool eventMouseButtonDown(const SDL_MouseButtonEvent* button);
00133 
00135     void eventInputFocusLost(SDLMessageObject* newfocus);
00136 
00138     bool eventFilterKey(const SDL_KeyboardEvent* key);
00139 
00140 private:
00141 
00142     SDLLineEdit(const SDLLineEdit&);
00143     SDLLineEdit& operator=(SDLLineEdit&);
00144 
00145     void DrawText(SDL_Surface* surface, SDL_Rect* rect);
00146     void DrawTextCursor(SDL_Surface* surface, SDL_Rect* rect);
00147     int GetCursorXPos();
00148     char* GetDrawText();
00149     int GetCursorPosFromScreen(int x, int y);
00150 
00151     void InsertChar(char* c);
00152     void DeleteChar(Uint16 pos);
00153 
00154     void FreeValidKeys();
00155     bool IsValidKey(char c);
00156 
00157     char my_text[256];
00158     int my_cursorPosition;
00159     bool my_isCursorVisible;
00160     int my_offsetX;
00161     char* my_validkeys;
00162 
00163     SDL_Surface* my_srfTextCursor;
00164 
00165     //SDL_Color my_colorText;
00166 };
00167 
00168 #endif // SDL_LINEEDIT