00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
00187 };
00188
00189 #endif