]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/applet/echovar.cpp
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: Implementation of wxEchoVariable Class, Dynamically constructed
26 * objects representing variables in SSI #echo directive
28 ****************************************************************************/
30 // For compilers that support precompilation
31 #include "wx/wxprec.h"
32 #include "wx/html/forcelnk.h"
34 // Include private headers
35 #include "wx/applet/echovar.h"
37 /*---------------------------- Global variables ---------------------------*/
39 // Implement the dynamic class so it can be constructed dynamically
40 IMPLEMENT_ABSTRACT_CLASS(wxEchoVariable
, wxObject
);
42 /*----------------------------- Implementation ----------------------------*/
44 /****************************************************************************
46 cls - The String name of the class
47 parms - an optional parameter string to pass off to the child class
50 The string value of the variable
53 To grab a value from any class which is derived from this one simple use this
54 static function and the name of the derived class to get the value.
55 This static function is the only function implemented in this base class
56 basically this is provided for an easier method of grabbing a variable. We
57 keep all the dynamic object handling in this class to avoid confusing the source
62 ****************************************************************************/
63 static wxString
wxEchoVariable::GetValue(
69 tmpclass
= wxCreateDynamicObject(wxString("wxEchoVariable") + cls
);
72 wxMessageBox(wxString("wxHTML #echo error: Class not found (") + cls
+ wxString(")."),"Error",wxICON_ERROR
);
77 wxEchoVariable
* ev
= wxDynamicCast(tmpclass
, wxEchoVariable
);
81 wxMessageBox(wxString("wxHTML #echo error: Class is not a valid echo variable (") + cls
+ wxString(")."),"Error",wxICON_ERROR
);
86 return ev
->GetValue(parms
);
90 /*------------------------ Macro Documentation ---------------------------*/
92 // Here we declare some fake functions to get doc-jet to properly document the macros
95 /****************************************************************************
97 The value of the parameter string from the HTML parm= field
100 This is a macro to retrieve the parameter string passed in the parm= field.
101 Use this macro to get the correct variable within a BEGIN_ECHO_VARIABLE and
102 END_ECHO_VARIABLE block.
105 wxEchoVariable, wxEchoPrep, BEGIN_ECHO_VARIABLE, END_ECHO_VARIABLE
106 ****************************************************************************/
107 wxString
ECHO_PARM();
110 #undef BEGIN_ECHO_VARIABLE
111 /****************************************************************************
113 name - The name of the variable to create
116 This macro is used to create variables for use by the #echo directive
117 the HTML preprocessor.
118 To create a new variable include the code necessary to get the value of the
119 variable between a block of BEGIN_ECHO_VARIABLE and END_ECHO_VARIABLE macros.
120 Use the ECHO_PARM macro to grab the optional parameter string passed from the
121 'parm=' field in the html file.
124 BEGIN_ECHO_VARIABLE(UserName)
125 // Get username from nucleus
126 wxString tmp = GA_GetUserName();
127 END_ECHO_VARIABLE(UserName, tmp)
130 wxEchoVariable, wxEchoPrep, END_ECHO_VARIABLE, ECHO_PARM, STRING_ECHO_VARIABLE
131 ****************************************************************************/
132 void BEGIN_ECHO_VARIABLE(
135 #undef END_ECHO_VARIABLE
136 /****************************************************************************
138 name - The name of the variable to end
139 returnval - The value which should be sent back as the value of the variable
142 This macro is used to create variables for use by the #echo directive
143 the HTML preprocessor.
144 To create a new variable include the code necessary to get the value of the
145 variable between a block of BEGIN_ECHO_VARIABLE and END_ECHO_VARIABLE macros.
148 BEGIN_ECHO_VARIABLE(UserName)
149 // Get username from nucleus
150 wxString tmp = GA_GetUserName();
151 END_ECHO_VARIABLE(UserName, tmp)
154 wxEchoVariable, wxEchoPrep, BEGIN_ECHO_VARIABLE, ECHO_PARM, STRING_ECHO_VARIABLE
155 ****************************************************************************/
156 void END_ECHO_VARIABLE(
160 #undef STRING_ECHO_VARIABLE
161 /****************************************************************************
163 name - The name of the variable
164 returnval - String to return as the value of the variable
167 This macro is used to create constant string variables for use by the #echo
168 directive in the HTML preprocessor.
169 This MACRO creates a variable that simply returns the given string and is
173 wxEchoVariable, wxEchoPrep, BEGIN_ECHO_VARIABLE, END_ECHO_VARIABLE
174 ****************************************************************************/
175 void STRING_ECHO_VARIABLE(
179 // hack to make this file link
180 FORCE_LINK_ME(echovar
)