ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

ThemeParser.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef THEME_PARSER_H
00024 #define THEME_PARSER_H
00025 
00026 #include "common/scummsys.h"
00027 #include "common/xmlparser.h"
00028 
00029 namespace GUI {
00030 
00031 class ThemeEngine;
00032 
00033 class ThemeParser : public Common::XMLParser {
00034 public:
00035     ThemeParser(ThemeEngine *parent);
00036 
00037     virtual ~ThemeParser();
00038 
00039     bool getPaletteColor(const Common::String &name, int &r, int &g, int &b) {
00040         if (!_palette.contains(name))
00041             return false;
00042 
00043         r = _palette[name].r;
00044         g = _palette[name].g;
00045         b = _palette[name].b;
00046 
00047         return true;
00048     }
00049 
00050 protected:
00051     ThemeEngine *_theme;
00052 
00053     CUSTOM_XML_PARSER(ThemeParser) {
00054         XML_KEY(render_info)
00055             XML_PROP(resolution, false)
00056             XML_KEY(palette)
00057                 XML_KEY(color)
00058                     XML_PROP(name, true)
00059                     XML_PROP(rgb, true)
00060                 KEY_END()
00061             KEY_END()
00062 
00063             XML_KEY(fonts)
00064                 XML_KEY(font)
00065                     XML_PROP(id, true)
00066                     XML_PROP(file, true)
00067                     XML_PROP(resolution, false)
00068                     XML_PROP(scalable_file, false)
00069                     XML_PROP(point_size, false)
00070                 KEY_END()
00071 
00072                 XML_KEY(text_color)
00073                     XML_PROP(id, true);
00074                     XML_PROP(color, true);
00075                 KEY_END()
00076             KEY_END()
00077 
00078             XML_KEY(bitmaps)
00079                 XML_KEY(bitmap)
00080                     XML_PROP(filename, true)
00081                     XML_PROP(resolution, false)
00082                 KEY_END()
00083                 XML_KEY(alphabitmap)
00084                     XML_PROP(filename, true)
00085                     XML_PROP(resolution, false)
00086                 KEY_END()
00087             KEY_END()
00088 
00089             XML_KEY(cursor)
00090                 XML_PROP(file, true)
00091                 XML_PROP(hotspot, true)
00092                 XML_PROP(resolution, false)
00093             KEY_END()
00094 
00095             XML_KEY(defaults)
00096                 XML_PROP(stroke, false)
00097                 XML_PROP(shadow, false)
00098                 XML_PROP(bevel, false)
00099                 XML_PROP(factor, false)
00100                 XML_PROP(fg_color, false)
00101                 XML_PROP(bg_color, false)
00102                 XML_PROP(gradient_start, false)
00103                 XML_PROP(gradient_end, false)
00104                 XML_PROP(bevel_color, false)
00105                 XML_PROP(gradient_factor, false)
00106                 XML_PROP(fill, false)
00107             KEY_END()
00108 
00109             XML_KEY(drawdata)
00110                 XML_PROP(id, true)
00111                 XML_PROP(cache, false)
00112                 XML_PROP(resolution, false)
00113 
00114                 XML_KEY(defaults)
00115                     XML_PROP(stroke, false)
00116                     XML_PROP(shadow, false)
00117                     XML_PROP(bevel, false)
00118                     XML_PROP(factor, false)
00119                     XML_PROP(fg_color, false)
00120                     XML_PROP(bg_color, false)
00121                     XML_PROP(gradient_start, false)
00122                     XML_PROP(gradient_end, false)
00123                     XML_PROP(bevel_color, false)
00124                     XML_PROP(gradient_factor, false)
00125                     XML_PROP(fill, false)
00126                 KEY_END()
00127 
00128                 XML_KEY(drawstep)
00129                     XML_PROP(func, true)
00130                     XML_PROP(stroke, false)
00131                     XML_PROP(shadow, false)
00132                     XML_PROP(bevel, false)
00133                     XML_PROP(factor, false)
00134                     XML_PROP(fg_color, false)
00135                     XML_PROP(bg_color, false)
00136                     XML_PROP(gradient_start, false)
00137                     XML_PROP(gradient_end, false)
00138                     XML_PROP(gradient_factor, false)
00139                     XML_PROP(bevel_color, false)
00140                     XML_PROP(fill, false)
00141                     XML_PROP(radius, false)
00142                     XML_PROP(width, false)
00143                     XML_PROP(height, false)
00144                     XML_PROP(xpos, false)
00145                     XML_PROP(ypos, false)
00146                     XML_PROP(padding, false)
00147                     XML_PROP(orientation, false)
00148                     XML_PROP(file, false)
00149                     XML_PROP(autoscale, false)
00150                 KEY_END()
00151 
00152                 XML_KEY(text)
00153                     XML_PROP(font, true)
00154                     XML_PROP(text_color, true)
00155                     XML_PROP(vertical_align, true)
00156                     XML_PROP(horizontal_align, true)
00157                 KEY_END()
00158             KEY_END()
00159 
00160         KEY_END() // render_info end
00161 
00162         XML_KEY(layout_info)
00163             XML_PROP(resolution, false)
00164             XML_KEY(globals)
00165                 XML_PROP(resolution, false)
00166                 XML_KEY(def)
00167                     XML_PROP(var, true)
00168                     XML_PROP(value, true)
00169                     XML_PROP(resolution, false)
00170                 KEY_END()
00171 
00172                 XML_KEY(widget)
00173                     XML_PROP(name, true)
00174                     XML_PROP(size, false)
00175                     XML_PROP(pos, false)
00176                     XML_PROP(padding, false)
00177                     XML_PROP(resolution, false)
00178                     XML_PROP(textalign, false)
00179                 KEY_END()
00180             KEY_END()
00181 
00182             XML_KEY(dialog)
00183                 XML_PROP(name, true)
00184                 XML_PROP(overlays, true)
00185                 XML_PROP(shading, false)
00186                 XML_PROP(enabled, false)
00187                 XML_PROP(resolution, false)
00188                 XML_PROP(inset, false)
00189                 XML_KEY(layout)
00190                     XML_PROP(type, true)
00191                     XML_PROP(center, false)
00192                     XML_PROP(padding, false)
00193                     XML_PROP(spacing, false)
00194 
00195                     XML_KEY(import)
00196                         XML_PROP(layout, true)
00197                     KEY_END()
00198 
00199                     XML_KEY(widget)
00200                         XML_PROP(name, true)
00201                         XML_PROP(width, false)
00202                         XML_PROP(height, false)
00203                         XML_PROP(type, false)
00204                         XML_PROP(enabled, false)
00205                         XML_PROP(textalign, false)
00206                     KEY_END()
00207 
00208                     XML_KEY(space)
00209                         XML_PROP(size, false)
00210                     KEY_END()
00211 
00212                     XML_KEY_RECURSIVE(layout)
00213                 KEY_END()
00214             KEY_END()
00215         KEY_END()
00216 
00217     } PARSER_END()
00218 
00219     
00220     bool parserCallback_render_info(ParserNode *node);
00221     bool parserCallback_defaults(ParserNode *node);
00222     bool parserCallback_font(ParserNode *node);
00223     bool parserCallback_text_color(ParserNode *node);
00224     bool parserCallback_fonts(ParserNode *node);
00225     bool parserCallback_text(ParserNode *node);
00226     bool parserCallback_palette(ParserNode *node);
00227     bool parserCallback_color(ParserNode *node);
00228     bool parserCallback_drawstep(ParserNode *node);
00229     bool parserCallback_drawdata(ParserNode *node);
00230     bool parserCallback_bitmaps(ParserNode *node) { return true; }
00231     bool parserCallback_bitmap(ParserNode *node);
00232     bool parserCallback_alphabitmap(ParserNode *node);
00233     bool parserCallback_cursor(ParserNode *node);
00234 
00235 
00237     bool parserCallback_layout_info(ParserNode *node);
00238     bool parserCallback_globals(ParserNode *node) { return true; }
00239     bool parserCallback_def(ParserNode *node);
00240     bool parserCallback_widget(ParserNode *node);
00241     bool parserCallback_dialog(ParserNode *node);
00242     bool parserCallback_layout(ParserNode *node);
00243     bool parserCallback_space(ParserNode *node);
00244     bool parserCallback_import(ParserNode *node);
00245 
00246     bool closedKeyCallback(ParserNode *node);
00247 
00248     bool resolutionCheck(const Common::String &resolution);
00249 
00250     void cleanup();
00251 
00252     Graphics::DrawStep *newDrawStep();
00253     Graphics::DrawStep *defaultDrawStep();
00254     bool parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawstep, bool functionSpecific);
00255     bool parseCommonLayoutProps(ParserNode *node, const Common::String &var);
00256 
00257     Graphics::DrawStep *_defaultStepGlobal;
00258     Graphics::DrawStep *_defaultStepLocal;
00259 
00260     struct PaletteColor {
00261         uint8 r, g, b;
00262     };
00263 
00264     Common::HashMap<Common::String, PaletteColor, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _palette;
00265 };
00266 
00267 } // End of namespace GUI
00268 
00269 #endif


Generated on Sat May 18 2019 05:01:27 for ResidualVM by doxygen 1.7.1
curved edge   curved edge