OpenClonk
C4GuiLabels.cpp
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
5  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
6  *
7  * Distributed under the terms of the ISC license; see accompanying file
8  * "COPYING" for details.
9  *
10  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11  * See accompanying file "TRADEMARK" for details.
12  *
13  * To redistribute this file separately, substitute the full license texts
14  * for the above references.
15  */
16 // generic user interface
17 // eye candy
18 
19 #include "C4Include.h"
20 #include "gui/C4Gui.h"
21 
22 #include "graphics/C4Draw.h"
24 #include "gui/C4MouseControl.h"
25 
26 namespace C4GUI
27 {
28 
29 // --------------------------------------------------
30 // Label
31 
33  {
34  // print out
35  pDraw->TextOut(sText.getData(), *pFont, 1.0f, cgo.Surface, x0 + cgo.TargetX, rcBounds.y + cgo.TargetY, dwFgClr, iAlign, fMarkup);
36  }
37 
38  Label::Label(const char *szLblText, int32_t iX0, int32_t iTop, int32_t iAlign, DWORD dwFClr, CStdFont *pFont, bool fMakeReadableOnBlack, bool fMarkup)
39  : Element(), dwFgClr(dwFClr), x0(iX0), iAlign(iAlign), pFont(pFont), cHotkey(0), fAutosize(true), fMarkup(fMarkup), pClickFocusControl(nullptr)
40  {
41  // make color readable
42  if (fMakeReadableOnBlack) MakeColorReadableOnBlack(dwFgClr);
43  // default font
44  if (!this->pFont) this->pFont = &::GraphicsResource.TextFont;
45  // set top
46  rcBounds.y = iTop;
47  // update text
48  SetText(szLblText);
49  }
50 
51  Label::Label(const char *szLblText, const C4Rect &rcBounds, int32_t iAlign, DWORD dwFClr, CStdFont *pFont, bool fMakeReadableOnBlack, bool fAutosize, bool fMarkup)
52  : Element(), dwFgClr(dwFClr), iAlign(iAlign), pFont(pFont), cHotkey(0), fAutosize(fAutosize), fMarkup(fMarkup), pClickFocusControl(nullptr)
53  {
54  // make color readable
55  if (fMakeReadableOnBlack) MakeColorReadableOnBlack(dwFgClr);
56  this->rcBounds = rcBounds;
57  // default font
58  if (!this->pFont) this->pFont = &::GraphicsResource.TextFont;
59  // set x0
60  UpdateOwnPos();
61  // update text
62  SetText(szLblText);
63  }
64 
65  void Label::MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
66  {
67  // left-click changes focus
68  if (pClickFocusControl && iButton == C4MC_Button_LeftDown)
70  // inherited
71  Element::MouseInput(rMouse, iButton, iX, iY, dwKeyParam);
72  }
73 
74  void Label::SetText(const char *szToText, bool fAllowHotkey)
75  {
76  // set new text
77  if (szToText)
78  {
79  sText.Copy(szToText);
80  // expand hotkey markup
81  if (fAllowHotkey && fMarkup) ExpandHotkeyMarkup(sText, cHotkey);
82  }
83  else
84  {
85  sText="";
86  cHotkey=0;
87  }
88  // update according to text only if autosize label (not wooden)
89  if (!fAutosize) return;
90  // get text extents
92  // update pos
93  SetX0(x0);
94  }
95 
97  {
98  // update text drawing pos
99  switch (iAlign)
100  {
101  case ALeft: x0 = rcBounds.x + GetLeftIndent(); break;
102  case ACenter: x0 = rcBounds.x+rcBounds.Wdt/2; break;
103  case ARight: x0 = rcBounds.x+rcBounds.Wdt; break;
104  }
105  }
106 
107  bool Label::OnHotkey(uint32_t cHotkey)
108  {
109  // if hotkey matches and focus control is assigned, set focus
110  if (this->cHotkey == cHotkey && pClickFocusControl)
111  {
113  return true;
114  }
115  else return false;
116  }
117 
118  void Label::SetX0(int32_t iToX0)
119  {
120  x0 = iToX0;
121  // update x-startpos
122  switch (iAlign)
123  {
124  case ALeft: rcBounds.x = x0; break;
125  case ACenter: rcBounds.x = x0 - rcBounds.Wdt/2; break;
126  case ARight: rcBounds.x = x0 - rcBounds.Wdt; break;
127  }
128  // size might have changed
129  UpdateSize();
130  }
131 
132 
133 // --------------------------------------------------
134 // WoodenLabel
135 
137  {
138  // draw wood
140  // draw symbol
141  if (fctIcon.Surface)
142  {
143  C4Facet cgoSymbol(cgo.Surface, cgo.TargetX + rcBounds.x + 1, cgo.TargetY + rcBounds.y + 1, rcBounds.Hgt-2, rcBounds.Hgt-2);
144  fctIcon.Draw(cgoSymbol);
145  }
146  // calculations for automatic scrolling
147  int32_t iXOff = 0;
148  if (iAlign == ALeft) iXOff += 5;
149  if (iAutoScrollDelay)
150  {
152  if (tNow >= tLastChangeTime + iAutoScrollDelay)
153  {
154  if (!iScrollDir) iScrollDir=1;
155  int32_t iMaxScroll = std::max<int32_t>(pFont->GetTextWidth(sText.getData(), true) + (x0 - rcBounds.x) + iXOff + GetRightIndent() - rcBounds.Wdt, 0);
156  if (iMaxScroll)
157  {
158  iScrollPos += iScrollDir;
159  if (iScrollPos >= iMaxScroll || iScrollPos < 0)
160  {
161  iScrollDir = -iScrollDir;
162  iScrollPos += iScrollDir;
163  tLastChangeTime = tNow;
164  }
165  }
166  }
167  iXOff -= iScrollPos;
168  }
169  // print out text; clipped
172  pDraw->TextOut(sText.getData(), *pFont, 1.0f, cgo.Surface, x0 + cgo.TargetX + iXOff, rcBounds.y + cgo.TargetY + (rcBounds.Hgt-pFont->GetLineHeight())/2-1, dwFgClr, iAlign);
174  }
175 
177  {
178  if (!pUseFont) pUseFont = &(::GraphicsResource.TextFont);
179  return std::max<int32_t>(pUseFont->GetLineHeight(), C4GUI_MinWoodBarHgt);
180  }
181 
182  void WoodenLabel::SetIcon(const C4Facet &rfctIcon)
183  {
184  // set icon
185  fctIcon = rfctIcon;
186  // realign text to left for set icons
187  if (fctIcon.Surface)
188  iAlign = ALeft;
189  else
190  iAlign = ACenter;
191  UpdateOwnPos();
192  }
193 
195  {
196  iScrollPos = iScrollDir = 0;
197  }
198 
199 // --------------------------------------------------
200 // MultilineLabel
201 
202  MultilineLabel::MultilineLabel(const C4Rect &rcBounds, int32_t iMaxLines, int32_t iMaxBuf, const char *szIndentChars, bool fAutoGrow, bool fMarkup) // ctor
203  : Element(), Lines(iMaxBuf, iMaxLines, rcBounds.Wdt, szIndentChars, fAutoGrow, fMarkup), fMarkup(fMarkup)
204  {
205  // set bounds
206  this->rcBounds = rcBounds;
207  // update height (min height)
208  UpdateOwnPos();
209  }
210 
212  {
213  // get clipping
214  int iClipX, iClipY, iClipX2, iClipY2;
215  pDraw->GetPrimaryClipper(iClipX, iClipY, iClipX2, iClipY2);
216  // draw all lines
217  int32_t iIndex = 0; const char *szLine;
218  int32_t iY = rcBounds.y + cgo.TargetY;
219  CStdFont *pLineFont; DWORD dwLineClr; bool fNewParagraph;
220  while ((szLine = Lines.GetLine(iIndex, &pLineFont, &dwLineClr, &fNewParagraph)))
221  {
222  int32_t iFontLineHeight = pLineFont->GetLineHeight();
223  // indents between paragraphs
224  if (fNewParagraph && iIndex) iY += iFontLineHeight/3;
225  // clip
226  if (iY > iClipY2) break;
227  if (iY >= iClipY-iFontLineHeight)
228  {
229  // draw line
230  pDraw->TextOut(szLine, *pLineFont, 1.0f, cgo.Surface, rcBounds.x + cgo.TargetX, iY, dwLineClr, ALeft, fMarkup);
231  }
232  // advance line
233  iY += iFontLineHeight;
234  ++iIndex;
235  }
236  }
237 
239  {
240  // forward change to line buffer
242  UpdateHeight();
243  }
244 
246  {
247  // size by line count
248  int32_t iIndex = 0; const char *szLine; int32_t iHgt = 0;
249  CStdFont *pLineFont; bool fNewPar;
250  while ((szLine = Lines.GetLine(iIndex, &pLineFont, nullptr, &fNewPar)))
251  {
252  int32_t iFontLineHeight = pLineFont->GetLineHeight();
253  // indents between separate messages
254  if (fNewPar && iIndex) iHgt += iFontLineHeight/3;
255  // text line height
256  iHgt += iFontLineHeight;
257  ++iIndex;
258  }
259  rcBounds.Hgt = std::max<int32_t>(iHgt, 5);
260  // update parent container
262  }
263 
264  void MultilineLabel::AddLine(const char *szLine, CStdFont *pFont, DWORD dwClr, bool fDoUpdate, bool fMakeReadableOnBlack, CStdFont *pCaptionFont)
265  {
266  // make color readable
267  if (fMakeReadableOnBlack) MakeColorReadableOnBlack(dwClr);
268  // forward to line buffer
269  if (szLine) Lines.AppendLines(szLine, pFont, dwClr, pCaptionFont);
270  // adjust height
271  if (fDoUpdate) UpdateSize();
272  }
273 
274  void MultilineLabel::Clear(bool fDoUpdate)
275  {
276  // forward to line buffer
277  Lines.Clear();
278  // adjust height
279  if (fDoUpdate) UpdateSize();
280  }
281 
282 
283 
284 // --------------------------------------------------
285 // HorizontalLine
286 
288  {
289  // draw horizontal line
290  int32_t iX1 = rcBounds.x + cgo.TargetX, iX2 = iX1 + rcBounds.Wdt,
291  iY = rcBounds.y + cgo.TargetY;
292  pDraw->DrawLineDw(cgo.Surface, (float)(iX1+1), (float)(iY+1), (float)(iX2-1), (float)(iY+1), dwShadowClr);
293  pDraw->DrawLineDw(cgo.Surface, (float)iX1, (float)iY, (float)(iX2-2), (float)iY, dwClr);
294  }
295 
296 
297 // --------------------------------------------------
298 // ProgressBar
299 
301  {
302  // do not draw in negative progress
303  if (iProgress<0) return;
305  // draw border
306  Draw3DFrame(cgo);
307  // calc progress width
308  int32_t iProgressWdt = (rcBounds.Wdt-4) * iProgress / iMax;
309  // draw progress
311  // print out progress text
312  char szPrg[32+1];
313  sprintf(szPrg, "%i%%", 100 * iProgress / iMax);
314  pDraw->TextOut(szPrg, rFont, 1.0f, cgo.Surface, cgo.TargetX+rcBounds.GetMiddleX(), rcBounds.y + cgo.TargetY + (rcBounds.Hgt-rFont.GetLineHeight())/2-1, C4GUI_ProgressBarFontClr, ACenter);
315  }
316 
317 
318 // --------------------------------------------------
319 // Picture
320 
321  Picture::Picture(const C4Rect &rcBounds, bool fAspect) : fCustomDrawClr(false), fAnimate(false)
322  {
323  // set values
324  this->fAspect = fAspect;
325  this->rcBounds = rcBounds;
326  // no facet yet
327  }
328 
330  {
331  // animation?
332  C4Facet *pDrawFacet, DrawFacet;
333  if (fAnimate)
334  {
335  if (++iPhaseTime > iDelay)
336  {
337  int32_t iPhasesX=1, iPhasesY=1;
338  Facet.GetPhaseNum(iPhasesX, iPhasesY);
339  if (++iAnimationPhase >= iPhasesX) iAnimationPhase = 0;
340  iPhaseTime = 0;
341  }
342  DrawFacet = Facet.GetPhase(iAnimationPhase);
343  pDrawFacet = &DrawFacet;
344  }
345  else
346  pDrawFacet = &Facet;
347  // draw the facet
348  C4Facet cgo2 = cgo;
349  cgo2.X = rcBounds.x + cgo.TargetX;
350  cgo2.Y = rcBounds.y + cgo.TargetY;
351  cgo2.Wdt = rcBounds.Wdt;
352  cgo2.Hgt = rcBounds.Hgt;
353  if (fCustomDrawClr)
354  {
355  pDrawFacet->DrawClr(cgo2, fAspect, dwDrawClr);
356  }
357  else
358  pDrawFacet->Draw(cgo2, fAspect);
359  }
360 
362  {
363  // no surface?
364  if (!Facet.Surface) return false;
365  // equals face already?
366  if (Facet.Surface == &Facet.GetFace()) return true;
367  // then create as a copy
368  C4Facet cgo = Facet;
369  if (!Facet.Create(cgo.Wdt, cgo.Hgt)) return false;
370  cgo.Draw(Facet);
371  return true;
372  }
373 
374 
375  void Picture::SetAnimated(bool fEnabled, int iDelay)
376  {
377  if ((fAnimate = fEnabled))
378  {
379  // starts cycling through all phases of the specified facet
381  this->iDelay = iDelay;
382  }
383  }
384 
385 
386 
387 // --------------------------------------------------
388 // OverlayPicture
389 
390  OverlayPicture::OverlayPicture(const C4Rect &rcBounds, bool fAspect, const C4Facet &rOverlayImage, int iBorderSize)
391  : Picture(rcBounds, fAspect), iBorderSize(iBorderSize), OverlayImage(rOverlayImage)
392  {
393  }
394 
396  {
397  // draw inner image
398  C4Facet cgo2 = cgo;
399  cgo2.X = rcBounds.x + cgo.TargetX + iBorderSize * rcBounds.Wdt / std::max<int>(OverlayImage.Wdt, 1);
400  cgo2.Y = rcBounds.y + cgo.TargetY + iBorderSize * rcBounds.Hgt / std::max<int>(OverlayImage.Hgt, 1);
401  cgo2.Wdt = rcBounds.Wdt - 2 * iBorderSize * rcBounds.Wdt / std::max<int>(OverlayImage.Wdt, 1);
402  cgo2.Hgt = rcBounds.Hgt - 2 * iBorderSize * rcBounds.Hgt / std::max<int>(OverlayImage.Hgt, 1);
403  Facet.Draw(cgo2, fAspect);
404  // draw outer image
405  cgo2.X = rcBounds.x + cgo.TargetX;
406  cgo2.Y = rcBounds.y + cgo.TargetY;
407  cgo2.Wdt = rcBounds.Wdt;
408  cgo2.Hgt = rcBounds.Hgt;
409  OverlayImage.Draw(cgo2, fAspect);
410  }
411 
412 
413 // --------------------------------------------------
414 // Icon
415 
416  Icon::Icon(const C4Rect &rcBounds, Icons icoIconIndex)
417  : Picture(rcBounds, true)
418  {
419  // set icon facet
420  SetIcon(icoIconIndex);
421  }
422 
423  void Icon::SetIcon(Icons icoNewIconIndex)
424  {
425  // load icon
426  SetFacet(GetIconFacet(icoNewIconIndex));
427  }
428 
430  {
431  if (icoIconIndex == Ico_None) return C4Facet();
432  C4Facet *rFacet;
433  switch (icoIconIndex & ~0xff)
434  {
435  case Ico_Extended: rFacet = &::GraphicsResource.fctIconsEx; break;
437  default: rFacet = &::GraphicsResource.fctIcons;
438  }
439  icoIconIndex = Icons(icoIconIndex & 0xff);
440  int32_t iXMax, iYMax;
441  rFacet->GetPhaseNum(iXMax, iYMax);
442  if (!iXMax) iXMax = 6;
443  return rFacet->GetPhase(icoIconIndex % iXMax, icoIconIndex / iXMax);
444  }
445 
446 
447 // --------------------------------------------------
448 // PaintBox
449 
450  void PaintBox::MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
451  {
452  }
453 
455  {
456  // draw it
458  }
459 
460  PaintBox::PaintBox(C4Rect &rtBounds, int32_t iSfcWdt, int32_t iSfcHgt)
461  {
462  // default surface bounds
463  if (iSfcWdt<0) iSfcWdt = rtBounds.Wdt;
464  if (iSfcHgt<0) iSfcHgt = rtBounds.Hgt;
465  // create surface
466  if (iSfcWdt<=0 || iSfcHgt<=0) return;
467  fctPaint.Create(iSfcWdt, iSfcHgt);
468  }
469 
470  PaintBox::~PaintBox() = default;
471 
472 
473 // --------------------------------------------------
474 // TextWindow
475 
476  TextWindow::TextWindow(C4Rect &rtBounds, size_t iPicWdt, size_t iPicHgt, size_t iPicPadding, size_t iMaxLines, size_t iMaxTextLen, const char *szIndentChars, bool fAutoGrow, const C4Facet *pOverlayPic, int iOverlayBorder, bool fMarkup)
477  : Control(rtBounds), pLogBuffer(nullptr), fDrawBackground(true), fDrawFrame(true), iPicPadding(iPicPadding)
478  {
479  // calc client rect
480  UpdateOwnPos();
481  // create content scroll window
482  pClientWindow = new ScrollWindow(this);
484  // create content multiline label
485  pLogBuffer = new MultilineLabel(pClientWindow->GetContainedClientRect(), iMaxLines, iMaxTextLen, szIndentChars, fAutoGrow, fMarkup);
486  // add to scroll window
488  // update scrolling (for empty buffer)
490  // create content picture, if desired
491  C4Rect rcContentSize = pClientWindow->GetClientRect();
492  if (iPicWdt && iPicHgt)
493  {
494  C4Rect rcImage;
495  rcImage.x = std::max<int32_t>(rcContentSize.GetMiddleX() - iPicWdt/2, 0);
496  rcImage.y = 0;
497  rcImage.Wdt = std::min<size_t>(iPicWdt, rcContentSize.Wdt);
498  rcImage.Hgt = iPicHgt * rcImage.Wdt / iPicWdt;
499  rcContentSize.y += rcImage.Hgt + iPicPadding;
500  if (pOverlayPic)
501  pTitlePicture = new OverlayPicture(rcImage, false, *pOverlayPic, iOverlayBorder);
502  else
503  pTitlePicture = new Picture(rcImage, false);
505  }
506  else pTitlePicture = nullptr;
507 
508  // update size
509  UpdateSize();
510  }
511 
513  {
516  // resize log buffer pos to horizontal extents
517  C4Rect rcChildBounds = pLogBuffer->GetBounds();
518  rcChildBounds.x = 0;
519  rcChildBounds.y = (pTitlePicture && pTitlePicture->IsVisible()) ? pTitlePicture->GetBounds().Hgt + iPicPadding : 0;
520  rcChildBounds.Wdt = pClientWindow->GetClientRect().Wdt;
521  pLogBuffer->SetBounds(rcChildBounds);
522  }
523 
525  {
526  // draw background
528  // draw frame
529  if (fDrawFrame) Draw3DFrame(cgo);
530  }
531 
533  {
534  // inherited
535  if (pOfElement->GetParent() == this)
536  Control::ElementSizeChanged(pOfElement);
537  // update size of scroll control
538  if (pClientWindow && pLogBuffer)
540  }
541 
543  {
544  // inherited
545  if (pOfElement->GetParent() == this)
546  Control::ElementSizeChanged(pOfElement);
547  // update size of scroll control
548  if (pClientWindow && pLogBuffer)
550  }
551 
552  void TextWindow::SetPicture(const C4Facet &rNewPic)
553  {
554  // update picture
555  if (!pTitlePicture) return;
556  pTitlePicture->SetFacet(rNewPic);
557  // reposition multiline label below picture if any is assigned
560  pTitlePicture->SetVisibility(!!rNewPic.Surface);
561  }
562 
563 } // end of namespace
564 
C4Draw * pDraw
Definition: C4Draw.cpp:42
C4GraphicsResource GraphicsResource
#define C4GUI_ProgressBarFontClr
Definition: C4Gui.h:54
#define C4GUI_MinWoodBarHgt
Definition: C4Gui.h:158
const int32_t C4MC_Button_LeftDown
const int ARight
Definition: C4Surface.h:41
const int ALeft
Definition: C4Surface.h:41
const int ACenter
Definition: C4Surface.h:41
uint32_t DWORD
#define sprintf
Definition: Standard.h:162
bool RestorePrimaryClipper()
Definition: C4Draw.cpp:210
void DrawBoxDw(C4Surface *sfcDest, int iX1, int iY1, int iX2, int iY2, DWORD dwClr)
Definition: C4Draw.cpp:840
bool GetPrimaryClipper(int &rX1, int &rY1, int &rX2, int &rY2)
Definition: C4Draw.cpp:716
bool StorePrimaryClipper()
Definition: C4Draw.cpp:203
void DrawLineDw(C4Surface *sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width=1.0f)
Definition: C4Draw.cpp:608
bool SetPrimaryClipper(int iX1, int iY1, int iX2, int iY2)
Definition: C4Draw.cpp:217
bool TextOut(const char *szText, CStdFont &rFont, float fZoom, C4Surface *sfcDest, float iTx, float iTy, DWORD dwFCol=0xffffffff, BYTE byForm=ALeft, bool fDoMarkup=true)
Definition: C4Draw.cpp:561
C4Surface * Surface
Definition: C4Facet.h:117
C4Facet GetPhase(int iPhaseX=0, int iPhaseY=0)
Definition: C4Facet.cpp:59
float Hgt
Definition: C4Facet.h:118
void DrawClr(C4Facet &cgo, bool fAspect=true, DWORD dwClr=0)
Definition: C4Facet.cpp:213
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
bool GetPhaseNum(int32_t &rX, int32_t &rY)
Definition: C4Facet.cpp:472
void DrawX(C4Surface *sfcTarget, float iX, float iY, float iWdt, float iHgt, int32_t iPhaseX=0, int32_t iPhaseY=0) const
Definition: C4Facet.cpp:358
float Y
Definition: C4Facet.h:118
float X
Definition: C4Facet.h:118
bool Create(int iWdt, int iHgt, int iWdt2=C4FCT_Full, int iHgt2=C4FCT_Full)
Definition: C4FacetEx.cpp:54
C4Surface & GetFace()
Definition: C4FacetEx.h:52
void AddElement(Element *pChild)
virtual void ElementSizeChanged(Element *pOfElement)
Definition: C4Gui.h:753
friend class ScrollWindow
Definition: C4Gui.h:844
void SetFocus(Control *pCtrl, bool fByMouse)
virtual void SetVisibility(bool fToValue)
Definition: C4Gui.cpp:207
bool IsVisible()
Definition: C4Gui.cpp:201
C4Rect rcBounds
Definition: C4Gui.h:385
C4Rect GetContainedClientRect()
Definition: C4Gui.h:448
virtual void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
Definition: C4Gui.cpp:244
virtual void UpdateSize()
Definition: C4Gui.cpp:185
void SetBounds(const C4Rect &rcNewBound)
Definition: C4Gui.h:446
friend class TextWindow
Definition: C4Gui.h:472
Container * GetParent()
Definition: C4Gui.h:429
void DrawBar(C4TargetFacet &cgo, DynBarFacet &rFacets)
Definition: C4Gui.cpp:308
virtual class Dialog * GetDlg()
Definition: C4Gui.cpp:288
C4Rect & GetBounds()
Definition: C4Gui.h:445
void Draw3DFrame(C4TargetFacet &cgo, bool fUp=false, int32_t iIndent=1, BYTE byAlpha=C4GUI_BorderAlpha, bool fDrawTop=true, int32_t iTopOff=0, bool fDrawLeft=true, int32_t iLeftOff=0)
Definition: C4Gui.cpp:291
virtual void UpdateOwnPos()
Definition: C4Gui.h:434
uint32_t dwShadowClr
Definition: C4Gui.h:585
void DrawElement(C4TargetFacet &cgo) override
uint32_t dwClr
Definition: C4Gui.h:585
void SetIcon(Icons icoNewIconIndex)
static C4Facet GetIconFacet(Icons icoIconIndex)
Icon(const C4Rect &rcBounds, Icons icoIconIndex)
StdStrBuf sText
Definition: C4Gui.h:479
void UpdateOwnPos() override
Definition: C4GuiLabels.cpp:96
virtual int32_t GetLeftIndent()
Definition: C4Gui.h:494
void SetText(const char *szToText, bool fAllowHotkey=true)
Definition: C4GuiLabels.cpp:74
int32_t x0
Definition: C4Gui.h:481
void DrawElement(C4TargetFacet &cgo) override
Definition: C4GuiLabels.cpp:32
CStdFont * pFont
Definition: C4Gui.h:482
void SetX0(int32_t iToX0)
Control * pClickFocusControl
Definition: C4Gui.h:487
Label(const char *szLblText, int32_t iX0, int32_t iTop, int32_t iAlign=ALeft, DWORD dwFClr=0xffffffff, CStdFont *pFont=nullptr, bool fMakeReadableOnBlack=true, bool fMarkup=true)
Definition: C4GuiLabels.cpp:38
bool OnHotkey(uint32_t cHotkey) override
void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override
Definition: C4GuiLabels.cpp:65
bool fAutosize
Definition: C4Gui.h:484
uint32_t cHotkey
Definition: C4Gui.h:483
DWORD dwFgClr
Definition: C4Gui.h:480
int32_t iAlign
Definition: C4Gui.h:481
bool fMarkup
Definition: C4Gui.h:485
C4LogBuffer Lines
Definition: C4Gui.h:548
void DrawElement(C4TargetFacet &cgo) override
void AddLine(const char *szLine, CStdFont *pFont, DWORD dwClr, bool fDoUpdate, bool fMakeReadableOnBlack, CStdFont *pCaptionFont)
MultilineLabel(const C4Rect &rcBounds, int32_t iMaxLines, int32_t iMaxBuf, const char *szIndentChars, bool fAutoGrow, bool fMarkup)
void Clear(bool fDoUpdate)
void UpdateSize() override
OverlayPicture(const C4Rect &rcBounds, bool fAspect, const C4Facet &rOverlayImage, int iBorderSize)
C4Facet OverlayImage
Definition: C4Gui.h:623
void DrawElement(C4TargetFacet &cgo) override
void DrawElement(C4TargetFacet &cgo) override
C4FacetSurface fctPaint
Definition: C4Gui.h:1035
void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override
PaintBox(C4Rect &rtBounds, int32_t iSfcWdt=-1, int32_t iSfcHgt=-1)
~PaintBox() override
void SetFacet(const C4Facet &fct)
Definition: C4Gui.h:612
C4FacetSurface Facet
Definition: C4Gui.h:598
int32_t iPhaseTime
Definition: C4Gui.h:603
Picture(const C4Rect &rcBounds, bool fAspect)
int32_t iAnimationPhase
Definition: C4Gui.h:603
void DrawElement(C4TargetFacet &cgo) override
uint32_t dwDrawClr
Definition: C4Gui.h:601
bool fCustomDrawClr
Definition: C4Gui.h:600
bool fAspect
Definition: C4Gui.h:599
bool EnsureOwnSurface()
int32_t iDelay
Definition: C4Gui.h:603
bool fAnimate
Definition: C4Gui.h:602
void SetAnimated(bool fEnabled, int iDelay)
int32_t iMax
Definition: C4Gui.h:569
int32_t iProgress
Definition: C4Gui.h:569
void DrawElement(C4TargetFacet &cgo) override
void SetClientHeight(int32_t iToHgt)
Definition: C4Gui.h:973
size_t iPicPadding
Definition: C4Gui.h:1728
MultilineLabel * pLogBuffer
Definition: C4Gui.h:1726
void DrawElement(C4TargetFacet &cgo) override
bool fDrawBackground
Definition: C4Gui.h:1727
void ElementSizeChanged(Element *pOfElement) override
void SetPicture(const C4Facet &rNewPic)
void ElementPosChanged(Element *pOfElement) override
ScrollWindow * pClientWindow
Definition: C4Gui.h:1724
Picture * pTitlePicture
Definition: C4Gui.h:1725
void UpdateSize() override
void UpdateOwnPos() override
C4Rect & GetClientRect() override
Definition: C4Gui.h:864
C4Facet fctIcon
Definition: C4Gui.h:524
static int32_t GetDefaultHeight(CStdFont *pUseFont=nullptr)
int32_t GetLeftIndent() override
Definition: C4Gui.h:526
int32_t GetRightIndent() const
Definition: C4Gui.h:527
void SetIcon(const C4Facet &rfctIcon)
void DrawElement(C4TargetFacet &cgo) override
C4GUI::DynBarFacet barCaption
void Clear()
Definition: C4LogBuf.cpp:308
const char * GetLine(int iLineIndex, CStdFont **ppFont, DWORD *pdwClr, bool *pNewParagraph) const
Definition: C4LogBuf.cpp:280
void SetLBWidth(int iToWidth)
Definition: C4LogBuf.cpp:314
void AppendLines(const char *szLine, CStdFont *pFont, DWORD dwClr, CStdFont *pFirstLineFont=nullptr)
Definition: C4LogBuf.cpp:170
Definition: C4Rect.h:28
int32_t y
Definition: C4Rect.h:30
int32_t GetMiddleX() const
Definition: C4Rect.h:56
int32_t Hgt
Definition: C4Rect.h:30
int32_t Wdt
Definition: C4Rect.h:30
int32_t x
Definition: C4Rect.h:30
float TargetY
Definition: C4Facet.h:165
float TargetX
Definition: C4Facet.h:165
static C4TimeMilliseconds Now()
int GetLineHeight() const
Definition: C4FontLoader.h:125
int32_t GetTextWidth(const char *szText, bool fCheckMarkup=true)
Definition: C4FontLoader.h:140
bool GetTextExtent(const char *szText, int32_t &rsx, int32_t &rsy, bool fCheckMarkup=true)
const char * getData() const
Definition: StdBuf.h:442
void Copy()
Definition: StdBuf.h:467
Icons
Definition: C4Gui.h:638
@ Ico_None
Definition: C4Gui.h:640
@ Ico_Extended
Definition: C4Gui.h:634
@ Ico_Controller
Definition: C4Gui.h:635
DWORD MakeColorReadableOnBlack(DWORD &rdwClr)
Definition: C4Gui.cpp:98
bool ExpandHotkeyMarkup(StdStrBuf &sText, uint32_t &rcHotkey, bool for_tooltip)
Definition: C4Gui.cpp:38