00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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;
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