Surface.h
Go to the documentation of this file.00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
#ifndef _SURFACE_H
00024
#define _SURFACE_H
00025
00026
00027
namespace gui
00028 {
00029
class SDLControl;
00030
class SurfaceHelper;
00031
class Color;
00032
class TTFont;
00033
00034 class Surface
00035 {
00036
public:
00037
Surface(
SDLControl *pclControl,
00038
coord_t x,
coord_t y,
coord_t w,
coord_t h,
SurfaceHelper * = NULL);
00039
Surface(
Surface *pclParent,
00040
coord_t x,
coord_t y,
coord_t w,
coord_t h,
SurfaceHelper * = NULL);
00041
Surface(
Surface *pclParent,
SurfaceHelper * = NULL);
00042
virtual ~Surface();
00043
00044
virtual void Dump(FILE *);
00045
virtual void DumpMembers(FILE *);
00046
virtual void SaveDialogs();
00047
00048
void CreateTemporaryScreen();
00049
void DrawTemporaryScreen();
00050
void SetUseTemporaryScreen(
bool);
00051
bool UseTemporaryScreen();
00052
virtual SDL_Surface *
GetTemporaryScreen();
00053
00054
virtual void AddChild(
Surface *);
00055
void BringToTop(
Surface *);
00056
void BringToTop();
00057
Surface *
GetChildOnTop();
00058
void Remove(
Surface *);
00059
Surface *
FindSurface(
coord_t,
coord_t,
coord_t X = 0,
coord_t Y = 0);
00060
void CalculateAbsolute();
00061
void RecreateSurfaces();
00062
void FreeSurface(SDL_Surface *);
00063
void CalculateClientRect();
00064
00065
void InvalidateEv();
00066
void InvalidateRectEv(SDL_Rect &);
00067
void FillRectEv(SDL_Rect &);
00068
void ResetFillRectsEv();
00069
00070
virtual void DrawAll();
00071
void Blit(
coord_t X = 0,
coord_t Y = 0,SDL_Surface * = NULL);
00072
void BlitAbsolute(SDL_Rect *,SDL_Surface * = NULL);
00073
00074
void Move(
Surface *rootSurface,
coord_t,
coord_t);
00075
void MoveTo(
Surface *,
coord_t,
coord_t,
bool bVisible =
true);
00076
00077
void Bond(
Surface *);
00078
void Unbond(
Surface *);
00079
private:
00080
void SetBond(
Surface *);
00081
public:
00082
Surface *
GetBond();
00083
void RemoveAllBonds();
00084
void CloseAll();
00085
void GetExtents(SDL_Rect &);
00086
00087
virtual void OnEvent(
surface_event_t *);
00088
virtual void OnMouseIn();
00089
virtual void OnMouseOut();
00090
virtual void OnKeyDown(SDL_keysym);
00091
virtual void OnKeyUp(SDL_keysym);
00092
virtual void OnButton();
00093
virtual void OnClose();
00094
virtual void OnFocus();
00095
virtual void OnLostFocus();
00096
virtual void OnHide();
00097
virtual void OnShow();
00098
virtual void OnSize(SDL_Rect &,
int xrel,
int yrel);
00099
virtual void OnMouseMove(
coord_t x,
coord_t y,
coord_t xrel,
coord_t yrel);
00100
virtual void OnRightClick(
coord_t x,
coord_t y);
00101
virtual void OnClick(
coord_t x,
coord_t y);
00102
virtual void OnTimer(
long id);
00103
00104
virtual void SetTimer(
long time_ms,
long id = 0,
bool bRepeating =
false);
00105
virtual void SetParent(
Surface *);
00106
virtual void SetX(
coord_t);
00107
virtual void SetY(
coord_t);
00108
virtual void SetW(
coord_t,
bool bRealloc =
true);
00109
virtual void SetH(
coord_t,
bool bRealloc =
true);
00110
virtual void SetAbsoluteX(
coord_t);
00111
virtual void SetAbsoluteY(
coord_t);
00112
00113
00114
00115
00116
virtual void SetBgColor(Uint8,Uint8,Uint8,Uint8 = SDL_ALPHA_OPAQUE);
00117
virtual void SetFgColor(Uint8,Uint8,Uint8,Uint8 = SDL_ALPHA_OPAQUE);
00118
virtual void SetFrameColor(Uint8,Uint8,Uint8,Uint8 = SDL_ALPHA_OPAQUE);
00119
00120
virtual void SetTTFont(
TTFont *);
00121
virtual void SetFrameWidth(
coord_t);
00122
virtual void SetAlpha(
alpha_t,
bool bRecurse =
true);
00123
virtual void UpdateAlpha(
alpha_t);
00124
virtual void SetLocalID(
unsigned long);
00125
00126
00127
virtual void SetText(
const string &);
00128
virtual void SetUICommand(
long);
00129
00130
virtual void SetVisible(
bool);
00131
virtual void SetChildrenVisible(
bool);
00132
virtual void SetInverted(
bool);
00133
virtual void SetTransparent(
bool);
00134
virtual void SetMoveable(
bool);
00135
virtual void SetDirty(
bool,
bool bInvalidate =
true);
00136
virtual void SetResizeArea(
bool);
00137
virtual void SetAnchorRight(
bool);
00138
virtual void SetAnchorDown(
bool);
00139
virtual void SetMustBeDeleted(
bool);
00140
virtual void SetClickable(
bool);
00141
00142
virtual SDL_Surface *
GetScreen();
00143
virtual Surface *
GetParent();
00144
virtual Surface *
GetRoot();
00145
virtual SDL_Rect *
GetClientRectPtr();
00146
virtual SDL_Rect
GetClientRect();
00147
virtual SDL_Rect *
GetAbsoluteRectPtr();
00148
virtual SDL_Rect
GetAbsoluteRect();
00149
virtual SDLControl *
GetSDLControl();
00150
virtual unsigned long GetID();
00151
virtual unsigned long GetLocalID();
00152
00153
virtual coord_t GetX();
00154
virtual coord_t GetY();
00155
virtual coord_t GetW();
00156
virtual coord_t GetH();
00157
virtual coord_t GetAbsoluteX();
00158
virtual coord_t GetAbsoluteY();
00159
00160
virtual const char *
GetText();
00161
virtual long GetUICommand();
00162
00163
virtual bool IsVisible();
00164
virtual bool IsInverted();
00165
virtual bool IsTransparent();
00166
virtual bool IsMoveable();
00167
virtual bool IsDirty();
00168
virtual bool IsResizeArea();
00169
virtual bool IsAnchorRight();
00170
virtual bool IsAnchorDown();
00171
virtual bool MustBeDeleted();
00172
virtual bool IsClickable();
00173
00174
00175
color_t GetBgColor();
00176
void GetBgColor(SDL_Color &);
00177
color_t GetFgColor();
00178
void GetFgColor(SDL_Color &);
00179
color_t GetFrameColor();
00180
void GetFrameColor(SDL_Color &);
00181
00182
TTFont *
GetTTFont();
00183
coord_t GetFrameWidth();
00184
alpha_t GetAlpha();
00185
00186
virtual void DrawFrame(SDL_Surface *,
coord_t,Uint32);
00187
00188
protected:
00189
virtual void Draw();
00190 SDL_Surface *
CreateSDLSurface(
bool);
00191
00192 SDL_Surface *
m_screen;
00193 SDL_Surface *
m_temp_screen;
00194 surfacevector_t m_ChildList;
00195
00196
private:
00197
static unsigned long m_unique_id;
00198 unsigned long m_id;
00199 unsigned long m_local_id;
00200 Surface *
m_pclParent;
00201 SDLControl *
m_pclControl;
00202 SurfaceHelper *
m_pclHelper;
00203 coord_t m_x;
00204 coord_t m_y;
00205 coord_t m_w;
00206 coord_t m_h;
00207 coord_t m_x_absolute;
00208 coord_t m_y_absolute;
00209
00210
00211 SDL_Color
m_bgColor;
00212 bool m_bBgColorIsSet;
00213
00214 SDL_Color
m_fgColor;
00215 bool m_bFgColorIsSet;
00216
00217 SDL_Color
m_frameColor;
00218 bool m_bFrameColorIsSet;
00219
00220 TTFont *
m_pclTTFont;
00221 alpha_t m_nAlpha;
00222 bool m_bAlphaIsSet;
00223 coord_t m_nFrameWidth;
00224 bool m_bFrameWidthIsSet;
00225 SDL_Rect
m_clientRect;
00226
00227 SDL_Rect
m_absoluteRect;
00228
00229
00230 bool m_bVisible;
00231 bool m_bChildrenVisible;
00232 bool m_bInverted;
00233 bool m_bTransparent;
00234 bool m_bMoveable;
00235 bool m_bDirty;
00236 bool m_bResizeArea;
00237 bool m_bAnchorRight;
00238 bool m_bAnchorDown;
00239 bool m_bMustBeDeleted;
00240 bool m_bClickable;
00241
00242 bool m_bUseTemporaryScreen;
00243 string
m_text;
00244 bool m_bRedrawTemporary;
00245 surfacevector_t m_bonds;
00246 Surface *
m_pclBond;
00247 long m_uicommand;
00248 };
00249 }
00250
00251
00252
#endif // _SURFACE_H
Generated
for
My SDL C++ Gui by
1.3.6
Page, code, and content Copyright (C) 2004 by Anders Hedström