Debian Codegraph @

src/guicontainer.h

raw symbols SCIP
1 /***************************************************************************
2 guicontainer.h - description
3 -------------------
4 begin : march 22th, 2004
5 copyright : (C) 2004-2007 by Duong Khang NGUYEN
6 email : neoneurone @ gmail com
7
8 $Id: guicontainer.h 450 2010-11-21 19:11:43Z neoneurone $
9 ***************************************************************************/
10
11 /***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * any later version. *
17 * *
18 ***************************************************************************/
19
20 #ifndef _OPENCITY_GUICONTAINER_H_
21 #define _OPENCITY_GUICONTAINER_H_ 1
22
23 #include "guimain.h"
24 #include "texture.h"
25
26 #include <vector>
27
28
29 //========================================================================
30 /** A container is a GUI wrapper. It is used to handle the controls
31 derived from the GUIMain class
32 */
33 class GUIContainer : public GUIMain {
34 public:
35 GUIContainer();
36
37
38 //========================================================================
39 /** Pctor 1.
40 \param ciX,ciY The 2D XY window coordinates of the container
41 \param cuiW,cuiH The width and height of the container
42 */
43 GUIContainer(
44 const int ciX,
45 const int ciY,
46 const uint cuiW,
47 const uint cuiH );
48
49
50 //========================================================================
51 /** Pctor 2.
52 \param ciX,ciY The 2D XY window coordinates of the container
53 \param cuiW,cuiH The width and height of the container
54 \param rcsTexFile The name of the texture file which will be used as
55 background.
56 */
57 GUIContainer(
58 const int ciX,
59 const int ciY,
60 const uint cuiW,
61 const uint cuiH,
62 const string& rcsTexFile );
63
64
65 ~GUIContainer();
66
67
68 //========================================================================
69 /** Add a nex control to the container
70 */
71 const uint
72 Add( GUIMain* const pguimain );
73
74
75 //========================================================================
76 /** Get the number of the controls in the container
77 \return the number of controls added so far
78 */
79 const uint
80 GetNumber() const;
81
82
83 //========================================================================
84 /** Get the width and the height of the window
85 \param riWinW,riWinH The width and the height of the current window
86 */
87 void
88 GetWinWH( int& riWinW, int& riWinH ) const;
89
90
91 //========================================================================
92 /** Get the index of the first control which is clicked. The index starts
93 from 1.
94 \return The index of the clicked control. The method returns 0 if
95 there's no clicked control
96 */
97 const uint
98 GetClick() const;
99
100
101 //========================================================================
102 /** Set the attribute of a contained GUIMain object. This declaration
103 hides the prototype of Set inherited from the GUIMain class.
104 \param rcuiIndex The index of the control to modify. It must be in
105 range because there is no error checking.
106 \param rcubAttribute The attributes to set
107 */
108 void
109 Set(
110 const uint& rcuiIndex,
111 const OC_BYTE& rcubAttribute ) const;
112
113
114 //========================================================================
115 /**
116 \note We need this method because the inherited one is hidden
117 */
118 void
119 Set(
120 const OC_BYTE& rcubAttribute ) {
121 GUIMain::Set( rcubAttribute );
122 }
123
124
125 //========================================================================
126 /** Unset the specified attributes of all controls.
127 \param rcubAttr The attributes to unset
128 */
129 void
130 ResetAttribute( const OC_BYTE& rcubAttr ) const;
131
132
133 //========================================================================
134 // Inherited methods from GUIMain
135 //========================================================================
136 void
137 Display() const;
138
139
140 //========================================================================
141 // Inherited methods from UI
142 //========================================================================
143 void Keyboard( const SDL_KeyboardEvent& rcEvent );
144 void MouseMotion( const SDL_MouseMotionEvent& rcEvent );
145 void MouseButton( const SDL_MouseButtonEvent& rcEvent );
146 void Expose( const SDL_ExposeEvent& rcEvent );
147 void Resize( const SDL_ResizeEvent& rcEvent );
148
149
150 private:
151 uint _uiWinWidth, _uiWinHeight;
152 std::vector<GUIMain*> vectorpguimain;
153 Texture moTextureBackground;
154 };
155
156 #endif
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187