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/>.
21 #include "button_base.h"
24 //-----------------------------------------------
27 //-----------------------------------------------
28 CButtonBase::CButtonBase()
30 init(0, 0, 0, CRGBA(255,0,0), CRGBA(0,255,0), CRGBA(100,100,100));
32 //-----------------------------------------------
35 //-----------------------------------------------
36 CButtonBase::CButtonBase(uint tOn
, uint tOff
, uint tDisable
)
38 init(tOn
, tOff
, tDisable
, CRGBA(255,0,0), CRGBA(0,255,0), CRGBA(100,100,100));
40 //-----------------------------------------------
43 //-----------------------------------------------
44 CButtonBase::CButtonBase(const CRGBA
&on
, const CRGBA
&off
, const CRGBA
&disable
)
46 init(0, 0, 0, on
, off
, disable
);
48 //-----------------------------------------------
51 //-----------------------------------------------
52 CButtonBase::CButtonBase(uint tOn
, uint tOff
, uint tDisable
, const CRGBA
&on
, const CRGBA
&off
, const CRGBA
&disable
)
54 init(tOn
, tOff
, tDisable
, on
, off
, disable
);
57 //-----------------------------------------------
59 // Initialize the class(only 1 function for all constructor -> easier).
60 //-----------------------------------------------
61 void CButtonBase::init(uint tOn
, uint tOff
, uint tDisable
, const CRGBA
&on
, const CRGBA
&off
, const CRGBA
&disable
)
67 _TextureDisable
= tDisable
;
70 _ColorDisable
= disable
;
73 _BGModeDisable
= BG_none
;
78 //-----------------------------------------------
80 // Change texture when On.
81 //-----------------------------------------------
82 void CButtonBase::textureOn(uint texture
)
86 //-----------------------------------------------
88 // Change texture when Off.
89 //-----------------------------------------------
90 void CButtonBase::textureOff(uint texture
)
92 _TextureOff
= texture
;
94 //-----------------------------------------------
96 // Change texture when Disable.
97 //-----------------------------------------------
98 void CButtonBase::textureDisable(uint texture
)
100 _TextureDisable
= texture
;
101 }// textureDisable //
104 //-----------------------------------------------
106 // Change color when On.
107 //-----------------------------------------------
108 void CButtonBase::colorOn(const CRGBA
&color
)
112 //-----------------------------------------------
114 // Change color when Off.
115 //-----------------------------------------------
116 void CButtonBase::colorOff(const CRGBA
&color
)
120 //-----------------------------------------------
122 // Change color when Disable.
123 //-----------------------------------------------
124 void CButtonBase::colorDisable(const CRGBA
&color
)
126 _ColorDisable
= color
;
130 //-----------------------------------------------
133 //-----------------------------------------------
134 void CButtonBase::select()
139 //-----------------------------------------------
141 // Un-push the button.
142 //-----------------------------------------------
143 void CButtonBase::unSelect()
149 //-----------------------------------------------
151 // Get the state of the button(Enable/Disable).
152 //-----------------------------------------------
153 bool CButtonBase::enable()
158 //-----------------------------------------------
160 // Enable or Disable the Button.
161 //-----------------------------------------------
162 void CButtonBase::enable(bool e
)