Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / client / src / interfaces_manager / brick_receptacle.h
blob0d226f7378fe386fff8eb99f155ad81fc030fad9
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 NL_BRICK_RECEPTACLE_H
20 #define NL_BRICK_RECEPTACLE_H
23 /////////////
24 // Include //
25 /////////////
26 // Misc
27 #include "nel/misc/types_nl.h"
28 // Client
29 #include "control.h"
30 #include "bitmap_base.h"
31 #include "interfaces_manager.h"
32 #include "brick_control.h"
33 // Interface 3D
34 #include "nel/3d/u_driver.h"
37 ////////////
38 // Extern //
39 ////////////
40 extern NL3D::UDriver *Driver;
42 /**
43 * <Class description>
44 * \author David Fleury
45 * \author Nevrax France
46 * \date 2001
48 class CBrickReceptacle : public CControl, public CBitmapBase
50 public:
52 /**
53 * constructor
54 * \param uint id the id of the control (default = 0)
56 CBrickReceptacle(uint id = 0);
58 /**
59 * constructor
61 CBrickReceptacle(uint id, float x, float y, float x_pixel, float y_pixel, float w, float h, float w_pixel, float h_pixel, uint texture, const CRGBA &rgba, uint16 family, uint numFunc = 0);
63 /// destructor
64 ~CBrickReceptacle();
66 /**
67 * set the brick this control "contains", only usable on a unlocked object (_Locked == false)
68 * \param CBrickControl* brick the brick that will be in this receptacle
69 * \return bool true if the brick is compatible, false otherwise
71 bool brick( CBrickControl *brick);
73 /**
74 * get the brick if any
75 * \return CBrickControl * the brick or NULL if receptacle is empty
77 CBrickControl *brick() { return _Brick; }
79 /**
80 * set the brick family accepted by this control
81 * \param uint16 family the new family accepted
83 bool family( uint16 family);
86 /**
87 * get the brick family this control can accept
88 * \return uint16 the family this control can accept
90 uint16 family() const { return _Family; }
92 /**
93 * test if the receptacle is empty (same as (brick() == NULL) )
94 * \return bool true if empty, false if full
96 bool isEmpty() const { return ( _Brick == NULL); }
98 /**
99 * emty the slot, delete _Brick if allocated
101 void clear();
103 /// Display the Bitmap.
104 virtual void display();
106 /// Set some references for the display.
107 virtual void ref(float x, float y, float w, float h);
110 /// Manage the click for the control.
111 virtual void click(float x, float y, bool &taken);
114 /// lock the control (the brick cannot be changed/removed/added )
115 inline void lock() { _Locked = true; }
117 /// unlock the control
118 inline void unlock() { _Locked = false; }
120 /// return the locked state of the control
121 inline bool isLocked() const { return _Locked; }
123 private:
124 /// init the control
125 void init( uint16 family=0, uint numFunc = 0);
127 private:
128 /// the brick contained by this control, or NULL if empty
129 CBrickControl *_Brick;
131 /// the brick family this control can accept
132 uint16 _Family;
134 /// lock the associated brick control or not (if locked == true, the brick cannot be changed/removed/added )
135 bool _Locked;
137 /// function called with a left click on the button
138 uint _NumFuncLeftClick;
143 #endif // NL_BRICK_RECEPTACLE_H
145 /* End of brick_receptacle.h */