]>
git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/applet/ifelsevar.h
1 /****************************************************************************
3 * wxWindows HTML Applet Package
5 * Copyright (C) 1991-2001 SciTech Software, Inc.
8 * ========================================================================
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
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.
20 * ========================================================================
25 * Description: Header file for wxIfElseVariable Class, Dynamically constructed
26 * objects representing variables in SSI #if, #else and #endif directives
28 ****************************************************************************/
30 #ifndef __WX_IFELSEVAR_H
31 #define __WX_IFELSEVAR_H
33 /*--------------------------- Class Definitions ---------------------------*/
35 /****************************************************************************
37 This class is used to create variables for the HTML preprocessor #if, #else,
38 and #endif directives.
42 ****************************************************************************/
43 class wxIfElseVariable
: public wxObject
{
45 DECLARE_ABSTRACT_CLASS(wxIfElseVariable
);
48 wxIfElseVariable() : wxObject() {}
49 ~wxIfElseVariable() {}
51 /****************************************************************************
53 The boolean value of the variable
56 To create new variables for the #if, #else and #endif HTML preprocessing
57 blocks you need to derive classes from wxIfElseVariable and override the
58 pure virtual GetValue function. However this should not be done directly
59 but by using the BEGIN_IFELSE_VARIABLE and END_IFELSE_VARIABLE macros
62 wxIfElsePrep, BEGIN_IFELSE_VARIABLE, END_IFELSE_VARIABLE
63 ****************************************************************************/
64 virtual bool GetValue() const = 0;
68 // static function to retrieve any variable avaliable
69 static bool GetValue(const wxString
&cls
);
72 /*--------------------------------- MACROS --------------------------------*/
74 #define BEGIN_IFELSE_VARIABLE(name) \
75 class wxIfElseVariable##name : public wxIfElseVariable { \
77 DECLARE_DYNAMIC_CLASS(wxIfElseVariable##name##); \
79 wxIfElseVariable##name##() : wxIfElseVariable() {} \
80 virtual bool GetValue() const; \
82 IMPLEMENT_DYNAMIC_CLASS(wxIfElseVariable##name##, wxIfElseVariable); \
83 bool wxIfElseVariable##name :: GetValue() const {
85 #define END_IFELSE_VARIABLE(name, returnval) \
89 #define IFELSE_VARIABLE(name, state) \
90 BEGIN_IFELSE_VARIABLE(##name##); \
91 END_IFELSE_VARIABLE(##name##, bool (state))
94 #endif // __WX_IFELSEVAR_H