00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef SDLWIDGET_H
00030 #define SDLWIDGET_H
00031
00032 #ifdef SWIG
00033 %include "swigcommon.h"
00034 %module sdlwidget
00035 %{
00036 #include "sdlwidget.h"
00037 %}
00038 #endif
00039
00040 #include "sdlmessageobject.h"
00041 #include "sdldrawobject.h"
00042
00051 class DECLSPEC SDLWidget : public SDLMessageObject, public SDLDrawObject {
00052 public:
00062 SDLWidget(SDLWidget* parent, SDL_Rect& rect, bool storeBackground = false);
00063
00069 ~SDLWidget();
00070
00079 virtual void LoadThemeStyle(const char* widgettype);
00080
00089 virtual void LoadThemeStyle(const char* widgettype, const char* objectname);
00090
00096 void StartWidgetDrag();
00097
00099 void WidgetDrag(int x, int y);
00100
00102 void EndWidgetDrag(int x, int y);
00103
00113 bool MoveWindow(int x, int y);
00114
00124 bool SizeWindow(int w, int h);
00125
00127 SDL_Point ClientToScreen(int sx, int sy);
00128
00130 SDL_Point ScreenToClient(int x, int y);
00131
00133 int Width();
00134
00136 int Height();
00137
00139 SDL_Surface* GetWidgetSurface();
00140
00142 SDL_Rect GetWidgetRect();
00143
00145 SDL_Surface* GetScreenSurface();
00146
00152 SDLWidget* GetParent();
00153
00155 void AddChild(SDLWidget* child);
00156
00165 bool ProcessEvent(const SDL_Event* event);
00166
00168 void SetID(int id);
00169
00171 int GetID();
00172
00174 bool IsInside(SDL_Point p, SDL_Rect* r = NULL);
00175
00177 bool IsMouseInside();
00178
00180 bool IsDisplayRectValid();
00181
00183 bool Redraw(bool update = true);
00184
00186 void Hide(bool fade = false);
00187
00189 void Show(bool fade = false);
00190
00192 void Update(bool doBlit = true);
00193
00195 void Blit(bool recursive = true);
00196
00198 void SetChildTransparency(Uint8 t);
00199
00205 int GetChildCount();
00206
00214 void SetFont(TTF_Font* newfont);
00215
00217 TTF_Font* GetFont();
00218
00222 void SetScreenUpdate(bool update);
00223
00225 void MoveRect(int x, int y);
00226
00228 static SDL_Rect& mkrect(int x, int y, int w, int h);
00229
00231 void RecalcClipRect();
00232
00234 void SetTextColor(Uint32 color);
00235
00237 #ifdef SWIG
00238
00239 %name(SetTextColor2) void SetTextColor(SDL_Color c);
00240 #else
00241 void SetTextColor(SDL_Color c);
00242 #endif
00243
00245 SDL_Color GetTextColor();
00246
00248 static void BulkUpdate();
00249
00250 protected:
00251
00253 virtual void eventMouseLeave();
00254
00256 virtual void eventMouseEnter();
00257
00259 virtual void eventShow();
00260
00262 virtual void eventHide();
00263
00265 bool AcceptEvent(const SDL_Event* event);
00266
00268 void RemoveChild(SDLWidget* child);
00269
00270 bool bSetCaptureOnShow;
00271
00272 static SDLWidget* widgetList;
00273 SDLWidget* my_widgetListNext;
00274 SDLWidget* my_widgetListPrev;
00275
00276 private:
00277
00278 SDLWidget(const SDLWidget&);
00279 SDLWidget& operator=(const SDLWidget&);
00280
00281 SDLWidget* my_widgetParent;
00282 SDLWidget* my_childList;
00283 SDLWidget* my_childNext;
00284
00285 SDL_mutex* my_mutexProcess;
00286 TTF_Font* my_font;
00287 SDL_Color my_textcolor;
00288
00289 int my_childCount;
00290 bool my_mouseInside;
00291 int my_zdepth;
00292 bool my_haveTooltip;
00293
00294 static bool bBulkUpdate;
00295 };
00296
00297 #endif // SDLWIDGET_H