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

sdlwidget.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:17 $
00024     Source File:      $Source: /usr/local/CVSROOT/linux/paragui/doc/html/sdlwidget_h-source.html,v $
00025     CVS/RCS Revision: $Revision: 1.34 $
00026     Status:           $State: Exp $
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