doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Winvar.cpp
Go to the documentation of this file.
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 #include "../idlib/precompiled.h"
30 #pragma hdrstop
31 
32 #include "Window.h"
33 #include "Winvar.h"
34 #include "UserInterfaceLocal.h"
35 
37  guiDict = NULL;
38  name = NULL;
39  eval = true;
40 }
41 
43  delete name;
44  name = NULL;
45 }
46 
47 void idWinVar::SetGuiInfo(idDict *gd, const char *_name) {
48  guiDict = gd;
49  SetName(_name);
50 }
51 
52 
53 void idWinVar::Init(const char *_name, idWindow *win) {
54  idStr key = _name;
55  guiDict = NULL;
56  int len = key.Length();
57  if (len > 5 && key[0] == 'g' && key[1] == 'u' && key[2] == 'i' && key[3] == ':') {
58  key = key.Right(len - VAR_GUIPREFIX_LEN);
59  SetGuiInfo( win->GetGui()->GetStateDict(), key );
60  win->AddUpdateVar(this);
61  } else {
62  Set(_name);
63  }
64 }
65 
66 void idMultiWinVar::Set( const char *val ) {
67  for ( int i = 0; i < Num(); i++ ) {
68  (*this)[i]->Set( val );
69  }
70 }
71 
72 void idMultiWinVar::Update( void ) {
73  for ( int i = 0; i < Num(); i++ ) {
74  (*this)[i]->Update();
75  }
76 }
77 
79  for ( int i = 0; i < Num(); i++ ) {
80  (*this)[i]->SetGuiInfo( dict, (*this)[i]->c_str() );
81  }
82 }
83 
virtual void Set(const char *val)=0
void Update(void)
Definition: Winvar.cpp:72
int Length(void) const
Definition: Str.h:702
GLenum GLsizei len
Definition: glext.h:3472
int i
Definition: process.py:33
void SetGuiInfo(idDict *gd, const char *_name)
Definition: Winvar.cpp:47
bool eval
Definition: Winvar.h:92
void AddUpdateVar(idWinVar *var)
Definition: Window.cpp:575
idDict * guiDict
Definition: Winvar.h:90
virtual void Init(const char *_name, idWindow *win)=0
Definition: Winvar.cpp:53
Definition: Dict.h:65
#define NULL
Definition: Lib.h:88
void SetName(const char *_name)
Definition: Winvar.h:53
const char * Right(int len, idStr &result) const
Definition: Str.h:896
virtual ~idWinVar()
Definition: Winvar.cpp:42
idUserInterfaceLocal * GetGui()
Definition: Window.h:225
int Num(void) const
const GLcharARB * name
Definition: glext.h:3629
Definition: Str.h:116
Window win
Definition: glimp.cpp:46
idWinVar()
Definition: Winvar.cpp:36
void SetGuiInfo(idDict *dict)
Definition: Winvar.cpp:78
void Set(const char *val)
Definition: Winvar.cpp:66
char * name
Definition: Winvar.h:91