OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
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 "gui/C4MouseControl.h"
24 #include "graphics/C4Draw.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 
471  {
472  }
473 
474 
475 // --------------------------------------------------
476 // TextWindow
477 
478  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)
479  : Control(rtBounds), pLogBuffer(nullptr), fDrawBackground(true), fDrawFrame(true), iPicPadding(iPicPadding)
480  {
481  // calc client rect
482  UpdateOwnPos();
483  // create content scroll window
484  pClientWindow = new ScrollWindow(this);
486  // create content multiline label
487  pLogBuffer = new MultilineLabel(pClientWindow->GetContainedClientRect(), iMaxLines, iMaxTextLen, szIndentChars, fAutoGrow, fMarkup);
488  // add to scroll window
490  // update scrolling (for empty buffer)
492  // create content picture, if desired
493  C4Rect rcContentSize = pClientWindow->GetClientRect();
494  if (iPicWdt && iPicHgt)
495  {
496  C4Rect rcImage;
497  rcImage.x = std::max<int32_t>(rcContentSize.GetMiddleX() - iPicWdt/2, 0);
498  rcImage.y = 0;
499  rcImage.Wdt = std::min<size_t>(iPicWdt, rcContentSize.Wdt);
500  rcImage.Hgt = iPicHgt * rcImage.Wdt / iPicWdt;
501  rcContentSize.y += rcImage.Hgt + iPicPadding;
502  if (pOverlayPic)
503  pTitlePicture = new OverlayPicture(rcImage, false, *pOverlayPic, iOverlayBorder);
504  else
505  pTitlePicture = new Picture(rcImage, false);
507  }
508  else pTitlePicture = nullptr;
509 
510  // update size
511  UpdateSize();
512  }
513 
515  {
518  // resize log buffer pos to horizontal extents
519  C4Rect rcChildBounds = pLogBuffer->GetBounds();
520  rcChildBounds.x = 0;
521  rcChildBounds.y = (pTitlePicture && pTitlePicture->IsVisible()) ? pTitlePicture->GetBounds().Hgt + iPicPadding : 0;
522  rcChildBounds.Wdt = pClientWindow->GetClientRect().Wdt;
523  pLogBuffer->SetBounds(rcChildBounds);
524  }
525 
527  {
528  // draw background
530  // draw frame
531  if (fDrawFrame) Draw3DFrame(cgo);
532  }
533 
535  {
536  // inherited
537  if (pOfElement->GetParent() == this)
538  Control::ElementSizeChanged(pOfElement);
539  // update size of scroll control
540  if (pClientWindow && pLogBuffer)
542  }
543 
545  {
546  // inherited
547  if (pOfElement->GetParent() == this)
548  Control::ElementSizeChanged(pOfElement);
549  // update size of scroll control
550  if (pClientWindow && pLogBuffer)
552  }
553 
554  void TextWindow::SetPicture(const C4Facet &rNewPic)
555  {
556  // update picture
557  if (!pTitlePicture) return;
558  pTitlePicture->SetFacet(rNewPic);
559  // reposition multiline label below picture if any is assigned
562  pTitlePicture->SetVisibility(!!rNewPic.Surface);
563  }
564 
565 } // end of namespace
566 
const char * getData() const
Definition: StdBuf.h:450
bool fDrawBackground
Definition: C4Gui.h:1726
virtual void UpdateSize()
bool RestorePrimaryClipper()
Definition: C4Draw.cpp:213
const int32_t C4MC_Button_LeftDown
int GetLineHeight() const
Definition: C4FontLoader.h:132
float Y
Definition: C4Facet.h:120
C4GUI::DynBarFacet barCaption
void SetAnimated(bool fEnabled, int iDelay)
OverlayPicture(const C4Rect &rcBounds, bool fAspect, const C4Facet &rOverlayImage, int iBorderSize)
const char * GetLine(int iLineIndex, CStdFont **ppFont, DWORD *pdwClr, bool *pNewParagraph) const
Definition: C4LogBuf.cpp:244
void SetLBWidth(int iToWidth)
Definition: C4LogBuf.cpp:278
Picture(const C4Rect &rcBounds, bool fAspect)
virtual void DrawElement(C4TargetFacet &cgo)
Definition: C4GuiLabels.cpp:32
virtual void DrawElement(C4TargetFacet &cgo)
bool GetPrimaryClipper(int &rX1, int &rY1, int &rX2, int &rY2)
Definition: C4Draw.cpp:725
#define sprintf
Definition: Standard.h:171
Control * pClickFocusControl
Definition: C4Gui.h:487
#define C4GUI_MinWoodBarHgt
Definition: C4Gui.h:158
virtual void ElementSizeChanged(Element *pOfElement)
virtual void ElementPosChanged(Element *pOfElement)
bool GetPhaseNum(int32_t &rX, int32_t &rY)
Definition: C4Facet.cpp:472
virtual void UpdateSize()
bool IsVisible()
Definition: C4Gui.cpp:202
void SetFacet(const C4Facet &fct)
Definition: C4Gui.h:612
void AppendLines(const char *szLine, CStdFont *pFont, DWORD dwClr, CStdFont *pFirstLineFont=nullptr)
Definition: C4LogBuf.cpp:170
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:570
C4FacetSurface Facet
Definition: C4Gui.h:598
virtual void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
Definition: C4GuiLabels.cpp:65
C4Facet fctIcon
Definition: C4Gui.h:524
const int ARight
Definition: C4Surface.h:43
PaintBox(C4Rect &rtBounds, int32_t iSfcWdt=-1, int32_t iSfcHgt=-1)
void DrawClr(C4Facet &cgo, bool fAspect=true, DWORD dwClr=0)
Definition: C4Facet.cpp:213
Definition: C4Rect.h:29
DWORD MakeColorReadableOnBlack(DWORD &rdwClr)
Definition: C4Gui.cpp:99
int32_t iAnimationPhase
Definition: C4Gui.h:603
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:292
C4Facet OverlayImage
Definition: C4Gui.h:623
bool GetTextExtent(const char *szText, int32_t &rsx, int32_t &rsy, bool fCheckMarkup=true)
virtual C4Rect & GetClientRect()
Definition: C4Gui.h:864
virtual void DrawElement(C4TargetFacet &cgo)
uint32_t dwClr
Definition: C4Gui.h:585
void AddElement(Element *pChild)
C4FacetSurface fctPaint
Definition: C4Gui.h:1035
virtual void UpdateSize()
Definition: C4Gui.cpp:186
bool fMarkup
Definition: C4Gui.h:485
C4Rect GetContainedClientRect()
Definition: C4Gui.h:448
int32_t GetTextWidth(const char *szText, bool fCheckMarkup=true)
Definition: C4FontLoader.h:147
C4GraphicsResource GraphicsResource
void DrawLineDw(C4Surface *sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width=1.0f)
Definition: C4Draw.cpp:617
void Clear()
Definition: C4LogBuf.cpp:272
int32_t iAlign
Definition: C4Gui.h:481
uint32_t dwDrawClr
Definition: C4Gui.h:601
TextWindow(C4Rect &rtBounds, size_t iPicWdt=0, size_t iPicHgt=0, size_t iPicPadding=0, size_t iMaxLines=100, size_t iMaxTextLen=4096, const char *szIndentChars=" ", bool fAutoGrow=false, const C4Facet *pOverlayPic=nullptr, int iOverlayBorder=0, bool fMarkup=false)
int32_t GetMiddleX() const
Definition: C4Rect.h:58
int32_t Wdt
Definition: C4Rect.h:32
bool ExpandHotkeyMarkup(StdStrBuf &sText, uint32_t &rcHotkey, bool for_tooltip)
Definition: C4Gui.cpp:39
DWORD dwFgClr
Definition: C4Gui.h:480
virtual void DrawElement(C4TargetFacet &cgo)
virtual void SetVisibility(bool fToValue)
Definition: C4Gui.cpp:208
void DrawBar(C4TargetFacet &cgo, DynBarFacet &rFacets)
Definition: C4Gui.cpp:309
static int32_t GetDefaultHeight(CStdFont *pUseFont=nullptr)
int32_t y
Definition: C4Rect.h:32
const int ACenter
Definition: C4Surface.h:43
int32_t iPhaseTime
Definition: C4Gui.h:603
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
void SetIcon(const C4Facet &rfctIcon)
uint32_t cHotkey
Definition: C4Gui.h:483
void DrawBoxDw(C4Surface *sfcDest, int iX1, int iY1, int iX2, int iY2, DWORD dwClr)
Definition: C4Draw.cpp:849
C4Rect rcBounds
Definition: C4Gui.h:385
int32_t x0
Definition: C4Gui.h:481
virtual int32_t GetLeftIndent()
Definition: C4Gui.h:494
virtual void DrawElement(C4TargetFacet &cgo)
void Draw(C4Facet &cgo, bool fAspect=true, int32_t iPhaseX=0, int32_t iPhaseY=0, bool fTransparent=true)
Definition: C4Facet.cpp:154
Container * GetParent()
Definition: C4Gui.h:429
virtual void ElementSizeChanged(Element *pOfElement)
Definition: C4Gui.h:753
virtual void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
C4Draw * pDraw
Definition: C4Draw.cpp:45
StdStrBuf sText
Definition: C4Gui.h:479
ScrollWindow * pClientWindow
Definition: C4Gui.h:1723
virtual void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
Definition: C4Gui.cpp:245
bool SetPrimaryClipper(int iX1, int iY1, int iX2, int iY2)
Definition: C4Draw.cpp:220
MultilineLabel * pLogBuffer
Definition: C4Gui.h:1725
bool EnsureOwnSurface()
virtual void UpdateOwnPos()
Definition: C4GuiLabels.cpp:96
C4Rect & GetBounds()
Definition: C4Gui.h:445
int32_t iDelay
Definition: C4Gui.h:603
uint32_t dwShadowClr
Definition: C4Gui.h:585
void AddLine(const char *szLine, CStdFont *pFont, DWORD dwClr, bool fDoUpdate, bool fMakeReadableOnBlack, CStdFont *pCaptionFont)
Icon(const C4Rect &rcBounds, Icons icoIconIndex)
friend class ScrollWindow
Definition: C4Gui.h:844
virtual class Dialog * GetDlg()
Definition: C4Gui.cpp:289
Icons
Definition: C4Gui.h:637
bool fCustomDrawClr
Definition: C4Gui.h:600
int32_t iProgress
Definition: C4Gui.h:569
int32_t x
Definition: C4Rect.h:32
virtual void UpdateOwnPos()
float TargetX
Definition: C4Facet.h:167
virtual void DrawElement(C4TargetFacet &cgo)
void SetFocus(Control *pCtrl, bool fByMouse)
float Hgt
Definition: C4Facet.h:120
void SetBounds(const C4Rect &rcNewBound)
Definition: C4Gui.h:446
#define C4GUI_ProgressBarFontClr
Definition: C4Gui.h:54
bool Create(int iWdt, int iHgt, int iWdt2=C4FCT_Full, int iHgt2=C4FCT_Full)
Definition: C4FacetEx.cpp:54
int32_t iMax
Definition: C4Gui.h:569
const int ALeft
Definition: C4Surface.h:43
virtual int32_t GetLeftIndent()
Definition: C4Gui.h:526
size_t iPicPadding
Definition: C4Gui.h:1727
C4LogBuffer Lines
Definition: C4Gui.h:548
void SetClientHeight(int32_t iToHgt)
Definition: C4Gui.h:973
virtual void DrawElement(C4TargetFacet &cgo)
MultilineLabel(const C4Rect &rcBounds, int32_t iMaxLines, int32_t iMaxBuf, const char *szIndentChars, bool fAutoGrow, bool fMarkup)
bool fAnimate
Definition: C4Gui.h:602
virtual void UpdateOwnPos()
Definition: C4Gui.h:434
void Clear(bool fDoUpdate)
int32_t Hgt
Definition: C4Rect.h:32
virtual void DrawElement(C4TargetFacet &cgo)
void SetPicture(const C4Facet &rNewPic)
C4Surface * Surface
Definition: C4Facet.h:119
float TargetY
Definition: C4Facet.h:167
virtual bool OnHotkey(uint32_t cHotkey)
uint32_t DWORD
CStdFont * pFont
Definition: C4Gui.h:482
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
Picture * pTitlePicture
Definition: C4Gui.h:1724
void Copy()
Definition: StdBuf.h:475
float Wdt
Definition: C4Facet.h:120
C4Facet GetPhase(int iPhaseX=0, int iPhaseY=0)
Definition: C4Facet.cpp:59
void SetX0(int32_t iToX0)
virtual void DrawElement(C4TargetFacet &cgo)
float X
Definition: C4Facet.h:120
void SetIcon(Icons icoNewIconIndex)
int32_t GetRightIndent() const
Definition: C4Gui.h:527
bool fAspect
Definition: C4Gui.h:599
static C4Facet GetIconFacet(Icons icoIconIndex)
C4Surface & GetFace()
Definition: C4FacetEx.h:52
static C4TimeMilliseconds Now()
bool StorePrimaryClipper()
Definition: C4Draw.cpp:206
void SetText(const char *szToText, bool fAllowHotkey=true)
Definition: C4GuiLabels.cpp:74
bool fAutosize
Definition: C4Gui.h:484