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 { Clear(); }

Here is the call graph for this function:

Member Function Documentation

void C4GUI::FrameDecoration::Clear ( )

Definition at line 41 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().

42  {
43  pSourceDef = nullptr;
48  fctTop.Default();
50  fctRight.Default();
54  fctLeft.Default();
56  }
#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:39
C4TargetFacet fctTopRight
Definition: C4Gui.h:2052
C4TargetFacet fctBottomLeft
Definition: C4Gui.h:2052
void Default()
Definition: C4Facet.h:179
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 121 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().

122  {
123  // draw BG
124  int ox = cgo.TargetX+rcBounds.x, oy = cgo.TargetY+rcBounds.y;
125  pDraw->DrawBoxDw(cgo.Surface, ox,oy,ox+rcBounds.Wdt-1,oy+rcBounds.Hgt-1,dwBackClr);
126  // draw borders
127  int x,y,Q;
128  // top
129  if ((Q=fctTop.Wdt))
130  {
131  for (x = iBorderLeft; x < rcBounds.Wdt-iBorderRight; x += fctTop.Wdt)
132  {
133  int w = std::min<int>(fctTop.Wdt, rcBounds.Wdt-iBorderRight-x);
134  fctTop.Wdt = w;
135  fctTop.Draw(cgo.Surface, ox+x, oy+fctTop.TargetY);
136  }
137  fctTop.Wdt = Q;
138  }
139  // left
140  if ((Q=fctLeft.Hgt))
141  {
142  for (y = iBorderTop; y < rcBounds.Hgt-iBorderBottom; y += fctLeft.Hgt)
143  {
144  int h = std::min<int>(fctLeft.Hgt, rcBounds.Hgt-iBorderBottom-y);
145  fctLeft.Hgt = h;
146  fctLeft.Draw(cgo.Surface, ox+fctLeft.TargetX, oy+y);
147  }
148  fctLeft.Hgt = Q;
149  }
150  // right
151  if ((Q=fctRight.Hgt))
152  {
153  for (y = iBorderTop; y < rcBounds.Hgt-iBorderBottom; y += fctRight.Hgt)
154  {
155  int h = std::min<int>(fctRight.Hgt, rcBounds.Hgt-iBorderBottom-y);
156  fctRight.Hgt = h;
157  fctRight.Draw(cgo.Surface, ox+rcBounds.Wdt-iBorderRight+fctRight.TargetX, oy+y);
158  }
159  fctRight.Hgt = Q;
160  }
161  // bottom
162  if ((Q=fctBottom.Wdt))
163  {
164  for (x = iBorderLeft; x < rcBounds.Wdt-iBorderRight; x += fctBottom.Wdt)
165  {
166  int w = std::min<int>(fctBottom.Wdt, rcBounds.Wdt-iBorderRight-x);
167  fctBottom.Wdt = w;
168  fctBottom.Draw(cgo.Surface, ox+x, oy+rcBounds.Hgt-iBorderBottom+fctBottom.TargetY);
169  }
170  fctBottom.Wdt = Q;
171  }
172  // draw edges
177  }
int Wdt
Definition: C4Surface.h:65
int Hgt
Definition: C4Surface.h:65
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:846
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:42
C4TargetFacet fctTopRight
Definition: C4Gui.h:2052
float TargetX
Definition: C4Facet.h:165
C4TargetFacet fctBottomLeft
Definition: C4Gui.h:2052
float Hgt
Definition: C4Facet.h:118
C4TargetFacet fctTopLeft
Definition: C4Gui.h:2052
C4TargetFacet fctLeft
Definition: C4Gui.h:2052
C4TargetFacet fctBottom
Definition: C4Gui.h:2052
C4Surface * Surface
Definition: C4Facet.h:117
float TargetY
Definition: C4Facet.h:165
float Wdt
Definition: C4Facet.h:118

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 82 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().

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

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 77 of file C4GuiDialogs.cpp.

References C4Id2Def(), and SetByDef().

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

Here is the call graph for this function:

bool C4GUI::FrameDecoration::UpdateGfx ( )

Definition at line 115 of file C4GuiDialogs.cpp.

References idSourceDef, and SetByDef().

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

116  {
117  // simply re-set by def
118  return SetByDef(idSourceDef);
119  }
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: