Planeshift
|
00001 /* 00002 * pawsstyles.h - Author: Ondrej Hurt 00003 * 00004 * Copyright (C) 2005 Atomic Blue ([email protected], http://www.atomicblue.org) 00005 * http://www.atomicblue.org) 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 (version 2 of the License) 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 */ 00019 00020 #ifndef PAWS_STYLES_HEADER 00021 #define PAWS_STYLES_HEADER 00022 00023 #include <csutil/csstring.h> 00024 #include <csutil/ref.h> 00025 #include <csutil/hash.h> 00026 #include <iutil/vfs.h> 00027 #include <util/psxmlparser.h> 00028 00037 #define STRING_HASH(V) csHash <V, csString> 00038 00067 class pawsStyles 00068 { 00069 public: 00070 pawsStyles(iObjectRegistry* objectReg); 00071 00073 bool LoadStyles(const csString &fileName); 00074 00079 /* Styles need to be redesigned, the current design is too fragile. So do not use unless absolutely necessary. */ 00080 void ApplyStyle(const char* style, iDocumentNode* target); 00081 void ApplyStyle(iDocumentNode* style, iDocumentNode* target); 00082 00083 protected: 00085 void InheritStyles(); 00086 00092 void InheritFromParent(iDocumentNode* style, STRING_HASH(bool) & alreadyInh, STRING_HASH(bool) & beingInh); 00093 00094 iObjectRegistry* objectReg; 00095 00097 STRING_HASH(csRef<iDocumentNode>) styles; 00098 }; 00099 00100 00103 #endif