]> git.saurik.com Git - wxWidgets.git/blame - contrib/src/applet/ifelsevar.cpp
use Windows standard icons instead of our own (patch 443856)
[wxWidgets.git] / contrib / src / applet / ifelsevar.cpp
CommitLineData
716cd410
KB
1/****************************************************************************
2*
3* wxWindows HTML Applet Package
4*
5* Copyright (C) 1991-2001 SciTech Software, Inc.
6* All rights reserved.
7*
8* ========================================================================
9*
10* The contents of this file are subject to the wxWindows License
11* Version 3.0 (the "License"); you may not use this file except in
12* compliance with the License. You may obtain a copy of the License at
13* http://www.wxwindows.org/licence3.txt
14*
15* Software distributed under the License is distributed on an
16* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
17* implied. See the License for the specific language governing
18* rights and limitations under the License.
19*
20* ========================================================================
21*
22* Language: ANSI C++
23* Environment: Any
24*
25* Description: Implementation of wxIfElseVariable Class, Dynamically constructed
26* objects representing variables in SSI #if, #else, and #endif directives
27*
28****************************************************************************/
29
30// For compilers that support precompilation
31#include "wx/wxprec.h"
32#include "wx/html/forcelnk.h"
33
34// Include private headers
35#include "wx/applet/ifelsevar.h"
36
37/*---------------------------- Global variables ---------------------------*/
38
39// Implement the dynamic class so it can be constructed dynamically
40IMPLEMENT_ABSTRACT_CLASS(wxIfElseVariable, wxObject);
41
42/*----------------------------- Implementation ----------------------------*/
43
44/****************************************************************************
45PARAMETERS:
46cls - The String name of the class
47
48RETURNS:
49The boolean value of the variable
50
51REMARKS:
52To grab a value from any class which is derived from this one simple use this
53static function and the name of the derived class to get the value.
54This static function is the only function implemented in this base class
55basically this is provided for an easier method of grabbing a variable. We
56keep all the dynamic object handling in this class to avoid confusing the source
57where these are used.
58
59SEE ALSO:
60wxIfElsePrep
61****************************************************************************/
62static bool wxIfElseVariable::GetValue(
63 const wxString &cls)
64{
65 wxObject * tmpclass;
66
67 tmpclass = wxCreateDynamicObject(wxString("wxIfElseVariable") + cls);
68 if (!tmpclass) {
69#ifdef CHECKED
70 wxMessageBox(wxString("wxHTML #if error: Class not found (") + cls + wxString(")."),"Error",wxICON_ERROR);
71#endif
72 return wxString("");
73 }
74
75 wxIfElseVariable * ev = wxDynamicCast(tmpclass, wxIfElseVariable);
76
77 if (!ev) {
78#ifdef CHECKED
79 wxMessageBox(wxString("wxHTML #if error: Class is not a valid ifelse variable (") + cls + wxString(")."),"Error",wxICON_ERROR);
80#endif
81 return wxString("");
82 }
83
84 return ev->GetValue();
85}
86
87/*------------------------ Macro Documentation ---------------------------*/
88
89// Here we declare some fake functions to get doc-jet to properly document the macros
90
91#undef BEGIN_IFELSE_VARIABLE
92/****************************************************************************
93PARAMETERS:
94name - The name of the variable to create
95
96REMARKS:
97This macro is used to create variables for use by the #if, #else and #endif
98blocks in the HTML preprocessor.
99To create a new variable include the code necessary to get the value of the
100variable between a block of BEGIN_IFELSE_VARIABLE and END_IFELSE_VARIABLE macros.
101
102EXAMPLE:
103BEGIN_IFELSE_VARIABLE(UserName)
104 // Get username from nucleus
105 bool tmp = GA_HasRegistered();
106END_IFELSE_VARIABLE(UserName, tmp)
107
108SEE ALSO:
109wxIfElseVariable, wxIfElsePrep, END_IFELSE_VARIABLE, IFELSE_VARIABLE
110****************************************************************************/
111void BEGIN_IFELSE_VARIABLE(
112 const char *name);
113
114#undef END_IFELSE_VARIABLE
115/****************************************************************************
116PARAMETERS:
117name - The name of the variable to end
118returnval - The boolean value which is the value of the variable
119
120REMARKS:
121This macro is used to create variables for use by the #if, #else and #endif
122blocks in the HTML preprocessor.
123To create a new variable include the code necessary to get the value of the
124variable between a block of BEGIN_IFELSE_VARIABLE and END_IFELSE_VARIABLE macros.
125
126EXAMPLE:
127BEGIN_IFELSE_VARIABLE(UserName)
128 // Get username from nucleus
129 bool tmp = GA_HasRegistered();
130END_IFELSE_VARIABLE(UserName, tmp)
131
132SEE ALSO:
133wxIfElseVariable, wxIfElsePrep, BEGIN_IFELSE_VARIABLE, IFELSE_VARIABLE
134****************************************************************************/
135void END_IFELSE_VARIABLE(
136 const char *name,
137 bool returnval);
138
139#undef IFELSE_VARIABLE
140/****************************************************************************
141PARAMETERS:
142name - The name of the variable
143state - value of the variable
144
145REMARKS:
146This macro is used to create constant boolean variables for use by the
147#if, #else and #endif blocks in the HTML preprocessor.
148This MACRO creates a variable that simply returns the given state and is
149not modifiable.
150
151SEE ALSO:
152wxIfElseVariable, wxIfElsePrep, BEGIN_IFELSE_VARIABLE, END_IFELSE_VARIABLE
153****************************************************************************/
154void IFELSE_VARIABLE(
155 const char *name,
156 bool state);
157
158
159FORCE_LINK_ME(ifelsevar)