Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

sdlapplication.h

Go to the documentation of this file.
00001 /*
00002     ParaGUI - crossplatform widgetset
00003     Copyright (C) 2000  Alexander Pipelka
00004  
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009  
00010     This library 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 GNU
00013     Library General Public License for more details.
00014  
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  
00019     Alexander Pipelka
00020     pipelka@teleweb.at
00021  
00022     Last Update:      $Author: pipelka $
00023     Update Date:      $Date: 2001/01/31 17:23:15 $
00024     Source File:      $Source: /usr/local/CVSROOT/linux/paragui/doc/html/sdlapplication_h-source.html,v $
00025     CVS/RCS Revision: $Revision: 1.34 $
00026     Status:           $State: Exp $
00027 */
00028 
00029 #ifndef SDLAPPLICATION_H
00030 #define SDLAPPLICATION_H
00031 
00032 #ifdef SWIG
00033 %include "swigcommon.h"
00034 %module sdlapplication
00035 %{
00036 #include "sdlapplication.h"
00037 %}
00038 #endif
00039 
00040 #include "sdlmessageobject.h"
00041 #include <vector>
00042 
00043 #define NO_EVENTTHREAD 1
00044 
00090 class DECLSPEC SDLApplication : public SDLMessageObject  {
00091 public:
00092 
00094     SDLApplication();
00095 
00097     ~SDLApplication();
00098 
00107 #ifdef SWIG
00108     // swig messes up the default arguments
00109     bool InitScreen(int w, int h, int depth, unsigned int flags);
00110 #else
00111     bool InitScreen(int w, int h, int depth=DISPLAY_DEPTH, Uint32 flags = SDL_SWSURFACE /* | SDL_FULLSCREEN*/ | SDL_HWPALETTE);
00112 #endif
00113 
00121     SDLTheme* LoadTheme(const char* xmltheme, bool asDefault = true, const char* searchpath = NULL);
00122 
00126     SDL_Thread* Run();
00127 
00131     void Quit();
00132 
00136     void Shutdown();
00137         
00139     SDL_Surface* SetScreen(SDL_Surface* screen);
00140 
00142     static SDL_Surface* GetScreen();
00143 
00145     static TTF_Font* GetDefaultFont();
00146 
00148     static bool UnlockScreen();
00149 
00151     static bool LockScreen();
00152 
00154     bool SetBackground(const char* filename, int mode=BKMODE_TILE);
00155 
00157 #ifdef SWIG
00158     %name(SetBackground2) bool SetBackground(SDL_Surface* surface, int mode=BKMODE_TILE);
00159 #else
00160     bool SetBackground(SDL_Surface* surface, int mode=BKMODE_TILE);
00161 #endif
00162 
00164     void RedrawBackground();
00165 
00167     static void SetApplicationPath(char* path);
00168 
00170     static char* GetApplicationPath();
00171 
00173     static char* GetRelativePath(char* file);
00174 
00176     static int GetScreenHeight();
00177 
00179     static int GetScreenWidth();
00180 
00182     static void FlipPage();
00183 
00185     static TTF_Font* LoadFont(char* filename, int size);
00186 
00188 #ifndef SWIG
00189     void PrintVideoTest();
00190 #endif
00191 
00193     static SDLTheme* GetTheme();
00194 
00196     static bool GetBulkMode();
00197 
00198 protected:
00199 
00201     bool eventKeyUp(const SDL_KeyboardEvent* key);
00202 
00204     bool eventQuit(int id, SDLWidget* widget, unsigned long data);
00205 
00207     virtual void eventInit();
00208 
00209 private:
00210 
00211     // disable the copy operators
00212     SDLApplication(const SDLApplication&);
00213     SDLApplication& operator=(const SDLApplication&);
00214 
00215     bool my_freeBackground;
00216     SDL_Surface* my_background;
00217     int my_backmode;
00218 
00219     static bool FileExists(const char* filename);
00220 
00221     static SDLTheme* my_Theme;
00222 
00223 #ifndef SWIG
00224     static char app_path[300];
00225 #endif
00226 
00227     static SDLApplication* pGlobalApp;
00228     static SDL_Surface* screen;
00229     static TTF_Font* font;
00230     static SDL_mutex* mutexScreen;
00231     static bool bulkMode;
00232 };
00233 
00234 #endif // SDLAPPLICATION_H