1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef NL_BUTTON_BASE_H
20 #define NL_BUTTON_BASE_H
27 #include "nel/misc/types_nl.h"
28 #include "nel/misc/rgba.h"
38 * Class to be the basis of a button.
39 * \author Guillaume PUZIN
40 * \author Nevrax France
46 enum TBG
// BG = Background.
48 BG_none
= 0, // NO BG.
49 BG_plain
, // BG is only made with 1 color (RGBA).
50 BG_stretch
// BG is a stretched Bitmap and 1 color (RGBA).
54 inline void init(uint tOn
, uint tOff
, uint tDisable
, const CRGBA
&on
, const CRGBA
&off
, const CRGBA
&disable
);
72 CButtonBase(uint tOn
, uint tOff
, uint tDisable
);
73 CButtonBase(const CRGBA
&on
, const CRGBA
&off
, const CRGBA
&disable
);
74 CButtonBase(uint tOn
, uint tOff
, uint tDisable
, const CRGBA
&on
, const CRGBA
&off
, const CRGBA
&disable
);
76 /// \name accessors for writing
78 /// Change color when On.
79 void colorOn(const CRGBA
&color
);
80 /// Change color when Off.
81 void colorOff(const CRGBA
&color
);
82 /// Change color when Disable.
83 void colorDisable(const CRGBA
&color
);
85 /// Change texture when On.
86 void textureOn(uint texture
);
87 /// Change texture when Off.
88 void textureOff(uint texture
);
89 /// Change texture when Disable.
90 void textureDisable(uint texture
);
92 /// Change the mode to display the background of the button when On.
93 void bgModeOn(const TBG
&mode
) {_BGModeOn
= mode
;}
94 /// Change the mode to display the background of the button when Off.
95 void bgModeOff(const TBG
&mode
) {_BGModeOff
= mode
;}
96 /// Change the mode to display the background of the button when Disable.
97 void bgModeDisable(const TBG
&mode
) {_BGModeDisable
= mode
;}
100 /// \name accessors for reading
102 /// get color when On.
103 inline const CRGBA
&colorOn() const { return _ColorOn
; }
104 /// get color when Off.
105 inline const CRGBA
&colorOff() const { return _ColorOff
; }
106 /// get color when Disable.
107 inline const CRGBA
&colorDisable() const { return _ColorDisable
; }
109 /// get texture when On.
110 inline uint
textureOn() const { return _TextureOn
; }
111 /// get texture when Off.
112 inline uint
textureOff() const { return _TextureOff
; }
113 /// get texture when Disable.
114 inline uint
textureDisable() const { return _TextureDisable
; }
116 /// get the background display mode when On.
117 inline const TBG
& bgModeOn() const { return _BGModeOn
; }
118 /// get the background display mode when Off.
119 inline const TBG
& bgModeOff() const { return _BGModeOff
; }
120 /// get the background display mode when Disable.
121 inline const TBG
& bgModeDisable() const { return _BGModeDisable
; }
125 /// Get the state of the button(Enable/Disable).
127 /// Enable or Disable the Button.
130 /// return true if the button is selected
131 bool isSelected() const { return _On
; }
133 /// Select the button.
134 virtual void select();
136 /// Un-Select the button.
137 virtual void unSelect();
141 #endif // NL_BUTTON_BASE_H
143 /* End of button_base.h */