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

button.h

00001 /***************************************************************************
00002                           button.h  -  description
00003                              -------------------
00004     begin                : Thu Aug 28 2003
00005     copyright            : (C) 2003 by Gabor Torok
00006     email                : cctorok@yahoo.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef BUTTON_H
00019 #define BUTTON_H
00020 
00021 #include "../constants.h"
00022 #include "widget.h"
00023 
00028 class Button : public Widget {
00029  private:
00030   int x2, y2;
00031   char label[255];
00032   bool inside; // was the last event inside the button?
00033   float alpha, alphaInc;
00034   GLint lastTick;
00035   int labelPos;
00036   bool toggle;
00037   bool selected;
00038   GLuint highlight;
00039   bool glowing;
00040   bool inverse;
00041 
00042  public: 
00043 
00044   enum {
00045         TOP = 0,
00046         CENTER,
00047         BOTTOM
00048   };
00049 
00050   Button(int x1, int y1, int x2, int y2, GLuint highlight, char *label=NULL);
00051   ~Button();
00052 
00053   inline void setInside( bool b ) { inside = b; }
00057   inline void setToggle(bool b) { toggle = b; }
00058   inline bool isToggle() { return toggle; }
00059 
00060   inline void setGlowing(bool b) { glowing = b; }
00061   inline bool isGlowing() { return glowing; }
00065   inline bool isSelected() { return selected; }
00066   inline void setSelected(bool b) { selected = b; }
00067   inline void setLabelPosition(int p) { labelPos = p; }
00068   inline int getLabelPosition() { return labelPos; }
00069   inline char *getLabel() { return label; }
00070   inline void setLabel( char *s ) { strncpy(label, ( s ? s : "" ), 255); label[254] = '\0'; }
00071   bool handleEvent(Widget *parent, SDL_Event *event, int x, int y);
00072   void removeEffects(Widget *parent);
00073   void drawWidget(Widget *parent);
00074 
00075 };
00076 
00077 #endif
00078 

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