Google
Web alhem.net
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

gui::Surface Class Reference

#include <Surface.h>

Inheritance diagram for gui::Surface:

Inheritance graph
[legend]
Collaboration diagram for gui::Surface:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Surface (SDLControl *pclControl, coord_t x, coord_t y, coord_t w, coord_t h, SurfaceHelper *=NULL)
 Surface (Surface *pclParent, coord_t x, coord_t y, coord_t w, coord_t h, SurfaceHelper *=NULL)
 Surface (Surface *pclParent, SurfaceHelper *=NULL)
virtual ~Surface ()
virtual void Dump (FILE *)
virtual void DumpMembers (FILE *)
virtual void SaveDialogs ()
void CreateTemporaryScreen ()
void DrawTemporaryScreen ()
void SetUseTemporaryScreen (bool)
bool UseTemporaryScreen ()
virtual SDL_Surface * GetTemporaryScreen ()
virtual void AddChild (Surface *)
void BringToTop (Surface *)
void BringToTop ()
SurfaceGetChildOnTop ()
void Remove (Surface *)
SurfaceFindSurface (coord_t, coord_t, coord_t X=0, coord_t Y=0)
void CalculateAbsolute ()
void RecreateSurfaces ()
void FreeSurface (SDL_Surface *)
void CalculateClientRect ()
void InvalidateEv ()
void InvalidateRectEv (SDL_Rect &)
void FillRectEv (SDL_Rect &)
void ResetFillRectsEv ()
virtual void DrawAll ()
void Blit (coord_t X=0, coord_t Y=0, SDL_Surface *=NULL)
void BlitAbsolute (SDL_Rect *, SDL_Surface *=NULL)
void Move (Surface *rootSurface, coord_t, coord_t)
void MoveTo (Surface *, coord_t, coord_t, bool bVisible=true)
void Bond (Surface *)
void Unbond (Surface *)
SurfaceGetBond ()
void RemoveAllBonds ()
void CloseAll ()
void GetExtents (SDL_Rect &)
virtual void OnEvent (surface_event_t *)
virtual void OnMouseIn ()
virtual void OnMouseOut ()
virtual void OnKeyDown (SDL_keysym)
virtual void OnKeyUp (SDL_keysym)
virtual void OnButton ()
virtual void OnClose ()
virtual void OnFocus ()
virtual void OnLostFocus ()
virtual void OnHide ()
virtual void OnShow ()
virtual void OnSize (SDL_Rect &, int xrel, int yrel)
virtual void OnMouseMove (coord_t x, coord_t y, coord_t xrel, coord_t yrel)
virtual void OnRightClick (coord_t x, coord_t y)
virtual void OnClick (coord_t x, coord_t y)
virtual void OnTimer (long id)
virtual void SetTimer (long time_ms, long id=0, bool bRepeating=false)
virtual void SetParent (Surface *)
virtual void SetX (coord_t)
virtual void SetY (coord_t)
virtual void SetW (coord_t, bool bRealloc=true)
virtual void SetH (coord_t, bool bRealloc=true)
virtual void SetAbsoluteX (coord_t)
virtual void SetAbsoluteY (coord_t)
virtual void SetBgColor (Uint8, Uint8, Uint8, Uint8=SDL_ALPHA_OPAQUE)
virtual void SetFgColor (Uint8, Uint8, Uint8, Uint8=SDL_ALPHA_OPAQUE)
virtual void SetFrameColor (Uint8, Uint8, Uint8, Uint8=SDL_ALPHA_OPAQUE)
virtual void SetTTFont (TTFont *)
virtual void SetFrameWidth (coord_t)
virtual void SetAlpha (alpha_t, bool bRecurse=true)
virtual void UpdateAlpha (alpha_t)
virtual void SetLocalID (unsigned long)
virtual void SetText (const string &)
virtual void SetUICommand (long)
virtual void SetVisible (bool)
virtual void SetChildrenVisible (bool)
virtual void SetInverted (bool)
virtual void SetTransparent (bool)
virtual void SetMoveable (bool)
virtual void SetDirty (bool, bool bInvalidate=true)
virtual void SetResizeArea (bool)
virtual void SetAnchorRight (bool)
virtual void SetAnchorDown (bool)
virtual void SetMustBeDeleted (bool)
virtual void SetClickable (bool)
virtual SDL_Surface * GetScreen ()
virtual SurfaceGetParent ()
virtual SurfaceGetRoot ()
virtual SDL_Rect * GetClientRectPtr ()
virtual SDL_Rect GetClientRect ()
virtual SDL_Rect * GetAbsoluteRectPtr ()
virtual SDL_Rect GetAbsoluteRect ()
virtual SDLControlGetSDLControl ()
virtual unsigned long GetID ()
virtual unsigned long GetLocalID ()
virtual coord_t GetX ()
virtual coord_t GetY ()
virtual coord_t GetW ()
virtual coord_t GetH ()
virtual coord_t GetAbsoluteX ()
virtual coord_t GetAbsoluteY ()
virtual const char * GetText ()
virtual long GetUICommand ()
virtual bool IsVisible ()
virtual bool IsInverted ()
virtual bool IsTransparent ()
virtual bool IsMoveable ()
virtual bool IsDirty ()
virtual bool IsResizeArea ()
virtual bool IsAnchorRight ()
virtual bool IsAnchorDown ()
virtual bool MustBeDeleted ()
virtual bool IsClickable ()
color_t GetBgColor ()
void GetBgColor (SDL_Color &)
color_t GetFgColor ()
void GetFgColor (SDL_Color &)
color_t GetFrameColor ()
void GetFrameColor (SDL_Color &)
TTFontGetTTFont ()
coord_t GetFrameWidth ()
alpha_t GetAlpha ()
virtual void DrawFrame (SDL_Surface *, coord_t, Uint32)

Protected Member Functions

virtual void Draw ()
SDL_Surface * CreateSDLSurface (bool)

Protected Attributes

SDL_Surface * m_screen
SDL_Surface * m_temp_screen
surfacevector_t m_ChildList

Private Member Functions

void SetBond (Surface *)

Private Attributes

unsigned long m_id
unsigned long m_local_id
Surfacem_pclParent
SDLControlm_pclControl
SurfaceHelperm_pclHelper
coord_t m_x
coord_t m_y
coord_t m_w
coord_t m_h
coord_t m_x_absolute
coord_t m_y_absolute
SDL_Color m_bgColor
bool m_bBgColorIsSet
SDL_Color m_fgColor
bool m_bFgColorIsSet
SDL_Color m_frameColor
bool m_bFrameColorIsSet
TTFontm_pclTTFont
alpha_t m_nAlpha
bool m_bAlphaIsSet
coord_t m_nFrameWidth
bool m_bFrameWidthIsSet
SDL_Rect m_clientRect
SDL_Rect m_absoluteRect
bool m_bVisible
bool m_bChildrenVisible
bool m_bInverted
bool m_bTransparent
bool m_bMoveable
bool m_bDirty
bool m_bResizeArea
bool m_bAnchorRight
bool m_bAnchorDown
bool m_bMustBeDeleted
bool m_bClickable
bool m_bUseTemporaryScreen
string m_text
bool m_bRedrawTemporary
surfacevector_t m_bonds
Surfacem_pclBond
long m_uicommand

Static Private Attributes

unsigned long m_unique_id = 0

Constructor & Destructor Documentation

gui::Surface::Surface SDLControl pclControl,
coord_t  x,
coord_t  y,
coord_t  w,
coord_t  h,
SurfaceHelper = NULL
 

Definition at line 71 of file Surface.cpp.

References gui::coord_t, CreateSDLSurface(), GetFrameWidth(), m_absoluteRect, m_clientRect, m_h, m_screen, m_w, and UICOMMAND_NONE.

00072 :m_screen(NULL) 00073 ,m_temp_screen(NULL) 00074 ,m_id(m_unique_id++) 00075 ,m_local_id(0) 00076 ,m_pclParent(NULL) 00077 ,m_pclControl(pclControl) 00078 ,m_pclHelper(pclHelper) 00079 ,m_x(x) 00080 ,m_y(y) 00081 ,m_w(w) 00082 ,m_h(h) 00083 ,m_x_absolute(0) 00084 ,m_y_absolute(0) 00085 ,m_bBgColorIsSet(false) 00086 ,m_bFgColorIsSet(false) 00087 ,m_bFrameColorIsSet(false) 00088 ,m_pclTTFont(NULL) 00089 ,m_nAlpha(0) 00090 ,m_bAlphaIsSet(0) 00091 ,m_nFrameWidth(0) 00092 ,m_bFrameWidthIsSet(false) 00093 //,m_strName("") 00094 //,m_style(0) 00095 ,m_bVisible(true) 00096 ,m_bChildrenVisible(true) 00097 ,m_bInverted(false) 00098 ,m_bTransparent(false) 00099 ,m_bMoveable(false) 00100 ,m_bDirty(true) 00101 ,m_bResizeArea(false) 00102 ,m_bAnchorRight(false) 00103 ,m_bAnchorDown(false) 00104 ,m_bMustBeDeleted(false) 00105 ,m_bClickable(false) 00106 ,m_bUseTemporaryScreen(false) 00107 ,m_text("") 00108 ,m_bRedrawTemporary(false) 00109 ,m_pclBond(NULL) 00110 ,m_uicommand(UICOMMAND_NONE) 00111 { 00112 coord_t fw = GetFrameWidth(); 00113 00114 m_screen = CreateSDLSurface(true); 00115 00116 m_clientRect.x = fw; 00117 m_clientRect.y = fw; 00118 m_clientRect.w = m_w - fw * 2; 00119 m_clientRect.h = m_h - fw * 2; 00120 m_absoluteRect.x = 0; 00121 m_absoluteRect.y = 0; 00122 m_absoluteRect.w = m_w; 00123 m_absoluteRect.h = m_h; 00124 }

gui::Surface::Surface Surface pclParent,
coord_t  x,
coord_t  y,
coord_t  w,
coord_t  h,
SurfaceHelper = NULL
 

Definition at line 127 of file Surface.cpp.

References gui::coord_t, CreateSDLSurface(), GetFrameWidth(), m_absoluteRect, m_clientRect, m_h, m_screen, m_w, and UICOMMAND_NONE.

00128 :m_screen(NULL) 00129 ,m_temp_screen(NULL) 00130 ,m_id(m_unique_id++) 00131 ,m_local_id(0) 00132 ,m_pclParent(pclParent) 00133 ,m_pclControl(NULL) 00134 ,m_pclHelper(pclHelper) 00135 ,m_x(x) 00136 ,m_y(y) 00137 ,m_w(w) 00138 ,m_h(h) 00139 ,m_x_absolute(0) 00140 ,m_y_absolute(0) 00141 ,m_bBgColorIsSet(false) 00142 ,m_bFgColorIsSet(false) 00143 ,m_bFrameColorIsSet(false) 00144 ,m_pclTTFont(NULL) 00145 ,m_nAlpha(0) 00146 ,m_bAlphaIsSet(0) 00147 ,m_nFrameWidth(0) 00148 ,m_bFrameWidthIsSet(false) 00149 //,m_strName("") 00150 //,m_style(0) 00151 ,m_bVisible(true) 00152 ,m_bChildrenVisible(true) 00153 ,m_bInverted(false) 00154 ,m_bTransparent(false) 00155 ,m_bMoveable(false) 00156 ,m_bDirty(true) 00157 ,m_bResizeArea(false) 00158 ,m_bAnchorRight(false) 00159 ,m_bAnchorDown(false) 00160 ,m_bMustBeDeleted(false) 00161 ,m_bClickable(false) 00162 ,m_bUseTemporaryScreen(false) 00163 ,m_text("") 00164 ,m_bRedrawTemporary(false) 00165 ,m_pclBond(NULL) 00166 ,m_uicommand(UICOMMAND_NONE) 00167 { 00168 coord_t fw = GetFrameWidth(); 00169 00170 m_screen = CreateSDLSurface(true); 00171 00172 m_clientRect.x = fw; 00173 m_clientRect.y = fw; 00174 m_clientRect.w = m_w - fw * 2; 00175 m_clientRect.h = m_h - fw * 2; 00176 m_absoluteRect.x = 0; 00177 m_absoluteRect.y = 0; 00178 m_absoluteRect.w = m_w; 00179 m_absoluteRect.h = m_h; 00180 }

gui::Surface::Surface Surface pclParent,
SurfaceHelper = NULL
 

Definition at line 183 of file Surface.cpp.

References UICOMMAND_NONE.

00184 :m_screen(NULL) 00185 ,m_temp_screen(NULL) 00186 ,m_id(m_unique_id++) 00187 ,m_local_id(0) 00188 ,m_pclParent(pclParent) 00189 ,m_pclControl(NULL) 00190 ,m_pclHelper(pclHelper) 00191 ,m_x(0) 00192 ,m_y(0) 00193 ,m_w(0) 00194 ,m_h(0) 00195 ,m_x_absolute(0) 00196 ,m_y_absolute(0) 00197 ,m_bBgColorIsSet(false) 00198 ,m_bFgColorIsSet(false) 00199 ,m_bFrameColorIsSet(false) 00200 ,m_pclTTFont(NULL) 00201 ,m_nAlpha(0) 00202 ,m_bAlphaIsSet(0) 00203 ,m_nFrameWidth(0) 00204 ,m_bFrameWidthIsSet(false) 00205 //,m_strName("") 00206 //,m_style(0) 00207 ,m_bVisible(true) 00208 ,m_bChildrenVisible(true) 00209 ,m_bInverted(false) 00210 ,m_bTransparent(false) 00211 ,m_bMoveable(false) 00212 ,m_bDirty(true) 00213 ,m_bResizeArea(false) 00214 ,m_bAnchorRight(false) 00215 ,m_bAnchorDown(false) 00216 ,m_bMustBeDeleted(false) 00217 ,m_bClickable(false) 00218 ,m_bUseTemporaryScreen(false) 00219 ,m_text("") 00220 ,m_bRedrawTemporary(false) 00221 ,m_pclBond(NULL) 00222 ,m_uicommand(UICOMMAND_NONE) 00223 { 00224 }

gui::Surface::~Surface  )  [virtual]
 

Definition at line 227 of file Surface.cpp.

References GetBond(), GetParent(), m_bonds, m_ChildList, m_screen, m_temp_screen, MustBeDeleted(), Remove(), SetBond(), and Unbond().

00228 { 00229 surfacevector_t::iterator it; 00230 00231 // unlink bonds 00232 if (GetBond()) 00233 { 00234 GetBond() -> Unbond(this); 00235 } 00236 for (it = m_bonds.begin(); it != m_bonds.end(); it++) 00237 { 00238 (*it) -> SetBond(NULL); 00239 } 00240 // unlink parent stuff 00241 if (GetParent()) 00242 { 00243 GetParent() -> Remove(this); 00244 } 00245 for (it = m_ChildList.begin(); it != m_ChildList.end(); it++) 00246 { 00247 Surface *pclSurface = *it; 00248 if (pclSurface -> MustBeDeleted()) 00249 { 00250 delete pclSurface; 00251 } 00252 } 00253 // delete screens 00254 if (m_screen) 00255 { 00256 SDL_FreeSurface(m_screen); 00257 } 00258 if (m_temp_screen) 00259 { 00260 SDL_FreeSurface(m_temp_screen); 00261 } 00262 }


Member Function Documentation

void gui::Surface::AddChild Surface  )  [virtual]
 

Reimplemented in gui::Dialog.

Definition at line 334 of file Surface.cpp.

References CalculateAbsolute(), m_ChildList, SetLocalID(), and SetParent().

00335 { 00336 m_ChildList.insert(m_ChildList.end(), pclChild); 00337 pclChild -> SetLocalID( m_ChildList.size() ); 00338 pclChild -> SetParent( this ); 00339 CalculateAbsolute(); 00340 }

void gui::Surface::Blit coord_t  X = 0,
coord_t  Y = 0,
SDL_Surface *  = NULL
 

Definition at line 710 of file Surface.cpp.

References Blit(), gui::coord_t, GetFrameWidth(), GetParent(), GetScreen(), GetSDLControl(), GetTemporaryScreen(), IsTransparent(), m_bChildrenVisible, m_bRedrawTemporary, m_bVisible, m_ChildList, m_h, m_w, m_x, m_y, and UseTemporaryScreen().

Referenced by Blit(), and DrawTemporaryScreen().

00711 { 00712 SDL_Surface *pclSDLSurface = s ? s : GetSDLControl() -> GetScreen(); 00713 coord_t xmax = pclSDLSurface->w; 00714 coord_t ymax = pclSDLSurface->h; 00715 00716 if (m_bVisible || m_bRedrawTemporary) 00717 { 00718 SDL_Rect src; 00719 SDL_Rect dst; 00720 coord_t fw = GetParent() ? GetParent() -> GetFrameWidth() : 0; 00721 src.x = src.y = 0; 00722 dst.x = X + m_x + fw; 00723 dst.y = Y + m_y + fw; 00724 src.w = dst.w = m_w; 00725 src.h = dst.h = m_h; 00726 // kontroll utanfor ytan 00727 if (dst.x + dst.w > xmax) 00728 { 00729 dst.w -= dst.x + dst.w - xmax; 00730 src.w = dst.w; 00731 } 00732 if (dst.y + dst.h > ymax) 00733 { 00734 dst.h -= dst.y + dst.h - ymax; 00735 src.h = dst.h; 00736 } 00737 // 00738 if (UseTemporaryScreen()) 00739 { 00740 SDL_BlitSurface(GetTemporaryScreen(), &src, pclSDLSurface, &dst); 00741 } 00742 else 00743 { 00744 if (!IsTransparent()) 00745 { 00746 SDL_BlitSurface(GetScreen(), &src, pclSDLSurface, &dst); 00747 } 00748 if (m_bChildrenVisible) 00749 { 00750 surfacevector_t::iterator it; 00751 00752 for (it = m_ChildList.begin(); it != m_ChildList.end(); it++) 00753 { 00754 (*it) -> Blit(X + m_x + fw, Y + m_y + fw, pclSDLSurface); 00755 } 00756 } 00757 } 00758 } 00759 }

void gui::Surface::BlitAbsolute SDL_Rect *  ,
SDL_Surface *  = NULL
 

Definition at line 765 of file Surface.cpp.

References BlitAbsolute(), gui::coord_t, GetAbsoluteRectPtr(), GetScreen(), GetSDLControl(), GetTemporaryScreen(), m_bChildrenVisible, m_bTransparent, m_bVisible, m_ChildList, MAX, MIN, and UseTemporaryScreen().

Referenced by BlitAbsolute().

00766 { 00767 SDL_Surface *pclSDLSurface = s ? s : GetSDLControl() -> GetScreen(); 00768 coord_t xmax = pclSDLSurface->w; 00769 coord_t ymax = pclSDLSurface->h; 00770 00771 if (m_bVisible) // || UseTemporaryScreen()) 00772 { 00773 SDL_Rect dst; 00774 SDL_Rect *area = GetAbsoluteRectPtr(); 00775 coord_t r; 00776 coord_t b; 00777 coord_t w; 00778 coord_t h; 00779 dst.x = MAX(pclRect -> x,area -> x); 00780 dst.y = MAX(pclRect -> y,area -> y); 00781 r = MIN(pclRect -> x + pclRect -> w,area -> x + area -> w); 00782 b = MIN(pclRect -> y + pclRect -> h,area -> y + area -> h); 00783 w = r - dst.x; 00784 h = b - dst.y; 00785 if (w > 0 && h > 0) 00786 { 00787 SDL_Rect src; 00788 src.x = dst.x - area -> x; 00789 src.y = dst.y - area -> y; 00790 src.w = dst.w = w; 00791 src.h = dst.h = h; 00792 // kontroll utanfor ytan 00793 if (dst.x + dst.w > xmax) 00794 { 00795 dst.w -= dst.x + dst.w - xmax; 00796 src.w = dst.w; 00797 } 00798 if (dst.y + dst.h > ymax) 00799 { 00800 dst.h -= dst.y + dst.h - ymax; 00801 src.h = dst.h; 00802 } 00803 // 00804 if (UseTemporaryScreen()) 00805 { 00806 SDL_BlitSurface(GetTemporaryScreen(), &src, pclSDLSurface, &dst); 00807 } 00808 else 00809 { 00810 if (!m_bTransparent) 00811 { 00812 SDL_BlitSurface(GetScreen(), &src, pclSDLSurface, &dst); 00813 } 00814 00815 if (m_bChildrenVisible) 00816 { 00817 surfacevector_t::iterator it; 00818 00819 for (it = m_ChildList.begin(); it != m_ChildList.end(); it++) 00820 { 00821 (*it) -> BlitAbsolute(pclRect, pclSDLSurface); 00822 } 00823 } 00824 } // UseTemporaryScreen 00825 } 00826 } 00827 }

void gui::Surface::Bond Surface  ) 
 

Definition at line 1754 of file Surface.cpp.

References m_bonds, and SetBond().

01755 { 01756 surfacevector_t::iterator it; 01757 01758 for (it = m_bonds.begin(); it != m_bonds.end(); it++) 01759 { 01760 if (*it == s) 01761 { 01762 return; 01763 } 01764 } 01765 m_bonds.insert(m_bonds.end(), s); 01766 s -> SetBond(this); 01767 }

void gui::Surface::BringToTop  ) 
 

Definition at line 365 of file Surface.cpp.

References GetParent().

Referenced by gui::Dialog::AddChild(), and gui::Hotspot::OnSize().

00366 { 00367 Surface *pclParent = GetParent(); 00368 00369 if (pclParent) 00370 { 00371 pclParent -> BringToTop(this); 00372 } 00373 }

void gui::Surface::BringToTop Surface  ) 
 

Definition at line 343 of file Surface.cpp.

References GetChildOnTop(), and m_ChildList.

00344 { 00345 surfacevector_t::iterator it; 00346 00347 if (pclChild != GetChildOnTop()) 00348 { 00349 for (it = m_ChildList.begin(); it != m_ChildList.end(); it++) 00350 { 00351 if (*it == pclChild) 00352 { 00353 m_ChildList.erase(it); 00354 break; 00355 } 00356 } 00357 if (it != m_ChildList.end()) 00358 { 00359 m_ChildList.insert(m_ChildList.end(), pclChild); 00360 } 00361 } 00362 }

void gui::Surface::CalculateAbsolute  ) 
 

Definition at line 444 of file Surface.cpp.

References gui::coord_t, GetAbsoluteX(), GetAbsoluteY(), GetFrameWidth(), GetX(), GetY(), m_ChildList, SetAbsoluteX(), and SetAbsoluteY().

Referenced by gui::Menu::ActivateSubMenu(), AddChild(), Move(), MoveTo(), and gui::PopupMenuItem::OnClick().

00445 { 00446 surfacevector_t::iterator it; 00447 00448 for (it = m_ChildList.begin(); it != m_ChildList.end(); it++) 00449 { 00450 Surface *pclTemp = *it; 00451 coord_t fw = GetFrameWidth(); 00452 coord_t x = GetAbsoluteX() + pclTemp -> GetX() + fw; 00453 coord_t y = GetAbsoluteY() + pclTemp -> GetY() + fw; 00454 pclTemp -> SetAbsoluteX(x); 00455 pclTemp -> SetAbsoluteY(y); 00456 pclTemp -> CalculateAbsolute(); 00457 } 00458 }

void gui::Surface::CalculateClientRect  ) 
 

Definition at line 1237 of file Surface.cpp.

References gui::coord_t, GetFrameWidth(), m_ChildList, m_clientRect, m_h, and m_w.

Referenced by SetFrameWidth().

01238 { 01239 coord_t fw = GetFrameWidth(); 01240 01241 m_clientRect.x = fw; 01242 m_clientRect.y = fw; 01243 m_clientRect.w = m_w - fw * 2; 01244 m_clientRect.h = m_h - fw * 2; 01245 01246 for (surfacevector_t::iterator it = m_ChildList.begin(); it != m_ChildList.end(); it++) 01247 { 01248 (*it) -> CalculateClientRect(); 01249 } 01250 }

void gui::Surface::CloseAll  ) 
 

Definition at line 1810 of file Surface.cpp.

References m_bonds, and OnClose().

Referenced by gui::MenuItem::OnClick(), and gui::Menu::OnRightClick().

01811 { 01812 surfacevector_t::iterator it; 01813 01814 OnClose(); 01815 for (it = m_bonds.begin(); it != m_bonds.end(); it++) 01816 { 01817 (*it) -> CloseAll(); 01818 } 01819 }

SDL_Surface * gui::Surface::CreateSDLSurface bool   )  [protected]
 

Definition at line 265 of file Surface.cpp.

References DEB, GetScreen(), GetSDLControl(), m_h, and m_w.

Referenced by CreateTemporaryScreen(), RecreateSurfaces(), and Surface().

00266 { 00267 Uint32 rmask, gmask, bmask, amask; 00268 SDLControl *pcl = GetSDLControl(); 00269 SDL_Surface *pclSurf = pcl -> GetScreen(); 00270 int depth = pcl -> GetBpp(); 00271 00272 rmask = pclSurf -> format -> Rmask; 00273 gmask = pclSurf -> format -> Gmask; 00274 bmask = pclSurf -> format -> Bmask; 00275 amask = pclSurf -> format -> Amask; 00276 if (0 && !amask) 00277 { 00278 #if SDL_BYTEORDER == SDL_BIG_ENDIAN 00279 amask = 0x000000ff; 00280 #else 00281 amask = 0xff000000; 00282 #endif 00283 } 00284 00285 // SDL interprets each pixel as a 32-bit number, so our masks must depend 00286 // on the endianness (byte order) of the machine 00287 if (bAlpha) 00288 { 00289 depth = 32; 00290 switch (depth) 00291 { 00292 case 24: 00293 rmask = 0x0000003f; 00294 gmask = 0x00000fc0; 00295 bmask = 0x0003f000; 00296 amask = 0x00fc0000; 00297 break; 00298 case 32: 00299 #if SDL_BYTEORDER == SDL_BIG_ENDIAN 00300 rmask = 0xff000000; 00301 gmask = 0x00ff0000; 00302 bmask = 0x0000ff00; 00303 amask = 0x000000ff; 00304 #else 00305 rmask = 0x000000ff; 00306 gmask = 0x0000ff00; 00307 bmask = 0x00ff0000; 00308 amask = 0xff000000; 00309 #endif 00310 break; 00311 default: 00312 rmask = gmask = bmask = amask = 0; 00313 } 00314 } // if (bAlpha) 00315 00316 DEB( 00317 printf("CreateSDLSurface() depth = %d\n", depth); 00318 printf(" rmask = %08x\n", rmask); 00319 printf(" gmask = %08x\n", gmask); 00320 printf(" bmask = %08x\n", bmask); 00321 printf(" amask = %08x\n", amask); 00322 ) 00323 00324 SDL_Surface *screen; 00325 if (!(screen = SDL_CreateRGBSurface(SDL_SWSURFACE, m_w, m_h, depth, rmask, gmask, bmask, amask))) 00326 { 00327 fprintf(stderr, "CreateRGBSurface failed: %s", SDL_GetError()); 00328 // exit(1); 00329 } 00330 return screen; 00331 }

void gui::Surface::CreateTemporaryScreen  ) 
 

Definition at line 1642 of file Surface.cpp.

References CreateSDLSurface(), m_temp_screen, and SetUseTemporaryScreen().

Referenced by RecreateSurfaces().

01643 { 01644 m_temp_screen = CreateSDLSurface(false); 01645 SetUseTemporaryScreen(true); 01646 SDL_SetAlpha(m_temp_screen, SDL_SRCALPHA|SDL_RLEACCEL, 192); //SDL_ALPHA_OPAQUE); 01647 }

void gui::Surface::Draw  )  [protected, virtual]
 

Reimplemented in gui::Button, gui::Dialog, gui::Edit, gui::Menu, gui::MenuItem, gui::Output, gui::PopupMenuItem, gui::Progress, gui::ScrollBarV, gui::SeparatorMenuItem, and gui::Static.

Definition at line 644 of file Surface.cpp.

Referenced by DrawAll().

00645 { 00646 }

void gui::Surface::DrawAll  )  [virtual]
 

Definition at line 649 of file Surface.cpp.

References Draw(), DrawFrame(), DrawTemporaryScreen(), GetFrameColor(), GetFrameWidth(), GetParent(), GetScreen(), IsDirty(), m_ChildList, SetDirty(), and UseTemporaryScreen().

00650 { 00651 surfacevector_t::iterator it; 00652 00653 if (IsDirty()) 00654 { 00655 Draw(); 00656 DrawFrame(GetScreen(), GetFrameWidth(), GetFrameColor()); 00657 Surface *pclParent = this; //GetParent(); 00658 while (pclParent) 00659 { 00660 if (pclParent -> UseTemporaryScreen()) 00661 { 00662 pclParent -> DrawTemporaryScreen(); 00663 } 00664 pclParent = pclParent -> GetParent(); 00665 } 00666 SetDirty(false); 00667 } 00668 for (it = m_ChildList.begin(); it != m_ChildList.end(); it++) 00669 { 00670 (*it) -> DrawAll(); 00671 } 00672 // if (UseTemporaryScreen()) 00673 // { 00674 // DrawTemporaryScreen(); 00675 // } 00676 }

void gui::Surface::DrawFrame SDL_Surface *  ,
coord_t  ,
Uint32 
[virtual]
 

Definition at line 679 of file Surface.cpp.

References m_h, and m_w.

Referenced by DrawAll().

00680 { 00681 SDL_Rect rect; 00682 00683 rect.x = 0; 00684 rect.y = 0; 00685 rect.w = m_w; 00686 rect.h = fw; 00687 SDL_FillRect(screen, &rect, color); 00688 00689 rect.x = 0; 00690 rect.y = 0; 00691 rect.w = fw; 00692 rect.h = m_h; 00693 SDL_FillRect(screen, &rect, color); 00694 00695 rect.x = m_w - fw; 00696 rect.y = 0; 00697 rect.w = fw; 00698 rect.h = m_h; 00699 SDL_FillRect(screen, &rect, color); 00700 00701 rect.x = 0; 00702 rect.y = m_h - fw; 00703 rect.w = m_w; 00704 rect.h = fw; 00705 SDL_FillRect(screen, &rect, color); 00706 00707 }

void gui::Surface::DrawTemporaryScreen  ) 
 

Definition at line 1650 of file Surface.cpp.

References Blit(), GetX(), GetY(), m_bRedrawTemporary, m_temp_screen, SetUseTemporaryScreen(), and UseTemporaryScreen().

Referenced by DrawAll(), gui::HotButton::OnMouseIn(), and gui::HotButton::OnMouseOut().

01651 { 01652 if (UseTemporaryScreen() && m_temp_screen) 01653 { 01654 SetUseTemporaryScreen(false); 01655 m_bRedrawTemporary = true; 01656 Blit(-GetX(),-GetY(),m_temp_screen); 01657 SetUseTemporaryScreen(true); 01658 m_bRedrawTemporary = false; 01659 } 01660 }

void gui::Surface::Dump FILE *   )  [virtual]
 

Definition at line 1852 of file Surface.cpp.

References Dump(), DumpMembers(), and m_ChildList.

Referenced by Dump(), and SaveDialogs().

01853 { 01854 string tag; 01855 if (dynamic_cast<Button *>(this)) 01856 { 01857 tag = "Button"; 01858 } 01859 else 01860 if (dynamic_cast<Dialog *>(this)) 01861 { 01862 tag = "Dialog"; 01863 } 01864 else 01865 if (dynamic_cast<Edit *>(this)) 01866 { 01867 tag = "Edit"; 01868 } 01869 else 01870 if (dynamic_cast<Hotspot *>(this)) 01871 { 01872 tag = "Hotspot"; 01873 } 01874 else 01875 if (dynamic_cast<Menu *>(this)) 01876 { 01877 tag = "Menu"; 01878 } 01879 else 01880 if (dynamic_cast<MenuItem *>(this)) 01881 { 01882 tag = "MenuItem"; 01883 } 01884 else 01885 if (dynamic_cast<Output *>(this)) 01886 { 01887 tag = "Output"; 01888 } 01889 else 01890 if (dynamic_cast<PopupMenuItem *>(this)) 01891 { 01892 tag = "PopupMenuItem"; 01893 } 01894 else 01895 if (dynamic_cast<Progress *>(this)) 01896 { 01897 tag = "Progress"; 01898 } 01899 else 01900 if (dynamic_cast<SeparatorMenuItem *>(this)) 01901 { 01902 tag = "SeparatorMenuItem"; 01903 } 01904 else 01905 if (dynamic_cast<Static *>(this)) 01906 { 01907 tag = "Static"; 01908 } 01909 else 01910 { 01911 tag = "no_cast"; 01912 } 01913 01914 fprintf(fil,"<%s>\n",tag.c_str()); 01915 DumpMembers(fil); 01916 for (surfacevector_t::iterator it = m_ChildList.begin(); it != m_ChildList.end(); it++) 01917 { 01918 (*it) -> Dump(fil); 01919 } 01920 fprintf(fil,"</%s>\n",tag.c_str()); 01921 }

void gui::Surface::DumpMembers FILE *   )  [virtual]
 

Reimplemented in gui::Edit, gui::MenuItem, and gui::PopupMenuItem.

Definition at line 1966 of file Surface.cpp.

References m_bAlphaIsSet, m_bAnchorDown, m_bAnchorRight, m_bBgColorIsSet, m_bChildrenVisible, m_bClickable, m_bFgColorIsSet, m_bFrameColorIsSet, m_bFrameWidthIsSet, m_bgColor, m_bMoveable, m_bResizeArea, m_bTransparent, m_bUseTemporaryScreen, m_bVisible, m_fgColor, m_frameColor, m_h, m_nAlpha, m_nFrameWidth, m_text, m_uicommand, m_w, m_x, m_y, UICOMMAND_NONE, and util::Xml::Write().

Referenced by Dump().

01967 { 01968 Xml xml(fil); 01969 01970 xml.Write("TEXT",m_text); 01971 if (m_uicommand != UICOMMAND_NONE) 01972 { 01973 xml.Write("UICOMMAND",m_uicommand); 01974 } 01975 xml.Write("X", (long)m_x); 01976 xml.Write("Y", (long)m_y); 01977 xml.Write("WIDTH", (long)m_w); 01978 xml.Write("HEIGHT", (long)m_h); 01979 xml.Write("BGCOLORISSET",m_bBgColorIsSet); 01980 if (m_bBgColorIsSet) 01981 { 01982 xml.Write("BGCOLOR",m_bgColor); 01983 } 01984 xml.Write("FGCOLORISSET",m_bFgColorIsSet); 01985 if (m_bFgColorIsSet) 01986 { 01987 xml.Write("FGCOLOR",m_fgColor); 01988 } 01989 xml.Write("FRAMECOLORISSET",m_bFrameColorIsSet); 01990 if (m_bFrameColorIsSet) 01991 { 01992 xml.Write("FRAMECOLOR",m_frameColor); 01993 } 01994 xml.Write("ALPHAISSET",m_bAlphaIsSet); 01995 if (m_bAlphaIsSet) 01996 { 01997 xml.Write("ALPHA", (long)m_nAlpha); 01998 } 01999 xml.Write("FRAMEWIDTHISSET",m_bFrameWidthIsSet); 02000 if (m_bFrameWidthIsSet) 02001 { 02002 xml.Write("FRAMEWIDTH", (long)m_nFrameWidth); 02003 } 02004 xml.Write("VISIBLE",m_bVisible); 02005 xml.Write("CHILDRENVISIBLE",m_bChildrenVisible); 02006 xml.Write("TRANSPARENT",m_bTransparent); 02007 xml.Write("MOVEABLE",m_bMoveable); 02008 xml.Write("RESIZEAREA",m_bResizeArea); 02009 xml.Write("ANCHORRIGHT",m_bAnchorRight); 02010 xml.Write("ANCHORDOWN",m_bAnchorDown); 02011 xml.Write("CLICKABLE",m_bClickable); 02012 xml.Write("USETEMPORARYSCREEN",m_bUseTemporaryScreen); 02013 }

void gui::Surface::FillRectEv SDL_Rect &   ) 
 

Definition at line 558 of file Surface.cpp.

References SDL_USEREVENT_FILLRECT.

00559 { 00560 SDL_Event e; 00561 long xy = a.x * 0x10000 + a.y; 00562 long wh = a.w * 0x10000 + a.h; 00563 00564 e.type = SDL_USEREVENT; 00565 e.user.code = SDL_USEREVENT_FILLRECT; 00566 memmove(&e.user.data1, &xy, 4); 00567 memmove(&e.user.data2, &wh, 4); 00568 SDL_PushEvent(&e); 00569 }

Surface * gui::Surface::FindSurface coord_t  ,
coord_t  ,
coord_t  X = 0,
coord_t  Y = 0
 

Definition at line 409 of file Surface.cpp.

References FindSurface(), GetAbsoluteX(), GetAbsoluteY(), GetH(), GetW(), IsVisible(), m_bChildrenVisible, and m_ChildList.

Referenced by FindSurface().

00410 { 00411 surfacevector_t::iterator it; 00412 Surface *pclFound = NULL; 00413 00414 if (m_bChildrenVisible) 00415 { 00416 for (it = m_ChildList.begin(); it != m_ChildList.end(); it++) 00417 { 00418 Surface *pclTemp = *it; 00419 if (pclTemp -> IsVisible()) 00420 { 00421 if (xpos >= pclTemp -> GetAbsoluteX() && 00422 xpos < pclTemp -> GetAbsoluteX() + pclTemp -> GetW() && 00423 ypos >= pclTemp -> GetAbsoluteY() && 00424 ypos < pclTemp -> GetAbsoluteY() + pclTemp -> GetH() ) 00425 /* 00426 if (xpos > X + pclTemp -> GetX() && 00427 xpos < X + pclTemp -> GetX() + pclTemp -> GetW() && 00428 ypos > Y + pclTemp -> GetY() && 00429 ypos < Y + pclTemp -> GetY() + pclTemp -> GetH()) 00430 */ 00431 { 00432 pclFound = pclTemp; 00433 } 00434 } 00435 } 00436 } 00437 if (pclFound) 00438 return pclFound -> FindSurface(xpos,ypos); // ,X + pclFound -> GetX(),Y + pclFound -> GetY()); 00439 else 00440 return this; 00441 }

void gui::Surface::FreeSurface SDL_Surface *   ) 
 

Definition at line 526 of file Surface.cpp.

Referenced by RecreateSurfaces().

00527 { 00528 SDL_FreeSurface(pclSurface); 00529 }

SDL_Rect gui::Surface::GetAbsoluteRect  )  [virtual]
 

Definition at line 1486 of file Surface.cpp.

References m_absoluteRect.

Referenced by gui::Menu::ActivateSubMenu(), gui::Output::AddLine(), GetExtents(), Move(), and MoveTo().

01487 { 01488 return m_absoluteRect; 01489 }

SDL_Rect * gui::Surface::GetAbsoluteRectPtr  )  [virtual]
 

Definition at line 1480 of file Surface.cpp.

References m_absoluteRect.

Referenced by BlitAbsolute().

01481 { 01482 return &m_absoluteRect; 01483 }

coord_t gui::Surface::GetAbsoluteX  )  [virtual]
 

Definition at line 1560 of file Surface.cpp.

References gui::coord_t, and m_x_absolute.

Referenced by CalculateAbsolute(), and FindSurface().

01561 { 01562 return m_x_absolute; 01563 }

coord_t gui::Surface::GetAbsoluteY  )  [virtual]
 

Definition at line 1566 of file Surface.cpp.

References gui::coord_t, and m_y_absolute.

Referenced by CalculateAbsolute(), and FindSurface().

01567 { 01568 return m_y_absolute; 01569 }

alpha_t gui::Surface::GetAlpha  ) 
 

Definition at line 1412 of file Surface.cpp.

References gui::alpha_t, m_bAlphaIsSet, m_nAlpha, and m_pclParent.

01413 { 01414 if (m_bAlphaIsSet) 01415 { 01416 return m_nAlpha; 01417 } 01418 if (m_pclParent) 01419 { 01420 return m_pclParent -> GetAlpha(); 01421 } 01422 return 0; 01423 }

void gui::Surface::GetBgColor SDL_Color &   ) 
 

Definition at line 1319 of file Surface.cpp.

References GetBgColor(), GetFgColor(), IsInverted(), m_bBgColorIsSet, m_bFgColorIsSet, m_bgColor, m_fgColor, and m_pclParent.

01320 { 01321 if (IsInverted()) 01322 { 01323 if (m_bFgColorIsSet) 01324 { 01325 color = m_fgColor; 01326 return; 01327 } 01328 if (m_pclParent) 01329 { 01330 m_pclParent -> GetFgColor(color); 01331 } 01332 } 01333 else 01334 { 01335 if (m_bBgColorIsSet) 01336 { 01337 color = m_bgColor; 01338 return; 01339 } 01340 if (m_pclParent) 01341 { 01342 m_pclParent -> GetBgColor(color); 01343 } 01344 } 01345 }

color_t gui::Surface::GetBgColor  ) 
 

Definition at line 1290 of file Surface.cpp.

References gui::color_t, GetFgColor(), IsInverted(), m_bBgColorIsSet, m_bFgColorIsSet, m_bgColor, m_fgColor, m_pclParent, and m_screen.

Referenced by gui::Static::Draw(), gui::SeparatorMenuItem::Draw(), gui::ScrollBarV::Draw(), gui::Progress::Draw(), gui::Output::Draw(), gui::MenuItem::Draw(), gui::Menu::Draw(), gui::Edit::Draw(), gui::Dialog::Draw(), gui::Button::Draw(), GetBgColor(), and GetFgColor().

01291 { 01292 if (IsInverted()) 01293 { 01294 if (m_bFgColorIsSet) 01295 { 01296 return SDL_MapRGBA(m_screen->format, m_fgColor.r, m_fgColor.g, m_fgColor.b, m_fgColor.unused); 01297 } 01298 if (m_pclParent) 01299 { 01300 return m_pclParent -> GetFgColor(); 01301 } 01302 return 0; 01303 } 01304 else 01305 { 01306 if (m_bBgColorIsSet) 01307 { 01308 return SDL_MapRGBA(m_screen->format, m_bgColor.r, m_bgColor.g, m_bgColor.b, m_bgColor.unused); 01309 } 01310 } 01311 if (m_pclParent) 01312 { 01313 return m_pclParent -> GetBgColor(); 01314 } 01315 return 0; 01316 }

Surface * gui::Surface::GetBond  ) 
 

Definition at line 1792 of file Surface.cpp.

References m_pclBond.

Referenced by gui::MenuItem::OnClick(), gui::Menu::OnRightClick(), and ~Surface().

01793 { 01794 return m_pclBond; 01795 }

Surface * gui::Surface::GetChildOnTop  ) 
 

Definition at line 376 of file Surface.cpp.

References m_ChildList.

Referenced by BringToTop().

00377 { 00378 surfacevector_t::iterator it; 00379 Surface *pclTemp = NULL; 00380 00381 for (it = m_ChildList.begin(); it != m_ChildList.end(); it++) 00382 { 00383 pclTemp = *it; 00384 } 00385 return pclTemp; 00386 }

SDL_Rect gui::Surface::GetClientRect  )  [virtual]
 

Definition at line 1474 of file Surface.cpp.

References m_clientRect.

Referenced by gui::ScrollBarV::Draw(), and gui::Progress::Draw().

01475 { 01476 return m_clientRect; 01477 }

SDL_Rect * gui::Surface::GetClientRectPtr  )  [virtual]
 

Definition at line 1468 of file Surface.cpp.

References m_clientRect.

Referenced by gui::Static::Draw(), gui::SeparatorMenuItem::Draw(), gui::PopupMenuItem::Draw(), gui::Output::Draw(), gui::MenuItem::Draw(), gui::Menu::Draw(), gui::Edit::Draw(), gui::Dialog::Draw(), gui::Button::Draw(), and RecreateSurfaces().

01469 { 01470 return &m_clientRect; 01471 }

void gui::Surface::GetExtents SDL_Rect &   ) 
 

Definition at line 1822 of file Surface.cpp.

References gui::coord_t, GetAbsoluteRect(), GetExtents(), and m_bonds.

Referenced by GetExtents().

01823 { 01824 SDL_Rect a = GetAbsoluteRect(); 01825 coord_t right = a.x + a.w; 01826 coord_t bottom = a.y + a.h; 01827 01828 r.x = a.x < r.x ? a.x : r.x; 01829 r.y = a.y < r.y ? a.y : r.y; 01830 r.w = right > r.w ? right : r.w; 01831 r.h = bottom> r.h ? bottom: r.w; 01832 01833 for (surfacevector_t::iterator it = m_bonds.begin(); it != m_bonds.end(); it++) 01834 { 01835 (*it) -> GetExtents(r); 01836 } 01837 }

void gui::Surface::GetFgColor SDL_Color &   ) 
 

Definition at line 1377 of file Surface.cpp.

References GetBgColor(), GetFgColor(), IsInverted(), m_bBgColorIsSet, m_bFgColorIsSet, m_bgColor, m_fgColor, and m_pclParent.

01378 { 01379 if (IsInverted()) 01380 { 01381 if (m_bBgColorIsSet) 01382 { 01383 color = m_bgColor; 01384 return; 01385 } 01386 if (m_pclParent) 01387 { 01388 m_pclParent -> GetBgColor(color); 01389 } 01390 } 01391 else 01392 { 01393 if (m_bFgColorIsSet) 01394 { 01395 color = m_fgColor; 01396 return; 01397 } 01398 if (m_pclParent) 01399 { 01400 m_pclParent -> GetFgColor(color); 01401 } 01402 } 01403 }

color_t gui::Surface::GetFgColor  ) 
 

Definition at line 1348 of file Surface.cpp.

References gui::color_t, GetBgColor(), IsInverted(), m_bBgColorIsSet, m_bFgColorIsSet, m_bgColor, m_fgColor, m_pclParent, and m_screen.

Referenced by gui::Static::Draw(), gui::SeparatorMenuItem::Draw(), gui::ScrollBarV::Draw(), gui::Progress::Draw(), gui::PopupMenuItem::Draw(), gui::Output::Draw(), gui::MenuItem::Draw(), gui::Edit::Draw(), gui::Button::Draw(), GetBgColor(), and GetFgColor().

01349 { 01350 if (IsInverted()) 01351 { 01352 if (m_bBgColorIsSet) 01353 { 01354 return SDL_MapRGBA(m_screen->format, m_bgColor.r, m_bgColor.g, m_bgColor.b, m_bgColor.unused); 01355 } 01356 if (m_pclParent) 01357 { 01358 return m_pclParent -> GetBgColor(); 01359 } 01360 return 0; 01361 } 01362 else 01363 { 01364 if (m_bFgColorIsSet) 01365 { 01366 return SDL_MapRGBA(m_screen->format, m_fgColor.r, m_fgColor.g, m_fgColor.b, m_fgColor.unused); 01367 } 01368 } 01369 if (m_pclParent) 01370 { 01371 return m_pclParent -> GetFgColor(); 01372 } 01373 return 0; 01374 }

void gui::Surface::GetFrameColor SDL_Color &   ) 
 

Definition at line 1454 of file Surface.cpp.

References GetFrameColor(), m_bFrameColorIsSet, m_frameColor, and m_pclParent.

01455 { 01456 if (m_bFrameColorIsSet) 01457 { 01458 color = m_frameColor; 01459 return; 01460 } 01461 if (m_pclParent) 01462 { 01463 m_pclParent -> GetFrameColor(color); 01464 } 01465 }

color_t gui::Surface::GetFrameColor  ) 
 

Definition at line 1440 of file Surface.cpp.

References gui::color_t, m_bFrameColorIsSet, m_frameColor, m_pclParent, and m_screen.

Referenced by gui::Button::Draw(), DrawAll(), and GetFrameColor().

01441 { 01442 if (m_bFrameColorIsSet) 01443 { 01444 return SDL_MapRGBA(m_screen->format, m_frameColor.r, m_frameColor.g, m_frameColor.b, m_frameColor.unused); 01445 } 01446 if (m_pclParent) 01447 { 01448 return m_pclParent -> GetFrameColor(); 01449 } 01450 return 0; 01451 }

coord_t gui::Surface::GetFrameWidth  ) 
 

Definition at line 1426 of file Surface.cpp.

References gui::coord_t, m_bFrameWidthIsSet, m_nFrameWidth, and m_pclParent.

Referenced by Blit(), CalculateAbsolute(), CalculateClientRect(), gui::Menu::CreateMenu(), gui::Button::Draw(), DrawAll(), SetH(), SetW(), and Surface().

01427 { 01428 if (m_bFrameWidthIsSet) 01429 { 01430 return m_nFrameWidth; 01431 } 01432 if (m_pclParent) 01433 { 01434 return m_pclParent -> GetFrameWidth(); 01435 } 01436 return 0; 01437 }

coord_t gui::Surface::GetH  )  [virtual]
 

Definition at line 1554 of file Surface.cpp.

References gui::coord_t, and m_h.

Referenced by gui::Output::AddLine(), gui::Menu::AddMenuItem(), gui::Static::Draw(), gui::Output::Draw(), gui::MenuItem::Draw(), gui::Edit::Draw(), gui::Button::Draw(), FindSurface(), Move(), MoveTo(), and gui::PopupMenuItem::OnClick().

01555 { 01556 return m_h; 01557 }

unsigned long gui::Surface::GetID  )  [virtual]
 

Definition at line 1504 of file Surface.cpp.

References m_id.

Referenced by OnButton(), OnClose(), OnEvent(), and gui::Edit::OnKeyDown().

01505 { 01506 return m_id; 01507 }

unsigned long gui::Surface::GetLocalID  )  [virtual]
 

Definition at line 1510 of file Surface.cpp.

References m_local_id.

Referenced by OnButton(), OnClose(), OnEvent(), gui::ScrollBarV::OnEvent(), and gui::Edit::OnKeyDown().

01511 { 01512 return m_local_id; 01513 }

Surface * gui::Surface::GetParent  )  [virtual]
 

Definition at line 1278 of file Surface.cpp.

References m_pclParent.

Referenced by gui::Menu::ActivateSubMenu(), Blit(), BringToTop(), DrawAll(), Move(), MoveTo(), OnButton(), OnClick(), gui::PopupMenuItem::OnClick(), gui::MenuItem::OnClick(), OnClose(), OnEvent(), gui::Edit::OnKeyDown(), gui::HotButton::OnMouseIn(), gui::HotButton::OnMouseOut(), OnRightClick(), and ~Surface().

01279 { 01280 return m_pclParent; 01281 }

Surface * gui::Surface::GetRoot  )  [virtual]
 

Definition at line 1284 of file Surface.cpp.

References m_pclParent.

01285 { 01286 return m_pclParent ? m_pclParent -> GetRoot() : this; 01287 }

SDL_Surface * gui::Surface::GetScreen  )  [virtual]
 

Reimplemented in gui::Button.

Definition at line 1272 of file Surface.cpp.

References m_screen.

Referenced by Blit(), BlitAbsolute(), CreateSDLSurface(), gui::PopupMenuItem::Draw(), DrawAll(), gui::PopupMenuItem::OnClick(), and RecreateSurfaces().

01273 { 01274 return m_screen; 01275 }

SDLControl * gui::Surface::GetSDLControl  )  [virtual]
 

Definition at line 1492 of file Surface.cpp.

References m_pclControl, and m_pclParent.

Referenced by Blit(), BlitAbsolute(), CreateSDLSurface(), and gui::PopupMenuItem::OnClick().

01493 { 01494 return m_pclControl ? m_pclControl : (m_pclParent ? m_pclParent -> GetSDLControl() : NULL); 01495 }

SDL_Surface * gui::Surface::GetTemporaryScreen  )  [virtual]
 

Definition at line 1675 of file Surface.cpp.

References m_temp_screen.

Referenced by Blit(), and BlitAbsolute().

01676 { 01677 return m_temp_screen; 01678 }

const char * gui::Surface::GetText  )  [virtual]
 

Definition at line 1688 of file Surface.cpp.

References m_text.

Referenced by gui::Button::Draw(), and SaveDialogs().

01689 { 01690 return m_text.c_str(); 01691 }

TTFont * gui::Surface::GetTTFont  ) 
 

Definition at line 1406 of file Surface.cpp.

References m_pclParent, and m_pclTTFont.

Referenced by gui::Output::AddLine(), gui::Static::Draw(), gui::Output::Draw(), gui::MenuItem::Draw(), gui::Edit::Draw(), gui::Button::Draw(), and gui::MenuItem::MenuItem().

01407 { 01408 return m_pclTTFont ? m_pclTTFont : (m_pclParent ? m_pclParent -> GetTTFont() : NULL); 01409 }

long gui::Surface::GetUICommand  )  [virtual]
 

Definition at line 1846 of file Surface.cpp.

References m_uicommand.

01847 { 01848 return m_uicommand; 01849 }

coord_t gui::Surface::GetW  )  [virtual]
 

Definition at line 1548 of file Surface.cpp.

References gui::coord_t, and m_w.

Referenced by gui::Menu::AddMenuItem(), gui::SeparatorMenuItem::Draw(), gui::Progress::Draw(), gui::Button::Draw(), FindSurface(), Move(), MoveTo(), and gui::PopupMenuItem::OnClick().

01549 { 01550 return m_w; 01551 }

coord_t gui::Surface::GetX  )  [virtual]
 

Definition at line 1530 of file Surface.cpp.

References gui::coord_t, and m_x.

Referenced by CalculateAbsolute(), DrawTemporaryScreen(), Move(), MoveTo(), gui::PopupMenuItem::OnClick(), and OnSize().

01531 { 01532 return m_x; 01533 }

coord_t gui::Surface::GetY  )  [virtual]
 

Definition at line 1536 of file Surface.cpp.

References gui::coord_t, and m_y.

Referenced by CalculateAbsolute(), DrawTemporaryScreen(), Move(), MoveTo(), gui::PopupMenuItem::OnClick(), and OnSize().

01537 { 01538 return m_y; 01539 }

void gui::Surface::InvalidateEv  ) 
 

Definition at line 532 of file Surface.cpp.

References SDL_USEREVENT_INVALIDATE.

Referenced by gui::Menu::ActivateSubMenu(), Move(), MoveTo(), gui::PopupMenuItem::OnClick(), gui::HotButton::OnMouseIn(), gui::HotButton::OnMouseOut(), and SetDirty().

00533 { 00534 SDL_Event e; 00535 00536 e.type = SDL_USEREVENT; 00537 e.user.code = SDL_USEREVENT_INVALIDATE; 00538 e.user.data1 = this; 00539 e.user.data2 = NULL; 00540 SDL_PushEvent(&e); 00541 }

void gui::Surface::InvalidateRectEv SDL_Rect &   ) 
 

Definition at line 544 of file Surface.cpp.

References SDL_USEREVENT_INVALIDATERECT.

Referenced by Move(), and MoveTo().

00545 { 00546 SDL_Event e; 00547 long xy = a.x * 0x10000 + a.y; 00548 long wh = a.w * 0x10000 + a.h; 00549 00550 e.type = SDL_USEREVENT; 00551 e.user.code = SDL_USEREVENT_INVALIDATERECT; 00552 memmove(&e.user.data1, &xy, 4); 00553 memmove(&e.user.data2, &wh, 4); 00554 SDL_PushEvent(&e); 00555 }

bool gui::Surface::IsAnchorDown  )  [virtual]
 

Definition at line 1724 of file Surface.cpp.

References m_bAnchorDown.

Referenced by OnSize().

01725 { 01726 return m_bAnchorDown; 01727 }

bool gui::Surface::IsAnchorRight  )  [virtual]
 

Definition at line 1712 of file Surface.cpp.

References m_bAnchorRight.

Referenced by OnSize().

01713 { 01714 return m_bAnchorRight; 01715 }

bool gui::Surface::IsClickable  )  [virtual]
 

Definition at line 1748 of file Surface.cpp.

References m_bClickable.

Referenced by gui::MenuItem::OnMouseIn(), gui::HotButton::OnMouseIn(), gui::MenuItem::OnMouseOut(), and gui::HotButton::OnMouseOut().

01749 { 01750 return m_bClickable; 01751 }

bool gui::Surface::IsDirty  )  [virtual]
 

Definition at line 1636 of file Surface.cpp.

References m_bDirty.

Referenced by DrawAll().

01637 { 01638 return m_bDirty; 01639 }

bool gui::Surface::IsInverted  )  [virtual]
 

Definition at line 1578 of file Surface.cpp.

References m_bInverted.

Referenced by GetBgColor(), GetFgColor(), gui::Button::GetScreen(), and gui::HotButton::OnTimer().

01579 { 01580 return m_bInverted; 01581 }

bool gui::Surface::IsMoveable  )  [virtual]
 

Definition at line 1616 of file Surface.cpp.

References m_bMoveable.

01617 { 01618 return m_bMoveable; 01619 }

bool gui::Surface::IsResizeArea  )  [virtual]
 

Definition at line 1700 of file Surface.cpp.

References m_bResizeArea.

01701 { 01702 return m_bResizeArea; 01703 }

bool gui::Surface::IsTransparent  )  [virtual]
 

Definition at line 1590 of file Surface.cpp.

References m_bTransparent.

Referenced by Blit().

01591 { 01592 return m_bTransparent; 01593 }

bool gui::Surface::IsVisible  )  [virtual]
 

Definition at line 1542 of file Surface.cpp.

References m_bVisible.

Referenced by gui::Menu::ActivateSubMenu(), FindSurface(), and MoveTo().

01543 { 01544 return m_bVisible; 01545 }

void gui::Surface::Move Surface rootSurface,
coord_t  ,
coord_t 
 

Definition at line 844 of file Surface.cpp.

References CalculateAbsolute(), gui::coord_t, GetAbsoluteRect(), GetH(), GetParent(), GetW(), GetX(), GetY(), InvalidateEv(), InvalidateRectEv(), m_bonds, Move(), SetX(), and SetY().

Referenced by Move(), and MoveTo().

00845 { 00846 coord_t x = GetX() + xrel; 00847 coord_t y = GetY() + yrel; 00848 coord_t wmax = GetParent() -> GetW(); 00849 coord_t hmax = GetParent() -> GetH(); 00850 00851 x = (x < 0) ? 0 : x; 00852 y = (y < 0) ? 0 : y; 00853 x = (x + GetW() > wmax) ? wmax - GetW() : x; 00854 y = (y + GetH() > hmax) ? hmax - GetH() : y; 00855 00856 SDL_Rect a = GetAbsoluteRect(); 00857 pclRootSurface -> InvalidateRectEv(a); 00858 SetX(x); 00859 SetY(y); 00860 GetParent() -> CalculateAbsolute(); 00861 InvalidateEv(); 00862 00863 for (surfacevector_t::iterator it = m_bonds.begin(); it != m_bonds.end(); it++) 00864 { 00865 (*it) -> Move(pclRootSurface,xrel,yrel); 00866 } 00867 }

void gui::Surface::MoveTo Surface ,
coord_t  ,
coord_t  ,
bool  bVisible = true
 

Definition at line 870 of file Surface.cpp.

References CalculateAbsolute(), gui::coord_t, GetAbsoluteRect(), GetH(), GetParent(), GetW(), GetX(), GetY(), InvalidateEv(), InvalidateRectEv(), IsVisible(), m_bonds, Move(), SetVisible(), SetX(), and SetY().

00871 { 00872 int xrel = x - GetX(); 00873 int yrel = y - GetY(); 00874 coord_t wmax = GetParent() -> GetW(); 00875 coord_t hmax = GetParent() -> GetH(); 00876 00877 x = (x < 0) ? 0 : x; 00878 y = (y < 0) ? 0 : y; 00879 x = (x + GetW() > wmax) ? wmax - GetW() : x; 00880 y = (y + GetH() > hmax) ? hmax - GetH() : y; 00881 00882 if (IsVisible()) 00883 { 00884 SDL_Rect a = GetAbsoluteRect(); 00885 pclRootSurface -> InvalidateRectEv(a); 00886 } 00887 SetVisible(bVisible); 00888 for (surfacevector_t::iterator it = m_bonds.begin(); it != m_bonds.end(); it++) 00889 { 00890 (*it) -> SetVisible(bVisible); 00891 (*it) -> InvalidateEv(); 00892 } 00893 if (bVisible) 00894 { 00895 SetX(x); 00896 SetY(y); 00897 GetParent() -> CalculateAbsolute(); 00898 InvalidateEv(); 00899 00900 for (surfacevector_t::iterator it = m_bonds.begin(); it != m_bonds.end(); it++) 00901 { 00902 (*it) -> Move(pclRootSurface,xrel,yrel); 00903 } 00904 } 00905 }

bool gui::Surface::MustBeDeleted  )  [virtual]
 

Definition at line 1736 of file Surface.cpp.

References m_bMustBeDeleted.

Referenced by Remove(), and ~Surface().

01737 { 01738 return m_bMustBeDeleted; 01739 }

void gui::Surface::OnButton  )  [virtual]
 

Definition at line 946 of file Surface.cpp.

References GetID(), GetLocalID(), GetParent(), GUI_EVENT_BUTTON, gui::surface_event_struct::id, gui::surface_event_struct::local_id, m_uicommand, OnEvent(), gui::surface_event_struct::ptr, SDL_USEREVENT_UICOMMAND, gui::surface_event_struct::type, and UICOMMAND_NONE.

Referenced by gui::MenuItem::OnClick(), gui::HotButton::OnClick(), and gui::HotButton::OnTimer().

00947 { 00948 //DEB(printf("OnButton()\n");) 00949 Surface *pclParent = GetParent(); 00950 if (m_uicommand != UICOMMAND_NONE) 00951 { 00952 SDL_Event e; 00953 e.type = SDL_USEREVENT; 00954 e.user.code = SDL_USEREVENT_UICOMMAND; 00955 memmove(&e.user.data1,this,4); 00956 memmove(&e.user.data2,&m_uicommand,4); 00957 SDL_PushEvent(&e); 00958 } 00959 if (pclParent) 00960 { 00961 surface_event_t e; 00962 e.type = GUI_EVENT_BUTTON; 00963 e.id = GetID(); 00964 e.local_id = GetLocalID(); 00965 e.ptr = this; 00966 pclParent -> OnEvent(&e); 00967 } 00968 }

void gui::Surface::OnClick coord_t  x,
coord_t  y
[virtual]
 

Reimplemented in gui::HotButton, gui::MenuItem, and gui::PopupMenuItem.

Definition at line 1036 of file Surface.cpp.

References GetParent(), and OnClick().

Referenced by OnClick().

01037 { 01038 Surface *pclParent = GetParent(); 01039 01040 if (pclParent) 01041 { 01042 pclParent -> OnClick(x,y); 01043 } 01044 }

void gui::Surface::OnClose  )  [virtual]
 

Definition at line 971 of file Surface.cpp.

References GetID(), GetLocalID(), GetParent(), GUI_EVENT_CLOSE, gui::surface_event_struct::id, gui::surface_event_struct::local_id, OnEvent(), gui::surface_event_struct::ptr, and gui::surface_event_struct::type.

Referenced by CloseAll(), and gui::Dialog::OnRightClick().

00972 { 00973 Surface *pclParent = GetParent(); 00974 if (pclParent) 00975 { 00976 surface_event_t e; 00977 e.type = GUI_EVENT_CLOSE; 00978 e.id = GetID(); 00979 e.local_id = GetLocalID(); 00980 e.ptr = this; 00981 pclParent -> OnEvent(&e); 00982 } 00983 }

void gui::Surface::OnEvent surface_event_t  )  [virtual]
 

Reimplemented in gui::ScrollBarV.

Definition at line 908 of file Surface.cpp.

References GetID(), GetLocalID(), GetParent(), OnEvent(), and gui::surface_event_t.

Referenced by OnButton(), OnClose(), and OnEvent().

00909 { 00910 Surface *pclParent = GetParent(); 00911 00912 if (pclParent) 00913 { 00914 pstEvent -> id = GetID(); 00915 pstEvent -> local_id = GetLocalID(); 00916 pstEvent -> ptr = this; 00917 pclParent -> OnEvent(pstEvent); 00918 } 00919 }

void gui::Surface::OnFocus  )  [virtual]
 

Reimplemented in gui::Edit.

Definition at line 986 of file Surface.cpp.

00987 { 00988 }

void gui::Surface::OnHide  )  [virtual]
 

Reimplemented in gui::Edit.

Definition at line 996 of file Surface.cpp.

Referenced by SetVisible().

00997 { 00998 }

void gui::Surface::OnKeyDown SDL_keysym   )  [virtual]
 

Reimplemented in gui::Edit.

Definition at line 934 of file Surface.cpp.

00935 { 00936 //DEB(printf("OnKeyDown()\n");) 00937 }

void gui::Surface::OnKeyUp SDL_keysym   )  [virtual]
 

Definition at line 940 of file Surface.cpp.

00941 { 00942 //DEB(printf("OnKeyUp()\n");) 00943 }

void gui::Surface::OnLostFocus  )  [virtual]
 

Reimplemented in gui::Edit.

Definition at line 991 of file Surface.cpp.

00992 { 00993 }

void gui::Surface::OnMouseIn  )  [virtual]
 

Reimplemented in gui::HotButton, and gui::MenuItem.

Definition at line 922 of file Surface.cpp.

00923 { 00924 //DEB(printf("OnMouseIn()\n");) 00925 }

void gui::Surface::OnMouseMove coord_t  x,
coord_t  y,
coord_t  xrel,
coord_t  yrel
[virtual]
 

Definition at line 1020 of file Surface.cpp.

01021 { 01022 }

void gui::Surface::OnMouseOut  )  [virtual]
 

Reimplemented in gui::HotButton, and gui::MenuItem.

Definition at line 928 of file Surface.cpp.

00929 { 00930 //DEB(printf("OnMouseOut()\n");) 00931 }

void gui::Surface::OnRightClick coord_t  x,
coord_t  y
[virtual]
 

Reimplemented in gui::Dialog, and gui::Menu.

Definition at line 1025 of file Surface.cpp.

References GetParent(), and OnRightClick().

Referenced by OnRightClick().

01026 { 01027 Surface *pclParent = GetParent(); 01028 01029 if (pclParent) 01030 { 01031 pclParent -> OnRightClick(x,y); 01032 } 01033 }

void gui::Surface::OnShow  )  [virtual]
 

Definition at line 1001 of file Surface.cpp.

Referenced by SetVisible().

01002 { 01003 }

void gui::Surface::OnSize SDL_Rect &  ,
int  xrel,
int  yrel
[virtual]
 

Reimplemented in gui::Hotspot.

Definition at line 1006 of file Surface.cpp.

References GetX(), GetY(), IsAnchorDown(), IsAnchorRight(), SetX(), and SetY().

Referenced by RecreateSurfaces().

01007 { 01008 // kolla anchor, stretch 01009 if (IsAnchorRight()) 01010 { 01011 SetX(GetX() + xrel); 01012 } 01013 if (IsAnchorDown()) 01014 { 01015 SetY(GetY() + yrel); 01016 } 01017 }

void gui::Surface::OnTimer long  id  )  [virtual]
 

Reimplemented in gui::HotButton.

Definition at line 1047 of file Surface.cpp.

01048 { 01049 }

void gui::Surface::RecreateSurfaces  ) 
 

Definition at line 481 of file Surface.cpp.

References CreateSDLSurface(), CreateTemporaryScreen(), FreeSurface(), GetClientRectPtr(), GetScreen(), m_ChildList, m_screen, m_temp_screen, OnSize(), SetDirty(), and UseTemporaryScreen().

Referenced by gui::Menu::CreateMenu(), gui::MenuItem::CreateMenuItem(), SetH(), and SetW().

00482 { 00483 int xrel = 0; 00484 int yrel = 0; 00485 bool event = false; 00486 00487 if (UseTemporaryScreen()) 00488 { 00489 if (m_temp_screen) 00490 { 00491 FreeSurface(m_temp_screen); 00492 } 00493 } 00494 if (m_screen) 00495 { 00496 xrel = GetScreen() -> w; 00497 yrel = GetScreen() -> h; 00498 event = true; 00499 FreeSurface(m_screen); 00500 } 00501 00502 m_screen = CreateSDLSurface(true); 00503 if (UseTemporaryScreen()) 00504 { 00505 CreateTemporaryScreen(); 00506 } 00507 00508 if (event) 00509 { 00510 surfacevector_t::iterator it; 00511 xrel = GetScreen() -> w - xrel; 00512 yrel = GetScreen() -> h - yrel; 00513 for (it = m_ChildList.begin(); it != m_ChildList.end(); it++) 00514 { 00515 (*it) -> OnSize(*GetClientRectPtr(), xrel, yrel); 00516 } 00517 } 00518 00519 // GetParent() -> CalculateAbsolute(); 00520 // DrawAll(); 00521 // DrawTemporaryScreen(); 00522 SetDirty(true); 00523 }

void gui::Surface::Remove Surface  ) 
 

Definition at line 389 of file Surface.cpp.

References m_ChildList, and MustBeDeleted().

Referenced by ~Surface().

00390 { 00391 surfacevector_t::iterator it; 00392 00393 for (it = m_ChildList.begin(); it != m_ChildList.end(); it++) 00394 { 00395 Surface *pclSurface = *it; 00396 if (pclSurface == pclChild) 00397 { 00398 m_ChildList.erase(it); 00399 break; 00400 } 00401 } 00402 if (pclChild -> MustBeDeleted()) 00403 { 00404 delete pclChild; 00405 } 00406 }

void gui::Surface::RemoveAllBonds  ) 
 

Definition at line 1798 of file Surface.cpp.

References m_bonds, and SetBond().

Referenced by gui::MenuItem::OnClick(), and gui::Menu::OnRightClick().

01799 { 01800 SetBond(NULL); 01801 while (m_bonds.size() > 0) 01802 { 01803 surfacevector_t::iterator it = m_bonds.begin(); 01804 (*it) -> RemoveAllBonds(); 01805 m_bonds.erase(it); 01806 } 01807 }

void gui::Surface::ResetFillRectsEv  ) 
 

Definition at line 572 of file Surface.cpp.

References SDL_USEREVENT_RESETFILLRECTS.

00573 { 00574 SDL_Event e; 00575 00576 e.type = SDL_USEREVENT; 00577 e.user.code = SDL_USEREVENT_RESETFILLRECTS; 00578 e.user.data1 = NULL; 00579 e.user.data2 = NULL; 00580 SDL_PushEvent(&e); 00581 }

void gui::Surface::SaveDialogs  )  [virtual]
 

Definition at line 2016 of file Surface.cpp.

References Dump(), GetText(), and m_ChildList.

02017 { 02018 if (dynamic_cast<Dialog *>(this)) 02019 { 02020 FILE *fil; 02021 char fn[200]; 02022 02023 sprintf(fn,"%s.xml",GetText()); 02024 if (strlen(fn) > 4) 02025 { 02026 if ((fil = fopen(fn,"wt")) != NULL) 02027 { 02028 fprintf(fil,"<?xml version=\"1.0\"?>\n"); 02029 Dump(fil); 02030 fclose(fil); 02031 } 02032 } 02033 } 02034 for (surfacevector_t::iterator it = m_ChildList.begin(); it != m_ChildList.end(); it++) 02035 { 02036 (*it) -> SaveDialogs(); 02037 } 02038 }

void gui::Surface::SetAbsoluteX coord_t   )  [virtual]
 

Definition at line 1135 of file Surface.cpp.

References m_absoluteRect, and m_x_absolute.

Referenced by CalculateAbsolute().

01136 { 01137 m_absoluteRect.x = x; 01138 m_x_absolute = x; 01139 }

void gui::Surface::SetAbsoluteY coord_t   )  [virtual]
 

Definition at line 1142 of file Surface.cpp.

References m_absoluteRect, and m_y_absolute.

Referenced by CalculateAbsolute().

01143 { 01144 m_absoluteRect.y = y; 01145 m_y_absolute = y; 01146 }

void gui::Surface::SetAlpha alpha_t  ,
bool  bRecurse = true
[virtual]
 

Definition at line 1104 of file Surface.cpp.

References m_bAlphaIsSet, m_ChildList, m_nAlpha, m_screen, and UpdateAlpha().

01105 { 01106 surfacevector_t::iterator it; 01107 m_nAlpha = a; 01108 m_bAlphaIsSet = true; 01109 SDL_SetAlpha(m_screen, SDL_SRCALPHA|SDL_RLEACCEL, a); 01110 if (bRecurse) 01111 { 01112 for (it = m_ChildList.begin(); it != m_ChildList.end(); it++) 01113 { 01114 (*it) -> UpdateAlpha(a); 01115 } 01116 } 01117 }

void gui::Surface::SetAnchorDown bool   )  [virtual]
 

Definition at line 1718 of file Surface.cpp.

References m_bAnchorDown.

Referenced by gui::Dialog::Dialog().

01719 { 01720 m_bAnchorDown = b; 01721 }

void gui::Surface::SetAnchorRight bool   )  [virtual]
 

Definition at line 1706 of file Surface.cpp.

References m_bAnchorRight.

Referenced by gui::Dialog::Dialog().

01707 { 01708 m_bAnchorRight = b; 01709 }

void gui::Surface::SetBgColor Uint8  ,
Uint8  ,
Uint8  ,
Uint8  = SDL_ALPHA_OPAQUE
[virtual]
 

Definition at line 1193 of file Surface.cpp.

References m_bBgColorIsSet, and m_bgColor.

01194 { 01195 m_bgColor.r = r; 01196 m_bgColor.g = g; 01197 m_bgColor.b = b; 01198 m_bgColor.unused = alpha; 01199 m_bBgColorIsSet = true; 01200 }

void gui::Surface::SetBond Surface  )  [private]
 

Definition at line 1786 of file Surface.cpp.

References m_pclBond.

Referenced by Bond(), RemoveAllBonds(), Unbond(), and ~Surface().

01787 { 01788 m_pclBond = s; 01789 }

void gui::Surface::SetChildrenVisible bool   )  [virtual]
 

Definition at line 1178 of file Surface.cpp.

References m_bChildrenVisible.

01179 { 01180 m_bChildrenVisible = b; 01181 }

void gui::Surface::SetClickable bool   )  [virtual]
 

Definition at line 1742 of file Surface.cpp.

References m_bClickable.

01743 { 01744 m_bClickable = b; 01745 }

void gui::Surface::SetDirty bool  ,
bool  bInvalidate = true
[virtual]
 

Definition at line 1622 of file Surface.cpp.

References InvalidateEv(), and m_bDirty.

Referenced by DrawAll(), RecreateSurfaces(), and SetText().

01623 { 01624 if (b && !m_bDirty && bInvalidate) 01625 { 01626 m_bDirty = b; 01627 InvalidateEv(); 01628 } 01629 else 01630 { 01631 m_bDirty = b; 01632 } 01633 }

void gui::Surface::SetFgColor Uint8  ,
Uint8  ,
Uint8  ,
Uint8  = SDL_ALPHA_OPAQUE
[virtual]
 

Definition at line 1212 of file Surface.cpp.

References m_bFgColorIsSet, and m_fgColor.

01213 { 01214 m_fgColor.r = r; 01215 m_fgColor.g = g; 01216 m_fgColor.b = b; 01217 m_fgColor.unused = alpha; 01218 m_bFgColorIsSet = true; 01219 }

void gui::Surface::SetFrameColor Uint8  ,
Uint8  ,
Uint8  ,
Uint8  = SDL_ALPHA_OPAQUE
[virtual]
 

Definition at line 1262 of file Surface.cpp.

References m_bFrameColorIsSet, and m_frameColor.

01263 { 01264 m_frameColor.r = r; 01265 m_frameColor.g = g; 01266 m_frameColor.b = b; 01267 m_frameColor.unused = alpha; 01268 m_bFrameColorIsSet = true; 01269 }

void gui::Surface::SetFrameWidth coord_t   )  [virtual]
 

Definition at line 1228 of file Surface.cpp.

References CalculateClientRect(), m_bFrameWidthIsSet, and m_nFrameWidth.

Referenced by gui::Dialog::Dialog().

01229 { 01230 m_nFrameWidth = fw; 01231 m_bFrameWidthIsSet = true; 01232 01233 CalculateClientRect(); 01234 }

void gui::Surface::SetH coord_t  ,
bool  bRealloc = true
[virtual]
 

Definition at line 1091 of file Surface.cpp.

References GetFrameWidth(), m_absoluteRect, m_clientRect, m_h, and RecreateSurfaces().

01092 { 01093 m_clientRect.h = h - GetFrameWidth() * 2; 01094 m_absoluteRect.h = h; 01095 m_h = h; 01096 01097 if (bRealloc) 01098 { 01099 RecreateSurfaces(); 01100 } 01101 }

void gui::Surface::SetInverted bool   )  [virtual]
 

Definition at line 1572 of file Surface.cpp.

References m_bInverted.

01573 { 01574 m_bInverted = b; 01575 }

void gui::Surface::SetLocalID unsigned  long  )  [virtual]
 

Definition at line 1498 of file Surface.cpp.

References m_local_id.

Referenced by AddChild().

01499 { 01500 m_local_id = l; 01501 }

void gui::Surface::SetMoveable bool   )  [virtual]
 

Definition at line 1610 of file Surface.cpp.

References m_bMoveable.

01611 { 01612 m_bMoveable = b; 01613 }

void gui::Surface::SetMustBeDeleted bool   )  [virtual]
 

Definition at line 1730 of file Surface.cpp.

References m_bMustBeDeleted.

01731 { 01732 m_bMustBeDeleted = b; 01733 }

void gui::Surface::SetParent Surface  )  [virtual]
 

Definition at line 1060 of file Surface.cpp.

References m_pclParent.

Referenced by AddChild().

01061 { 01062 m_pclParent = s; 01063 }

void gui::Surface::SetResizeArea bool   )  [virtual]
 

Definition at line 1694 of file Surface.cpp.

References m_bResizeArea.

Referenced by gui::Dialog::Dialog().

01695 { 01696 m_bResizeArea = b; 01697 }

void gui::Surface::SetText const string &   )  [virtual]
 

Definition at line 1681 of file Surface.cpp.

References m_text, and SetDirty().

01682 { 01683 m_text = str; 01684 SetDirty(true); 01685 }

virtual void gui::Surface::SetTimer long  time_ms,
long  id = 0,
bool  bRepeating = false
[virtual]
 

void gui::Surface::SetTransparent bool   )  [virtual]
 

Definition at line 1584 of file Surface.cpp.

References m_bTransparent.

01585 { 01586 m_bTransparent = b; 01587 }

void gui::Surface::SetTTFont TTFont  )  [virtual]
 

Definition at line 1222 of file Surface.cpp.

References m_pclTTFont.

01223 { 01224 m_pclTTFont = pclTTFont; 01225 }

void gui::Surface::SetUICommand long   )  [virtual]
 

Definition at line 1840 of file Surface.cpp.

References m_uicommand.

01841 { 01842 m_uicommand = id; 01843 }

void gui::Surface::SetUseTemporaryScreen bool   ) 
 

Definition at line 1663 of file Surface.cpp.

References m_bUseTemporaryScreen.

Referenced by CreateTemporaryScreen(), and DrawTemporaryScreen().

01664 { 01665 m_bUseTemporaryScreen = b; 01666 }

void gui::Surface::SetVisible bool   )  [virtual]
 

Definition at line 1149 of file Surface.cpp.

References m_bVisible, m_ChildList, OnHide(), and OnShow().

Referenced by MoveTo().

01150 { 01151 surfacevector_t::iterator it; 01152 01153 if (b != m_bVisible) 01154 { 01155 m_bVisible = b; 01156 for (it = m_ChildList.begin(); it != m_ChildList.end(); it++) 01157 { 01158 if (b) 01159 { 01160 (*it) -> OnShow(); 01161 } 01162 else 01163 { 01164 (*it) -> OnHide(); 01165 } 01166 } 01167 if (!b) 01168 { 01169 } 01170 // if (b) 01171 // { 01172 // BringToTop(); 01173 // } 01174 } 01175 }

void gui::Surface::SetW coord_t  ,
bool  bRealloc = true
[virtual]
 

Definition at line 1078 of file Surface.cpp.

References GetFrameWidth(), m_absoluteRect, m_clientRect, m_w, and RecreateSurfaces().

01079 { 01080 m_clientRect.w = w - GetFrameWidth() * 2; 01081 m_absoluteRect.w = w; 01082 m_w = w; 01083 01084 if (bRealloc) 01085 { 01086 RecreateSurfaces(); 01087 } 01088 }

void gui::Surface::SetX coord_t   )  [virtual]
 

Definition at line 1066 of file Surface.cpp.

References m_x.

Referenced by Move(), MoveTo(), and OnSize().

01067 { 01068 m_x = x; 01069 }

void gui::Surface::SetY coord_t   )  [virtual]
 

Definition at line 1072 of file Surface.cpp.

References m_y.

Referenced by Move(), MoveTo(), and OnSize().

01073 { 01074 m_y = y; 01075 }

void gui::Surface::Unbond Surface  ) 
 

Definition at line 1770 of file Surface.cpp.

References m_bonds, and SetBond().

Referenced by ~Surface().

01771 { 01772 surfacevector_t::iterator it; 01773 01774 for (it = m_bonds.begin(); it != m_bonds.end(); it++) 01775 { 01776 if (*it == s) 01777 { 01778 m_bonds.erase(it); 01779 s -> SetBond(NULL); 01780 return; 01781 } 01782 } 01783 }

void gui::Surface::UpdateAlpha alpha_t   )  [virtual]
 

Definition at line 1120 of file Surface.cpp.

References m_bAlphaIsSet, m_ChildList, m_nAlpha, m_screen, and UpdateAlpha().

Referenced by SetAlpha(), and UpdateAlpha().

01121 { 01122 surfacevector_t::iterator it; 01123 if (!m_bAlphaIsSet) 01124 { 01125 m_nAlpha = a; 01126 SDL_SetAlpha(m_screen, SDL_SRCALPHA|SDL_RLEACCEL, a); 01127 } 01128 for (it = m_ChildList.begin(); it != m_ChildList.end(); it++) 01129 { 01130 (*it) -> UpdateAlpha(a); 01131 } 01132 }

bool gui::Surface::UseTemporaryScreen  ) 
 

Definition at line 1669 of file Surface.cpp.

References m_bUseTemporaryScreen.

Referenced by Blit(), BlitAbsolute(), DrawAll(), DrawTemporaryScreen(), gui::HotButton::OnMouseIn(), gui::HotButton::OnMouseOut(), and RecreateSurfaces().

01670 { 01671 return m_bUseTemporaryScreen; 01672 }


Member Data Documentation

SDL_Rect gui::Surface::m_absoluteRect [private]
 

Definition at line 227 of file Surface.h.

Referenced by GetAbsoluteRect(), GetAbsoluteRectPtr(), SetAbsoluteX(), SetAbsoluteY(), SetH(), SetW(), and Surface().

bool gui::Surface::m_bAlphaIsSet [private]
 

Definition at line 222 of file Surface.h.

Referenced by DumpMembers(), GetAlpha(), SetAlpha(), and UpdateAlpha().

bool gui::Surface::m_bAnchorDown [private]
 

Definition at line 238 of file Surface.h.

Referenced by DumpMembers(), IsAnchorDown(), and SetAnchorDown().

bool gui::Surface::m_bAnchorRight [private]
 

Definition at line 237 of file Surface.h.

Referenced by DumpMembers(), IsAnchorRight(), and SetAnchorRight().

bool gui::Surface::m_bBgColorIsSet [private]
 

Definition at line 212 of file Surface.h.

Referenced by DumpMembers(), GetBgColor(), GetFgColor(), and SetBgColor().

bool gui::Surface::m_bChildrenVisible [private]
 

Definition at line 231 of file Surface.h.

Referenced by Blit(), BlitAbsolute(), DumpMembers(), FindSurface(), and SetChildrenVisible().

bool gui::Surface::m_bClickable [private]
 

Definition at line 240 of file Surface.h.

Referenced by DumpMembers(), IsClickable(), and SetClickable().

bool gui::Surface::m_bDirty [private]
 

Definition at line 235 of file Surface.h.

Referenced by IsDirty(), and SetDirty().

bool gui::Surface::m_bFgColorIsSet [private]
 

Definition at line 215 of file Surface.h.

Referenced by DumpMembers(), GetBgColor(), GetFgColor(), and SetFgColor().

bool gui::Surface::m_bFrameColorIsSet [private]
 

Definition at line 218 of file Surface.h.

Referenced by DumpMembers(), GetFrameColor(), and SetFrameColor().

bool gui::Surface::m_bFrameWidthIsSet [private]
 

Definition at line 224 of file Surface.h.

Referenced by DumpMembers(), GetFrameWidth(), and SetFrameWidth().

SDL_Color gui::Surface::m_bgColor [private]
 

Definition at line 211 of file Surface.h.

Referenced by DumpMembers(), GetBgColor(), GetFgColor(), and SetBgColor().

bool gui::Surface::m_bInverted [private]
 

Definition at line 232 of file Surface.h.

Referenced by IsInverted(), and SetInverted().

bool gui::Surface::m_bMoveable [private]
 

Definition at line 234 of file Surface.h.

Referenced by DumpMembers(), IsMoveable(), and SetMoveable().

bool gui::Surface::m_bMustBeDeleted [private]
 

Definition at line 239 of file Surface.h.

Referenced by MustBeDeleted(), and SetMustBeDeleted().

surfacevector_t gui::Surface::m_bonds [private]
 

Definition at line 245 of file Surface.h.

Referenced by Bond(), CloseAll(), GetExtents(), Move(), MoveTo(), RemoveAllBonds(), Unbond(), and ~Surface().

bool gui::Surface::m_bRedrawTemporary [private]
 

Definition at line 244 of file Surface.h.

Referenced by Blit(), and DrawTemporaryScreen().

bool gui::Surface::m_bResizeArea [private]
 

Definition at line 236 of file Surface.h.

Referenced by DumpMembers(), IsResizeArea(), and SetResizeArea().

bool gui::Surface::m_bTransparent [private]
 

Definition at line 233 of file Surface.h.

Referenced by BlitAbsolute(), DumpMembers(), IsTransparent(), and SetTransparent().

bool gui::Surface::m_bUseTemporaryScreen [private]
 

Definition at line 242 of file Surface.h.

Referenced by DumpMembers(), SetUseTemporaryScreen(), and UseTemporaryScreen().

bool gui::Surface::m_bVisible [private]
 

Definition at line 230 of file Surface.h.

Referenced by Blit(), BlitAbsolute(), DumpMembers(), IsVisible(), and SetVisible().

surfacevector_t gui::Surface::m_ChildList [protected]
 

Definition at line 194 of file Surface.h.

Referenced by AddChild(), Blit(), BlitAbsolute(), BringToTop(), CalculateAbsolute(), CalculateClientRect(), DrawAll(), Dump(), FindSurface(), GetChildOnTop(), RecreateSurfaces(), Remove(), SaveDialogs(), SetAlpha(), SetVisible(), UpdateAlpha(), and ~Surface().

SDL_Rect gui::Surface::m_clientRect [private]
 

Definition at line 225 of file Surface.h.

Referenced by CalculateClientRect(), GetClientRect(), GetClientRectPtr(), SetH(), SetW(), and Surface().

SDL_Color gui::Surface::m_fgColor [private]
 

Definition at line 214 of file Surface.h.

Referenced by DumpMembers(), GetBgColor(), GetFgColor(), and SetFgColor().

SDL_Color gui::Surface::m_frameColor [private]
 

Definition at line 217 of file Surface.h.

Referenced by DumpMembers(), GetFrameColor(), and SetFrameColor().

coord_t gui::Surface::m_h [private]
 

Reimplemented in gui::Menu.

Definition at line 206 of file Surface.h.

Referenced by Blit(), CalculateClientRect(), CreateSDLSurface(), DrawFrame(), DumpMembers(), GetH(), SetH(), and Surface().

unsigned long gui::Surface::m_id [private]
 

Reimplemented in gui::PopupMenuItem.

Definition at line 198 of file Surface.h.

Referenced by GetID().

unsigned long gui::Surface::m_local_id [private]
 

Definition at line 199 of file Surface.h.

Referenced by GetLocalID(), and SetLocalID().

alpha_t gui::Surface::m_nAlpha [private]
 

Definition at line 221 of file Surface.h.

Referenced by DumpMembers(), GetAlpha(), SetAlpha(), and UpdateAlpha().

coord_t gui::Surface::m_nFrameWidth [private]
 

Definition at line 223 of file Surface.h.

Referenced by DumpMembers(), GetFrameWidth(), and SetFrameWidth().

Surface* gui::Surface::m_pclBond [private]
 

Definition at line 246 of file Surface.h.

Referenced by GetBond(), and SetBond().

SDLControl* gui::Surface::m_pclControl [private]
 

Definition at line 201 of file Surface.h.

Referenced by GetSDLControl().

SurfaceHelper* gui::Surface::m_pclHelper [private]
 

Definition at line 202 of file Surface.h.

Surface* gui::Surface::m_pclParent [private]
 

Definition at line 200 of file Surface.h.

Referenced by GetAlpha(), GetBgColor(), GetFgColor(), GetFrameColor(), GetFrameWidth(), GetParent(), GetRoot(), GetSDLControl(), GetTTFont(), and SetParent().

TTFont* gui::Surface::m_pclTTFont [private]
 

Definition at line 220 of file Surface.h.

Referenced by GetTTFont(), and SetTTFont().

SDL_Surface* gui::Surface::m_screen [protected]
 

Definition at line 192 of file Surface.h.

Referenced by GetBgColor(), GetFgColor(), GetFrameColor(), GetScreen(), RecreateSurfaces(), SetAlpha(), Surface(), UpdateAlpha(), and ~Surface().

SDL_Surface* gui::Surface::m_temp_screen [protected]
 

Definition at line 193 of file Surface.h.

Referenced by CreateTemporaryScreen(), DrawTemporaryScreen(), GetTemporaryScreen(), RecreateSurfaces(), and ~Surface().

string gui::Surface::m_text [private]
 

Definition at line 243 of file Surface.h.

Referenced by DumpMembers(), GetText(), and SetText().

long gui::Surface::m_uicommand [private]
 

Definition at line 247 of file Surface.h.

Referenced by DumpMembers(), GetUICommand(), OnButton(), and SetUICommand().

unsigned long gui::Surface::m_unique_id = 0 [static, private]
 

Definition at line 69 of file Surface.cpp.

coord_t gui::Surface::m_w [private]
 

Reimplemented in gui::Menu.

Definition at line 205 of file Surface.h.

Referenced by Blit(), CalculateClientRect(), CreateSDLSurface(), DrawFrame(), DumpMembers(), GetW(), SetW(), and Surface().

coord_t gui::Surface::m_x [private]
 

Definition at line 203 of file Surface.h.

Referenced by Blit(), DumpMembers(), GetX(), and SetX().

coord_t gui::Surface::m_x_absolute [private]
 

Definition at line 207 of file Surface.h.

Referenced by GetAbsoluteX(), and SetAbsoluteX().

coord_t gui::Surface::m_y [private]
 

Definition at line 204 of file Surface.h.

Referenced by Blit(), DumpMembers(), GetY(), and SetY().

coord_t gui::Surface::m_y_absolute [private]
 

Definition at line 208 of file Surface.h.

Referenced by GetAbsoluteY(), and SetAbsoluteY().


The documentation for this class was generated from the following files:
Generated for My SDL C++ Gui by doxygen 1.3.6

www.TV-friendship.com
The matchmaking service with an all new twist.

Quantum 'Teleportation'
Some thoughts
Page, code, and content Copyright (C) 2004 by Anders Hedström