Planeshift

pawsprefmanager.h

Go to the documentation of this file.
00001 /*
00002  * pawsprefmanager.h - Author: Andrew Craig
00003  *
00004  * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org)
00005  *
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 // pawsprefmanager.h: interface for the pawsPrefManager class.
00020 //
00022 
00023 #ifndef PAWS_PREF_MANAGER_HEADER
00024 #define PAWS_PREF_MANAGER_HEADER
00025 
00026 #include <iutil/document.h>
00027 #include <csutil/parray.h>
00028 #include <csutil/csstring.h>
00029 
00030 struct iObjectRegistry;
00031 struct iVFS;
00032 struct iGraphics2D;
00033 struct iFont;
00034 struct BorderDefinition;
00035 class PawsManager;
00036 
00041 #define BORDER_COLOURS 5
00042 
00043 
00046 class pawsPrefManager
00047 {
00048 public:
00049     pawsPrefManager();
00050     virtual ~pawsPrefManager();
00051 
00052     bool LoadPrefFile(const char* file);
00053     bool LoadBorderFile(const char* file);
00054 
00055     iFont* GetDefaultFont(bool scaled = true)
00056     {
00057         return scaled?defaultScaledFont:defaultFont;
00058     }
00059     const char* GetDefaultFontName()
00060     {
00061         return defaultFontName;
00062     }
00063     int    GetDefaultFontColour()
00064     {
00065         return defaultFontColour;
00066     }
00067     int    GetBorderColour(int index)
00068     {
00069         return borderColours[index];
00070     }
00071 
00072     BorderDefinition* GetBorderDefinition(const char* name);
00073 private:
00074 
00075     iObjectRegistry*        objectReg;
00076     csRef<iVFS>             vfs;
00077     csRef<iDocumentSystem>  xml;
00078     csRef<iGraphics2D>      graphics2D;
00079 
00080     csRef<iFont> defaultFont, defaultScaledFont;
00081     int defaultFontColour;
00082     csString defaultFontName;
00083 
00084     int borderColours[BORDER_COLOURS];
00085 
00086     void LoadBorderColours(iDocumentNode* node);
00087 
00088     csPDelArray<BorderDefinition> borders;
00089 };
00090 
00093 #endif
00094