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)
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)
149 if (iAutoScrollDelay)
152 if (tNow >= tLastChangeTime + iAutoScrollDelay)
154 if (!iScrollDir) iScrollDir=1;
158 iScrollPos += iScrollDir;
159 if (iScrollPos >= iMaxScroll || iScrollPos < 0)
161 iScrollDir = -iScrollDir;
162 iScrollPos += iScrollDir;
163 tLastChangeTime = tNow;
196 iScrollPos = iScrollDir = 0;
203 :
Element(), Lines(iMaxBuf, iMaxLines, rcBounds.Wdt, szIndentChars, fAutoGrow, fMarkup), fMarkup(fMarkup)
214 int iClipX, iClipY, iClipX2, iClipY2;
217 int32_t iIndex = 0;
const char *szLine;
220 while ((szLine =
Lines.
GetLine(iIndex, &pLineFont, &dwLineClr, &fNewParagraph)))
224 if (fNewParagraph && iIndex) iY += iFontLineHeight/3;
226 if (iY > iClipY2)
break;
227 if (iY >= iClipY-iFontLineHeight)
233 iY += iFontLineHeight;
248 int32_t iIndex = 0;
const char *szLine; int32_t iHgt = 0;
250 while ((szLine =
Lines.
GetLine(iIndex, &pLineFont,
nullptr, &fNewPar)))
254 if (fNewPar && iIndex) iHgt += iFontLineHeight/3;
256 iHgt += iFontLineHeight;
332 C4Facet *pDrawFacet, DrawFacet;
337 int32_t iPhasesX=1, iPhasesY=1;
343 pDrawFacet = &DrawFacet;
391 :
Picture(rcBounds, fAspect), iBorderSize(iBorderSize), OverlayImage(rOverlayImage)
433 switch (icoIconIndex & ~0xff)
439 icoIconIndex =
Icons(icoIconIndex & 0xff);
440 int32_t iXMax, iYMax;
442 if (!iXMax) iXMax = 6;
443 return rFacet->
GetPhase(icoIconIndex % iXMax, icoIconIndex / iXMax);
463 if (iSfcWdt<0) iSfcWdt = rtBounds.
Wdt;
464 if (iSfcHgt<0) iSfcHgt = rtBounds.
Hgt;
466 if (iSfcWdt<=0 || iSfcHgt<=0)
return;
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)
492 if (iPicWdt && iPicHgt)
495 rcImage.
x = std::max<int32_t>(rcContentSize.
GetMiddleX() - iPicWdt/2, 0);
497 rcImage.
Wdt = std::min<size_t>(iPicWdt, rcContentSize.
Wdt);
498 rcImage.
Hgt = iPicHgt * rcImage.
Wdt / iPicWdt;
C4GraphicsResource GraphicsResource
#define C4GUI_ProgressBarFontClr
#define C4GUI_MinWoodBarHgt
const int32_t C4MC_Button_LeftDown
bool RestorePrimaryClipper()
void DrawBoxDw(C4Surface *sfcDest, int iX1, int iY1, int iX2, int iY2, DWORD dwClr)
bool GetPrimaryClipper(int &rX1, int &rY1, int &rX2, int &rY2)
bool StorePrimaryClipper()
void DrawLineDw(C4Surface *sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width=1.0f)
bool SetPrimaryClipper(int iX1, int iY1, int iX2, int iY2)
bool TextOut(const char *szText, CStdFont &rFont, float fZoom, C4Surface *sfcDest, float iTx, float iTy, DWORD dwFCol=0xffffffff, BYTE byForm=ALeft, bool fDoMarkup=true)
C4Facet GetPhase(int iPhaseX=0, int iPhaseY=0)
void DrawClr(C4Facet &cgo, bool fAspect=true, DWORD dwClr=0)
void Draw(C4Facet &cgo, bool fAspect=true, int32_t iPhaseX=0, int32_t iPhaseY=0, bool fTransparent=true)
bool GetPhaseNum(int32_t &rX, int32_t &rY)
void DrawX(C4Surface *sfcTarget, float iX, float iY, float iWdt, float iHgt, int32_t iPhaseX=0, int32_t iPhaseY=0) const
bool Create(int iWdt, int iHgt, int iWdt2=C4FCT_Full, int iHgt2=C4FCT_Full)
void AddElement(Element *pChild)
virtual void ElementSizeChanged(Element *pOfElement)
friend class ScrollWindow
void SetFocus(Control *pCtrl, bool fByMouse)
virtual void SetVisibility(bool fToValue)
C4Rect GetContainedClientRect()
virtual void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
virtual void UpdateSize()
void SetBounds(const C4Rect &rcNewBound)
void DrawBar(C4TargetFacet &cgo, DynBarFacet &rFacets)
virtual class Dialog * GetDlg()
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)
virtual void UpdateOwnPos()
void DrawElement(C4TargetFacet &cgo) override
void SetIcon(Icons icoNewIconIndex)
static C4Facet GetIconFacet(Icons icoIconIndex)
Icon(const C4Rect &rcBounds, Icons icoIconIndex)
void UpdateOwnPos() override
virtual int32_t GetLeftIndent()
void SetText(const char *szToText, bool fAllowHotkey=true)
void DrawElement(C4TargetFacet &cgo) override
void SetX0(int32_t iToX0)
Control * pClickFocusControl
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)
bool OnHotkey(uint32_t cHotkey) override
void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override
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)
void DrawElement(C4TargetFacet &cgo) override
void DrawElement(C4TargetFacet &cgo) override
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)
void SetFacet(const C4Facet &fct)
Picture(const C4Rect &rcBounds, bool fAspect)
void DrawElement(C4TargetFacet &cgo) override
void SetAnimated(bool fEnabled, int iDelay)
void DrawElement(C4TargetFacet &cgo) override
MultilineLabel * pLogBuffer
void DrawElement(C4TargetFacet &cgo) override
void ElementSizeChanged(Element *pOfElement) override
void SetPicture(const C4Facet &rNewPic)
void ElementPosChanged(Element *pOfElement) override
ScrollWindow * pClientWindow
void UpdateSize() override
void UpdateOwnPos() override
C4Rect & GetClientRect() override
static int32_t GetDefaultHeight(CStdFont *pUseFont=nullptr)
int32_t GetLeftIndent() override
int32_t GetRightIndent() const
void SetIcon(const C4Facet &rfctIcon)
void DrawElement(C4TargetFacet &cgo) override
C4FacetID fctControllerIcons
C4GUI::DynBarFacet barCaption
const char * GetLine(int iLineIndex, CStdFont **ppFont, DWORD *pdwClr, bool *pNewParagraph) const
void SetLBWidth(int iToWidth)
void AppendLines(const char *szLine, CStdFont *pFont, DWORD dwClr, CStdFont *pFirstLineFont=nullptr)
int32_t GetMiddleX() const
static C4TimeMilliseconds Now()
int GetLineHeight() const
int32_t GetTextWidth(const char *szText, bool fCheckMarkup=true)
bool GetTextExtent(const char *szText, int32_t &rsx, int32_t &rsy, bool fCheckMarkup=true)
const char * getData() const
DWORD MakeColorReadableOnBlack(DWORD &rdwClr)
bool ExpandHotkeyMarkup(StdStrBuf &sText, uint32_t &rcHotkey, bool for_tooltip)