uimanager.h

Go to the documentation of this file.
00001 /********************************************************************************/
00002 /*                                                                              */
00003 /*  Netrinjo-Engine - a library for game-development                            */
00004 /*  Copyright (C) 1999, 2000, 2005 by Tobias Nadler and Georg Schnattinger      */
00005 /*                                                                              */
00006 /*  This library is free software; you can redistribute it and/or               */
00007 /*  modify it under the terms of the GNU Lesser General Public                  */
00008 /*  License as published by the Free Software Foundation; either                */
00009 /*  version 2.1 of the License, or (at your option) any later version.          */
00010 /*                                                                              */
00011 /*  This library is distributed in the hope that it will be useful,             */
00012 /*  but WITHOUT ANY WARRANTY; without even the implied warranty of              */
00013 /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU           */
00014 /*  Lesser General Public License for more details.                             */
00015 /*                                                                              */
00016 /*  You should have received a copy of the GNU Lesser General Public            */
00017 /*  License along with this library; if not, write to the Free Software         */
00018 /*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   */
00019 /*                                                                              */
00020 /********************************************************************************/
00021 
00022 #ifndef UIMANAGER_H
00023 #define UIMANAGER_H
00024 
00025 #include <list>
00026 #include "SDL/SDL.h"
00027 #include "uiobject.h"
00028 #include "tinyxml.h"
00029 
00030 using namespace std;
00031 
00032 class UiObject;
00033 class UiTheme;
00034 
00065 class UiManager : public BasicObject
00066 {
00067 public:
00076     DECLSPEC UiManager(TiXmlElement*el, BasicObject *p);
00077     virtual DECLSPEC ~UiManager();
00078 
00079     virtual const char *getClassName()  {return "UiManager";}
00088     DECLSPEC void loop(bool &stop);
00093     DECLSPEC void handleEvents();
00098     DECLSPEC void drawFrame();
00104     DECLSPEC void setFocus(UiObject::FocusType f, UiObject *obj);
00105     /* *
00106     Releases the focus of keyboard, mouse or display from the object,
00107     if the focus is on the specified object
00108     \param f the kind of focus to set
00109     \param obj the object that should be unfocused
00110     * /
00111     DECLSPEC bool releaseFocus(FocusType f, UiObject *obj);*/
00116     DECLSPEC UiObject *getFocus(UiObject::FocusType f);
00117     
00122     Uint32 getTimePerFrame() const  { return tPerFrame; }
00126     Uint32 getFrames() const        { return nFrames; }
00130     DECLSPEC Uint32 getAvgTimePerFrame() const;
00131 
00137     DECLSPEC void setMaxFramerate( Uint32 n );
00138 
00142     static UiManager *the;
00150     DECLSPEC static UiManager *getThe();
00151     
00152 protected:
00160     virtual DECLSPEC void onInit();
00161 private:
00162     DECLSPEC void themeChanged( UiTheme *t );
00163 
00164     UiObject *uiKeyboardFocus;
00165     UiObject *uiMouseFocus;
00166     UiObject *uiDisplayFocus;
00167     bool bActive;
00168 
00169     Uint32 tInit, tFrame, tPerFrame;
00170     Uint32 nFrames;
00171     Uint32 tMinPerFrame;
00172 
00173 //  friend class UiObject;
00174     friend class ThemeManager;
00175 };
00176 
00177 #endif

Generated on Wed May 9 17:35:55 2007 for netrinjo by  doxygen 1.5.1