OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4GUI::ScrollBar Class Reference

#include <C4Gui.h>

Inheritance diagram for C4GUI::ScrollBar:
[legend]
Collaboration diagram for C4GUI::ScrollBar:
[legend]

Public Member Functions

 ScrollBar (C4Rect &rcBounds, ScrollWindow *pWin)
 
 ScrollBar (C4Rect &rcBounds, bool fHorizontal, BaseParCallbackHandler< int32_t > *pCB, int32_t iCBMaxRange=256)
 
 ~ScrollBar () override
 
void MouseInput (CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override
 
void DoDragging (CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam) override
 
void MouseLeave (CMouse &rMouse) override
 
void SetDecoration (ScrollBarFacets *pToGfx, bool fAutoHide)
 
void SetScrollPos (int32_t iToPos)
 
virtual ContainerGetContainer ()
 
virtual void MouseEnter (CMouse &rMouse)
 
virtual void StartDragging (CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam)
 
virtual void StopDragging (CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam)
 
virtual bool OnHotkey (uint32_t cHotkey)
 
bool DoContext ()
 
ContainerGetParent ()
 
virtual class DialogGetDlg ()
 
virtual ScreenGetScreen ()
 
virtual ControlIsFocusElement ()
 
virtual void UpdateOwnPos ()
 
void ScreenPos2ClientPos (int32_t &riX, int32_t &riY)
 
void ClientPos2ScreenPos (int32_t &riX, int32_t &riY)
 
void SetToolTip (const char *szNewTooltip, bool is_immediate=false)
 
const char * GetToolTip ()
 
const char * GetOwnToolTip ()
 
bool IsImmediateToolTip () const
 
int32_t GetWidth ()
 
int32_t GetHeight ()
 
C4RectGetBounds ()
 
void SetBounds (const C4Rect &rcNewBound)
 
virtual C4RectGetClientRect ()
 
C4Rect GetContainedClientRect ()
 
ElementGetNext () const
 
ElementGetPrev () const
 
virtual ElementGetFirstNestedElement (bool fBackwards)
 
virtual ElementGetFirstContained ()
 
bool IsInActiveDlg (bool fForKeyboard)
 
virtual bool IsParentOf (Element *pEl)
 
C4Rect GetToprightCornerRect (int32_t iWidth=16, int32_t iHeight=16, int32_t iHIndent=4, int32_t iVIndent=4, int32_t iIndexX=0)
 
bool IsVisible ()
 
virtual void SetVisibility (bool fToValue)
 
virtual int32_t GetListItemTopSpacing ()
 
virtual bool GetListItemTopSpacingBar ()
 
void SetDragTarget (Window *pToWindow)
 
void SetContextHandler (ContextHandler *pNewHd)
 
virtual ContextHandlerGetContextHandler ()
 

Public Attributes

bool fVisible {true}
 

Protected Member Functions

void Update ()
 
void OnPosChanged ()
 
void DrawElement (C4TargetFacet &cgo) override
 
bool HasPin ()
 
int32_t GetMaxScroll ()
 
int32_t GetScrollByPos (int32_t iX, int32_t iY)
 
bool IsScrolling ()
 
virtual void Draw (C4TargetFacet &cgo)
 
virtual void RemoveElement (Element *pChild)
 
virtual void UpdateSize ()
 
virtual void UpdatePos ()
 
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)
 
void DrawBar (C4TargetFacet &cgo, DynBarFacet &rFacets)
 
void DrawVBar (C4TargetFacet &cgo, DynBarFacet &rFacets)
 
void DrawHBarByVGfx (C4TargetFacet &cgo, DynBarFacet &rFacets)
 
void DrawHVBar (C4TargetFacet &cgo, DynBarFacet &rFacets, C4DrawTransform &trf, int32_t iMiddleLength)
 
virtual bool IsOwnPtrElement ()
 
virtual bool IsExternalDrawDialog ()
 
virtual bool IsMenu ()
 
virtual class DialogWindowGetDialogWindow ()
 
virtual bool CheckNameHotkey (const char *)
 

Protected Attributes

bool fScrolling
 
bool fAutoHide
 
int32_t iScrollThumbSize
 
int32_t iScrollPos
 
bool fTopDown
 
bool fBottomDown
 
bool fHorizontal
 
int32_t iCBMaxRange
 
ScrollWindowpScrollWindow
 
BaseParCallbackHandler< int32_t > * pScrollCallback
 
ScrollBarFacetspCustomGfx
 
ContainerpParent {nullptr}
 
ElementpPrev
 
ElementpNext
 
WindowpDragTarget {nullptr}
 
int32_t iDragX
 
int32_t iDragY
 
bool fDragging {false}
 
ContextHandlerpContextHandler {nullptr}
 
C4Rect rcBounds
 

Friends

class ScrollWindow
 
class ::C4ScriptGuiWindow
 

Detailed Description

Definition at line 880 of file C4Gui.h.

Constructor & Destructor Documentation

C4GUI::ScrollBar::ScrollBar ( C4Rect rcBounds,
ScrollWindow pWin 
)

Definition at line 336 of file C4GuiContainers.cpp.

References C4GUI_ScrollThumbHgt, fBottomDown, fScrolling, fTopDown, iScrollPos, iScrollThumbSize, pScrollWindow, C4GUI::Element::rcBounds, and Update().

336  : fAutoHide(false), fHorizontal(false), iCBMaxRange(100), pScrollCallback(nullptr), pCustomGfx(nullptr)
337  {
338  // set bounds
339  this->rcBounds = rcBounds;
340  // set initial values
341  pScrollWindow = pWin;
342  fScrolling = false;
344  iScrollPos = 0;
345  fTopDown = fBottomDown = false;
346  // update scroll bar pos
347  Update();
348  }
#define C4GUI_ScrollThumbHgt
Definition: C4Gui.h:107
int32_t iCBMaxRange
Definition: C4Gui.h:889
ScrollBarFacets * pCustomGfx
Definition: C4Gui.h:894
int32_t iScrollThumbSize
Definition: C4Gui.h:885
int32_t iScrollPos
Definition: C4Gui.h:886
C4Rect rcBounds
Definition: C4Gui.h:385
ScrollWindow * pScrollWindow
Definition: C4Gui.h:891
bool fBottomDown
Definition: C4Gui.h:887
bool fAutoHide
Definition: C4Gui.h:884
bool fTopDown
Definition: C4Gui.h:887
bool fHorizontal
Definition: C4Gui.h:888
bool fScrolling
Definition: C4Gui.h:883
BaseParCallbackHandler< int32_t > * pScrollCallback
Definition: C4Gui.h:892

Here is the call graph for this function:

C4GUI::ScrollBar::ScrollBar ( C4Rect rcBounds,
bool  fHorizontal,
BaseParCallbackHandler< int32_t > *  pCB,
int32_t  iCBMaxRange = 256 
)

Definition at line 350 of file C4GuiContainers.cpp.

References C4GUI_ScrollThumbHgt, C4GUI_ScrollThumbWdt, fBottomDown, fScrolling, fTopDown, iScrollPos, iScrollThumbSize, pScrollCallback, C4GUI::Element::rcBounds, and C4GUI::BaseCallbackHandler::Ref().

351  {
352  // set bounds
353  this->rcBounds = rcBounds;
354  // set initial values
355  if ((pScrollCallback = pCB)) pScrollCallback->Ref();
356  fScrolling = true;
358  iScrollPos = 0;
359  fTopDown = fBottomDown = false;
360  }
#define C4GUI_ScrollThumbHgt
Definition: C4Gui.h:107
int32_t iCBMaxRange
Definition: C4Gui.h:889
ScrollBarFacets * pCustomGfx
Definition: C4Gui.h:894
int32_t iScrollThumbSize
Definition: C4Gui.h:885
#define C4GUI_ScrollThumbWdt
Definition: C4Gui.h:108
int32_t iScrollPos
Definition: C4Gui.h:886
C4Rect rcBounds
Definition: C4Gui.h:385
ScrollWindow * pScrollWindow
Definition: C4Gui.h:891
bool fBottomDown
Definition: C4Gui.h:887
bool fAutoHide
Definition: C4Gui.h:884
bool fTopDown
Definition: C4Gui.h:887
bool fHorizontal
Definition: C4Gui.h:888
bool fScrolling
Definition: C4Gui.h:883
BaseParCallbackHandler< int32_t > * pScrollCallback
Definition: C4Gui.h:892

Here is the call graph for this function:

C4GUI::ScrollBar::~ScrollBar ( )
override

Definition at line 362 of file C4GuiContainers.cpp.

References C4GUI::BaseCallbackHandler::DeRef(), C4GUI::ScrollWindow::pScrollBar, pScrollCallback, and pScrollWindow.

363  {
364  if (pScrollWindow) { pScrollWindow->pScrollBar = nullptr; }
366  }
ScrollBar * pScrollBar
Definition: C4Gui.h:942
ScrollWindow * pScrollWindow
Definition: C4Gui.h:891
BaseParCallbackHandler< int32_t > * pScrollCallback
Definition: C4Gui.h:892

Here is the call graph for this function:

Member Function Documentation

virtual bool C4GUI::Element::CheckNameHotkey ( const char *  )
inlineprotectedvirtualinherited

Reimplemented in C4StartupScenSelDlg::ScenListItem.

Definition at line 407 of file C4Gui.h.

Referenced by C4GUI::ListBox::CharIn().

407 { return false; }

Here is the caller graph for this function:

void C4GUI::Element::ClientPos2ScreenPos ( int32_t &  riX,
int32_t &  riY 
)
inherited

Definition at line 231 of file C4Gui.cpp.

References C4GUI::Container::ApplyInvElementOffset(), C4GUI::Element::GetParent(), C4GUI::Element::pParent, C4GUI::Element::rcBounds, C4Rect::x, and C4Rect::y.

Referenced by C4MapFolderData::CreateGUIElements(), C4GUI::Screen::DoContext(), and C4Menu::Draw().

232  {
233  // apply all parent offsets
234  Container *pCont = pParent;
235  while (pCont)
236  {
237  pCont->ApplyInvElementOffset(riX, riY);
238  pCont = pCont->GetParent();
239  }
240  // apply own offset
241  riX += rcBounds.x; riY += rcBounds.y;
242  }
int32_t y
Definition: C4Rect.h:30
C4Rect rcBounds
Definition: C4Gui.h:385
Container * pParent
Definition: C4Gui.h:376
int32_t x
Definition: C4Rect.h:30
friend class Container
Definition: C4Gui.h:472
virtual void ApplyInvElementOffset(int32_t &riX, int32_t &riY)
Definition: C4Gui.h:841

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Element::DoContext ( )
inherited

Definition at line 417 of file C4Gui.cpp.

References C4Rect::Hgt, C4GUI::ContextHandler::OnContext(), C4GUI::Element::pContextHandler, C4GUI::Element::rcBounds, and C4Rect::Wdt.

Referenced by C4GUI::Control::KeyContext(), and C4GUI::ContextButton::MouseInput().

418  {
419  if (!pContextHandler) return false;
420  return pContextHandler->OnContext(this, rcBounds.Wdt/2, rcBounds.Hgt/2);
421  }
ContextHandler * pContextHandler
Definition: C4Gui.h:381
int32_t Wdt
Definition: C4Rect.h:30
C4Rect rcBounds
Definition: C4Gui.h:385
virtual bool OnContext(Element *pOnElement, int32_t iX, int32_t iY)=0
int32_t Hgt
Definition: C4Rect.h:30

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::ScrollBar::DoDragging ( CMouse rMouse,
int32_t  iX,
int32_t  iY,
DWORD  dwKeyParam 
)
overridevirtual

Reimplemented from C4GUI::Element.

Definition at line 455 of file C4GuiContainers.cpp.

References GetScrollByPos(), iScrollPos, and OnPosChanged().

456  {
457  // move thumb
458  iScrollPos = GetScrollByPos(iX, iY);
459  // reflect movement in associated window
460  OnPosChanged();
461  }
int32_t iScrollPos
Definition: C4Gui.h:886
int32_t GetScrollByPos(int32_t iX, int32_t iY)
Definition: C4Gui.h:912

Here is the call graph for this function:

virtual void C4GUI::Element::Draw ( C4TargetFacet cgo)
inlineprotectedvirtualinherited

Reimplemented in C4GUI::Dialog, C4GUI::ContextMenu, C4GUI::Window, C4GUI::Container, C4ScriptGuiWindow, C4Menu, and C4ScoreboardDlg.

Definition at line 387 of file C4Gui.h.

References C4GUI::Element::DrawElement().

387 { DrawElement(cgo); } // draw this class (this + any contents)
virtual void DrawElement(C4TargetFacet &cgo)
Definition: C4Gui.h:388

Here is the call graph for this function:

void C4GUI::Element::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 
)
protectedinherited

Definition at line 291 of file C4Gui.cpp.

References C4GUI_BorderColor1, C4GUI_BorderColor2, C4GUI_BorderColor3, C4Draw::DrawLineDw(), C4Rect::Hgt, pDraw, C4GUI::Element::rcBounds, C4Facet::Surface, C4TargetFacet::TargetX, C4TargetFacet::TargetY, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by C4GUI::ProgressBar::DrawElement(), C4GUI::GroupBox::DrawElement(), C4GUI::Edit::DrawElement(), C4GUI::ListBox::DrawElement(), C4GUI::Tabular::DrawElement(), C4GUI::TextWindow::DrawElement(), C4GUI::ContextMenu::DrawElement(), C4GUI::ComboBox::DrawElement(), and C4GUI::Dialog::DrawElement().

292  {
293  DWORD dwAlpha = byAlpha<<24;
294  int32_t x0 = cgo.TargetX + rcBounds.x + iLeftOff,
295  y0 = cgo.TargetY + rcBounds.y + iTopOff,
296  x1 = cgo.TargetX + rcBounds.x + rcBounds.Wdt - 1,
297  y1 = cgo.TargetY + rcBounds.y + rcBounds.Hgt - 1;
298  if (fDrawTop) pDraw->DrawLineDw(cgo.Surface, (float)x0,(float)y0,(float)x1,(float)y0, C4GUI_BorderColor1 | dwAlpha);
299  if (fDrawLeft) pDraw->DrawLineDw(cgo.Surface, (float)x0,(float)y0,(float)x0,(float)y1, C4GUI_BorderColor1 | dwAlpha);
300  if (fDrawTop) pDraw->DrawLineDw(cgo.Surface, (float)(x0+1),(float)(y0+1),(float)(x1-1),(float)(y0+1), C4GUI_BorderColor2 | dwAlpha);
301  if (fDrawLeft) pDraw->DrawLineDw(cgo.Surface, (float)(x0+1),(float)(y0+1),(float)(x0+1),(float)(y1-1), C4GUI_BorderColor2 | dwAlpha);
302  pDraw->DrawLineDw(cgo.Surface, (float)x0,(float)y1,(float)x1,(float)y1, C4GUI_BorderColor3 | dwAlpha);
303  pDraw->DrawLineDw(cgo.Surface, (float)x1,(float)y0,(float)x1,(float)y1, C4GUI_BorderColor3 | dwAlpha);
304  pDraw->DrawLineDw(cgo.Surface, (float)(x0+1),(float)(y1-1),(float)(x1-1),(float)(y1-1), C4GUI_BorderColor1 | dwAlpha);
305  pDraw->DrawLineDw(cgo.Surface, (float)(x1-1),(float)(y0+1),(float)(x1-1),(float)(y1-1), C4GUI_BorderColor1 | dwAlpha);
306  }
#define C4GUI_BorderColor2
Definition: C4Gui.h:86
void DrawLineDw(C4Surface *sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width=1.0f)
Definition: C4Draw.cpp:614
int32_t Wdt
Definition: C4Rect.h:30
#define C4GUI_BorderColor1
Definition: C4Gui.h:85
int32_t y
Definition: C4Rect.h:30
C4Rect rcBounds
Definition: C4Gui.h:385
C4Draw * pDraw
Definition: C4Draw.cpp:42
int32_t x
Definition: C4Rect.h:30
float TargetX
Definition: C4Facet.h:165
#define C4GUI_BorderColor3
Definition: C4Gui.h:87
int32_t Hgt
Definition: C4Rect.h:30
C4Surface * Surface
Definition: C4Facet.h:117
float TargetY
Definition: C4Facet.h:165
uint32_t DWORD

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Element::DrawBar ( C4TargetFacet cgo,
DynBarFacet rFacets 
)
protectedinherited

Definition at line 308 of file C4Gui.cpp.

References C4Facet::Draw(), C4Facet::DrawX(), C4GUI::DynBarFacet::fctBegin, C4GUI::DynBarFacet::fctEnd, C4GUI::DynBarFacet::fctMiddle, C4Rect::Hgt, C4Facet::Hgt, C4GUI::Element::rcBounds, C4Facet::Surface, C4TargetFacet::TargetX, C4TargetFacet::TargetY, C4Rect::Wdt, C4Facet::Wdt, C4Rect::x, C4Facet::X, and C4Rect::y.

Referenced by C4GUI::WoodenLabel::DrawElement(), and C4GUI::Button::DrawElement().

309  {
310  if (rcBounds.Hgt == rFacets.fctMiddle.Hgt)
311  {
312  // exact bar
313  int32_t x0=cgo.TargetX+rcBounds.x, y0=cgo.TargetY+rcBounds.y;
314  int32_t iX = rFacets.fctBegin.Wdt, w=rFacets.fctMiddle.Wdt, wLeft=rFacets.fctBegin.Wdt, wRight=rFacets.fctEnd.Wdt;
315  int32_t iRightShowLength = wRight/3;
316  bool fOverflow = (wLeft > rcBounds.Wdt);
317  if (fOverflow) rFacets.fctBegin.Wdt = rcBounds.Wdt;
318  rFacets.fctBegin.Draw(cgo.Surface, x0,y0);
319  if (fOverflow) rFacets.fctBegin.Wdt = wLeft;
320  while (iX < rcBounds.Wdt-iRightShowLength)
321  {
322  int32_t w2=std::min(w, rcBounds.Wdt-iRightShowLength-iX); rFacets.fctMiddle.Wdt=w2;
323  rFacets.fctMiddle.Draw(cgo.Surface, x0+iX, y0);
324  iX += w;
325  }
326  rFacets.fctMiddle.Wdt=w;
327  fOverflow = (wRight > rcBounds.Wdt);
328  if (fOverflow)
329  {
330  rFacets.fctEnd.X += wRight - rcBounds.Wdt;
331  rFacets.fctEnd.Wdt = rcBounds.Wdt;
332  }
333  rFacets.fctEnd.Draw(cgo.Surface, x0+rcBounds.Wdt-rFacets.fctEnd.Wdt, y0);
334  if (fOverflow)
335  {
336  rFacets.fctEnd.X -= wRight - rcBounds.Wdt;
337  rFacets.fctEnd.Wdt = wRight;
338  }
339  }
340  else
341  {
342  // zoomed bar
343  float fZoom = (float) rcBounds.Hgt / rFacets.fctMiddle.Hgt;
344  int32_t x0=cgo.TargetX+rcBounds.x, y0=cgo.TargetY+rcBounds.y;
345  int32_t iX = int32_t(fZoom*rFacets.fctBegin.Wdt), w=int32_t(fZoom*rFacets.fctMiddle.Wdt), wOld=rFacets.fctMiddle.Wdt;
346  int32_t iRightShowLength = rFacets.fctEnd.Wdt/3;
347  rFacets.fctBegin.DrawX(cgo.Surface, x0,y0,int32_t(fZoom*rFacets.fctBegin.Wdt),rcBounds.Hgt);
348  while (iX < rcBounds.Wdt-(fZoom*iRightShowLength))
349  {
350  int32_t w2=std::min<int32_t>(w, rcBounds.Wdt-int32_t(fZoom*iRightShowLength)-iX); rFacets.fctMiddle.Wdt=long(float(w2)/fZoom);
351  rFacets.fctMiddle.DrawX(cgo.Surface, x0+iX, y0, w2,rcBounds.Hgt);
352  iX += w;
353  }
354  rFacets.fctMiddle.Wdt=wOld;
355  rFacets.fctEnd.DrawX(cgo.Surface, x0+rcBounds.Wdt-int32_t(fZoom*rFacets.fctEnd.Wdt), y0,int32_t(fZoom*rFacets.fctEnd.Wdt),rcBounds.Hgt);
356  }
357  }
int32_t Wdt
Definition: C4Rect.h:30
int32_t y
Definition: C4Rect.h:30
C4Rect rcBounds
Definition: C4Gui.h:385
int32_t x
Definition: C4Rect.h:30
float TargetX
Definition: C4Facet.h:165
int32_t Hgt
Definition: C4Rect.h:30
C4Surface * Surface
Definition: C4Facet.h:117
float TargetY
Definition: C4Facet.h:165

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::ScrollBar::DrawElement ( C4TargetFacet cgo)
overrideprotectedvirtual

Reimplemented from C4GUI::Element.

Definition at line 471 of file C4GuiContainers.cpp.

References C4GUI::ScrollBarFacets::barScroll, C4GUI_ScrollArrowHgt, C4GUI_ScrollArrowWdt, C4Facet::Draw(), C4GUI::Element::DrawHBarByVGfx(), C4GUI::Element::DrawVBar(), fBottomDown, C4GUI::DynBarFacet::fctBegin, C4GUI::DynBarFacet::fctEnd, C4GUI::ScrollBarFacets::fctScrollDBottom, C4GUI::ScrollBarFacets::fctScrollDTop, C4GUI::ScrollBarFacets::fctScrollPin, fHorizontal, fScrolling, fTopDown, GetMaxScroll(), GraphicsResource, HasPin(), iScrollPos, OnPosChanged(), pCustomGfx, C4GUI::Element::rcBounds, C4GraphicsResource::sfctScroll, C4Facet::Surface, C4TargetFacet::TargetX, C4TargetFacet::TargetY, C4Rect::x, and C4Rect::y.

Referenced by C4ScriptGuiWindow::DrawChildren().

472  {
473  // do scrolling
474  // not quite perfect; but there's no OnIdle, and it's be a bit of overkill starting a timer
475  if (fTopDown && fScrolling && iScrollPos>0)
476  { --iScrollPos; OnPosChanged(); }
477  if (fBottomDown && fScrolling)
478  {
480  }
481  // draw bar
482  ScrollBarFacets &rUseGfx = pCustomGfx ? *pCustomGfx : ::GraphicsResource.sfctScroll;
483  DynBarFacet bar = rUseGfx.barScroll;
484  if (fTopDown) bar.fctBegin = rUseGfx.fctScrollDTop;
485  if (fBottomDown) bar.fctEnd = rUseGfx.fctScrollDBottom;
486  if (fHorizontal)
487  DrawHBarByVGfx(cgo, bar);
488  else
489  DrawVBar(cgo, bar);
490  // draw scroll pin
491  if (fScrolling && HasPin())
492  {
493  if (fHorizontal)
494  rUseGfx.fctScrollPin.Draw(cgo.Surface, cgo.TargetX+rcBounds.x+C4GUI_ScrollArrowWdt+iScrollPos, cgo.TargetY+rcBounds.y);
495  else
496  rUseGfx.fctScrollPin.Draw(cgo.Surface, cgo.TargetX+rcBounds.x, cgo.TargetY+rcBounds.y+C4GUI_ScrollArrowHgt+iScrollPos);
497  }
498  }
ScrollBarFacets * pCustomGfx
Definition: C4Gui.h:894
#define C4GUI_ScrollArrowWdt
Definition: C4Gui.h:106
C4GraphicsResource GraphicsResource
int32_t GetMaxScroll()
Definition: C4Gui.h:907
DynBarFacet barScroll
Definition: C4Gui.h:361
bool HasPin()
Definition: C4Gui.h:902
#define C4GUI_ScrollArrowHgt
Definition: C4Gui.h:105
int32_t y
Definition: C4Rect.h:30
int32_t iScrollPos
Definition: C4Gui.h:886
C4Rect rcBounds
Definition: C4Gui.h:385
bool fBottomDown
Definition: C4Gui.h:887
bool fTopDown
Definition: C4Gui.h:887
int32_t x
Definition: C4Rect.h:30
bool fHorizontal
Definition: C4Gui.h:888
C4Facet fctBegin
Definition: C4Gui.h:351
float TargetX
Definition: C4Facet.h:165
void DrawHBarByVGfx(C4TargetFacet &cgo, DynBarFacet &rFacets)
Definition: C4Gui.cpp:365
bool fScrolling
Definition: C4Gui.h:883
void DrawVBar(C4TargetFacet &cgo, DynBarFacet &rFacets)
Definition: C4Gui.cpp:359
C4GUI::ScrollBarFacets sfctScroll
C4Surface * Surface
Definition: C4Facet.h:117
float TargetY
Definition: C4Facet.h:165

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Element::DrawHBarByVGfx ( C4TargetFacet cgo,
DynBarFacet rFacets 
)
protectedinherited

Definition at line 365 of file C4Gui.cpp.

References C4GUI::Element::DrawHVBar(), C4Rect::Hgt, C4GUI::Element::rcBounds, C4BltTransform::SetRotate(), C4TargetFacet::TargetX, C4TargetFacet::TargetY, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by DrawElement().

366  {
367  C4DrawTransform trf;
368  float fOffX = cgo.TargetX + rcBounds.x + rcBounds.Hgt/2;
369  float fOffY = cgo.TargetY + rcBounds.y + rcBounds.Hgt/2;
370  trf.SetRotate(-90.0f, fOffX, fOffY);
371 
372  DrawHVBar(cgo, rFacets, trf, rcBounds.Wdt);
373  }
void DrawHVBar(C4TargetFacet &cgo, DynBarFacet &rFacets, C4DrawTransform &trf, int32_t iMiddleLength)
Definition: C4Gui.cpp:375
int32_t Wdt
Definition: C4Rect.h:30
int32_t y
Definition: C4Rect.h:30
C4Rect rcBounds
Definition: C4Gui.h:385
int32_t x
Definition: C4Rect.h:30
float TargetX
Definition: C4Facet.h:165
void SetRotate(float iAngle, float fOffX, float fOffY)
int32_t Hgt
Definition: C4Rect.h:30
float TargetY
Definition: C4Facet.h:165

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Element::DrawHVBar ( C4TargetFacet cgo,
DynBarFacet rFacets,
C4DrawTransform trf,
int32_t  iMiddleLength 
)
protectedinherited

Definition at line 375 of file C4Gui.cpp.

References C4Facet::DrawT(), C4GUI::DynBarFacet::fctBegin, C4GUI::DynBarFacet::fctEnd, C4GUI::DynBarFacet::fctMiddle, C4Facet::Hgt, C4GUI::Element::rcBounds, C4Facet::Surface, C4TargetFacet::TargetX, C4TargetFacet::TargetY, C4Rect::x, and C4Rect::y.

Referenced by C4GUI::Element::DrawHBarByVGfx(), and C4GUI::Element::DrawVBar().

376  {
377  int32_t y0 = cgo.TargetY + rcBounds.y;
378  int32_t x0 = cgo.TargetX + rcBounds.x;
379 
380  // draw up arrow
381  rFacets.fctBegin.DrawT(cgo.Surface, x0, y0, 0, 0, &trf);
382 
383  // draw middle part
384  int32_t h = rFacets.fctMiddle.Hgt;
385  int32_t barHeight = iMiddleLength - (rFacets.fctBegin.Hgt + rFacets.fctEnd.Hgt);
386 
387  for (int32_t iY = 0; iY <= barHeight; iY += h)
388  {
389  int32_t h2 = std::min(h, barHeight - iY);
390  rFacets.fctMiddle.Hgt = h2;
391  rFacets.fctMiddle.DrawT(cgo.Surface, x0, y0 + rFacets.fctBegin.Hgt + iY, 0, 0, &trf);
392  }
393  rFacets.fctMiddle.Hgt = h;
394 
395  // draw lower arrow
396  rFacets.fctEnd.DrawT(cgo.Surface, x0, y0 + iMiddleLength - rFacets.fctEnd.Hgt, 0, 0, &trf);
397  }
int Hgt
Definition: C4Surface.h:65
int32_t y
Definition: C4Rect.h:30
C4Rect rcBounds
Definition: C4Gui.h:385
int32_t x
Definition: C4Rect.h:30
float TargetX
Definition: C4Facet.h:165
C4Surface * Surface
Definition: C4Facet.h:117
float TargetY
Definition: C4Facet.h:165

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Element::DrawVBar ( C4TargetFacet cgo,
DynBarFacet rFacets 
)
protectedinherited

Definition at line 359 of file C4Gui.cpp.

References C4GUI::Element::DrawHVBar(), C4Rect::Hgt, and C4GUI::Element::rcBounds.

Referenced by DrawElement().

360  {
361  C4DrawTransform trf(1);
362  DrawHVBar(cgo, rFacets, trf, rcBounds.Hgt);
363  }
void DrawHVBar(C4TargetFacet &cgo, DynBarFacet &rFacets, C4DrawTransform &trf, int32_t iMiddleLength)
Definition: C4Gui.cpp:375
C4Rect rcBounds
Definition: C4Gui.h:385
int32_t Hgt
Definition: C4Rect.h:30

Here is the call graph for this function:

Here is the caller graph for this function:

C4Rect& C4GUI::Element::GetBounds ( )
inlineinherited

Definition at line 445 of file C4Gui.h.

References C4GUI::Element::rcBounds.

Referenced by C4GUI::ListBox::AddElement(), C4Menu::AdjustPosition(), C4GameOverDlg::C4GameOverDlg(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupNetListEntry::C4StartupNetListEntry(), C4StartupScenSelDlg::C4StartupScenSelDlg(), C4GUI::ContextMenu::CheckOpenSubmenu(), C4GUI::ListBox::ContractToElementHeight(), C4MapFolderData::CreateGUIElements(), C4GUI::Screen::DoContext(), C4GUI::Window::Draw(), C4GUI::ListBox::DrawElement(), C4GUI::ContextMenu::DrawElement(), C4GUI::TextWindow::ElementPosChanged(), C4GUI::TextWindow::ElementSizeChanged(), C4GUI::Dialog::GetMarginTop(), GetMaxScroll(), C4GUI::GetScreenHgt(), C4GUI::GetScreenWdt(), C4Menu::InitSize(), C4GUI::ListBox::InsertElement(), C4GUI::ScrollWindow::IsRangeInView(), C4StartupPlrSelDlg::PlayerListItem::Load(), C4GUI::Window::MouseInput(), MouseInput(), C4GUI::ListBox::MouseInput(), C4GUI::Screen::MouseInput(), C4StartupPlrSelDlg::OnNewBtn(), OnPosChanged(), C4StartupPlrSelDlg::OnPropertyBtn(), C4StartupScenSelDlg::ScenListItem::ScenListItem(), C4GUI::ScrollWindow::ScrollBy(), C4GUI::ListBox::ScrollItemInView(), C4GUI::ScrollWindow::ScrollPages(), C4GUI::ScrollWindow::ScrollRangeInView(), C4GUI::ScrollWindow::ScrollToBottom(), C4GUI::Tabular::SetGfx(), C4GoalDisplay::SetGoals(), C4GUI::TextWindow::SetPicture(), C4GUI::Dialog::SetTitle(), Update(), C4GUI::ScrollWindow::Update(), C4StartupPlrSelDlg::PlayerListItem::UpdateCore(), C4GUI::ListBox::UpdateElementPosition(), C4Menu::UpdateElementPositions(), C4GUI::ListBox::UpdateElementPositions(), C4GUI::ScrollWindow::UpdateOwnPos(), C4Menu::UpdateScrollBar(), and C4GUI::TextWindow::UpdateSize().

445 { return rcBounds; }
C4Rect rcBounds
Definition: C4Gui.h:385

Here is the caller graph for this function:

virtual C4Rect& C4GUI::Element::GetClientRect ( )
inlinevirtualinherited

Reimplemented in C4GUI::Window.

Definition at line 447 of file C4Gui.h.

References C4GUI::Element::rcBounds.

Referenced by C4GUI::Element::GetContainedClientRect(), and C4GUI::Element::GetToprightCornerRect().

447 { return rcBounds; }
C4Rect rcBounds
Definition: C4Gui.h:385

Here is the caller graph for this function:

C4Rect C4GUI::Element::GetContainedClientRect ( )
inlineinherited

Definition at line 448 of file C4Gui.h.

References C4GUI::Element::GetClientRect(), C4Rect::x, and C4Rect::y.

Referenced by C4GUI::Tabular::AddSheet(), C4ChartDialog::C4ChartDialog(), C4Network2ClientListDlg::C4Network2ClientListDlg(), C4Network2StartWaitDlg::C4Network2StartWaitDlg(), C4StartupAboutDlg::C4StartupAboutDlg(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupNetListEntry::C4StartupNetListEntry(), C4FileSelDlg::DefaultListItem::DefaultListItem(), C4ChatDlg::DoPlacement(), C4GUI::Element::GetToprightCornerRect(), C4GUI::InputDialog::InputDialog(), C4GameLobby::MainDlg::MainDlg(), C4GUI::TextWindow::TextWindow(), C4Menu::UpdateElementPositions(), C4ChatControl::ChatSheet::NickItem::UpdateOwnPos(), C4FileSelDlg::DefaultListItem::UpdateOwnPos(), C4StartupScenSelDlg::ScenListItem::UpdateOwnPos(), C4GUI::ScrollWindow::UpdateOwnPos(), C4ChatControl::UpdateSize(), C4ChatDlg::UpdateSize(), C4GUI::Tabular::UpdateSize(), and C4GUI::TextWindow::UpdateSize().

448 { C4Rect rc=GetClientRect(); rc.x=rc.y=0; return rc; }
Definition: C4Rect.h:27
int32_t y
Definition: C4Rect.h:30
int32_t x
Definition: C4Rect.h:30
virtual C4Rect & GetClientRect()
Definition: C4Gui.h:447

Here is the call graph for this function:

Here is the caller graph for this function:

virtual Container* C4GUI::Element::GetContainer ( )
inlinevirtualinherited

Reimplemented in C4GUI::Container.

Definition at line 410 of file C4Gui.h.

References C4GUI::Element::pParent.

Referenced by C4GUI::ContextButton::ContextButton(), and C4GUI::Element::GetToprightCornerRect().

410 { return pParent; } // returns parent for elements; this for containers
Container * pParent
Definition: C4Gui.h:376

Here is the caller graph for this function:

ContextHandler * C4GUI::Element::GetContextHandler ( )
virtualinherited

Reimplemented in C4GUI::Dialog.

Definition at line 429 of file C4Gui.cpp.

References C4GUI::Element::GetContextHandler(), C4GUI::Element::pContextHandler, and C4GUI::Element::pParent.

Referenced by C4GUI::ContextButton::ContextButton(), C4GUI::Element::GetContextHandler(), and C4GUI::Element::MouseInput().

430  {
431  // fallback to parent context, if own is not assigned
433  }
ContextHandler * pContextHandler
Definition: C4Gui.h:381
virtual ContextHandler * GetContextHandler()
Definition: C4Gui.cpp:429
Container * pParent
Definition: C4Gui.h:376

Here is the call graph for this function:

Here is the caller graph for this function:

virtual class DialogWindow* C4GUI::Element::GetDialogWindow ( )
inlineprotectedvirtualinherited

Reimplemented in C4GUI::Dialog.

Definition at line 404 of file C4Gui.h.

404 { return nullptr; } // return DialogWindow if this element is a dialog
Dialog * C4GUI::Element::GetDlg ( )
virtualinherited

Reimplemented in C4GUI::Dialog.

Definition at line 288 of file C4Gui.cpp.

References C4GUI::Element::GetDlg(), and C4GUI::Element::pParent.

Referenced by C4GUI::Control::DisableFocus(), C4ChatControl::DlgEnter(), C4ChatControl::GetDefaultControl(), C4GUI::Element::GetDlg(), C4GUI::ContextMenu::GetTargetDialog(), C4GUI::Control::HasDrawFocus(), C4GUI::Element::IsInActiveDlg(), C4GUI::Label::MouseInput(), C4GUI::Control::MouseInput(), C4GUI::Screen::MouseInput(), C4ChatControl::OnConnectBtn(), C4GUI::RenameEdit::OnFinishInput(), C4GUI::Label::OnHotkey(), C4ChatControl::OnLoginDataEnter(), C4GUI::CloseButton::OnPress(), C4GUI::CloseIconButton::OnPress(), C4GUI::RenameEdit::RenameEdit(), C4GUI::Container::SetVisibility(), and C4GUI::Screen::ShowDialog().

288 { if (pParent) return pParent->GetDlg (); return nullptr; }
Container * pParent
Definition: C4Gui.h:376
virtual class Dialog * GetDlg()
Definition: C4Gui.cpp:288

Here is the call graph for this function:

Here is the caller graph for this function:

virtual Element* C4GUI::Element::GetFirstContained ( )
inlinevirtualinherited

Reimplemented in C4GUI::Container.

Definition at line 452 of file C4Gui.h.

Referenced by C4GUI::Container::GetNextNestedElement().

452 { return nullptr; }

Here is the caller graph for this function:

virtual Element* C4GUI::Element::GetFirstNestedElement ( bool  fBackwards)
inlinevirtualinherited

Reimplemented in C4GUI::Container.

Definition at line 451 of file C4Gui.h.

Referenced by C4GUI::Container::GetFirstNestedElement(), and C4GUI::Container::GetNextNestedElement().

451 { return this; }

Here is the caller graph for this function:

int32_t C4GUI::Element::GetHeight ( )
inlineinherited

Definition at line 444 of file C4Gui.h.

References C4Rect::Hgt.

Referenced by C4GUI::Screen::ShowDialog().

444 { return rcBounds.Hgt; }
C4Rect rcBounds
Definition: C4Gui.h:385
int32_t Hgt
Definition: C4Rect.h:30

Here is the caller graph for this function:

virtual int32_t C4GUI::Element::GetListItemTopSpacing ( )
inlinevirtualinherited

Reimplemented in C4StartupNetListEntry.

Definition at line 461 of file C4Gui.h.

References C4GUI_DefaultListSpacing.

Referenced by C4GUI::ListBox::AddElement(), C4GUI::ListBox::DrawElement(), and C4GUI::ListBox::UpdateElementPositions().

461 { return C4GUI_DefaultListSpacing; }
#define C4GUI_DefaultListSpacing
Definition: C4Gui.h:123

Here is the caller graph for this function:

virtual bool C4GUI::Element::GetListItemTopSpacingBar ( )
inlinevirtualinherited

Definition at line 462 of file C4Gui.h.

Referenced by C4GUI::ListBox::DrawElement().

462 { return false; }

Here is the caller graph for this function:

int32_t C4GUI::ScrollBar::GetMaxScroll ( )
inlineprotected

Definition at line 907 of file C4Gui.h.

References C4GUI_ScrollArrowHgt, C4GUI_ScrollArrowWdt, C4GUI::Element::GetBounds(), HasPin(), C4Rect::Hgt, and C4Rect::Wdt.

Referenced by DrawElement(), GetScrollByPos(), OnPosChanged(), and SetScrollPos().

908  {
910  else return HasPin() ? GetBounds().Hgt - 2*C4GUI_ScrollArrowHgt - iScrollThumbSize : 100;
911  }
#define C4GUI_ScrollArrowWdt
Definition: C4Gui.h:106
int32_t iScrollThumbSize
Definition: C4Gui.h:885
bool HasPin()
Definition: C4Gui.h:902
int32_t Wdt
Definition: C4Rect.h:30
#define C4GUI_ScrollArrowHgt
Definition: C4Gui.h:105
C4Rect & GetBounds()
Definition: C4Gui.h:445
bool fHorizontal
Definition: C4Gui.h:888
int32_t Hgt
Definition: C4Rect.h:30

Here is the call graph for this function:

Here is the caller graph for this function:

const char* C4GUI::Element::GetOwnToolTip ( )
inlineinherited

Definition at line 440 of file C4Gui.h.

References StdStrBuf::getData().

440 { return ToolTip.getData(); } // return tooltip const char*, without fallback to parent
const char * getData() const
Definition: StdBuf.h:442

Here is the call graph for this function:

Element* C4GUI::Element::GetPrev ( ) const
inlineinherited

Definition at line 450 of file C4Gui.h.

References C4GUI::Element::pPrev.

Referenced by C4GUI::ListBox::AddElement(), C4GUI::Screen::GetDialog(), C4GUI::Screen::GetTopDialog(), C4GUI::Window::MouseInput(), C4GUI::Screen::MouseInput(), and C4GUI::Container::ReverseIterator::operator++().

450 { return pPrev; }
Element * pPrev
Definition: C4Gui.h:377

Here is the caller graph for this function:

Screen * C4GUI::Element::GetScreen ( )
virtualinherited

Reimplemented in C4GUI::Screen, and C4GUI::ContextMenu.

Definition at line 289 of file C4Gui.cpp.

References C4GUI::Element::GetScreen(), and C4GUI::Element::pParent.

Referenced by C4GUI::Dialog::Close(), C4StartupScenSelDlg::DoOK(), C4GUI::Dialog::Draw(), C4GUI::ContextButton::DrawElement(), C4GUI::ComboBox::DrawElement(), C4GUI::Dialog::FadeOut(), C4GUI::Element::GetScreen(), C4GUI::Control::HasDrawFocus(), C4GUI::Dialog::IsActive(), C4StartupScenSelDlg::KeyDelete(), C4GUI::ComboBox::MouseInput(), C4GameOptionButtons::OnBtnComment(), C4GameOptionButtons::OnBtnPassword(), C4StartupPlrPropertiesDlg::OnClosed(), C4StartupPlrPropertiesDlg::OnClrChangeCustom(), C4ChatControl::OnConnectBtn(), C4GUI::CBContextHandler< CBClass >::OnContext(), C4StartupPlrSelDlg::OnDelBtn(), C4StartupPlrSelDlg::OnDelBtnConfirm(), C4StartupPlrSelDlg::OnNewBtn(), C4StartupPlrPropertiesDlg::OnPictureBtn(), C4StartupPlrSelDlg::OnPropertyBtn(), C4StartupMainDlg::OnShown(), C4StartupMainDlg::OnTODO(), C4StartupOptionsDlg::SaveConfig(), C4GUI::Element::SetVisibility(), C4GameLobby::MainDlg::Start(), C4StartupScenSelDlg::StartScenario(), C4ScoreboardDlg::Update(), C4StartupPlrSelDlg::PlayerListItem::UpdateCore(), C4FileSelDlg::UserClose(), and C4ChatControl::UserQueryQuit().

289 { if (pParent) return pParent->GetScreen(); return nullptr; }
Container * pParent
Definition: C4Gui.h:376
virtual Screen * GetScreen()
Definition: C4Gui.cpp:289

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4GUI::ScrollBar::GetScrollByPos ( int32_t  iX,
int32_t  iY 
)
inlineprotected

Definition at line 912 of file C4Gui.h.

References C4GUI_ScrollArrowHgt, C4GUI_ScrollArrowWdt, and GetMaxScroll().

Referenced by DoDragging(), and MouseInput().

913  {
914  return Clamp<int32_t>((fHorizontal ? iX-C4GUI_ScrollArrowWdt : iY-C4GUI_ScrollArrowHgt)-iScrollThumbSize/2, 0, GetMaxScroll());
915  }
#define C4GUI_ScrollArrowWdt
Definition: C4Gui.h:106
int32_t iScrollThumbSize
Definition: C4Gui.h:885
int32_t GetMaxScroll()
Definition: C4Gui.h:907
#define C4GUI_ScrollArrowHgt
Definition: C4Gui.h:105
bool fHorizontal
Definition: C4Gui.h:888

Here is the call graph for this function:

Here is the caller graph for this function:

const char * C4GUI::Element::GetToolTip ( )
inherited

Definition at line 423 of file C4Gui.cpp.

References StdStrBuf::getData(), C4GUI::Element::GetToolTip(), StdStrBuf::isNull(), and C4GUI::Element::pParent.

Referenced by C4GUI::CMouse::Draw(), C4GUI::Element::GetToolTip(), C4GameLobby::MainDlg::OnRightTabContext(), and C4GameLobby::MainDlg::UpdateRightTab().

424  {
425  // fallback to parent tooltip, if own is not assigned
426  return (!pParent || !ToolTip.isNull()) ? ToolTip.getData() : pParent->GetToolTip();
427  }
const char * getData() const
Definition: StdBuf.h:442
const char * GetToolTip()
Definition: C4Gui.cpp:423
Container * pParent
Definition: C4Gui.h:376
bool isNull() const
Definition: StdBuf.h:441

Here is the call graph for this function:

Here is the caller graph for this function:

C4Rect C4GUI::Element::GetToprightCornerRect ( int32_t  iWidth = 16,
int32_t  iHeight = 16,
int32_t  iHIndent = 4,
int32_t  iVIndent = 4,
int32_t  iIndexX = 0 
)
inherited

Definition at line 399 of file C4Gui.cpp.

References C4GUI::Element::GetClientRect(), C4GUI::Element::GetContainedClientRect(), C4GUI::Element::GetContainer(), C4Rect::Hgt, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by C4GUI::ContextButton::ContextButton(), C4GUI::Dialog::SetTitle(), and C4GUI::Dialog::UpdateSize().

400  {
401  // bounds by topright corner of element
402  C4Rect rtBounds = (GetContainer() != this) ? GetClientRect() : GetContainedClientRect();
403  rtBounds.x += rtBounds.Wdt - (iWidth + iHIndent) * (iIndexX + 1);
404  rtBounds.y += iVIndent;
405  rtBounds.Wdt = rtBounds.Hgt = iHeight;
406  return rtBounds;
407  }
virtual Container * GetContainer()
Definition: C4Gui.h:410
Definition: C4Rect.h:27
C4Rect GetContainedClientRect()
Definition: C4Gui.h:448
int32_t Wdt
Definition: C4Rect.h:30
int32_t y
Definition: C4Rect.h:30
int32_t x
Definition: C4Rect.h:30
virtual C4Rect & GetClientRect()
Definition: C4Gui.h:447
int32_t Hgt
Definition: C4Rect.h:30

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4GUI::Element::GetWidth ( )
inlineinherited

Definition at line 443 of file C4Gui.h.

References C4Rect::Wdt.

Referenced by C4GUI::Screen::ShowDialog().

443 { return rcBounds.Wdt; }
int32_t Wdt
Definition: C4Rect.h:30
C4Rect rcBounds
Definition: C4Gui.h:385

Here is the caller graph for this function:

bool C4GUI::ScrollBar::HasPin ( )
inlineprotected

Definition at line 902 of file C4Gui.h.

References C4GUI_ScrollArrowHgt, C4GUI_ScrollArrowWdt, C4GUI_ScrollThumbHgt, C4GUI_ScrollThumbWdt, C4Rect::Hgt, C4GUI::Element::rcBounds, and C4Rect::Wdt.

Referenced by DrawElement(), GetMaxScroll(), and MouseInput().

903  {
906  }
#define C4GUI_ScrollThumbHgt
Definition: C4Gui.h:107
#define C4GUI_ScrollArrowWdt
Definition: C4Gui.h:106
#define C4GUI_ScrollThumbWdt
Definition: C4Gui.h:108
int32_t Wdt
Definition: C4Rect.h:30
#define C4GUI_ScrollArrowHgt
Definition: C4Gui.h:105
C4Rect rcBounds
Definition: C4Gui.h:385
bool fHorizontal
Definition: C4Gui.h:888
int32_t Hgt
Definition: C4Rect.h:30

Here is the caller graph for this function:

virtual bool C4GUI::Element::IsExternalDrawDialog ( )
inlineprotectedvirtualinherited

Reimplemented in C4GUI::Dialog, and C4Menu.

Definition at line 402 of file C4Gui.h.

402 { return false; }
virtual Control* C4GUI::Element::IsFocusElement ( )
inlinevirtualinherited

Reimplemented in C4GUI::ComboBox, C4GUI::TextWindow, C4GUI::Tabular, C4GUI::ListBox, C4GUI::CheckBox, and C4GUI::Control.

Definition at line 432 of file C4Gui.h.

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

432 { return nullptr; }; // return control to gain focus in search-cycle

Here is the caller graph for this function:

bool C4GUI::Element::IsImmediateToolTip ( ) const
inlineinherited

Definition at line 441 of file C4Gui.h.

Referenced by C4GUI::CMouse::Draw().

441 { return is_immediate_tooltip; }

Here is the caller graph for this function:

bool C4GUI::Element::IsInActiveDlg ( bool  fForKeyboard)
inherited

Definition at line 435 of file C4Gui.cpp.

References C4GUI::Element::GetDlg(), and C4GUI::Dialog::IsActive().

Referenced by C4GUI::ControlKeyDlgCB< TargetClass >::CheckCondition(), C4GUI::Button::DrawElement(), C4GUI::IconButton::DrawElement(), C4GUI::ArrowButton::DrawElement(), C4GUI::FacetButton::DrawElement(), C4GUI::CheckBox::DrawElement(), and C4GUI::ContextButton::DrawElement().

436  {
437  // get dlg
438  Dialog *pDlg=GetDlg();
439  if (!pDlg) return false;
440  // check if dlg is active
441  return pDlg->IsActive(fForKeyboard);
442  }
virtual class Dialog * GetDlg()
Definition: C4Gui.cpp:288

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool C4GUI::Element::IsMenu ( )
inlineprotectedvirtualinherited

Reimplemented in C4GUI::ContextMenu, and C4GUI::ContextMenu::Entry.

Definition at line 403 of file C4Gui.h.

Referenced by C4GUI::Element::RemoveElement().

403 { return false; }

Here is the caller graph for this function:

virtual bool C4GUI::Element::IsOwnPtrElement ( )
inlineprotectedvirtualinherited

Reimplemented in C4Menu.

Definition at line 401 of file C4Gui.h.

Referenced by C4GUI::Container::ClearChildren().

401 { return false; } // if true is returned, item will not be deleted when container is cleared

Here is the caller graph for this function:

virtual bool C4GUI::Element::IsParentOf ( Element pEl)
inlinevirtualinherited

Reimplemented in C4GUI::Container.

Definition at line 454 of file C4Gui.h.

Referenced by C4GUI::ListBox::IsSelectedChild().

454 { return false; } // whether this is the parent container (directly or recursively) of the passed element

Here is the caller graph for this function:

bool C4GUI::ScrollBar::IsScrolling ( )
inlineprotected

Definition at line 916 of file C4Gui.h.

References fScrolling.

Referenced by C4GUI::ScrollWindow::IsScrollingActive().

916 { return fScrolling; }
bool fScrolling
Definition: C4Gui.h:883

Here is the caller graph for this function:

bool C4GUI::Element::IsVisible ( )
inherited

Definition at line 201 of file C4Gui.cpp.

References C4GUI::Element::fVisible, C4GUI::Element::IsVisible(), and C4GUI::Element::pParent.

Referenced by C4GUI::Dialog::AdvanceFocus(), C4GUI::Screen::CharIn(), C4GUI::ControlKeyDlgCB< TargetClass >::CheckCondition(), C4ScriptGuiWindow::Draw(), C4GUI::Container::Draw(), C4GUI::Window::Draw(), C4GUI::Screen::Draw(), C4ScriptGuiWindow::DrawAll(), C4ScriptGuiWindow::DrawChildren(), C4ChatControl::GetDefaultControl(), C4GUI::Screen::GetFullscreenDialog(), C4GUI::Element::IsVisible(), C4ScriptGuiWindow::IsVisibleTo(), C4GUI::Window::MouseInput(), C4GUI::Control::MouseInput(), C4GUI::Screen::MouseInput(), C4GUI::Container::OnHotkey(), C4ScriptGuiWindow::ProcessMouseInput(), C4Menu::SetPosition(), C4Menu::UpdateElementPositions(), and C4GUI::TextWindow::UpdateSize().

202  {
203  // self and parent must be visible
204  return fVisible && (!pParent || pParent->IsVisible());
205  }
bool IsVisible()
Definition: C4Gui.cpp:201
Container * pParent
Definition: C4Gui.h:376
bool fVisible
Definition: C4Gui.h:383

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void C4GUI::Element::MouseEnter ( CMouse rMouse)
inlinevirtualinherited

Reimplemented in C4GUI::ComboBox, C4GUI::ContextButton, C4GUI::CheckBox, C4GUI::Button, C4ScriptGuiWindow, and C4MenuItem.

Definition at line 413 of file C4Gui.h.

Referenced by C4GUI::Button::MouseEnter(), C4GUI::CheckBox::MouseEnter(), C4GUI::ContextButton::MouseEnter(), C4GUI::ComboBox::MouseEnter(), and C4GUI::Screen::MouseInput().

413 {}; // called when mouse cursor enters element region

Here is the caller graph for this function:

void C4GUI::ScrollBar::MouseInput ( CMouse rMouse,
int32_t  iButton,
int32_t  iX,
int32_t  iY,
DWORD  dwKeyParam 
)
overridevirtual

Reimplemented from C4GUI::Element.

Definition at line 416 of file C4GuiContainers.cpp.

References C4GUI_ScrollArrowHgt, C4GUI_ScrollArrowWdt, C4GUI_ScrollBarHgt, C4GUI_ScrollBarWdt, fBottomDown, fHorizontal, fScrolling, fTopDown, C4GUI::Element::GetBounds(), GetScrollByPos(), C4GUI::GUISound(), HasPin(), C4Rect::Hgt, iScrollPos, C4GUI::CMouse::IsLDown(), C4GUI::Element::MouseInput(), OnPosChanged(), C4GUI::CMouse::pDragElement, and C4Rect::Wdt.

Referenced by C4ScriptGuiWindow::ProcessMouseInput().

417  {
418  // inherited
419  Element::MouseInput(rMouse, iButton, iX, iY, dwKeyParam);
420  // not if scrolling is disabled
421  if (!fScrolling) return;
422  // reset arrow states
423  bool fPrevDown = fTopDown || fBottomDown;
424  fTopDown = fBottomDown = false;
425  // not if dragging
426  if (rMouse.pDragElement) return;
427  // left mouse button down?
428  if (rMouse.IsLDown())
429  // non-scroll-direction area check
430  if (fHorizontal ? Inside<int32_t>(iY, 0, C4GUI_ScrollBarHgt) : Inside<int32_t>(iX, 0, C4GUI_ScrollBarWdt))
431  {
432  // scroll-direction area check: up/left arrow
433  if (fHorizontal ? Inside<int32_t>(iX, 0, C4GUI_ScrollArrowWdt-1) : Inside<int32_t>(iY, 0, C4GUI_ScrollArrowHgt-1))
434  fTopDown = true;
435  // check down arrow
436  else if (fHorizontal ? Inside<int32_t>(iX, GetBounds().Wdt-C4GUI_ScrollArrowWdt, GetBounds().Wdt-1)
437  : Inside<int32_t>(iY, GetBounds().Hgt-C4GUI_ScrollArrowHgt, GetBounds().Hgt-1))
438  fBottomDown = true;
439  else if (HasPin() && (fHorizontal ? Inside<int32_t>(iX, C4GUI_ScrollArrowWdt, GetBounds().Wdt-C4GUI_ScrollArrowWdt-1)
440  : Inside<int32_t>(iY, C4GUI_ScrollArrowHgt, GetBounds().Hgt-C4GUI_ScrollArrowHgt-1)))
441  {
442  // move thumb here
443  iScrollPos = GetScrollByPos(iX, iY);
444  // reflect movement in associated window or do CB
445  OnPosChanged();
446  // start dragging
447  rMouse.pDragElement = this;
448  GUISound("UI::Select");
449  }
450  }
451  // sound effekt when buttons are pressed
452  if ((fTopDown || fBottomDown) != fPrevDown) GUISound("UI::Tick");
453  }
void GUISound(const char *szSound)
Definition: C4Gui.cpp:1175
#define C4GUI_ScrollArrowWdt
Definition: C4Gui.h:106
bool HasPin()
Definition: C4Gui.h:902
int32_t Wdt
Definition: C4Rect.h:30
#define C4GUI_ScrollArrowHgt
Definition: C4Gui.h:105
int32_t iScrollPos
Definition: C4Gui.h:886
bool fBottomDown
Definition: C4Gui.h:887
bool fTopDown
Definition: C4Gui.h:887
virtual void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
Definition: C4Gui.cpp:244
#define C4GUI_ScrollBarHgt
Definition: C4Gui.h:104
C4Rect & GetBounds()
Definition: C4Gui.h:445
int32_t GetScrollByPos(int32_t iX, int32_t iY)
Definition: C4Gui.h:912
bool fHorizontal
Definition: C4Gui.h:888
bool fScrolling
Definition: C4Gui.h:883
#define C4GUI_ScrollBarWdt
Definition: C4Gui.h:103
int32_t Hgt
Definition: C4Rect.h:30

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::ScrollBar::MouseLeave ( CMouse rMouse)
overridevirtual

Reimplemented from C4GUI::Element.

Definition at line 463 of file C4GuiContainers.cpp.

References fBottomDown, fTopDown, and C4GUI::Element::MouseLeave().

464  {
465  // inherited
466  Element::MouseLeave(rMouse);
467  // reset button states
468  fTopDown = fBottomDown = false;
469  }
bool fBottomDown
Definition: C4Gui.h:887
bool fTopDown
Definition: C4Gui.h:887
virtual void MouseLeave(CMouse &rMouse)
Definition: C4Gui.h:414

Here is the call graph for this function:

virtual bool C4GUI::Element::OnHotkey ( uint32_t  cHotkey)
inlinevirtualinherited

Reimplemented in C4GUI::ContextMenu::Entry, C4GUI::CheckBox, C4GUI::Button, C4GUI::Container, and C4GUI::Label.

Definition at line 420 of file C4Gui.h.

420 { return false; } // return true when hotkey has been processed
void C4GUI::ScrollBar::OnPosChanged ( )
protected

Definition at line 395 of file C4GuiContainers.cpp.

References C4GUI::BaseParCallbackHandler< ParType >::DoCall(), fHorizontal, fScrolling, C4GUI::Element::GetBounds(), C4GUI::Window::GetClientRect(), GetMaxScroll(), C4Rect::Hgt, iCBMaxRange, iScrollPos, C4GUI::ScrollWindow::iScrollY, pScrollCallback, pScrollWindow, and C4GUI::ScrollWindow::SetScroll().

Referenced by DoDragging(), DrawElement(), and MouseInput().

396  {
397  int32_t iMaxBarScroll = GetMaxScroll();
398  if (!iMaxBarScroll) iMaxBarScroll=1;
399  // CB - passes scroll pos
400  if (pScrollCallback) pScrollCallback->DoCall(Clamp<int32_t>(iScrollPos * (iCBMaxRange-1) / iMaxBarScroll, 0, (iCBMaxRange-1)));
401  // safety
402  if (!pScrollWindow || !fScrolling) return;
403  // get scrolling values
404  assert(!fHorizontal); // nyi
405  int32_t iVisHgt = pScrollWindow->GetBounds().Hgt;
406  int32_t iClientHgt = pScrollWindow->GetClientRect().Hgt;
407  int32_t iMaxWinScroll = iClientHgt - iVisHgt;
408  int32_t iWinScroll = pScrollWindow->iScrollY;
409  // calc new window scrolling
410  int32_t iNewWinScroll = Clamp<int32_t>(iMaxWinScroll * iScrollPos / iMaxBarScroll, 0, iMaxWinScroll);
411  // apply it, if it is different
412  if (iWinScroll != iNewWinScroll)
413  pScrollWindow->SetScroll(iNewWinScroll);
414  }
int32_t iCBMaxRange
Definition: C4Gui.h:889
int32_t GetMaxScroll()
Definition: C4Gui.h:907
int32_t iScrollY
Definition: C4Gui.h:943
void SetScroll(int32_t iToScroll)
int32_t iScrollPos
Definition: C4Gui.h:886
ScrollWindow * pScrollWindow
Definition: C4Gui.h:891
C4Rect & GetClientRect() override
Definition: C4Gui.h:864
C4Rect & GetBounds()
Definition: C4Gui.h:445
bool fHorizontal
Definition: C4Gui.h:888
bool fScrolling
Definition: C4Gui.h:883
void DoCall(class Element *pElement) override
Definition: C4Gui.h:321
int32_t Hgt
Definition: C4Rect.h:30
BaseParCallbackHandler< int32_t > * pScrollCallback
Definition: C4Gui.h:892

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Element::RemoveElement ( Element pChild)
protectedvirtualinherited

Reimplemented in C4GUI::Screen, C4GUI::Dialog, C4GUI::ContextMenu, C4GUI::Tabular, C4GUI::ListBox, and C4GUI::Container.

Definition at line 173 of file C4Gui.cpp.

References C4GUI::Screen::GetScreenS(), C4GUI::Element::IsMenu(), C4GUI::Element::pParent, C4GUI::Container::RemoveElement(), and C4GUI::Screen::RemoveElement().

Referenced by C4GUI::Container::RemoveElement().

174  {
175  // child removed: forward to parent
176  if (pParent)
177  pParent->RemoveElement(pChild);
178  else if (this != Screen::GetScreenS())
179  // always ensure removal from screen!
180  // but not if this is the context menu, to avoid endless flip-flop!
181  if (!IsMenu())
183  }
static Screen * GetScreenS()
Definition: C4Gui.h:2626
virtual bool IsMenu()
Definition: C4Gui.h:403
Container * pParent
Definition: C4Gui.h:376
void RemoveElement(Element *pChild) override
Definition: C4Gui.cpp:556
void RemoveElement(Element *pChild) override

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Element::ScreenPos2ClientPos ( int32_t &  riX,
int32_t &  riY 
)
inherited

Definition at line 218 of file C4Gui.cpp.

References C4GUI::Container::ApplyElementOffset(), C4GUI::Element::GetParent(), C4GUI::Element::pParent, C4GUI::Element::rcBounds, C4Rect::x, and C4Rect::y.

Referenced by C4GUI::Screen::MouseInput(), and C4GUI::CMouse::ReleaseElements().

219  {
220  // apply all parent offsets
221  Container *pCont = pParent;
222  while (pCont)
223  {
224  pCont->ApplyElementOffset(riX, riY);
225  pCont = pCont->GetParent();
226  }
227  // apply own offset
228  riX -= rcBounds.x; riY -= rcBounds.y;
229  }
int32_t y
Definition: C4Rect.h:30
virtual void ApplyElementOffset(int32_t &riX, int32_t &riY)
Definition: C4Gui.h:840
C4Rect rcBounds
Definition: C4Gui.h:385
Container * pParent
Definition: C4Gui.h:376
int32_t x
Definition: C4Rect.h:30
friend class Container
Definition: C4Gui.h:472

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Element::SetBounds ( const C4Rect rcNewBound)
inlineinherited

Definition at line 446 of file C4Gui.h.

References C4GUI::Element::UpdatePos(), and C4GUI::Element::UpdateSize().

Referenced by C4GameOptionButtons::C4GameOptionButtons(), C4GoalDisplay::C4GoalDisplay(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupNetListEntry::C4StartupNetListEntry(), C4GUI::ContextButton::ContextButton(), C4GUI::ListBox::ContractToElementHeight(), C4GUI::Control::Control(), C4GUI::Dialog::Dialog(), C4ChatDlg::DoPlacement(), C4StartupNetListEntry::Execute(), C4GUI::FullscreenDialog::FullscreenDialog(), C4GUI::GroupBox::GroupBox(), C4GUI::HorizontalLine::HorizontalLine(), C4GUI::Screen::Init(), C4Menu::InitSize(), C4GUI::LabeledEdit::LabeledEdit(), C4Game::OnResolutionChanged(), C4GameLobby::ScenDesc::ScenDesc(), C4StartupScenSelDlg::ScenListItem::ScenListItem(), C4GUI::ScrollWindow::ScrollWindow(), C4GUI::InputDialog::SetCustomEdit(), C4GUI::Tabular::SetGfx(), C4GoalDisplay::SetGoals(), C4StartupNetListEntry::SetReference(), C4StartupNetListEntry::SetRefQuery(), C4GUI::Tabular::Sheet::Sheet(), C4GUI::TextWindow::TextWindow(), C4ScoreboardDlg::Update(), C4Menu::UpdateElementPositions(), C4GUI::ListBox::UpdateElementPositions(), C4GUI::ScrollWindow::UpdateOwnPos(), C4ChatControl::UpdateSize(), C4ChatDlg::UpdateSize(), C4GUI::TextWindow::UpdateSize(), and C4GUI::Dialog::UpdateSize().

446 { rcBounds=rcNewBound; UpdatePos(); UpdateSize(); }
virtual void UpdateSize()
Definition: C4Gui.cpp:185
C4Rect rcBounds
Definition: C4Gui.h:385
virtual void UpdatePos()
Definition: C4Gui.cpp:193

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Element::SetContextHandler ( ContextHandler pNewHd)
inlineinherited

Definition at line 465 of file C4Gui.h.

References C4GUI::ContextHandler::DeRef(), C4GUI::Element::pContextHandler, and C4GUI::ContextHandler::Ref().

Referenced by C4StartupMainDlg::C4StartupMainDlg(), C4GUI::ContextButton::ContextButton(), and C4GUI::Edit::Edit().

466  {
468  if ((pContextHandler = pNewHd)) pNewHd->Ref();
469  }
ContextHandler * pContextHandler
Definition: C4Gui.h:381

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::ScrollBar::SetDecoration ( ScrollBarFacets pToGfx,
bool  fAutoHide 
)
inline

Definition at line 929 of file C4Gui.h.

References fAutoHide.

Referenced by C4GUI::ScrollWindow::SetDecoration().

930  { pCustomGfx = pToGfx; this->fAutoHide=fAutoHide; }
ScrollBarFacets * pCustomGfx
Definition: C4Gui.h:894
bool fAutoHide
Definition: C4Gui.h:884

Here is the caller graph for this function:

void C4GUI::Element::SetDragTarget ( Window pToWindow)
inlineinherited

Definition at line 464 of file C4Gui.h.

References C4GUI::Element::pDragTarget.

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

464 { pDragTarget = pToWindow; }
Window * pDragTarget
Definition: C4Gui.h:378

Here is the caller graph for this function:

void C4GUI::ScrollBar::SetScrollPos ( int32_t  iToPos)
inline

Definition at line 932 of file C4Gui.h.

References GetMaxScroll().

932 { iScrollPos = iToPos * GetMaxScroll() / (iCBMaxRange-1); }
int32_t iCBMaxRange
Definition: C4Gui.h:889
int32_t GetMaxScroll()
Definition: C4Gui.h:907
int32_t iScrollPos
Definition: C4Gui.h:886

Here is the call graph for this function:

void C4GUI::Element::SetToolTip ( const char *  szNewTooltip,
bool  is_immediate = false 
)
inherited

Definition at line 409 of file C4Gui.cpp.

References StdStrBuf::Clear(), and StdStrBuf::Copy().

Referenced by C4GUI::ContextMenu::AddItem(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4MenuItem::C4MenuItem(), C4StartupMainDlg::C4StartupMainDlg(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4StartupPlrPropertiesDlg::C4StartupPlrPropertiesDlg(), C4StartupPlrSelDlg::C4StartupPlrSelDlg(), C4StartupScenSelDlg::C4StartupScenSelDlg(), C4GUI::InfoDialog::CreateSubComponents(), C4GUI::FullscreenDialog::FullscreenDialog(), C4GUI::IconButton::IconButton(), C4GUI::InputDialog::InputDialog(), C4GameLobby::MainDlg::MainDlg(), C4GUI::ProgressDialog::ProgressDialog(), C4StartupScenSelDlg::ScenListItem::ScenListItem(), C4GUI::InputDialog::SetCustomEdit(), C4GUI::Dialog::SetTitle(), C4GUI::FullscreenDialog::SetTitle(), C4ChatControl::ChatSheet::NickItem::Update(), and C4GameLobby::MainDlg::UpdateRightTab().

410  {
411  // store tooltip
412  if (szNewTooltip) ToolTip.Copy(szNewTooltip); else ToolTip.Clear();
413  // store immediate flag
414  is_immediate_tooltip = is_immediate;
415  }
void Clear()
Definition: StdBuf.h:466
void Copy()
Definition: StdBuf.h:467

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Element::SetVisibility ( bool  fToValue)
virtualinherited

Reimplemented in C4GUI::Container, and C4StartupNetListEntry.

Definition at line 207 of file C4Gui.cpp.

References C4GUI::Element::fVisible, C4GUI::Element::GetScreen(), C4GUI::Screen::Mouse, and C4GUI::CMouse::OnElementGetsInvisible().

Referenced by C4GUI::RenameEdit::RenameEdit(), C4GUI::TextWindow::SetPicture(), C4GUI::ScrollWindow::SetScrollBarEnabled(), C4GUI::Container::SetVisibility(), Update(), and C4ScriptGuiWindow::UpdateLayout().

208  {
209  fVisible = fToValue;
210  // stop mouseover for invisible
211  if (!fVisible)
212  {
213  Screen *pScreen = GetScreen();
214  if (pScreen) pScreen->Mouse.OnElementGetsInvisible(this);
215  }
216  }
bool fVisible
Definition: C4Gui.h:383
virtual Screen * GetScreen()
Definition: C4Gui.cpp:289

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Element::StartDragging ( CMouse rMouse,
int32_t  iX,
int32_t  iY,
DWORD  dwKeyParam 
)
virtualinherited

Definition at line 259 of file C4Gui.cpp.

References C4GUI::Element::fDragging, C4GUI::Element::iDragX, C4GUI::Element::iDragY, and C4GUI::CMouse::pDragElement.

Referenced by C4MenuItem::MouseInput(), and C4GUI::Element::MouseInput().

260  {
261  // set flag
262  fDragging = true;
263  // set drag start pos
264  iDragX = iX; iDragY = iY;
265  // mark drag in mouse
266  rMouse.pDragElement = this;
267  }
int32_t iDragY
Definition: C4Gui.h:379
bool fDragging
Definition: C4Gui.h:380
int32_t iDragX
Definition: C4Gui.h:379

Here is the caller graph for this function:

void C4GUI::Element::StopDragging ( CMouse rMouse,
int32_t  iX,
int32_t  iY,
DWORD  dwKeyParam 
)
virtualinherited

Definition at line 282 of file C4Gui.cpp.

References C4GUI::Element::DoDragging().

Referenced by C4GUI::Screen::MouseInput(), and C4GUI::CMouse::ReleaseElements().

283  {
284  // move element pos
285  DoDragging(rMouse, iX, iY, dwKeyParam);
286  }
virtual void DoDragging(CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam)
Definition: C4Gui.cpp:269

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::ScrollBar::Update ( )
protected

Definition at line 368 of file C4GuiContainers.cpp.

References C4GUI_ScrollArrowHgt, fAutoHide, fBottomDown, fScrolling, fTopDown, C4GUI::Element::GetBounds(), C4GUI::Window::GetClientRect(), C4Rect::Hgt, iScrollPos, iScrollThumbSize, C4GUI::ScrollWindow::iScrollY, pScrollCallback, pScrollWindow, and C4GUI::Element::SetVisibility().

Referenced by ScrollBar(), C4GUI::ScrollWindow::Update(), and C4ScriptGuiWindow::UpdateLayout().

369  {
370  // check associated control
371  if (pScrollWindow)
372  {
373  int32_t iVisHgt = pScrollWindow->GetBounds().Hgt;
374  int32_t iClientHgt = pScrollWindow->GetClientRect().Hgt;
375  if ((fScrolling = (iVisHgt < iClientHgt)))
376  {
377  // scrolling necessary
378  // get vertical scroll pos
379  int32_t iMaxWinScroll = iClientHgt - iVisHgt;
380  int32_t iMaxBarScroll = GetBounds().Hgt - 2*C4GUI_ScrollArrowHgt - iScrollThumbSize;
381  int32_t iWinScroll = pScrollWindow->iScrollY;
382  // scroll thumb height is currently hardcoded
383  // calc scroll pos
384  iScrollPos = Clamp<int32_t>(iMaxBarScroll * iWinScroll / iMaxWinScroll, 0, iMaxBarScroll);
385  }
386  }
387  else fScrolling = !!pScrollCallback;
388  // reset buttons
389  if (!fScrolling)
390  fTopDown = fBottomDown = false;
391  // set visibility by scroll status
393  }
int32_t iScrollThumbSize
Definition: C4Gui.h:885
int32_t iScrollY
Definition: C4Gui.h:943
#define C4GUI_ScrollArrowHgt
Definition: C4Gui.h:105
virtual void SetVisibility(bool fToValue)
Definition: C4Gui.cpp:207
int32_t iScrollPos
Definition: C4Gui.h:886
ScrollWindow * pScrollWindow
Definition: C4Gui.h:891
C4Rect & GetClientRect() override
Definition: C4Gui.h:864
bool fBottomDown
Definition: C4Gui.h:887
bool fAutoHide
Definition: C4Gui.h:884
bool fTopDown
Definition: C4Gui.h:887
C4Rect & GetBounds()
Definition: C4Gui.h:445
bool fScrolling
Definition: C4Gui.h:883
int32_t Hgt
Definition: C4Rect.h:30
BaseParCallbackHandler< int32_t > * pScrollCallback
Definition: C4Gui.h:892

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void C4GUI::Element::UpdateOwnPos ( )
inlinevirtualinherited
void C4GUI::Element::UpdatePos ( )
protectedvirtualinherited

Reimplemented in C4GUI::Dialog.

Definition at line 193 of file C4Gui.cpp.

References C4GUI::Container::ElementPosChanged(), C4GUI::Element::pParent, and C4GUI::Element::UpdateOwnPos().

Referenced by C4GUI::Element::DoDragging(), C4GUI::ContextMenu::Open(), C4GUI::ProgressBar::ProgressBar(), C4GUI::Element::SetBounds(), C4GUI::Window::SetPos(), and C4GUI::Dialog::UpdatePos().

194  {
195  // update own fields
196  UpdateOwnPos();
197  // notify container
198  if (pParent) pParent->ElementPosChanged(this);
199  }
Container * pParent
Definition: C4Gui.h:376
virtual void ElementPosChanged(Element *pOfElement)
Definition: C4Gui.h:754
virtual void UpdateOwnPos()
Definition: C4Gui.h:434

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Element::UpdateSize ( )
protectedvirtualinherited

Reimplemented in C4GUI::Dialog, C4GUI::TextWindow, C4GUI::Tabular, C4GUI::ListBox, C4GUI::MultilineLabel, C4ChatDlg, and C4ChatControl.

Definition at line 185 of file C4Gui.cpp.

References C4GUI::Container::ElementSizeChanged(), C4GUI::Element::pParent, and C4GUI::Element::UpdateOwnPos().

Referenced by C4FileSelDlg::DefaultListItem::DefaultListItem(), C4GUI::Element::SetBounds(), C4GUI::Label::SetX0(), C4GUI::MultilineLabel::UpdateHeight(), C4GUI::ListBox::UpdateSize(), C4GUI::Tabular::UpdateSize(), C4GUI::TextWindow::UpdateSize(), and C4GUI::Dialog::UpdateSize().

186  {
187  // update own fields
188  UpdateOwnPos();
189  // notify container
190  if (pParent) pParent->ElementSizeChanged(this);
191  }
virtual void ElementSizeChanged(Element *pOfElement)
Definition: C4Gui.h:753
Container * pParent
Definition: C4Gui.h:376
virtual void UpdateOwnPos()
Definition: C4Gui.h:434

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class ::C4ScriptGuiWindow
friend

Definition at line 935 of file C4Gui.h.

friend class ScrollWindow
friend

Definition at line 934 of file C4Gui.h.

Member Data Documentation

bool C4GUI::ScrollBar::fAutoHide
protected

Definition at line 884 of file C4Gui.h.

Referenced by SetDecoration(), and Update().

bool C4GUI::ScrollBar::fBottomDown
protected

Definition at line 887 of file C4Gui.h.

Referenced by DrawElement(), MouseInput(), MouseLeave(), ScrollBar(), and Update().

bool C4GUI::Element::fDragging {false}
protectedinherited

Definition at line 380 of file C4Gui.h.

Referenced by C4GUI::Element::StartDragging().

bool C4GUI::ScrollBar::fHorizontal
protected

Definition at line 888 of file C4Gui.h.

Referenced by DrawElement(), MouseInput(), and OnPosChanged().

bool C4GUI::ScrollBar::fScrolling
protected

Definition at line 883 of file C4Gui.h.

Referenced by DrawElement(), IsScrolling(), MouseInput(), OnPosChanged(), ScrollBar(), and Update().

bool C4GUI::ScrollBar::fTopDown
protected

Definition at line 887 of file C4Gui.h.

Referenced by DrawElement(), MouseInput(), MouseLeave(), ScrollBar(), and Update().

int32_t C4GUI::ScrollBar::iCBMaxRange
protected

Definition at line 889 of file C4Gui.h.

Referenced by OnPosChanged().

int32_t C4GUI::Element::iDragX
protectedinherited

Definition at line 379 of file C4Gui.h.

Referenced by C4GUI::Element::DoDragging(), and C4GUI::Element::StartDragging().

int32_t C4GUI::Element::iDragY
protectedinherited

Definition at line 379 of file C4Gui.h.

Referenced by C4GUI::Element::DoDragging(), and C4GUI::Element::StartDragging().

int32_t C4GUI::ScrollBar::iScrollPos
protected

Definition at line 886 of file C4Gui.h.

Referenced by DoDragging(), DrawElement(), MouseInput(), OnPosChanged(), ScrollBar(), and Update().

int32_t C4GUI::ScrollBar::iScrollThumbSize
protected

Definition at line 885 of file C4Gui.h.

Referenced by ScrollBar(), and Update().

ContextHandler* C4GUI::Element::pContextHandler {nullptr}
protectedinherited
ScrollBarFacets* C4GUI::ScrollBar::pCustomGfx
protected

Definition at line 894 of file C4Gui.h.

Referenced by DrawElement().

Window* C4GUI::Element::pDragTarget {nullptr}
protectedinherited
BaseParCallbackHandler<int32_t>* C4GUI::ScrollBar::pScrollCallback
protected

Definition at line 892 of file C4Gui.h.

Referenced by OnPosChanged(), ScrollBar(), Update(), and ~ScrollBar().

ScrollWindow* C4GUI::ScrollBar::pScrollWindow
protected
C4Rect C4GUI::Element::rcBounds
protectedinherited

Definition at line 385 of file C4Gui.h.

Referenced by C4Chart::C4Chart(), C4StartupMainDlg::C4StartupMainDlg(), C4StartupScenSelDlg::C4StartupScenSelDlg(), C4GUI::Element::ClientPos2ScreenPos(), C4GUI::ContextMenu::ContextMenu(), C4GUI::Dialog::CreateConsoleWindow(), C4GUI::ContextMenu::CtxMouseInput(), C4FileSelDlg::DefaultListItem::DefaultListItem(), C4GUI::Element::DoContext(), C4GUI::Element::DoDragging(), C4ScoreboardDlg::DoPlacement(), C4ScriptGuiWindow::Draw(), C4GUI::Element::Draw3DFrame(), C4GUI::Element::DrawBar(), C4ScriptGuiWindow::DrawChildren(), C4StartupMainDlg::DrawElement(), C4MenuItem::DrawElement(), C4StartupNetListEntry::DrawElement(), C4Chart::DrawElement(), C4StartupPlrPropertiesDlg::DrawElement(), C4Menu::DrawElement(), C4GUI::Label::DrawElement(), C4GUI::WoodenLabel::DrawElement(), C4GUI::MultilineLabel::DrawElement(), C4GUI::ProgressBar::DrawElement(), C4GUI::HorizontalLine::DrawElement(), C4GUI::Picture::DrawElement(), C4GUI::OverlayPicture::DrawElement(), DrawElement(), C4GUI::GroupBox::DrawElement(), C4GUI::PaintBox::DrawElement(), C4GUI::Button::DrawElement(), C4GUI::IconButton::DrawElement(), C4GUI::ArrowButton::DrawElement(), C4GUI::FacetButton::DrawElement(), C4GUI::Edit::DrawElement(), C4GUI::CheckBox::DrawElement(), C4GUI::ListBox::DrawElement(), C4GUI::Tabular::DrawElement(), C4GUI::TextWindow::DrawElement(), C4GUI::ContextMenu::Entry::DrawElement(), C4GUI::ContextMenu::DrawElement(), C4GUI::ContextButton::DrawElement(), C4GUI::ComboBox::DrawElement(), C4GUI::Element::DrawHBarByVGfx(), C4GUI::Element::DrawHVBar(), C4GUI::Element::DrawVBar(), C4GUI::Element::Element(), C4GUI::ContextMenu::Entry::Entry(), C4GUI::Element::GetBounds(), C4GUI::Element::GetClientRect(), C4ScriptGuiWindow::GetClippingRect(), C4GUI::WoodenLabel::GetLeftIndent(), C4GUI::Tabular::GetMarginBottom(), C4GUI::Tabular::GetMarginLeft(), C4GUI::Tabular::GetMarginRight(), C4StartupPlrSelDlg::GetMarginTop(), C4StartupScenSelDlg::GetMarginTop(), C4GUI::Tabular::GetMarginTop(), HasPin(), C4Menu::InitLocation(), C4Menu::InitSize(), C4GUI::ScrollWindow::IsScrollingNecessary(), C4GUI::Label::Label(), C4ScriptGuiWindow::MouseInput(), C4GUI::Window::MouseInput(), C4GUI::CheckBox::MouseInput(), C4GUI::Tabular::MouseInput(), C4GUI::ContextMenu::MouseInput(), C4GUI::Screen::MouseInput(), C4GUI::MultilineLabel::MultilineLabel(), C4ChatControl::ChatSheet::NickItem::NickItem(), C4ScriptGuiWindow::OnMouseIn(), C4GUI::ContextMenu::Open(), C4GUI::Picture::Picture(), C4ScriptGuiWindow::ProcessMouseInput(), C4GUI::ProgressBar::ProgressBar(), C4GUI::Screen::Render(), C4GUI::Element::ScreenPos2ClientPos(), ScrollBar(), C4GUI::Tabular::SetGfx(), C4GUI::Window::SetPos(), C4GUI::Label::SetText(), C4GUI::Label::SetX0(), C4ScoreboardDlg::Update(), C4GUI::ScrollWindow::Update(), C4GUI::MultilineLabel::UpdateHeight(), C4ScriptGuiWindow::UpdateLayout(), C4ScriptGuiWindow::UpdateLayoutGrid(), C4ScriptGuiWindow::UpdateLayoutTightGrid(), C4ScriptGuiWindow::UpdateLayoutVertical(), C4GUI::Label::UpdateOwnPos(), C4GUI::Window::UpdateOwnPos(), C4GUI::MultilineLabel::UpdateSize(), and C4GUI::WoodenLabel::WoodenLabel().


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