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_BRICK_RECEPTACLE_H
20 #define NL_BRICK_RECEPTACLE_H
27 #include "nel/misc/types_nl.h"
30 #include "bitmap_base.h"
31 #include "interfaces_manager.h"
32 #include "brick_control.h"
34 #include "nel/3d/u_driver.h"
40 extern NL3D::UDriver
*Driver
;
44 * \author David Fleury
45 * \author Nevrax France
48 class CBrickReceptacle
: public CControl
, public CBitmapBase
54 * \param uint id the id of the control (default = 0)
56 CBrickReceptacle(uint id
= 0);
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);
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
);
74 * get the brick if any
75 * \return CBrickControl * the brick or NULL if receptacle is empty
77 CBrickControl
*brick() { return _Brick
; }
80 * set the brick family accepted by this control
81 * \param uint16 family the new family accepted
83 bool family( uint16 family
);
87 * get the brick family this control can accept
88 * \return uint16 the family this control can accept
90 uint16
family() const { return _Family
; }
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
); }
99 * emty the slot, delete _Brick if allocated
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
; }
125 void init( uint16 family
=0, uint numFunc
= 0);
128 /// the brick contained by this control, or NULL if empty
129 CBrickControl
*_Brick
;
131 /// the brick family this control can accept
134 /// lock the associated brick control or not (if locked == true, the brick cannot be changed/removed/added )
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 */