Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields

textfield.h

00001 
00002 /***************************************************************************
00003                           textfield.h  -  description
00004                              -------------------
00005     begin                : Thu Aug 28 2003
00006     copyright            : (C) 2003 by Gabor Torok
00007     email                : cctorok@yahoo.com
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 #ifndef TEXTFIELD_H
00020 #define TEXTFIELD_H
00021 
00022 #include "../constants.h"
00023 #include "widget.h"
00024 #include "window.h"
00025 #include "label.h"
00026 
00031 class TextField : public  Widget {
00032 private:
00033   int numChars;
00034   bool inside; // was the last event inside the button?
00035   char *text;
00036   int pos, maxPos;
00037   int eventType;
00038 
00039 public: 
00040 
00041   enum {
00042     EVENT_KEYPRESS=0,
00043     EVENT_ACTION
00044   };
00045 
00046   TextField(int x, int y, int numChars);
00047   ~TextField();
00048   bool handleEvent(Widget *parent, SDL_Event *event, int x, int y);
00049   void drawWidget(Widget *parent);
00050   inline char *getText() { text[maxPos] = '\0'; return text; }
00051   inline void setFocus(bool b) { Widget::setFocus(b); inside = b; }
00052   inline void clearText() { pos = maxPos = 0; }
00053   inline int getEventType() { return eventType; }
00054   // don't play sound when the value changes
00055   virtual inline bool hasSound() { return false; }
00056 };
00057 
00058 #endif
00059 

Generated on Thu Jun 16 21:50:43 2005 for scourge by  doxygen 1.4.0