OpenClonk
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 2042 of file C4Gui.h.

Constructor & Destructor Documentation

◆ FrameDecoration()

C4GUI::FrameDecoration::FrameDecoration ( )
inline

Definition at line 2057 of file C4Gui.h.

2057 { Clear(); }

References Clear().

Here is the call graph for this function:

Member Function Documentation

◆ Clear()

void C4GUI::FrameDecoration::Clear ( )

Definition at line 41 of file C4GuiDialogs.cpp.

42  {
43  pSourceDef = nullptr;
48  fctTop.Default();
50  fctRight.Default();
54  fctLeft.Default();
56  }
#define C4GUI_StandardBGColor
Definition: C4Gui.h:66
C4TargetFacet fctRight
Definition: C4Gui.h:2053
C4TargetFacet fctLeft
Definition: C4Gui.h:2053
C4TargetFacet fctTopRight
Definition: C4Gui.h:2053
uint32_t dwBackClr
Definition: C4Gui.h:2052
C4TargetFacet fctTop
Definition: C4Gui.h:2053
C4TargetFacet fctTopLeft
Definition: C4Gui.h:2053
C4TargetFacet fctBottom
Definition: C4Gui.h:2053
bool fHasGfxOutsideClientArea
Definition: C4Gui.h:2055
C4TargetFacet fctBottomLeft
Definition: C4Gui.h:2053
C4TargetFacet fctBottomRight
Definition: C4Gui.h:2053
static const C4ID None
Definition: C4Id.h:39
void Default()
Definition: C4Facet.h:179

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Deref()

void C4GUI::FrameDecoration::Deref ( )
inline

Definition at line 2066 of file C4Gui.h.

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

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

Here is the caller graph for this function:

◆ Draw()

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

Definition at line 121 of file C4GuiDialogs.cpp.

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  }
C4Draw * pDraw
Definition: C4Draw.cpp:42
void DrawBoxDw(C4Surface *sfcDest, int iX1, int iY1, int iX2, int iY2, DWORD dwClr)
Definition: C4Draw.cpp:840
C4Surface * Surface
Definition: C4Facet.h:117
float Hgt
Definition: C4Facet.h:118
float Wdt
Definition: C4Facet.h:118
void Draw(C4Facet &cgo, bool fAspect=true, int32_t iPhaseX=0, int32_t iPhaseY=0, bool fTransparent=true)
Definition: C4Facet.cpp:154
int Wdt
Definition: C4Surface.h:65
int Hgt
Definition: C4Surface.h:65
float TargetY
Definition: C4Facet.h:165
float TargetX
Definition: C4Facet.h:165

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

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ref()

void C4GUI::FrameDecoration::Ref ( )
inline

Definition at line 2065 of file C4Gui.h.

2065 { ++iRefCount; }

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

Here is the caller graph for this function:

◆ SetByDef() [1/2]

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

Definition at line 82 of file C4GuiDialogs.cpp.

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  }
#define PSF_FrameDecoration
Definition: C4GameScript.h:90
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270
C4DefScriptHost Script
Definition: C4Def.h:181
C4ID id
Definition: C4Def.h:101
C4Value Call(C4PropertyName k, C4AulParSet *pPars=nullptr, bool fPassErrors=false)
Definition: C4PropList.h:114
bool IsReady()
Definition: C4ScriptHost.h:54
int32_t getInt() const
Definition: C4Value.h:112

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetByDef() [2/2]

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

Definition at line 77 of file C4GuiDialogs.cpp.

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

References C4Id2Def(), idSourceDef, and SetByDef().

Here is the call graph for this function:

◆ UpdateGfx()

bool C4GUI::FrameDecoration::UpdateGfx ( )

Definition at line 115 of file C4GuiDialogs.cpp.

116  {
117  // simply re-set by def
118  return SetByDef(idSourceDef);
119  }

References idSourceDef, and SetByDef().

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

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ dwBackClr

uint32_t C4GUI::FrameDecoration::dwBackClr

Definition at line 2052 of file C4Gui.h.

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

◆ fctBottom

C4TargetFacet C4GUI::FrameDecoration::fctBottom

Definition at line 2053 of file C4Gui.h.

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

◆ fctBottomLeft

C4TargetFacet C4GUI::FrameDecoration::fctBottomLeft

Definition at line 2053 of file C4Gui.h.

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

◆ fctBottomRight

C4TargetFacet C4GUI::FrameDecoration::fctBottomRight

Definition at line 2053 of file C4Gui.h.

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

◆ fctLeft

C4TargetFacet C4GUI::FrameDecoration::fctLeft

Definition at line 2053 of file C4Gui.h.

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

◆ fctRight

C4TargetFacet C4GUI::FrameDecoration::fctRight

Definition at line 2053 of file C4Gui.h.

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

◆ fctTop

C4TargetFacet C4GUI::FrameDecoration::fctTop

Definition at line 2053 of file C4Gui.h.

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

◆ fctTopLeft

C4TargetFacet C4GUI::FrameDecoration::fctTopLeft

Definition at line 2053 of file C4Gui.h.

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

◆ fctTopRight

C4TargetFacet C4GUI::FrameDecoration::fctTopRight

Definition at line 2053 of file C4Gui.h.

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

◆ fHasGfxOutsideClientArea

bool C4GUI::FrameDecoration::fHasGfxOutsideClientArea

Definition at line 2055 of file C4Gui.h.

Referenced by Clear(), and SetByDef().

◆ iBorderBottom

int C4GUI::FrameDecoration::iBorderBottom

Definition at line 2054 of file C4Gui.h.

Referenced by Clear(), Draw(), C4GameMessage::Draw(), C4GUI::Dialog::GetMarginBottom(), and SetByDef().

◆ iBorderLeft

int C4GUI::FrameDecoration::iBorderLeft

Definition at line 2054 of file C4Gui.h.

Referenced by Clear(), Draw(), C4GameMessage::Draw(), C4GUI::Dialog::GetMarginLeft(), and SetByDef().

◆ iBorderRight

int C4GUI::FrameDecoration::iBorderRight

Definition at line 2054 of file C4Gui.h.

Referenced by Clear(), Draw(), C4GameMessage::Draw(), C4GUI::Dialog::GetMarginRight(), and SetByDef().

◆ iBorderTop

int C4GUI::FrameDecoration::iBorderTop

Definition at line 2054 of file C4Gui.h.

Referenced by Clear(), Draw(), C4GameMessage::Draw(), C4GUI::Dialog::GetMarginTop(), and SetByDef().

◆ idSourceDef

C4ID C4GUI::FrameDecoration::idSourceDef

◆ pSourceDef

C4Def* C4GUI::FrameDecoration::pSourceDef

Definition at line 2050 of file C4Gui.h.

Referenced by Clear(), and SetByDef().


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