uiobject.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 und 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 UIOBJECT_H
00023 #define UIOBJECT_H
00024 
00025 #include "SDL/SDL.h"
00026 #include "definitions.h"
00027 #include "basicobject.h"
00028 
00029 class UiTheme;
00030 class SdlSurface;
00031 
00048 class DECLSPEC UiObject : public BasicObject
00049 {
00050 public:
00052     enum FocusType {ftKeyboard = 1, ftMouse = 2, ftDisplay = 4};
00054     typedef Uint8 FocusTypes;
00060     DECLSPEC UiObject( BasicObject *parent, const char *name );
00066     DECLSPEC UiObject( TiXmlElement *el, BasicObject *parent );
00067     virtual DECLSPEC ~UiObject();
00068 
00069     virtual const char *getClassName()  { return "UiObject"; }
00074     DECLSPEC void toTop();
00079     DECLSPEC void toBottom();
00084     DECLSPEC void oneStepToTop();
00089     DECLSPEC void oneStepToBottom();
00090     
00095     virtual bool isGuiElement() const   { return false; }
00101     virtual bool isOglElement() const   { return false; }
00102     virtual bool isUiObject() const { return true; }
00103     
00111     void applyTheme( UiTheme *t )   { onThemeChanged(t); }
00117     static DECLSPEC const char *tr( const char *text );
00118 
00119 protected:
00126     virtual Uint32 onKeyDown( SDL_KeyboardEvent *ev )       { return 0; }
00133     virtual Uint32 onKeyUp( SDL_KeyboardEvent *ev )         { return 0; }
00140     virtual Uint32 onMouseDown( SDL_MouseButtonEvent *ev )  { return 0; }
00147     virtual Uint32 onMouseUp( SDL_MouseButtonEvent *ev )    { return 0; }
00154     virtual Uint32 onMouseMotion(SDL_MouseMotionEvent *ev)  { return 0; }
00160     virtual Uint32 onFocus(FocusTypes gained)   { return 0; }
00166     virtual Uint32 onRelease(FocusTypes lost)   { return 0; }
00174     virtual Uint32 onFrame()    {return 0;}
00181     virtual DECLSPEC Uint32 onThemeChanged( UiTheme *t );
00182     virtual DECLSPEC void onDestroy();
00183     
00184 private:
00185     friend class UiManager;
00186 //  friend class GuiElement;
00187 };
00188 
00189 #endif

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