Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Button.h
Go to the documentation of this file.
1 /* Project nGenEx
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: nGenEx.lib
6  FILE: Button.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Button class
13 */
14 
15 #ifndef Button_h
16 #define Button_h
17 
18 #include "Types.h"
19 #include "ActiveWindow.h"
20 #include "Bitmap.h"
21 
22 // +--------------------------------------------------------------------+
23 
24 class Button : public ActiveWindow
25 {
26 public:
27  enum SOUNDS {
46  };
47 
48  Button(Screen* s, int ax, int ay, int aw, int ah, DWORD id=0);
49  Button(ActiveWindow* p, int ax, int ay, int aw, int ah, DWORD id=0);
50  virtual ~Button();
51 
52  static void Initialize();
53  static void Close();
54  static void PlaySound(int n=0);
55  static void SetVolume(int vol);
56 
57  // Operations:
58  virtual void Draw(); // refresh backing store
59 
60  // Event Target Interface:
61  virtual int OnMouseMove(int x, int y);
62  virtual int OnLButtonDown(int x, int y);
63  virtual int OnLButtonUp(int x, int y);
64  virtual int OnClick();
65  virtual int OnMouseEnter(int x, int y);
66  virtual int OnMouseExit(int x, int y);
67 
68  // Property accessors:
70  void SetActiveColor(Color c);
71  bool GetAnimated();
72  void SetAnimated(bool bNewValue);
73  short GetBevelWidth();
74  void SetBevelWidth(short nNewValue);
75  bool GetBorder();
76  void SetBorder(bool bNewValue);
78  void SetBorderColor(Color c);
79  short GetButtonState();
80  void SetButtonState(short nNewValue);
81  bool GetDropShadow();
82  void SetDropShadow(bool bNewValue);
83  void GetPicture(Bitmap& img);
84  void SetPicture(const Bitmap& img);
85  short GetPictureLocation();
86  void SetPictureLocation(short nNewValue);
87  bool GetSticky();
88  void SetSticky(bool bNewValue);
89 
90  void SetStandardImage(Bitmap* img);
91  void SetActivatedImage(Bitmap* img);
92  void SetTransitionImage(Bitmap* img);
93 
94 protected:
95  Rect CalcLabelRect(int img_w, int img_h);
97  void DrawImage(Bitmap* bmp, const Rect& irect);
98 
99  bool animated;
101  bool sticky;
102  bool border;
103 
106 
107  int captured;
109  short bevel_width;
111 
112  short picture_loc;
114 
115  Bitmap* standard_image; // state = 0
116  Bitmap* activated_image; // state = 1 (if sticky)
117  Bitmap* transition_image; // state = 2 (if sticky)
118 };
119 
120 #endif Button_h
121