00001 /******************************************************************************* 00002 This file is Part of the Gewi GUI Library for ZEngine. 00003 Gewi and ZEngine Copyright (C) 2002, 2003 James Turk 00004 00005 Licensed under a BSD-style license. (see licensing.txt) 00006 00007 The maintainer of this library is James Turk (james@conceptofzero.net) 00008 this library is found at the home of ZEngine http://zengine.sourceforge.net 00009 *******************************************************************************/ 00010 00020 #ifndef __gewiengine_h__ 00021 #define __gewiengine_h__ 00022 00023 #include "GewiIncludes.h" 00024 #include "GewiWidgetList.h" 00025 00026 00032 namespace Gewi 00033 { 00034 00035 00042 class GewiEngine 00043 { 00044 public: 00046 static VersionInfo Version; 00048 static VersionInfo MinZEVersion; 00049 00050 private: 00052 static GewiEngine *sInstance; 00054 std::vector<ZE::ZImage*> mImageVec; 00056 std::vector<ZE::ZFont*> mFontVec; 00058 WidgetList mWidgetList; 00059 00060 //singleton setup// 00061 private: 00067 GewiEngine(); 00068 00069 public: 00071 static const ResourceID InvalidID = UINT_MAX; //UINT_MAX b/c many compilers don't like numeric_limits 00072 00080 static GewiEngine* GetInstance(); 00081 00087 static void ReleaseInstance(); 00088 00089 //utilities// 00090 00098 static int EventFilter(SDL_Event *event); 00099 00107 static char TranslateKey(SDL_keysym key); 00108 00114 void Display(); 00115 00116 //resource management// 00117 00125 ResourceID AddResource(ZE::ZImage *image); 00126 00134 ResourceID AddResource(ZE::ZFont *font); 00135 00143 ZE::ZImage* Image(ResourceID id); 00144 00152 ZE::ZFont* Font(ResourceID id); 00153 00159 void FreeResources(); 00160 00161 //widget management// 00162 private: 00169 void InsertWidget(WidgetNode *node); 00170 00171 public: 00178 void Register(GWidget *widget); 00179 00192 void SendMessage(SDL_Event *rawEvent, GewiEvent event, Uint16 mouseX, Uint16 mouseY, char ch); 00193 00200 void DeleteWidget(GWidget *widget); 00201 }; 00202 00203 } 00204 00205 #endif //__gewiengine_h__