Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: 21/2/2004 00003 author: Paul D Turner 00004 00005 purpose: Defines abstract base class for the GUI Scheme object. 00006 *************************************************************************/ 00007 /*************************************************************************** 00008 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00009 * 00010 * Permission is hereby granted, free of charge, to any person obtaining 00011 * a copy of this software and associated documentation files (the 00012 * "Software"), to deal in the Software without restriction, including 00013 * without limitation the rights to use, copy, modify, merge, publish, 00014 * distribute, sublicense, and/or sell copies of the Software, and to 00015 * permit persons to whom the Software is furnished to do so, subject to 00016 * the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be 00019 * included in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00022 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00023 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00024 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00025 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00026 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00027 * OTHER DEALINGS IN THE SOFTWARE. 00028 ***************************************************************************/ 00029 #ifndef _CEGUIScheme_h_ 00030 #define _CEGUIScheme_h_ 00031 00032 #include "CEGUI/Base.h" 00033 #include "CEGUI/String.h" 00034 #include "CEGUI/SchemeManager.h" 00035 00036 00037 #include <vector> 00038 00039 00040 #if defined(_MSC_VER) 00041 # pragma warning(push) 00042 # pragma warning(disable : 4251) 00043 #endif 00044 00045 00046 // Start of CEGUI namespace section 00047 namespace CEGUI 00048 { 00058 class CEGUIEXPORT Scheme : 00059 public AllocatedObject<Scheme> 00060 { 00061 private: 00062 friend class Scheme_xmlHandler; 00063 00064 /************************************************************************* 00065 Construction and Destruction 00066 *************************************************************************/ 00074 Scheme(const String& name); 00075 00076 public: 00084 ~Scheme(void); 00085 00093 void loadResources(void); 00094 00095 00103 void unloadResources(void); 00104 00105 00113 bool resourcesLoaded(void) const; 00114 00115 00123 const String& getName(void) const {return d_name;} 00124 00133 static const String& getDefaultResourceGroup() 00134 { return d_defaultResourceGroup; } 00135 00146 static void setDefaultResourceGroup(const String& resourceGroup) 00147 { d_defaultResourceGroup = resourceGroup; } 00148 00153 void loadXMLImagesets(); 00154 00159 void loadImageFileImagesets(); 00160 00165 void loadFonts(); 00166 00171 void loadLookNFeels(); 00172 00177 void loadWindowFactories(); 00178 00183 void loadWindowRendererFactories(); 00184 00189 void loadFactoryAliases(); 00190 00195 void loadFalagardMappings(); 00196 00201 void unloadXMLImagesets(); 00202 00207 void unloadImageFileImagesets(); 00208 00213 void unloadFonts(); 00214 00219 void unloadLookNFeels(); 00220 00225 void unloadWindowFactories(); 00226 00231 void unloadWindowRendererFactories(); 00232 00237 void unloadFactoryAliases(); 00238 00243 void unloadFalagardMappings(); 00244 00249 bool areXMLImagesetsLoaded() const; 00250 00255 bool areImageFileImagesetsLoaded() const; 00256 00261 bool areFontsLoaded() const; 00262 00267 bool areLookNFeelsLoaded() const; 00268 00273 bool areWindowFactoriesLoaded() const; 00274 00279 bool areWindowRendererFactoriesLoaded() const; 00280 00285 bool areFactoryAliasesLoaded() const; 00286 00291 bool areFalagardMappingsLoaded() const; 00292 00300 struct LoadableUIElement 00301 { 00302 String name; 00303 String filename; 00304 String resourceGroup; 00305 }; 00306 00307 private: 00309 typedef std::vector<LoadableUIElement 00310 CEGUI_VECTOR_ALLOC(LoadableUIElement)> LoadableUIElementList; 00311 00312 public: 00313 typedef ConstVectorIterator<LoadableUIElementList> LoadableUIElementIterator; 00314 00319 LoadableUIElementIterator getXMLImagesets() const; 00320 00325 LoadableUIElementIterator getImageFileImagesets() const; 00326 00331 LoadableUIElementIterator getFonts() const; 00332 00337 LoadableUIElementIterator getLookNFeels() const; 00338 00339 private: 00340 /************************************************************************* 00341 Structs used to hold scheme information 00342 *************************************************************************/ 00343 00344 struct UIModule 00345 { 00346 String name; 00347 DynamicModule* dynamicModule; 00348 FactoryModule* factoryModule; 00349 00350 typedef std::vector<String 00351 CEGUI_VECTOR_ALLOC(String)> TypeList; 00352 00353 TypeList types; 00354 }; 00355 00356 struct AliasMapping 00357 { 00358 String aliasName; 00359 String targetName; 00360 }; 00361 00362 struct FalagardMapping 00363 { 00364 String windowName; 00365 String targetName; 00366 String rendererName; 00367 String lookName; 00368 String effectName; 00369 }; 00370 00371 /************************************************************************* 00372 Implementation Data 00373 *************************************************************************/ 00374 String d_name; 00375 00376 LoadableUIElementList d_imagesets; 00377 LoadableUIElementList d_imagesetsFromImages; 00378 LoadableUIElementList d_fonts; 00379 00380 typedef std::vector<UIModule 00381 CEGUI_VECTOR_ALLOC(UIModule)> UIModuleList; 00382 UIModuleList d_widgetModules; 00383 00384 typedef std::vector<UIModule 00385 CEGUI_VECTOR_ALLOC(UIModule)> WRModuleList; 00386 WRModuleList d_windowRendererModules; 00387 00388 typedef std::vector<AliasMapping 00389 CEGUI_VECTOR_ALLOC(AliasMapping)> AliasMappingList; 00390 AliasMappingList d_aliasMappings; 00391 00392 LoadableUIElementList d_looknfeels; 00393 00394 typedef std::vector<FalagardMapping 00395 CEGUI_VECTOR_ALLOC(FalagardMapping)> FalagardMappingList; 00396 FalagardMappingList d_falagardMappings; 00397 00398 static String d_defaultResourceGroup; 00399 }; 00400 00401 } // End of CEGUI namespace section 00402 00403 #if defined(_MSC_VER) 00404 # pragma warning(pop) 00405 #endif 00406 00407 #endif // end of guard _CEGUIScheme_h_