Fix css style order when using external css files
[ryzomcore.git] / ryzom / client / src / interfaces_manager / button.h
blob261b2dde067de10dc8d7d88fa8cb74956922f5f0
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 #ifndef CL_BUTTON_H
20 #define CL_BUTTON_H
23 //////////////
24 // Includes //
25 //////////////
26 // Misc.
27 #include "nel/misc/types_nl.h"
28 #include "nel/misc/ucstring.h"
29 // Client.
30 #include "control.h"
31 #include "button_base.h"
32 #include "pen.h"
33 #include <string>
36 ///////////
37 // Using //
38 ///////////
39 using std::string;
42 /**
43 * Manages "Button" control in Interface.
44 * \author Guillaume PUZIN
45 * \author Nevrax France
46 * \date 2001
48 class CButton : public CControl, public CButtonBase
50 public:
51 enum TState
53 released, // unselected
54 left_clicked, // selected with a single click with the left mouse button
55 right_clicked, // selected with a single click with the right mouse button
56 double_clicked, // selected with a double click with the left mouse button
59 private:
60 /// Initialize the button (1 function called for all constructors -> easier).
61 inline void init(uint numFuncOn, uint numFuncR, uint numFuncD);
63 protected:
64 /// Text of the button.
65 ucstring _Text;
66 /// Pen used to display the text.
67 CPen _Pen;
69 /// function called with a left click on the button
70 uint _NumFuncOn;
72 /// function called with a right click on the button
73 uint _NumFuncRightClick;
75 /// function called with a double (left) click on the button
76 uint _NumFuncDbleClick;
78 /// state of the button
79 TState _State;
81 public:
82 /// Constructor
83 CButton(uint id = 0);
84 explicit CButton(uint id, float x, float y, float x_pixel, float y_pixel, float w, float h, float w_pixel, float h_pixel, uint numFuncOn, uint numFuncR, uint numFuncD, const CButtonBase &buttonBase);
85 explicit CButton(uint id, float x, float y, float x_pixel, float y_pixel, float w, float h, float w_pixel, float h_pixel, uint numFuncOn, uint numFuncR, uint numFuncD, CRGBA on, CRGBA off, CRGBA disable);
87 /// Set the Pen to use for the Text of the button.
88 void pen(const CPen &pen);
90 /// unSelect the button.
91 virtual void unSelect();
93 /// Display the Bitmap.
94 virtual void display();
96 /// Manage the click of the mouse for the Button.
97 virtual void click(float x, float y, bool &taken);
99 /// Manage the right click of the mouse for the Button.
100 virtual void clickRight(float x, float y, bool &taken);
102 /// get the state of the button (clicked, released (unselected), etc...)
103 TState getState() const { return _State; }
106 * set the text displayed in the button.
107 * \param text : the new text to display.
109 void text(const ucstring &text) { _Text = text; }
112 * get the text displayed in the button
113 * \return cont ucstring& : the text displayed by the button.
115 const ucstring &text() const { return _Text; }
119 #endif // CL_BUTTON_H
121 /* End of button.h */