]> Shamusworld >> Repos - apple2/blob - apple2/src/gui/button.h
fcf366bbc8ad205d2700bff0368d521738609d45
[apple2] / apple2 / src / gui / button.h
1 //
2 // BUTTON.H
3 //
4 // Graphical User Interface button class
5 //
6
7 #ifndef __BUTTON_H__
8 #define __BUTTON_H__
9
10 #include <string>
11 #include "element.h"
12
13 //Apparently this approach doesn't work for inheritance... D'oh!
14 //class Element;                                                                        // Forward declaration
15
16 class Button: public Element
17 {
18         public:
19                 Button(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0, Element * parent = NULL);
20                 Button(uint32 x, uint32 y, uint32 w, uint32 h, SDL_Surface * upImg, Element * parent = NULL);
21                 Button(uint32 x, uint32 y, SDL_Surface * bU, SDL_Surface * bH = NULL, SDL_Surface * bD = NULL, Element * parent = NULL);
22                 Button(uint32 x, uint32 y, uint32 w, uint32 h, std::string s, Element * parent = NULL);
23                 Button(uint32 x, uint32 y, std::string s, Element * parent = NULL);
24                 ~Button();
25                 virtual void HandleKey(SDLKey key);
26                 virtual void HandleMouseMove(uint32 x, uint32 y);
27                 virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown);
28                 virtual void Draw(void);
29                 virtual void Notify(Element *);
30                 bool ButtonClicked(void);
31                 void SaveStateVariables(void);
32                 void CheckStateAndRedrawIfNeeded(void);
33
34         protected:
35                 bool activated, clicked, inside;
36                 SDL_Surface * buttonUp, * buttonDown, * buttonHover;
37
38         private:
39                 bool surfacesAreLocal;
40                 bool activatedSave, clickedSave, insideSave;
41 };
42
43 #endif  // __BUTTON_H__