Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / client / src / interfaces_manager / button_base.cpp
blob4a2d866c19cd6617af8faf2b941ff0679cf8e05d
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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.
8 //
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 #include "stdpch.h"
21 #include "button_base.h"
24 //-----------------------------------------------
25 // CButtonBase :
26 // Constructor.
27 //-----------------------------------------------
28 CButtonBase::CButtonBase()
30 init(0, 0, 0, CRGBA(255,0,0), CRGBA(0,255,0), CRGBA(100,100,100));
31 }// CButtonBase //
32 //-----------------------------------------------
33 // CButtonBase :
34 // Constructor.
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));
39 }// CButtonBase //
40 //-----------------------------------------------
41 // CButtonBase :
42 // Constructor.
43 //-----------------------------------------------
44 CButtonBase::CButtonBase(const CRGBA &on, const CRGBA &off, const CRGBA &disable)
46 init(0, 0, 0, on, off, disable);
47 }// CButtonBase //
48 //-----------------------------------------------
49 // CButtonBase :
50 // Constructor.
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);
55 }// CButtonBase //
57 //-----------------------------------------------
58 // init :
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)
63 _On = false;
64 _Enable = true;
65 _TextureOn = tOn;
66 _TextureOff = tOff;
67 _TextureDisable = tDisable;
68 _ColorOn = on;
69 _ColorOff = off;
70 _ColorDisable = disable;
71 _BGModeOn = BG_none;
72 _BGModeOff = BG_none;
73 _BGModeDisable = BG_none;
75 }// init //
78 //-----------------------------------------------
79 // textureOn :
80 // Change texture when On.
81 //-----------------------------------------------
82 void CButtonBase::textureOn(uint texture)
84 _TextureOn = texture;
85 }// textureOn //
86 //-----------------------------------------------
87 // textureOff :
88 // Change texture when Off.
89 //-----------------------------------------------
90 void CButtonBase::textureOff(uint texture)
92 _TextureOff = texture;
93 }// textureOff //
94 //-----------------------------------------------
95 // textureDisable :
96 // Change texture when Disable.
97 //-----------------------------------------------
98 void CButtonBase::textureDisable(uint texture)
100 _TextureDisable = texture;
101 }// textureDisable //
104 //-----------------------------------------------
105 // colorOn :
106 // Change color when On.
107 //-----------------------------------------------
108 void CButtonBase::colorOn(const CRGBA &color)
110 _ColorOn = color;
111 }// colorOn //
112 //-----------------------------------------------
113 // colorOff :
114 // Change color when Off.
115 //-----------------------------------------------
116 void CButtonBase::colorOff(const CRGBA &color)
118 _ColorOff = color;
119 }// colorOff //
120 //-----------------------------------------------
121 // colorDisable :
122 // Change color when Disable.
123 //-----------------------------------------------
124 void CButtonBase::colorDisable(const CRGBA &color)
126 _ColorDisable = color;
127 }// colorDisable //
130 //-----------------------------------------------
131 // push :
132 // Push the button.
133 //-----------------------------------------------
134 void CButtonBase::select()
136 _On = true;
137 }// push //
139 //-----------------------------------------------
140 // unPush :
141 // Un-push the button.
142 //-----------------------------------------------
143 void CButtonBase::unSelect()
145 _On = false;
146 }// unPush //
149 //-----------------------------------------------
150 // enable :
151 // Get the state of the button(Enable/Disable).
152 //-----------------------------------------------
153 bool CButtonBase::enable()
155 return _Enable;
156 }// enable //
158 //-----------------------------------------------
159 // enable :
160 // Enable or Disable the Button.
161 //-----------------------------------------------
162 void CButtonBase::enable(bool e)
164 _Enable = e;
165 }// enable //