OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4GUI::FrameDecoration Class Reference

#include <C4Gui.h>

Collaboration diagram for C4GUI::FrameDecoration:
[legend]

Public Member Functions

 FrameDecoration ()
 
void Clear ()
 
bool SetByDef (C4Def *pSrcDef)
 
bool SetByDef (C4ID idSourceDef)
 
bool UpdateGfx ()
 
void Ref ()
 
void Deref ()
 
void Draw (C4TargetFacet &cgo, C4Rect &rcDrawArea)
 

Public Attributes

C4DefpSourceDef
 
C4ID idSourceDef
 
uint32_t dwBackClr
 
C4TargetFacet fctTop
 
C4TargetFacet fctTopRight
 
C4TargetFacet fctRight
 
C4TargetFacet fctBottomRight
 
C4TargetFacet fctBottom
 
C4TargetFacet fctBottomLeft
 
C4TargetFacet fctLeft
 
C4TargetFacet fctTopLeft
 
int iBorderTop
 
int iBorderLeft
 
int iBorderRight
 
int iBorderBottom
 
bool fHasGfxOutsideClientArea
 

Detailed Description

Definition at line 2041 of file C4Gui.h.

Constructor & Destructor Documentation

C4GUI::FrameDecoration::FrameDecoration ( )
inline

Definition at line 2056 of file C4Gui.h.

References Clear().

2056 : iRefCount(0) { Clear(); }

Here is the call graph for this function:

Member Function Documentation

void C4GUI::FrameDecoration::Clear ( )

Definition at line 42 of file C4GuiDialogs.cpp.

References C4GUI_StandardBGColor, C4TargetFacet::Default(), dwBackClr, fctBottom, fctBottomLeft, fctBottomRight, fctLeft, fctRight, fctTop, fctTopLeft, fctTopRight, fHasGfxOutsideClientArea, iBorderBottom, iBorderLeft, iBorderRight, iBorderTop, idSourceDef, C4ID::None, and pSourceDef.

Referenced by FrameDecoration(), and SetByDef().

43  {
44  pSourceDef = nullptr;
49  fctTop.Default();
51  fctRight.Default();
55  fctLeft.Default();
57  }
#define C4GUI_StandardBGColor
Definition: C4Gui.h:66
C4TargetFacet fctBottomRight
Definition: C4Gui.h:2052
C4TargetFacet fctRight
Definition: C4Gui.h:2052
C4TargetFacet fctTop
Definition: C4Gui.h:2052
uint32_t dwBackClr
Definition: C4Gui.h:2051
static const C4ID None
Definition: C4Id.h:42
C4TargetFacet fctTopRight
Definition: C4Gui.h:2052
C4TargetFacet fctBottomLeft
Definition: C4Gui.h:2052
void Default()
Definition: C4Facet.h:181
C4TargetFacet fctTopLeft
Definition: C4Gui.h:2052
C4TargetFacet fctLeft
Definition: C4Gui.h:2052
C4TargetFacet fctBottom
Definition: C4Gui.h:2052
bool fHasGfxOutsideClientArea
Definition: C4Gui.h:2054

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::FrameDecoration::Deref ( )
inline

Definition at line 2065 of file C4Gui.h.

Referenced by C4GUI::Dialog::ClearFrameDeco(), C4GUI::Dialog::SetFrameDeco(), and C4GUI::Dialog::~Dialog().

2065 { if (!--iRefCount) delete this; }

Here is the caller graph for this function:

void C4GUI::FrameDecoration::Draw ( C4TargetFacet cgo,
C4Rect rcDrawArea 
)

Definition at line 122 of file C4GuiDialogs.cpp.

References C4Facet::Draw(), C4Draw::DrawBoxDw(), dwBackClr, fctBottom, fctBottomLeft, fctBottomRight, fctLeft, fctRight, fctTop, fctTopLeft, fctTopRight, C4Rect::Hgt, C4Facet::Hgt, iBorderBottom, iBorderLeft, iBorderRight, iBorderTop, pDraw, C4Facet::Surface, C4TargetFacet::TargetX, C4TargetFacet::TargetY, C4Rect::Wdt, C4Facet::Wdt, C4Rect::x, and C4Rect::y.

Referenced by C4GameMessage::Draw(), C4ScriptGuiWindow::Draw(), and C4GUI::Dialog::DrawElement().

123  {
124  // draw BG
125  int ox = cgo.TargetX+rcBounds.x, oy = cgo.TargetY+rcBounds.y;
126  pDraw->DrawBoxDw(cgo.Surface, ox,oy,ox+rcBounds.Wdt-1,oy+rcBounds.Hgt-1,dwBackClr);
127  // draw borders
128  int x,y,Q;
129  // top
130  if ((Q=fctTop.Wdt))
131  {
132  for (x = iBorderLeft; x < rcBounds.Wdt-iBorderRight; x += fctTop.Wdt)
133  {
134  int w = std::min<int>(fctTop.Wdt, rcBounds.Wdt-iBorderRight-x);
135  fctTop.Wdt = w;
136  fctTop.Draw(cgo.Surface, ox+x, oy+fctTop.TargetY);
137  }
138  fctTop.Wdt = Q;
139  }
140  // left
141  if ((Q=fctLeft.Hgt))
142  {
143  for (y = iBorderTop; y < rcBounds.Hgt-iBorderBottom; y += fctLeft.Hgt)
144  {
145  int h = std::min<int>(fctLeft.Hgt, rcBounds.Hgt-iBorderBottom-y);
146  fctLeft.Hgt = h;
147  fctLeft.Draw(cgo.Surface, ox+fctLeft.TargetX, oy+y);
148  }
149  fctLeft.Hgt = Q;
150  }
151  // right
152  if ((Q=fctRight.Hgt))
153  {
154  for (y = iBorderTop; y < rcBounds.Hgt-iBorderBottom; y += fctRight.Hgt)
155  {
156  int h = std::min<int>(fctRight.Hgt, rcBounds.Hgt-iBorderBottom-y);
157  fctRight.Hgt = h;
158  fctRight.Draw(cgo.Surface, ox+rcBounds.Wdt-iBorderRight+fctRight.TargetX, oy+y);
159  }
160  fctRight.Hgt = Q;
161  }
162  // bottom
163  if ((Q=fctBottom.Wdt))
164  {
165  for (x = iBorderLeft; x < rcBounds.Wdt-iBorderRight; x += fctBottom.Wdt)
166  {
167  int w = std::min<int>(fctBottom.Wdt, rcBounds.Wdt-iBorderRight-x);
168  fctBottom.Wdt = w;
169  fctBottom.Draw(cgo.Surface, ox+x, oy+rcBounds.Hgt-iBorderBottom+fctBottom.TargetY);
170  }
171  fctBottom.Wdt = Q;
172  }
173  // draw edges
178  }
int Wdt
Definition: C4Surface.h:67
int Hgt
Definition: C4Surface.h:67
C4TargetFacet fctBottomRight
Definition: C4Gui.h:2052
C4TargetFacet fctRight
Definition: C4Gui.h:2052
C4TargetFacet fctTop
Definition: C4Gui.h:2052
uint32_t dwBackClr
Definition: C4Gui.h:2051
void DrawBoxDw(C4Surface *sfcDest, int iX1, int iY1, int iX2, int iY2, DWORD dwClr)
Definition: C4Draw.cpp:849
void Draw(C4Facet &cgo, bool fAspect=true, int32_t iPhaseX=0, int32_t iPhaseY=0, bool fTransparent=true)
Definition: C4Facet.cpp:154
C4Draw * pDraw
Definition: C4Draw.cpp:45
C4TargetFacet fctTopRight
Definition: C4Gui.h:2052
float TargetX
Definition: C4Facet.h:167
C4TargetFacet fctBottomLeft
Definition: C4Gui.h:2052
float Hgt
Definition: C4Facet.h:120
C4TargetFacet fctTopLeft
Definition: C4Gui.h:2052
C4TargetFacet fctLeft
Definition: C4Gui.h:2052
C4TargetFacet fctBottom
Definition: C4Gui.h:2052
C4Surface * Surface
Definition: C4Facet.h:119
float TargetY
Definition: C4Facet.h:167
float Wdt
Definition: C4Facet.h:120

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::FrameDecoration::Ref ( )
inline

Definition at line 2064 of file C4Gui.h.

Referenced by C4GUI::Dialog::SetFrameDeco().

2064 { ++iRefCount; }

Here is the caller graph for this function:

bool C4GUI::FrameDecoration::SetByDef ( C4Def pSrcDef)

Definition at line 83 of file C4GuiDialogs.cpp.

References C4PropList::Call(), Clear(), dwBackClr, fctBottom, fctBottomLeft, fctBottomRight, fctLeft, fctRight, fctTop, fctTopLeft, fctTopRight, fHasGfxOutsideClientArea, FormatString(), C4Value::getInt(), C4Facet::Hgt, iBorderBottom, iBorderLeft, iBorderRight, iBorderTop, C4Def::id, idSourceDef, C4ScriptHost::IsReady(), PSF_FrameDecoration, pSourceDef, C4Def::Script, C4TargetFacet::TargetX, C4TargetFacet::TargetY, and C4Facet::Wdt.

Referenced by C4GameMessage::Init(), SetByDef(), and UpdateGfx().

84  {
85  if (!pSrcDef) return false;
86  // script compiled?
87  if (!pSrcDef->Script.IsReady()) return false;
88  // reset old
89  Clear();
90  this->pSourceDef = pSrcDef;
91  this->idSourceDef = pSrcDef->id;
92  // query values
93  dwBackClr = pSrcDef->Call(FormatString(PSF_FrameDecoration, "BackClr" ).getData()).getInt();
94  iBorderTop = pSrcDef->Call(FormatString(PSF_FrameDecoration, "BorderTop" ).getData()).getInt();
95  iBorderLeft = pSrcDef->Call(FormatString(PSF_FrameDecoration, "BorderLeft" ).getData()).getInt();
96  iBorderRight = pSrcDef->Call(FormatString(PSF_FrameDecoration, "BorderRight" ).getData()).getInt();
97  iBorderBottom = pSrcDef->Call(FormatString(PSF_FrameDecoration, "BorderBottom").getData()).getInt();
98  // get gfx
99  SetFacetByAction(pSrcDef, fctTop , "Top" );
100  SetFacetByAction(pSrcDef, fctTopRight , "TopRight" );
101  SetFacetByAction(pSrcDef, fctRight , "Right" );
102  SetFacetByAction(pSrcDef, fctBottomRight, "BottomRight");
103  SetFacetByAction(pSrcDef, fctBottom , "Bottom" );
104  SetFacetByAction(pSrcDef, fctBottomLeft , "BottomLeft" );
105  SetFacetByAction(pSrcDef, fctLeft , "Left" );
106  SetFacetByAction(pSrcDef, fctTopLeft , "TopLeft" );
107  // check for gfx outside main area
109  || (fctTopLeft.TargetX < 0) || (fctLeft.TargetX < 0) || (fctBottomLeft.TargetX < 0)
112  // k, done
113  return true;
114  }
C4ID id
Definition: C4Def.h:103
C4TargetFacet fctBottomRight
Definition: C4Gui.h:2052
C4TargetFacet fctRight
Definition: C4Gui.h:2052
C4TargetFacet fctTop
Definition: C4Gui.h:2052
uint32_t dwBackClr
Definition: C4Gui.h:2051
bool IsReady()
Definition: C4ScriptHost.h:53
C4TargetFacet fctTopRight
Definition: C4Gui.h:2052
int32_t getInt() const
Definition: C4Value.h:112
float TargetX
Definition: C4Facet.h:167
C4TargetFacet fctBottomLeft
Definition: C4Gui.h:2052
float Hgt
Definition: C4Facet.h:120
C4TargetFacet fctTopLeft
Definition: C4Gui.h:2052
C4DefScriptHost Script
Definition: C4Def.h:184
C4TargetFacet fctLeft
Definition: C4Gui.h:2052
C4TargetFacet fctBottom
Definition: C4Gui.h:2052
float TargetY
Definition: C4Facet.h:167
C4Value Call(C4PropertyName k, C4AulParSet *pPars=0, bool fPassErrors=false)
Definition: C4PropList.h:112
float Wdt
Definition: C4Facet.h:120
bool fHasGfxOutsideClientArea
Definition: C4Gui.h:2054
#define PSF_FrameDecoration
Definition: C4GameScript.h:90
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:277

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::FrameDecoration::SetByDef ( C4ID  idSourceDef)

Definition at line 78 of file C4GuiDialogs.cpp.

References C4Id2Def(), and SetByDef().

79  {
80  return SetByDef(C4Id2Def(idSourceDef));
81  }
bool SetByDef(C4Def *pSrcDef)
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:80

Here is the call graph for this function:

bool C4GUI::FrameDecoration::UpdateGfx ( )

Definition at line 116 of file C4GuiDialogs.cpp.

References idSourceDef, and SetByDef().

Referenced by C4DefGraphicsPtrBackupEntry::AssignUpdate(), and C4GameMessage::UpdateDef().

117  {
118  // simply re-set by def
119  return SetByDef(idSourceDef);
120  }
bool SetByDef(C4Def *pSrcDef)

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

uint32_t C4GUI::FrameDecoration::dwBackClr

Definition at line 2051 of file C4Gui.h.

Referenced by Clear(), Draw(), and SetByDef().

C4TargetFacet C4GUI::FrameDecoration::fctBottom

Definition at line 2052 of file C4Gui.h.

Referenced by Clear(), Draw(), and SetByDef().

C4TargetFacet C4GUI::FrameDecoration::fctBottomLeft

Definition at line 2052 of file C4Gui.h.

Referenced by Clear(), Draw(), and SetByDef().

C4TargetFacet C4GUI::FrameDecoration::fctBottomRight

Definition at line 2052 of file C4Gui.h.

Referenced by Clear(), Draw(), and SetByDef().

C4TargetFacet C4GUI::FrameDecoration::fctLeft

Definition at line 2052 of file C4Gui.h.

Referenced by Clear(), Draw(), and SetByDef().

C4TargetFacet C4GUI::FrameDecoration::fctRight

Definition at line 2052 of file C4Gui.h.

Referenced by Clear(), Draw(), and SetByDef().

C4TargetFacet C4GUI::FrameDecoration::fctTop

Definition at line 2052 of file C4Gui.h.

Referenced by Clear(), Draw(), and SetByDef().

C4TargetFacet C4GUI::FrameDecoration::fctTopLeft

Definition at line 2052 of file C4Gui.h.

Referenced by Clear(), Draw(), and SetByDef().

C4TargetFacet C4GUI::FrameDecoration::fctTopRight

Definition at line 2052 of file C4Gui.h.

Referenced by Clear(), Draw(), and SetByDef().

bool C4GUI::FrameDecoration::fHasGfxOutsideClientArea

Definition at line 2054 of file C4Gui.h.

Referenced by Clear(), and SetByDef().

int C4GUI::FrameDecoration::iBorderBottom
int C4GUI::FrameDecoration::iBorderLeft
int C4GUI::FrameDecoration::iBorderRight
int C4GUI::FrameDecoration::iBorderTop
C4ID C4GUI::FrameDecoration::idSourceDef
C4Def* C4GUI::FrameDecoration::pSourceDef

Definition at line 2049 of file C4Gui.h.

Referenced by Clear(), and SetByDef().


The documentation for this class was generated from the following files: