]> icculus.org git repositories - icculus/iodoom3.git/blob - neo/tools/guied/GEWindowWrapper.h
hello world
[icculus/iodoom3.git] / neo / tools / guied / GEWindowWrapper.h
1 /*
2 ===========================================================================
3
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 
6
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).  
8
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code.  If not, see <http://www.gnu.org/licenses/>.
21
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code.  If not, please request a copy in writing from id Software at the address below.
23
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25
26 ===========================================================================
27 */
28
29 #ifndef GEWINDOWWRAPPER_H_
30 #define GEWINDOWWRAPPER_H_
31
32 class idWindow;
33 class rvGEWindowWrapper;
34
35 typedef bool (*PFNENUMCHILDRENPROC) ( rvGEWindowWrapper* wrapper, void* data );
36
37 class rvGEWindowWrapper
38 {
39 public:
40
41         enum EWindowType
42         {
43                 WT_UNKNOWN,
44                 WT_NORMAL,
45                 WT_EDIT,
46                 WT_HTML,
47                 WT_CHOICE,
48                 WT_SLIDER,
49                 WT_BIND,
50                 WT_LIST,
51                 WT_RENDER,
52                 WT_TRANSITION
53         };
54
55         rvGEWindowWrapper ( idWindow* window, EWindowType type );
56
57         static rvGEWindowWrapper*       GetWrapper ( idWindow* window );        
58                 
59         idWindow*                       GetWindow                       ( void );
60         idDict&                         GetStateDict            ( void );
61         idDict&                         GetVariableDict         ( void );
62         idDict&                         GetScriptDict           ( void );
63         idRectangle&            GetClientRect           ( void );
64         idRectangle&            GetScreenRect           ( void );
65         EWindowType                     GetWindowType           ( void );
66         int                                     GetChildCount           ( void );
67         int                                     GetDepth                        ( void );
68         idWindow*                       GetChild                        ( int index );
69         
70         void                            SetRect                         ( idRectangle& rect );
71         void                            SetState                        ( const idDict& dict );
72         void                            SetStateKey                     ( const char* key, const char* value, bool update = true );
73         void                            DeleteStateKey          ( const char* key );
74         bool                            VerfiyStateKey          ( const char* name, const char* value, idStr* result = NULL );
75         
76         bool                            IsFlippedHorz           ( void );
77         bool                            IsFlippedVert           ( void );
78         bool                            IsHidden                        ( void );
79         bool                            IsDeleted                       ( void );
80         bool                            IsSelected                      ( void );
81         bool                            IsExpanded                      ( void );
82
83         bool                            CanHaveChildren         ( void );
84         bool                            CanMoveAndSize          ( void );
85         
86         void                            SetFlippedHorz          ( bool f );
87         void                            SetFlippedVert          ( bool f );
88         void                            SetHidden                       ( bool v );
89         void                            SetDeleted                      ( bool del );
90         void                            SetSelected                     ( bool sel );
91         void                            SetWindowType           ( EWindowType type );
92
93         bool                            Expand                          ( void );
94         bool                            Collapse                        ( void );
95
96         bool                            EnumChildren            ( PFNENUMCHILDRENPROC proc, void* data );
97
98         idWindow*                       WindowFromPoint         ( float x, float y, bool visibleOnly = true );
99         
100         void                            Finish                          ( void );
101         
102         static EWindowType      StringToWindowType              ( const char* string );
103         static const char*      WindowTypeToString              ( EWindowType type );
104         
105 protected:
106
107         void                            CalcScreenRect          ( void );
108         void                            UpdateRect                      ( void );
109         void                            UpdateWindowState       ( void );       
110
111         idRectangle             mClientRect;
112         idRectangle             mScreenRect;
113         idWindow*               mWindow;
114         idDict                  mState;
115         idDict                  mVariables;
116         idDict                  mScripts;
117         bool                    mFlippedHorz;
118         bool                    mFlippedVert;
119         bool                    mHidden;
120         bool                    mDeleted;
121         bool                    mSelected;
122         bool                    mExpanded;
123         bool                    mOldVisible;
124         bool                    mMoveable;
125         EWindowType             mType;
126 };
127
128 ID_INLINE idDict& rvGEWindowWrapper::GetStateDict ( void )
129 {
130         return mState;
131 }
132
133 ID_INLINE idDict& rvGEWindowWrapper::GetVariableDict ( void )
134 {
135         return mVariables;
136 }
137
138 ID_INLINE idDict& rvGEWindowWrapper::GetScriptDict ( void )
139 {
140         return mScripts;
141 }
142
143 ID_INLINE bool rvGEWindowWrapper::IsFlippedHorz ( void )
144 {
145         return mFlippedHorz;
146 }
147
148 ID_INLINE bool rvGEWindowWrapper::IsFlippedVert ( void ) 
149 {
150         return mFlippedVert;
151 }
152
153 ID_INLINE bool rvGEWindowWrapper::IsExpanded ( void ) 
154 {
155         return mExpanded;
156 }
157         
158 ID_INLINE void rvGEWindowWrapper::SetFlippedHorz ( bool f )
159 {
160         mFlippedHorz = f;
161 }
162
163 ID_INLINE void rvGEWindowWrapper::SetFlippedVert ( bool f )
164 {
165         mFlippedVert = f;
166 }
167
168 ID_INLINE idRectangle& rvGEWindowWrapper::GetClientRect ( void )
169 {
170         return mClientRect;
171 }
172
173 ID_INLINE idRectangle& rvGEWindowWrapper::GetScreenRect ( void )
174 {
175         return mScreenRect;
176 }
177
178 ID_INLINE bool rvGEWindowWrapper::IsHidden ( void )
179 {
180         return mHidden;
181 }
182
183 ID_INLINE bool rvGEWindowWrapper::IsDeleted ( void )
184 {
185         return mDeleted;
186 }
187
188 ID_INLINE bool rvGEWindowWrapper::IsSelected ( void )
189 {
190         return mSelected;
191 }
192
193 ID_INLINE void rvGEWindowWrapper::SetSelected ( bool sel )
194 {
195         mSelected = sel;
196 }
197
198 ID_INLINE rvGEWindowWrapper::EWindowType rvGEWindowWrapper::GetWindowType ( void )
199 {
200         return mType;
201 }
202
203 ID_INLINE void rvGEWindowWrapper::SetWindowType ( rvGEWindowWrapper::EWindowType type )
204 {
205         mType = type;
206 }
207
208 ID_INLINE idWindow* rvGEWindowWrapper::GetChild ( int index )
209 {
210         return mWindow->GetChild ( index );
211 }
212
213 ID_INLINE idWindow* rvGEWindowWrapper::GetWindow ( void )
214 {
215         return mWindow;
216 }
217
218 ID_INLINE bool rvGEWindowWrapper::CanMoveAndSize ( void )
219 {
220         return mMoveable;
221 }
222
223 #endif // GEWINDOWWRAPPER_H_