OpenClonk
C4ScriptGuiWindow Class Reference

#include <C4ScriptGuiWindow.h>

Inheritance diagram for C4ScriptGuiWindow:
[legend]
Collaboration diagram for C4ScriptGuiWindow:
[legend]

Public Types

enum  MouseState { None = 0 , Focus = 1 , MouseDown = 2 }
 

Public Member Functions

void SetTag (C4String *tag)
 
 C4ScriptGuiWindow ()
 
 ~C4ScriptGuiWindow () override
 
int32_t GetID ()
 
C4ScriptGuiWindowGetChildByID (int32_t child)
 
C4ScriptGuiWindowGetChildByName (C4String *childName)
 
C4ScriptGuiWindowGetSubWindow (int32_t childID, C4Object *childTarget)
 
bool CreateFromPropList (C4PropList *proplist, bool resetStdTag=false, bool isUpdate=false, bool isLoading=false)
 
const C4Value ToC4Value ()
 
void SetEnumeratedID (int enumID)
 
void Denumerate (C4ValueNumbers *numbers)
 
C4ScriptGuiWindowAddChild (C4ScriptGuiWindow *child)
 
C4ScriptGuiWindowAddChild ()
 
void ClearChildren (bool close=true)
 
void RemoveChild (C4ScriptGuiWindow *child, bool close=true, bool all=false)
 
void Close ()
 
void ClearPointers (C4Object *pObj)
 
float CalculateRelativeSize (float parentWidthOrHeight, C4ScriptGuiWindowPropertyName::type absoluteProperty, C4ScriptGuiWindowPropertyName::type relativeProperty)
 
void RequestLayoutUpdate ()
 
bool UpdateLayout (C4TargetFacet &cgo)
 
bool UpdateLayout (C4TargetFacet &cgo, float parentWidth, float parentHeight)
 
bool UpdateChildLayout (C4TargetFacet &cgo, float parentWidth, float parentHeight)
 
void UpdateLayoutGrid ()
 
void UpdateLayoutTightGrid ()
 
void UpdateLayoutVertical ()
 
void Draw (C4TargetFacet &cgo) override
 
bool DrawAll (C4TargetFacet &cgo, int32_t player)
 
bool Draw (C4TargetFacet &cgo, int32_t player, C4Rect *currentClippingRect)
 
bool GetClippingRect (int32_t &left, int32_t &top, int32_t &right, int32_t &bottom)
 
bool DrawChildren (C4TargetFacet &cgo, int32_t player, int32_t withMultipleFlag=-1, C4Rect *currentClippingRect=nullptr)
 
bool ExecuteCommand (int32_t actionID, int32_t player, int32_t subwindowID, int32_t actionType, C4Object *target)
 
virtual bool MouseInput (int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
 
virtual bool ProcessMouseInput (int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam, int32_t parentOffsetX, int32_t parentOffsetY)
 
void MouseEnter (C4GUI::CMouse &rMouse) override
 
void MouseLeave (C4GUI::CMouse &rMouse) override
 
void OnMouseOut (int32_t player)
 
void OnMouseIn (int32_t player, int32_t parentOffsetX, int32_t parentOffsetY)
 
bool HasMouseFocus ()
 
bool IsVisibleTo (int32_t player)
 
void MouseInput (CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override
 
bool IsComponentOutsideClientArea () override
 
void Update ()
 
void UpdateOwnPos () override
 
void Freeze ()
 
void UnFreeze ()
 
bool IsFrozen () const
 
void SetClientHeight (int32_t iToHgt)
 
void SetDecoration (ScrollBarFacets *pToGfx, bool fAutoScroll)
 
void SetScroll (int32_t iToScroll)
 
void ScrollToBottom ()
 
void ScrollPages (int iPageCount)
 
void ScrollBy (int iAmount)
 
void ScrollRangeInView (int32_t iY, int32_t iHgt)
 
bool IsRangeInView (int32_t iY, int32_t iHgt)
 
int32_t GetScrollY ()
 
void SetScrollBarEnabled (bool fToVal, bool noAutomaticPositioning=false)
 
bool IsScrollBarEnabled ()
 
bool IsScrollingActive ()
 
bool IsScrollingNecessary ()
 
void SetPos (int32_t iXPos, int32_t iYPos)
 
C4RectGetClientRect () override
 
void ApplyElementOffset (int32_t &riX, int32_t &riY) override
 
void ApplyInvElementOffset (int32_t &riX, int32_t &riY) override
 
virtual int32_t GetMarginTop ()
 
virtual int32_t GetMarginLeft ()
 
virtual int32_t GetMarginRight ()
 
virtual int32_t GetMarginBottom ()
 
void Clear ()
 
void ClearChildren ()
 
void RemoveElement (Element *pChild) override
 
void MakeLastElement (Element *pChild)
 
void AddElement (Element *pChild)
 
void ReaddElement (Element *pChild)
 
void InsertElement (Element *pChild, Element *pInsertBefore)
 
ElementGetNextNestedElement (Element *pPrevElement, bool fBackwards)
 
ElementGetFirstContained () override
 
virtual ElementGetLastContained ()
 
ElementGetFirstNestedElement (bool fBackwards) override
 
Iterator begin ()
 
Iterator end ()
 
ReverseIterator rbegin ()
 
ReverseIterator rend ()
 
ElementGetFirst ()
 
ElementGetLast ()
 
ContainerGetContainer () override
 
ElementGetElementByIndex (int32_t i)
 
int32_t GetElementCount ()
 
void SetVisibility (bool fToValue) override
 
virtual bool IsFocused (Control *pCtrl)
 
virtual bool IsSelectedChild (Element *pChild)
 
bool IsParentOf (Element *pEl) override
 
virtual void StartDragging (CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam)
 
virtual void DoDragging (CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam)
 
virtual void StopDragging (CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam)
 
bool DoContext ()
 
ContainerGetParent ()
 
virtual class Dialog * GetDlg ()
 
virtual Screen * GetScreen ()
 
virtual ControlIsFocusElement ()
 
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)
 
C4Rect GetContainedClientRect ()
 
ElementGetNext () const
 
ElementGetPrev () const
 
bool IsInActiveDlg (bool fForKeyboard)
 
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 int32_t GetListItemTopSpacing ()
 
virtual bool GetListItemTopSpacingBar ()
 
void SetDragTarget (Window *pToWindow)
 
void SetContextHandler (ContextHandler *pNewHd)
 
virtual ContextHandler * GetContextHandler ()
 

Public Attributes

int32_t currentMouseState
 
bool fVisible {true}
 

Static Public Attributes

static const float standardWidth = 50.0f
 
static const float standardHeight = 31.0f
 

Protected Member Functions

void ElementSizeChanged (Element *pOfElement) override
 
void ElementPosChanged (Element *pOfElement) override
 
virtual void AfterElementRemoval ()
 
bool OnHotkey (uint32_t cHotkey) override
 
virtual void DrawElement (C4TargetFacet &cgo)
 
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 DialogWindow * GetDialogWindow ()
 
virtual bool CheckNameHotkey (const char *)
 

Protected Attributes

ScrollBarpScrollBar
 
int32_t iScrollY
 
int32_t iClientHeight
 
bool fHasBar
 
int32_t iFrozen
 
C4Rect rcClientRect
 
ElementpFirst
 
ElementpLast
 
ContainerpParent {nullptr}
 
ElementpPrev
 
ElementpNext
 
WindowpDragTarget {nullptr}
 
int32_t iDragX
 
int32_t iDragY
 
bool fDragging {false}
 
ContextHandler * pContextHandler {nullptr}
 
C4Rect rcBounds
 

Friends

class C4ScriptGuiWindowAction
 
class C4ScriptGuiWindowScrollBar
 

Detailed Description

Definition at line 179 of file C4ScriptGuiWindow.h.

Member Enumeration Documentation

◆ MouseState

Enumerator
None 
Focus 
MouseDown 

Definition at line 339 of file C4ScriptGuiWindow.h.

340  {
341  None = 0,
342  Focus = 1,
343  MouseDown = 2
344  };

Constructor & Destructor Documentation

◆ C4ScriptGuiWindow()

C4ScriptGuiWindow::C4ScriptGuiWindow ( )

Definition at line 624 of file C4ScriptGuiWindow.cpp.

624  : C4GUI::ScrollWindow(this)
625 {
626  Init();
627 }

Referenced by AddChild(), and CreateFromPropList().

Here is the caller graph for this function:

◆ ~C4ScriptGuiWindow()

C4ScriptGuiWindow::~C4ScriptGuiWindow ( )
override

Definition at line 688 of file C4ScriptGuiWindow.cpp.

689 {
690  ClearChildren(false);
691 
692  // delete certain properties that contain allocated elements or referenced strings
693  for (auto & prop : props)
694  prop.CleanUpAll();
695 
696  if (pScrollBar)
697  delete pScrollBar;
698  if (name)
699  name->DecRef();
700 }
ScrollBar * pScrollBar
Definition: C4Gui.h:942
void DecRef()
Definition: C4StringTable.h:28

References C4GUI::Container::ClearChildren(), C4RefCnt::DecRef(), and C4GUI::ScrollWindow::pScrollBar.

Here is the call graph for this function:

Member Function Documentation

◆ AddChild() [1/2]

C4ScriptGuiWindow* C4ScriptGuiWindow::AddChild ( )
inline

Definition at line 286 of file C4ScriptGuiWindow.h.

286 { return AddChild(new C4ScriptGuiWindow()); }
C4ScriptGuiWindow * AddChild()

References AddChild(), and C4ScriptGuiWindow().

Referenced by AddChild(), and CreateFromPropList().

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

◆ AddChild() [2/2]

C4ScriptGuiWindow * C4ScriptGuiWindow::AddChild ( C4ScriptGuiWindow child)

Definition at line 1187 of file C4ScriptGuiWindow.cpp.

1188 {
1189  if (IsRoot())
1190  {
1191  child->SetID(GenerateMenuID());
1192  child->isMainWindow = true;
1193  // update all windows asap
1194  mainWindowNeedsLayoutUpdate = true;
1195  }
1196 
1197  // child's priority is ususally 0 here, so just insert it in front of other windows with a priority below 0
1198  // when the child's priority updates, the update function will be called and the child will be sorted to the correct position
1199  ChildChangedPriority(child);
1200 
1201  return child;
1202 }

◆ AddElement()

void C4GUI::Container::AddElement ( Element pChild)
inherited

Definition at line 118 of file C4GuiContainers.cpp.

119  {
120  // safety
121  if (!pChild) return;
122  // remove from any previous container
123  if (pChild->pParent) pChild->pParent->RemoveElement(pChild);
124  // add to end of list
125  if (pLast) pLast->pNext = pChild; else pFirst = pChild;
126  pChild->pPrev = pLast; pChild->pNext = nullptr; pLast = pChild;
127  pChild->pParent = this;
128 
129  assert(pChild->pNext != pChild);
130  assert(pChild->pPrev != pChild);
131  assert(pChild->pParent != pChild);
132  }
Element * pFirst
Definition: C4Gui.h:750
Element * pLast
Definition: C4Gui.h:750
Element * pPrev
Definition: C4Gui.h:377
Container * pParent
Definition: C4Gui.h:376
Element * pNext
Definition: C4Gui.h:377

References C4GUI::Container::pFirst, C4GUI::Container::pLast, C4GUI::Element::pNext, C4GUI::Element::pParent, C4GUI::Element::pPrev, and C4GUI::Container::RemoveElement().

Referenced by C4GUI::Tabular::AddCustomSheet(), C4GUI::ListBox::AddElement(), C4ChartDialog::C4ChartDialog(), C4ChatControl::C4ChatControl(), C4ChatDlg::C4ChatDlg(), C4DownloadDlg::C4DownloadDlg(), C4GameOptionButtons::C4GameOptionButtons(), C4GameOverDlg::C4GameOverDlg(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4Menu::C4Menu(), C4Network2ClientListDlg::C4Network2ClientListDlg(), C4Network2StartWaitDlg::C4Network2StartWaitDlg(), C4StartupAboutDlg::C4StartupAboutDlg(), C4StartupLegalDlg::C4StartupLegalDlg(), C4StartupMainDlg::C4StartupMainDlg(), C4StartupModsDlg::C4StartupModsDlg(), C4StartupModsListEntry::C4StartupModsListEntry(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupNetListEntry::C4StartupNetListEntry(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4StartupPlrColorPickerDlg::C4StartupPlrColorPickerDlg(), C4StartupPlrPropertiesDlg::C4StartupPlrPropertiesDlg(), C4StartupPlrSelDlg::C4StartupPlrSelDlg(), C4StartupScenSelDlg::C4StartupScenSelDlg(), C4GUI::ContextButton::ContextButton(), C4MapFolderData::CreateGUIElements(), C4GUI::InfoDialog::CreateSubComponents(), C4FileSelDlg::DefaultListItem::DefaultListItem(), C4GUI::FullscreenDialog::FullscreenDialog(), C4FileSelDlg::InitElements(), C4GUI::InputDialog::InputDialog(), C4GUI::Container::InsertElement(), C4GUI::LabeledEdit::LabeledEdit(), C4GameLobby::MainDlg::MainDlg(), C4GUI::MessageDialog::MessageDialog(), C4ChatControl::ChatSheet::NickItem::NickItem(), C4GUI::ProgressDialog::ProgressDialog(), C4GUI::RenameEdit::RenameEdit(), C4GameLobby::ScenDesc::ScenDesc(), C4StartupScenSelDlg::ScenListItem::ScenListItem(), C4GUI::ScrollWindow::ScrollWindow(), C4GUI::InputDialog::SetCustomEdit(), C4GoalDisplay::SetGoals(), C4GUI::FullscreenDialog::SetTitle(), C4GUI::Dialog::SetTitle(), and C4GUI::TextWindow::TextWindow().

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

◆ AfterElementRemoval()

virtual void C4GUI::Container::AfterElementRemoval ( )
inlineprotectedvirtualinherited

Reimplemented in C4GUI::ListBox.

Definition at line 756 of file C4Gui.h.

757  { if (pParent) pParent->AfterElementRemoval(); } // called by ScrollWindow to parent after an element has been removed
virtual void AfterElementRemoval()
Definition: C4Gui.h:756

References C4GUI::Container::AfterElementRemoval(), and C4GUI::Element::pParent.

Referenced by C4GUI::Container::AfterElementRemoval(), C4GUI::ListBox::AfterElementRemoval(), and C4GUI::Container::RemoveElement().

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

◆ ApplyElementOffset()

void C4GUI::Window::ApplyElementOffset ( int32_t &  riX,
int32_t &  riY 
)
inlineoverridevirtualinherited

Reimplemented from C4GUI::Container.

Reimplemented in C4GUI::Dialog.

Definition at line 866 of file C4Gui.h.

867  { riX -= rcClientRect.x; riY -= rcClientRect.y; }
C4Rect rcClientRect
Definition: C4Gui.h:851
int32_t y
Definition: C4Rect.h:30
int32_t x
Definition: C4Rect.h:30

References C4GUI::Window::rcClientRect, C4Rect::x, and C4Rect::y.

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

Here is the caller graph for this function:

◆ ApplyInvElementOffset()

void C4GUI::Window::ApplyInvElementOffset ( int32_t &  riX,
int32_t &  riY 
)
inlineoverridevirtualinherited

Reimplemented from C4GUI::Container.

Reimplemented in C4GUI::Dialog.

Definition at line 868 of file C4Gui.h.

869  { riX += rcClientRect.x; riY += rcClientRect.y; }

References C4GUI::Window::rcClientRect, C4Rect::x, and C4Rect::y.

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

Here is the caller graph for this function:

◆ begin()

Iterator C4GUI::Container::begin ( )
inlineinherited

Definition at line 824 of file C4Gui.h.

824 { return Iterator(pFirst); }

References C4GUI::Container::pFirst.

Referenced by ClearPointers().

Here is the caller graph for this function:

◆ CalculateRelativeSize()

float C4ScriptGuiWindow::CalculateRelativeSize ( float  parentWidthOrHeight,
C4ScriptGuiWindowPropertyName::type  absoluteProperty,
C4ScriptGuiWindowPropertyName::type  relativeProperty 
)

Definition at line 1398 of file C4ScriptGuiWindow.cpp.

1399 {
1400  const float widthOrHeight = Em2Pix(props[absoluteProperty].GetFloat())
1401  + float(parentWidthOrHeight) * props[relativeProperty].GetFloat();
1402  return widthOrHeight;
1403 }

References C4ScriptGuiWindowProperty::GetFloat().

Referenced by UpdateLayoutGrid(), UpdateLayoutTightGrid(), and UpdateLayoutVertical().

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

◆ CheckNameHotkey()

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

Reimplemented in C4StartupScenSelDlg::ScenListItem.

Definition at line 407 of file C4Gui.h.

407 { return false; }

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

Here is the caller graph for this function:

◆ Clear()

void C4GUI::Container::Clear ( )
inherited

Definition at line 63 of file C4GuiContainers.cpp.

64  {
65  ClearChildren();
66  }

References C4GUI::Container::ClearChildren().

Referenced by C4GUI::Screen::Clear(), C4GUI::ComboBox_FillCB::ClearEntries(), C4StartupNetListEntry::ClearRef(), C4GUI::Container::~Container(), and C4GUI::ContextMenu::~ContextMenu().

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

◆ ClearChildren() [1/2]

void C4GUI::Container::ClearChildren ( )
inherited

Definition at line 68 of file C4GuiContainers.cpp.

69  {
70  // delete all items; dtor will update list
71  while (pFirst)
72  {
73  if (pFirst->IsOwnPtrElement())
74  {
75  // unlink from list
76  Element *pANext = pFirst->pNext;
77  pFirst->pPrev = pFirst->pNext = nullptr;
78  pFirst->pParent = nullptr;
79  if ((pFirst = pANext))
80  pFirst->pPrev = nullptr;
81  else
82  pLast = nullptr;
83  }
84  else
85  delete pFirst;
86  }
87  }
friend class Element
Definition: C4Gui.h:844
virtual bool IsOwnPtrElement()
Definition: C4Gui.h:401

References C4GUI::Element::IsOwnPtrElement(), C4GUI::Container::pFirst, C4GUI::Container::pLast, C4GUI::Element::pNext, C4GUI::Element::pParent, and C4GUI::Element::pPrev.

Referenced by C4GUI::Container::Clear(), Close(), RemoveChild(), C4GoalDisplay::SetGoals(), and ~C4ScriptGuiWindow().

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

◆ ClearChildren() [2/2]

void C4ScriptGuiWindow::ClearChildren ( bool  close = true)

Definition at line 1337 of file C4ScriptGuiWindow.cpp.

1338 {
1339  RemoveChild(nullptr, close, true);
1340 }
void RemoveChild(C4ScriptGuiWindow *child, bool close=true, bool all=false)

References RemoveChild().

Here is the call graph for this function:

◆ ClearPointers()

void C4ScriptGuiWindow::ClearPointers ( C4Object pObj)

Definition at line 1159 of file C4ScriptGuiWindow.cpp.

1160 {
1161  // not removing or clearing anything twice
1162  // if this flag is set, the object will not be used after this frame (callbacks?) anyway
1163  if (wasRemovedFromParent) return;
1164 
1165  // all properties which have anything to do with objects need to be called from here!
1171 
1172  for (auto iter = begin(); iter != end();)
1173  {
1174  C4ScriptGuiWindow *child = static_cast<C4ScriptGuiWindow*>(*iter);
1175  // increment the iterator before (possibly) deleting the child
1176  ++iter;
1177  child->ClearPointers(pObj);
1178  }
1179 
1180  if (target == pObj)
1181  {
1182  MenuDebugLogF("Closing window (%d, %s, @%p, target: %p) due to target removal.", id, name, this, this->target);
1183  Close();
1184  }
1185 }
#define MenuDebugLogF(...)
Iterator end()
Definition: C4Gui.h:825
Iterator begin()
Definition: C4Gui.h:824
void ClearPointers(C4Object *pObj)
void ClearPointers(C4Object *pObj)

References C4GUI::Container::begin(), C4ScriptGuiWindowProperty::ClearPointers(), ClearPointers(), Close(), C4GUI::Container::end(), MenuDebugLogF, C4ScriptGuiWindowPropertyName::onClickAction, C4ScriptGuiWindowPropertyName::onCloseAction, C4ScriptGuiWindowPropertyName::onMouseInAction, C4ScriptGuiWindowPropertyName::onMouseOutAction, and C4ScriptGuiWindowPropertyName::symbolObject.

Referenced by ClearPointers().

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

◆ ClientPos2ScreenPos()

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

Definition at line 231 of file C4Gui.cpp.

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  }
virtual void ApplyInvElementOffset(int32_t &riX, int32_t &riY)
Definition: C4Gui.h:841
C4Rect rcBounds
Definition: C4Gui.h:385
friend class Container
Definition: C4Gui.h:472

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

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

◆ Close()

void C4ScriptGuiWindow::Close ( )

Definition at line 1342 of file C4ScriptGuiWindow.cpp.

1343 {
1344  // This can only be called once.
1345  if (wasClosed)
1346  return;
1347  wasClosed = true;
1348  // first, close all children and dispose of them properly
1349  ClearChildren(true);
1350 
1351  // make call to target object if applicable
1353  // only calls are valid actions for OnClose
1354  if (action && action->action == C4ScriptGuiWindowActionID::Call)
1355  {
1356  // close is always syncronized (script call/object removal) and thus the action can be executed immediately
1357  // (otherwise the GUI&action would have been removed anyway..)
1358  lockRemovalForClosingCallback();
1359  action->ExecuteCommand(action->id, this, NO_OWNER);
1360  unlockRemovalForClosingCallback();
1361  }
1362 
1363  target = nullptr;
1364 
1365  if (!wasRemovedFromParent)
1366  {
1367  assert(GetParent() && "Close()ing GUIWindow without parent");
1368  static_cast<C4ScriptGuiWindow*>(GetParent())->RemoveChild(this);
1369  }
1370 }
const int NO_OWNER
Definition: C4Constants.h:137
Container * GetParent()
Definition: C4Gui.h:429
bool ExecuteCommand(int32_t actionID, C4ScriptGuiWindow *parent, int32_t player)
C4ScriptGuiWindowAction * GetAction()

References C4ScriptGuiWindowActionID::Call, C4GUI::Container::ClearChildren(), C4ScriptGuiWindowAction::ExecuteCommand(), C4ScriptGuiWindowProperty::GetAction(), C4GUI::Element::GetParent(), NO_OWNER, C4ScriptGuiWindowPropertyName::onCloseAction, and RemoveChild().

Referenced by ClearPointers(), and RemoveChild().

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

◆ CreateFromPropList()

bool C4ScriptGuiWindow::CreateFromPropList ( C4PropList proplist,
bool  resetStdTag = false,
bool  isUpdate = false,
bool  isLoading = false 
)

Definition at line 988 of file C4ScriptGuiWindow.cpp.

989 {
990  if (!proplist) return false;
991  C4ScriptGuiWindow * parent = static_cast<C4ScriptGuiWindow*>(GetParent());
992  assert((parent || isLoading) && "GuiWindow created from proplist without parent (fails for ID tag)");
993 
994  bool layoutUpdateRequired = false; // needed for position changes etc
995 
996  // Get properties from proplist and check for those, that match an allowed property to set them;
997  // We take ownership here. Automatically destroy the object when we're done.
998  std::unique_ptr<C4ValueArray> properties(proplist->GetProperties());
999  properties->SortStrings();
1000  C4String *stdTag = &Strings.P[P_Std];
1001  const int32_t propertySize = properties->GetSize();
1002  for (int32_t i = 0; i < propertySize; ++i)
1003  {
1004  const C4Value &entry = properties->GetItem(i);
1005  C4String *key = entry.getStr();
1006  assert(key && "PropList returns non-string as key");
1007  MenuDebugLogF("--%s\t\t(I am %d)", key->GetCStr(), id);
1008  C4Value property;
1009  proplist->GetPropertyByS(key, &property);
1010 
1011  if(&Strings.P[P_Left] == key)
1012  {
1013  SetPositionStringProperties(property, C4ScriptGuiWindowPropertyName::relLeft, C4ScriptGuiWindowPropertyName::left, stdTag);
1014  layoutUpdateRequired = true;
1015  }
1016  else if(&Strings.P[P_Top] == key)
1017  {
1018  SetPositionStringProperties(property, C4ScriptGuiWindowPropertyName::relTop, C4ScriptGuiWindowPropertyName::top, stdTag);
1019  layoutUpdateRequired = true;
1020  }
1021  else if(&Strings.P[P_Right] == key)
1022  {
1023  SetPositionStringProperties(property, C4ScriptGuiWindowPropertyName::relRight, C4ScriptGuiWindowPropertyName::right, stdTag);
1024  layoutUpdateRequired = true;
1025  }
1026  else if(&Strings.P[P_Bottom] == key)
1027  {
1028  SetPositionStringProperties(property, C4ScriptGuiWindowPropertyName::relBottom, C4ScriptGuiWindowPropertyName::bottom, stdTag);
1029  layoutUpdateRequired = true;
1030  }
1031  else if (&Strings.P[P_Margin] == key)
1032  {
1033  SetMarginProperties(property, stdTag);
1034  layoutUpdateRequired = true;
1035  }
1036  else if(&Strings.P[P_BackgroundColor] == key)
1037  props[C4ScriptGuiWindowPropertyName::backgroundColor].Set(property, stdTag);
1038  else if(&Strings.P[P_Target] == key)
1039  target = property.getObj();
1040  else if(&Strings.P[P_Symbol] == key)
1041  {
1042  props[C4ScriptGuiWindowPropertyName::symbolDef].Set(property, stdTag);
1043  props[C4ScriptGuiWindowPropertyName::symbolObject].Set(property, stdTag);
1044  }
1045  else if(&Strings.P[P_Decoration] == key)
1046  {
1047  props[C4ScriptGuiWindowPropertyName::frameDecoration].Set(property, stdTag);
1048  }
1049  else if(&Strings.P[P_Text] == key)
1050  {
1051  props[C4ScriptGuiWindowPropertyName::text].Set(property, stdTag);
1052  layoutUpdateRequired = true;
1053  }
1054  else if (&Strings.P[P_GraphicsName] == key)
1055  {
1056  props[C4ScriptGuiWindowPropertyName::symbolGraphicsName].Set(property, stdTag);
1057  }
1058  else if (&Strings.P[P_Tooltip] == key)
1059  {
1060  props[C4ScriptGuiWindowPropertyName::tooltip].Set(property, stdTag);
1061  }
1062  else if(&Strings.P[P_Prototype] == key)
1063  ; // do nothing
1064  else if (&Strings.P[P_Mode] == key) // note that "Mode" is abused here for saving whether we have mouse focus
1065  {
1066  if (isLoading)
1067  currentMouseState = property.getInt();
1068  }
1069  else if(&Strings.P[P_ID] == key)
1070  {
1071  // setting IDs is only valid for subwindows or when loading savegames!
1072  if (parent && !isMainWindow)
1073  {
1074  if (id) // already have an ID? remove from parent
1075  parent->ChildWithIDRemoved(this);
1076  id = property.getInt();
1077  if (id != 0)
1078  parent->ChildGotID(this);
1079  }
1080  else
1081  if (isLoading)
1082  id = property.getInt();
1083  }
1084  else if (&Strings.P[P_OnClick] == key)
1085  {
1086  MenuDebugLogF("Adding new action, I am window %d with parent %d", id, static_cast<C4ScriptGuiWindow*>(parent)->id);
1087  props[C4ScriptGuiWindowPropertyName::onClickAction].Set(property, stdTag);
1088  }
1089  else if(&Strings.P[P_OnMouseIn] == key)
1090  props[C4ScriptGuiWindowPropertyName::onMouseInAction].Set(property, stdTag);
1091  else if(&Strings.P[P_OnMouseOut] == key)
1092  props[C4ScriptGuiWindowPropertyName::onMouseOutAction].Set(property, stdTag);
1093  else if(&Strings.P[P_OnClose] == key)
1094  props[C4ScriptGuiWindowPropertyName::onCloseAction].Set(property, stdTag);
1095  else if(&Strings.P[P_Style] == key)
1096  {
1097  props[C4ScriptGuiWindowPropertyName::style].Set(property, stdTag);
1098  layoutUpdateRequired = true;
1099  }
1100  else if(&Strings.P[P_Priority] == key)
1101  {
1102  props[C4ScriptGuiWindowPropertyName::priority].Set(property, stdTag);
1103  layoutUpdateRequired = true;
1104  // resort into parent's list
1105  if (parent)
1106  parent->ChildChangedPriority(this);
1107  }
1108  else if(&Strings.P[P_Player] == key)
1109  props[C4ScriptGuiWindowPropertyName::player].Set(property, stdTag);
1110  else
1111  {
1112  // possibly sub-window?
1113  C4PropList *subwindow = property.getPropList();
1114  if (subwindow)
1115  {
1116  // remember the name of the child; but ignore names starting with underscores
1117  C4String *childName = nullptr;
1118  if (key->GetCStr()[0] != '_')
1119  childName = key;
1120 
1121  // Do we already have a child with that name? That implies that we are updating here.
1122  C4ScriptGuiWindow *child = GetChildByName(childName);
1123  bool freshlyAdded = false;
1124 
1125  // first time referencing a child with that name? Create a new one!
1126  if (!child)
1127  {
1128  child = new C4ScriptGuiWindow();
1129  if (childName != nullptr)
1130  {
1131  child->name = childName;
1132  child->name->IncRef();
1133  }
1134  AddChild(child);
1135  freshlyAdded = true;
1136  }
1137 
1138  if (!child->CreateFromPropList(subwindow, isUpdate == true, false, isLoading))
1139  {
1140  // Remove the child again if we just added it. However, ignore when just updating an existing child.
1141  if (freshlyAdded)
1142  RemoveChild(child, false);
1143  }
1144  else
1145  layoutUpdateRequired = true;
1146  }
1147  }
1148  }
1149 
1150  if (!isLoading && layoutUpdateRequired)
1152 
1153  if (resetStdTag || isLoading)
1154  SetTag(stdTag);
1155 
1156  return true;
1157 }
C4StringTable Strings
Definition: C4Globals.cpp:42
@ P_ID
@ P_Margin
@ P_BackgroundColor
@ P_Priority
@ P_Bottom
@ P_OnMouseIn
@ P_Tooltip
@ P_GraphicsName
@ P_OnClose
@ P_Std
@ P_Top
@ P_OnClick
@ P_Prototype
@ P_Style
@ P_OnMouseOut
@ P_Target
@ P_Symbol
@ P_Text
@ P_Player
@ P_Left
@ P_Mode
@ P_Decoration
@ P_Right
virtual C4ValueArray * GetProperties() const
Definition: C4PropList.cpp:883
virtual bool GetPropertyByS(const C4String *k, C4Value *pResult) const
Definition: C4PropList.cpp:726
void IncRef()
Definition: C4StringTable.h:27
C4ScriptGuiWindow * GetChildByName(C4String *childName)
bool CreateFromPropList(C4PropList *proplist, bool resetStdTag=false, bool isUpdate=false, bool isLoading=false)
void SetTag(C4String *tag)
void Set(const C4Value &value, C4String *tag)
const char * GetCStr() const
Definition: C4StringTable.h:49
C4String P[P_LAST]
C4String * getStr() const
Definition: C4Value.h:117

References AddChild(), C4ScriptGuiWindowPropertyName::backgroundColor, C4ScriptGuiWindowPropertyName::bottom, C4ScriptGuiWindow(), CreateFromPropList(), currentMouseState, C4ScriptGuiWindowPropertyName::frameDecoration, GetChildByName(), C4String::GetCStr(), C4GUI::Element::GetParent(), C4PropList::GetProperties(), C4PropList::GetPropertyByS(), C4Value::getStr(), C4RefCnt::IncRef(), C4ScriptGuiWindowPropertyName::left, MenuDebugLogF, C4ScriptGuiWindowPropertyName::onClickAction, C4ScriptGuiWindowPropertyName::onCloseAction, C4ScriptGuiWindowPropertyName::onMouseInAction, C4ScriptGuiWindowPropertyName::onMouseOutAction, C4StringTable::P, P_BackgroundColor, P_Bottom, P_Decoration, P_GraphicsName, P_ID, P_Left, P_Margin, P_Mode, P_OnClick, P_OnClose, P_OnMouseIn, P_OnMouseOut, P_Player, P_Priority, P_Prototype, P_Right, P_Std, P_Style, P_Symbol, P_Target, P_Text, P_Tooltip, P_Top, C4ScriptGuiWindowPropertyName::player, C4ScriptGuiWindowPropertyName::priority, C4ScriptGuiWindowPropertyName::relBottom, C4ScriptGuiWindowPropertyName::relLeft, C4ScriptGuiWindowPropertyName::relRight, C4ScriptGuiWindowPropertyName::relTop, RemoveChild(), RequestLayoutUpdate(), C4ScriptGuiWindowPropertyName::right, C4ScriptGuiWindowProperty::Set(), SetTag(), Strings, C4ScriptGuiWindowPropertyName::style, C4ScriptGuiWindowPropertyName::symbolDef, C4ScriptGuiWindowPropertyName::symbolGraphicsName, C4ScriptGuiWindowPropertyName::symbolObject, C4ScriptGuiWindowPropertyName::text, C4ScriptGuiWindowPropertyName::tooltip, and C4ScriptGuiWindowPropertyName::top.

Referenced by CreateFromPropList(), and Denumerate().

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

◆ Denumerate()

void C4ScriptGuiWindow::Denumerate ( C4ValueNumbers numbers)

Definition at line 867 of file C4ScriptGuiWindow.cpp.

868 {
869  assert(IsRoot());
870  if (id == 0)
871  {
872  // nothing to do, note that the id is abused for the id in the enumeration
873  return;
874  }
875  C4Value value = numbers->GetValue(id);
876  id = 0;
877  CreateFromPropList(value.getPropList(), false, false, true);
878 
879  for (C4GUI::Element * element : *this)
880  {
881  C4ScriptGuiWindow *mainWindow = static_cast<C4ScriptGuiWindow*>(element);
882  mainWindow->RequestLayoutUpdate();
883  }
884 }
C4PropList * getPropList() const
Definition: C4Value.h:116
const C4Value & GetValue(uint32_t)
Definition: C4Value.cpp:243

References CreateFromPropList(), C4Value::getPropList(), C4ValueNumbers::GetValue(), and RequestLayoutUpdate().

Here is the call graph for this function:

◆ DoContext()

bool C4GUI::Element::DoContext ( )
inherited

Definition at line 417 of file C4Gui.cpp.

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

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

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

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

◆ DoDragging()

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

Reimplemented in C4GUI::Edit, and C4GUI::ScrollBar.

Definition at line 269 of file C4Gui.cpp.

270  {
271  // check if anything moved
272  if (pDragTarget && (iX != iDragX || iY != iDragY))
273  {
274  // move position, then
275  pDragTarget->rcBounds.x += iX-iDragX;
276  pDragTarget->rcBounds.y += iY-iDragY;
277  // drag X/Y is up-to-date if this is a child element of the drag target
279  }
280  }
int32_t iDragY
Definition: C4Gui.h:379
int32_t iDragX
Definition: C4Gui.h:379
virtual void UpdatePos()
Definition: C4Gui.cpp:193
Window * pDragTarget
Definition: C4Gui.h:378

References C4GUI::Element::iDragX, C4GUI::Element::iDragY, C4GUI::Element::pDragTarget, C4GUI::Element::rcBounds, C4GUI::Element::UpdatePos(), C4Rect::x, and C4Rect::y.

Referenced by C4GUI::Screen::MouseInput(), and C4GUI::Element::StopDragging().

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

◆ Draw() [1/2]

void C4ScriptGuiWindow::Draw ( C4TargetFacet cgo)
inlineoverridevirtual

Reimplemented from C4GUI::Window.

Definition at line 308 of file C4ScriptGuiWindow.h.

308 {}

Referenced by DrawChildren().

Here is the caller graph for this function:

◆ Draw() [2/2]

bool C4ScriptGuiWindow::Draw ( C4TargetFacet cgo,
int32_t  player,
C4Rect currentClippingRect 
)

Definition at line 1904 of file C4ScriptGuiWindow.cpp.

1905 {
1906  assert(!IsRoot()); // not root, root needs to receive DrawAll
1907 
1908  // message hidden?
1909  if (!IsVisibleTo(player)) return false;
1910 
1911  const int32_t &style = props[C4ScriptGuiWindowPropertyName::style].GetInt();
1912 
1913  if (mainWindowNeedsLayoutUpdate)
1914  {
1915  assert(GetParent() && (static_cast<C4ScriptGuiWindow*>(GetParent())->IsRoot()));
1916  assert(isMainWindow);
1917  assert(!(style & C4ScriptGuiWindowStyleFlag::Multiple) && "\"Multiple\"-style window not updated by a full refresh of the root window.");
1918  C4ScriptGuiWindow * parent = static_cast<C4ScriptGuiWindow*>(GetParent());
1919  UpdateLayout(cgo, parent->rcBounds.Wdt, parent->rcBounds.Hgt);
1920  assert(!mainWindowNeedsLayoutUpdate);
1921  }
1922 
1923  const int32_t outDrawX = cgo.X + cgo.TargetX + rcBounds.x;
1924  const int32_t outDrawY = cgo.Y + cgo.TargetY + rcBounds.y;
1925  const int32_t outDrawWdt = rcBounds.Wdt;
1926  const int32_t outDrawHgt = rcBounds.Hgt;
1927  const int32_t outDrawRight = outDrawX + rcBounds.Wdt;
1928  const int32_t outDrawBottom = outDrawY + rcBounds.Hgt;
1929  // draw various properties
1930  C4Facet cgoOut(cgo.Surface, outDrawX, outDrawY, outDrawWdt, outDrawHgt);
1931 
1933  if (backgroundColor)
1934  pDraw->DrawBoxDw(cgo.Surface, outDrawX, outDrawY, outDrawRight - 1.0f, outDrawBottom - 1.0f, backgroundColor);
1935 
1937 
1938  if (frameDecoration)
1939  {
1940  // the frame decoration will adjust for cgo.TargetX/Y itself
1941  C4Rect rect(
1942  outDrawX - frameDecoration->iBorderLeft - cgo.TargetX,
1943  outDrawY - frameDecoration->iBorderTop - cgo.TargetY,
1944  outDrawWdt + frameDecoration->iBorderRight + frameDecoration->iBorderLeft,
1945  outDrawHgt + frameDecoration->iBorderBottom + frameDecoration->iBorderTop);
1946  frameDecoration->Draw(cgo, rect);
1947  }
1948 
1950  if (symbolObject)
1951  {
1952  symbolObject->DrawPicture(cgoOut, false, nullptr);
1953  }
1954  else
1955  {
1958  if (symbolDef)
1959  {
1960  symbolDef->Draw(cgoOut, false, 0UL, nullptr, 0, 0, nullptr, graphicsName ? graphicsName->getData() : nullptr);
1961  }
1962  }
1963 
1965 
1966  if (strBuf)
1967  {
1968  StdStrBuf sText;
1969  int alignment = ALeft;
1970  // If we are showing a scrollbar, we need to leave a bit of space for it so that it doesn't overlap the text.
1971  const int scrollbarXOffset = pScrollBar->IsVisible() ? pScrollBar->rcBounds.Wdt : 0;
1972  const int scrollbarScroll = pScrollBar->IsVisible() ? this->GetScrollY() : 0;
1973  const int actualDrawingWidth = outDrawWdt - scrollbarXOffset;
1974 
1975  // If we are set to NoCrop, the message will be split by string-defined line breaks only.
1976  int allowedTextWidth = actualDrawingWidth;
1977 
1979  allowedTextWidth = std::numeric_limits<int>::max();
1980  int32_t textHgt = ::GraphicsResource.FontRegular.BreakMessage(strBuf->getData(), allowedTextWidth, &sText, true);
1981  float textYOffset = static_cast<float>(-scrollbarScroll), textXOffset = 0.0f;
1983  textYOffset = float(outDrawHgt) / 2.0f - float(textHgt) / 2.0f;
1985  textYOffset = float(outDrawHgt) - float(textHgt);
1987  {
1988  int wdt, hgt;
1989  ::GraphicsResource.FontRegular.GetTextExtent(sText.getData(), wdt, hgt, true);
1990  textXOffset = float(actualDrawingWidth) / 2.0f;
1991  alignment = ACenter;
1992  }
1994  {
1995  alignment = ARight;
1996  int wdt, hgt;
1997  ::GraphicsResource.FontRegular.GetTextExtent(sText.getData(), wdt, hgt, true);
1998  textXOffset = float(actualDrawingWidth);
1999  }
2000  pDraw->TextOut(sText.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface, outDrawX + textXOffset, outDrawY + textYOffset, 0xffffffff, alignment);
2001  }
2002 
2003 
2004  if (GraphicsSystem.ShowMenuInfo) // print helpful debug info
2005  {
2006  DWORD frameColor = C4RGB(100, 150, 100);
2007  if (currentMouseState & MouseState::Focus) frameColor = C4RGB(0, 255, 0);
2008 
2009  pDraw->DrawFrameDw(cgo.Surface, outDrawX, outDrawY, outDrawRight, outDrawBottom, frameColor);
2010  if (target || id)
2011  {
2012  StdStrBuf buf = FormatString("%s(%d)", target ? target->GetName() : "", id);
2013  pDraw->TextOut(buf.getData(), ::GraphicsResource.FontCaption, 1.0, cgo.Surface, cgo.X + outDrawRight, cgo.Y + outDrawBottom - ::GraphicsResource.FontCaption.GetLineHeight(), 0xffff00ff, ARight);
2014  }
2015  //StdStrBuf buf2 = FormatString("(%d, %d, %d, %d)", rcBounds.x, rcBounds.y, rcBounds.Wdt, rcBounds.Hgt);
2016  //pDraw->TextOut(buf2.getData(), ::GraphicsResource.FontCaption, 1.0, cgo.Surface, cgo.X + outDrawX + rcBounds.Wdt / 2, cgo.Y + outDrawY + +rcBounds.Hgt / 2, 0xff00ffff, ACenter);
2017  }
2018 
2019  DrawChildren(cgo, player, -1, currentClippingRect);
2020  return true;
2021 }
C4Draw * pDraw
Definition: C4Draw.cpp:42
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51
C4GraphicsResource GraphicsResource
const int ARight
Definition: C4Surface.h:41
const int ALeft
Definition: C4Surface.h:41
const int ACenter
Definition: C4Surface.h:41
uint32_t DWORD
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270
#define C4RGB(r, g, b)
Definition: StdColors.h:26
Definition: C4Def.h:99
void DrawFrameDw(C4Surface *sfcDest, int x1, int y1, int x2, int y2, DWORD dwClr, float width=1.0f)
Definition: C4Draw.cpp:635
void DrawBoxDw(C4Surface *sfcDest, int iX1, int iY1, int iX2, int iY2, DWORD dwClr)
Definition: C4Draw.cpp:840
bool TextOut(const char *szText, CStdFont &rFont, float fZoom, C4Surface *sfcDest, float iTx, float iTy, DWORD dwFCol=0xffffffff, BYTE byForm=ALeft, bool fDoMarkup=true)
Definition: C4Draw.cpp:561
C4Surface * Surface
Definition: C4Facet.h:117
float Y
Definition: C4Facet.h:118
float X
Definition: C4Facet.h:118
bool IsVisible()
Definition: C4Gui.cpp:201
int32_t GetScrollY()
Definition: C4Gui.h:987
virtual const char * GetName() const
Definition: C4PropList.cpp:618
Definition: C4Rect.h:28
bool DrawChildren(C4TargetFacet &cgo, int32_t player, int32_t withMultipleFlag=-1, C4Rect *currentClippingRect=nullptr)
bool IsVisibleTo(int32_t player)
bool UpdateLayout(C4TargetFacet &cgo)
C4GUI::FrameDecoration * GetFrameDecoration()
float TargetY
Definition: C4Facet.h:165
float TargetX
Definition: C4Facet.h:165
int GetLineHeight() const
Definition: C4FontLoader.h:125
std::tuple< std::string, int > BreakMessage(const char *szMsg, int iWdt, bool fCheckMarkup, float fZoom=1.0f)
bool GetTextExtent(const char *szText, int32_t &rsx, int32_t &rsy, bool fCheckMarkup=true)
const char * getData() const
Definition: StdBuf.h:442

References ACenter, ALeft, ARight, C4ScriptGuiWindowPropertyName::backgroundColor, CStdFont::BreakMessage(), C4RGB, currentMouseState, C4Draw::DrawBoxDw(), DrawChildren(), C4Draw::DrawFrameDw(), C4GraphicsResource::FontCaption, C4GraphicsResource::FontRegular, FormatString(), C4ScriptGuiWindowPropertyName::frameDecoration, StdStrBuf::getData(), C4ScriptGuiWindowProperty::GetDef(), C4ScriptGuiWindowProperty::GetFrameDecoration(), C4ScriptGuiWindowProperty::GetInt(), CStdFont::GetLineHeight(), C4PropList::GetName(), C4ScriptGuiWindowProperty::GetObject(), C4GUI::Element::GetParent(), C4GUI::ScrollWindow::GetScrollY(), C4ScriptGuiWindowProperty::GetStrBuf(), CStdFont::GetTextExtent(), GraphicsResource, GraphicsSystem, C4Rect::Hgt, C4GUI::Element::IsVisible(), IsVisibleTo(), C4ScriptGuiWindowStyleFlag::Multiple, C4ScriptGuiWindowStyleFlag::NoCrop, pDraw, C4ScriptGuiWindowPropertyName::player, C4GUI::ScrollWindow::pScrollBar, C4GUI::Element::rcBounds, C4GraphicsSystem::ShowMenuInfo, C4ScriptGuiWindowPropertyName::style, C4Facet::Surface, C4ScriptGuiWindowPropertyName::symbolDef, C4ScriptGuiWindowPropertyName::symbolGraphicsName, C4ScriptGuiWindowPropertyName::symbolObject, C4TargetFacet::TargetX, C4TargetFacet::TargetY, C4ScriptGuiWindowPropertyName::text, C4ScriptGuiWindowStyleFlag::TextBottom, C4ScriptGuiWindowStyleFlag::TextHCenter, C4Draw::TextOut(), C4ScriptGuiWindowStyleFlag::TextRight, C4ScriptGuiWindowStyleFlag::TextVCenter, UpdateLayout(), C4Rect::Wdt, C4Facet::X, C4Rect::x, C4Facet::Y, and C4Rect::y.

Here is the call graph for this function:

◆ Draw3DFrame()

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.

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
#define C4GUI_BorderColor1
Definition: C4Gui.h:85
#define C4GUI_BorderColor3
Definition: C4Gui.h:87
void DrawLineDw(C4Surface *sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width=1.0f)
Definition: C4Draw.cpp:608

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

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

◆ DrawAll()

bool C4ScriptGuiWindow::DrawAll ( C4TargetFacet cgo,
int32_t  player 
)

Definition at line 1882 of file C4ScriptGuiWindow.cpp.

1883 {
1884  assert(IsRoot()); // we are root
1885  if (!IsVisible()) return false;
1886  // if the viewport shows an upper-board, apply an offset to everything
1887  const int oldTargetX = cgo.TargetX;
1888  const int oldTargetY = cgo.TargetY;
1889  cgo.TargetX += cgo.X;
1890  cgo.TargetY += cgo.Y;
1891  // this will check whether the viewport resized and we need an update
1892  UpdateLayout(cgo);
1893  // step one: draw all multiple-tagged windows
1894  DrawChildren(cgo, player, 1);
1895  // TODO: adjust rectangle for main menu if multiple windows exist
1896  // step two: draw one "main" menu
1897  DrawChildren(cgo, player, 0);
1898  // ..and restore the offset
1899  cgo.TargetX = oldTargetX;
1900  cgo.TargetY = oldTargetY;
1901  return true;
1902 }

References DrawChildren(), C4GUI::Element::IsVisible(), C4ScriptGuiWindowPropertyName::player, C4TargetFacet::TargetX, C4TargetFacet::TargetY, UpdateLayout(), C4Facet::X, and C4Facet::Y.

Here is the call graph for this function:

◆ DrawBar()

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

Definition at line 308 of file C4Gui.cpp.

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  }

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

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

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

◆ DrawChildren()

bool C4ScriptGuiWindow::DrawChildren ( C4TargetFacet cgo,
int32_t  player,
int32_t  withMultipleFlag = -1,
C4Rect currentClippingRect = nullptr 
)

Definition at line 1573 of file C4ScriptGuiWindow.cpp.

1574 {
1575  // remember old target rectangle and adjust
1576  float oldTargetX = cgo.TargetX;
1577  float oldTargetY = cgo.TargetY;
1578  C4Rect myClippingRect;
1579  if (IsRoot())
1580  {
1581  cgo.TargetX = 0;
1582  cgo.TargetY = 0;
1584  // default: full screen clipper
1585  myClippingRect = C4Rect(0, 0, cgo.Wdt * cgo.Zoom, cgo.Hgt * cgo.Zoom);
1586  currentClippingRect = &myClippingRect;
1587  }
1588 
1589  // if ANY PARENT has scroll bar, then adjust clipper
1590  int32_t clipX1(0), clipX2(0), clipY1(0), clipY2(0);
1591  bool clipping = GetClippingRect(clipX1, clipY1, clipX2, clipY2);
1592 
1593  const int32_t targetClipX1 = cgo.X + cgo.TargetX + clipX1;
1594  const int32_t targetClipY1 = cgo.Y + cgo.TargetY + clipY1;
1595  const int32_t targetClipX2 = cgo.X + cgo.TargetX + clipX2;
1596  const int32_t targetClipY2 = cgo.Y + cgo.TargetY + clipY2;
1597 
1598  if (clipping)
1599  {
1600  // Take either the parent rectangle or restrict it additionally by the child's geometry.
1601  myClippingRect = C4Rect(
1602  std::max(currentClippingRect->x, targetClipX1),
1603  std::max(currentClippingRect->y, targetClipY1),
1604  std::min(currentClippingRect->Wdt, targetClipX2),
1605  std::min(currentClippingRect->Hgt, targetClipY2));
1606  currentClippingRect = &myClippingRect;
1607  }
1608 
1609  if (withMultipleFlag != 1)
1610  {
1611  cgo.TargetX += rcBounds.x;
1612  cgo.TargetY += rcBounds.y - iScrollY;
1613  }
1614  else
1615  {
1616  assert(IsRoot());
1617  assert(withMultipleFlag == 1);
1618  }
1619 
1620 
1621  // note that withMultipleFlag only plays a roll for the root-menu
1622  bool oneDrawn = false; // was at least one child drawn?
1623  //for (auto iter = rbegin(); iter != rend(); ++iter)
1624  for (auto element : *this)
1625  {
1626  C4ScriptGuiWindow *child = static_cast<C4ScriptGuiWindow*>(element);
1627 
1628  if (withMultipleFlag != -1)
1629  {
1630  const int32_t &style = child->props[C4ScriptGuiWindowPropertyName::style].GetInt();
1631  if ((withMultipleFlag == 0) && (style & C4ScriptGuiWindowStyleFlag::Multiple)) continue;
1632  if ((withMultipleFlag == 1) && !(style & C4ScriptGuiWindowStyleFlag::Multiple)) continue;
1633  }
1634 
1635  pDraw->SetPrimaryClipper(currentClippingRect->x, currentClippingRect->y, currentClippingRect->Wdt, currentClippingRect->Hgt);
1636 
1637  if (child->Draw(cgo, player, currentClippingRect))
1638  oneDrawn = true;
1639  // draw only one window when drawing non-Multiple windows
1640  if (oneDrawn && (withMultipleFlag == 0)) break;
1641  }
1642 
1643  // Scrolling obviously does not affect the scroll bar.
1644  cgo.TargetY += iScrollY;
1645  // The scroll bar does not correct for the cgo offset (i.e. the upper board).
1646  cgo.TargetX += cgo.X;
1647  cgo.TargetY += cgo.Y;
1648 
1649  if (pScrollBar->IsVisible())
1650  pScrollBar->DrawElement(cgo);
1651 
1652  if (IsRoot())
1653  {
1655  }
1656 
1657  // restore target rectangle
1658  cgo.TargetX = oldTargetX;
1659  cgo.TargetY = oldTargetY;
1660  return oneDrawn;
1661 }
bool RestorePrimaryClipper()
Definition: C4Draw.cpp:210
bool StorePrimaryClipper()
Definition: C4Draw.cpp:203
bool SetPrimaryClipper(int iX1, int iY1, int iX2, int iY2)
Definition: C4Draw.cpp:217
float Hgt
Definition: C4Facet.h:118
float Wdt
Definition: C4Facet.h:118
void DrawElement(C4TargetFacet &cgo) override
int32_t iScrollY
Definition: C4Gui.h:943
void Draw(C4TargetFacet &cgo) override
bool GetClippingRect(int32_t &left, int32_t &top, int32_t &right, int32_t &bottom)
float Zoom
Definition: C4Facet.h:165

References Draw(), C4GUI::ScrollBar::DrawElement(), GetClippingRect(), C4ScriptGuiWindowProperty::GetInt(), C4Facet::Hgt, C4Rect::Hgt, C4GUI::ScrollWindow::iScrollY, C4GUI::Element::IsVisible(), C4ScriptGuiWindowStyleFlag::Multiple, pDraw, C4ScriptGuiWindowPropertyName::player, C4GUI::ScrollWindow::pScrollBar, C4GUI::Element::rcBounds, C4Draw::RestorePrimaryClipper(), C4Draw::SetPrimaryClipper(), C4Draw::StorePrimaryClipper(), C4ScriptGuiWindowPropertyName::style, C4TargetFacet::TargetX, C4TargetFacet::TargetY, C4Facet::Wdt, C4Rect::Wdt, C4Facet::X, C4Rect::x, C4Facet::Y, C4Rect::y, and C4TargetFacet::Zoom.

Referenced by Draw(), and DrawAll().

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

◆ DrawElement()

◆ DrawHBarByVGfx()

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

Definition at line 365 of file C4Gui.cpp.

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 SetRotate(float iAngle, float fOffX, float fOffY)
void DrawHVBar(C4TargetFacet &cgo, DynBarFacet &rFacets, C4DrawTransform &trf, int32_t iMiddleLength)
Definition: C4Gui.cpp:375

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

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

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

◆ DrawHVBar()

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

Definition at line 375 of file C4Gui.cpp.

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

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

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

◆ DrawVBar()

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

Definition at line 359 of file C4Gui.cpp.

360  {
361  C4DrawTransform trf(1);
362  DrawHVBar(cgo, rFacets, trf, rcBounds.Hgt);
363  }

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

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

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

◆ ElementPosChanged()

void C4GUI::ScrollWindow::ElementPosChanged ( Element pOfElement)
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Container.

Definition at line 954 of file C4Gui.h.

955  {
956  Window::ElementPosChanged(pOfElement);
957  if (pParent) pParent->ElementPosChanged(pOfElement);
958  }
virtual void ElementPosChanged(Element *pOfElement)
Definition: C4Gui.h:754

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

Here is the call graph for this function:

◆ ElementSizeChanged()

void C4GUI::ScrollWindow::ElementSizeChanged ( Element pOfElement)
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Container.

Definition at line 949 of file C4Gui.h.

950  {
951  Window::ElementSizeChanged(pOfElement);
952  if (pParent) pParent->ElementSizeChanged(pOfElement);
953  }
virtual void ElementSizeChanged(Element *pOfElement)
Definition: C4Gui.h:753

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

Here is the call graph for this function:

◆ end()

Iterator C4GUI::Container::end ( )
inlineinherited

Definition at line 825 of file C4Gui.h.

825 { return Iterator(nullptr); }

Referenced by ClearPointers().

Here is the caller graph for this function:

◆ ExecuteCommand()

bool C4ScriptGuiWindow::ExecuteCommand ( int32_t  actionID,
int32_t  player,
int32_t  subwindowID,
int32_t  actionType,
C4Object target 
)

Definition at line 2295 of file C4ScriptGuiWindow.cpp.

2296 {
2297  if (isMainWindow && subwindowID) // we are a main window! try a shortcut through the ID?
2298  {
2299  MenuDebugLogF("passing command... instance:%d, plr:%d, subwin:%d, type:%d [I am %d, MW]", actionID, player, subwindowID, actionType, id);
2300  MenuDebugLogF("stats:");
2301  MenuDebugLogF("active menus:\t%d", GetElementCount());
2302  MenuDebugLogF("children ID map:\t%d", childrenIDMap.size());
2303  // the reasoning for that shortcut is that I assume that usually windows with actions will also have an ID assigned
2304  // this obviously doesn't have to be the case, but I believe it's worth the try
2305  std::pair<std::multimap<int32_t, C4ScriptGuiWindow*>::iterator, std::multimap<int32_t, C4ScriptGuiWindow*>::iterator> range;
2306  range = childrenIDMap.equal_range(subwindowID);
2307 
2308  for (std::multimap<int32_t, C4ScriptGuiWindow*>::iterator iter = range.first; iter != range.second; ++iter)
2309  {
2310  if (iter->second->ExecuteCommand(actionID, player, subwindowID, actionType, target))
2311  {
2312  MenuDebugLogF("shortcutting command sucessful!");
2313  return true;
2314  }
2315  }
2316  // it is not possible that another window would match the criteria. Abort later after self-check
2317  MenuDebugLogF("shortcutting command failed.. no appropriate window");
2318  }
2319 
2320  // are we elligible?
2321  if ((id == subwindowID) && (this->target == target))
2322  {
2323  MenuDebugLogF("stats: (I am %d)", id);
2324  MenuDebugLogF("children:\t%d", GetElementCount());
2325  MenuDebugLogF("all actions:\t%d", props[actionType].GetAllActions().size());
2326  std::list<C4ScriptGuiWindowAction*> allActions = props[actionType].GetAllActions();
2327  for (auto action : allActions)
2328  {
2329  assert(action && "C4ScriptGuiWindowProperty::GetAllActions returned list with null-pointer");
2330 
2331  if (action->ExecuteCommand(actionID, this, player))
2332  {
2333  MenuDebugLogF("executing command sucessful!");
2334  return true;
2335  }
2336  }
2337 
2338  // note that we should not simply return false here
2339  // there is no guarantee that only one window with that target&ID exists
2340  }
2341 
2342  // not caught, forward to children!
2343  // abort if main window, though. See above
2344  if (isMainWindow && subwindowID)
2345  {
2346  MenuDebugLogF("executing command failed!");
2347  return false;
2348  }
2349 
2350  // otherwise, just pass to children..
2351  for (C4GUI::Element *element : *this)
2352  {
2353  C4ScriptGuiWindow *child = static_cast<C4ScriptGuiWindow*>(element);
2354  if (child->ExecuteCommand(actionID, player, subwindowID, actionType, target))
2355  {
2356  MenuDebugLogF("passing command sucessful! (I am %d - &p)", id, this->target);
2357  return true;
2358  }
2359  }
2360  return false;
2361 }
bool ExecuteCommand(int32_t actionID, int32_t player, int32_t subwindowID, int32_t actionType, C4Object *target)
std::list< C4ScriptGuiWindowAction * > GetAllActions()

References ExecuteCommand(), C4ScriptGuiWindowProperty::GetAllActions(), C4GUI::Container::GetElementCount(), MenuDebugLogF, and C4ScriptGuiWindowPropertyName::player.

Referenced by ExecuteCommand().

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

◆ Freeze()

void C4GUI::ScrollWindow::Freeze ( )
inlineinherited

Definition at line 969 of file C4Gui.h.

969 { ++iFrozen; }
int32_t iFrozen
Definition: C4Gui.h:946

References C4GUI::ScrollWindow::iFrozen.

Referenced by C4GUI::ListBox::FreezeScrolling(), and C4Menu::RefillInternal().

Here is the caller graph for this function:

◆ GetBounds()

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

Definition at line 445 of file C4Gui.h.

445 { return rcBounds; }

References C4GUI::Element::rcBounds.

Referenced by C4GUI::ListBox::AddElement(), C4Menu::AdjustPosition(), C4GameOverDlg::C4GameOverDlg(), C4StartupModsDlg::C4StartupModsDlg(), C4StartupModsListEntry::C4StartupModsListEntry(), 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(), C4GUI::ScrollBar::GetMaxScroll(), C4GUI::GetScreenHgt(), C4GUI::GetScreenWdt(), C4Menu::InitSize(), C4GUI::ListBox::InsertElement(), C4GUI::ScrollWindow::IsRangeInView(), C4StartupPlrSelDlg::PlayerListItem::Load(), C4GUI::Window::MouseInput(), C4GUI::ScrollBar::MouseInput(), C4GUI::ListBox::MouseInput(), C4GUI::Screen::MouseInput(), C4StartupPlrSelDlg::OnNewBtn(), C4GUI::ScrollBar::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(), C4GUI::ScrollBar::Update(), C4GUI::ScrollWindow::Update(), C4StartupPlrSelDlg::PlayerListItem::UpdateCore(), C4GUI::ListBox::UpdateElementPosition(), C4GUI::ListBox::UpdateElementPositions(), C4Menu::UpdateElementPositions(), C4GUI::ScrollWindow::UpdateOwnPos(), C4Menu::UpdateScrollBar(), and C4GUI::TextWindow::UpdateSize().

Here is the caller graph for this function:

◆ GetChildByID()

C4ScriptGuiWindow * C4ScriptGuiWindow::GetChildByID ( int32_t  child)

Definition at line 1249 of file C4ScriptGuiWindow.cpp.

1250 {
1251  for (Element * element : *this)
1252  {
1253  C4ScriptGuiWindow * child = static_cast<C4ScriptGuiWindow*>(element);
1254  if (child->id != childID) continue;
1255  return child;
1256  }
1257  return nullptr;
1258 }

References C4GUI::Container::Element.

◆ GetChildByName()

C4ScriptGuiWindow * C4ScriptGuiWindow::GetChildByName ( C4String childName)

Definition at line 1260 of file C4ScriptGuiWindow.cpp.

1261 {
1262  // invalid child names never match
1263  if (childName == nullptr) return nullptr;
1264 
1265  for (Element * element : *this)
1266  {
1267  C4ScriptGuiWindow * child = static_cast<C4ScriptGuiWindow*>(element);
1268  // every C4String is unique, so we can compare pointers here
1269  if (child->name != childName) continue;
1270  return child;
1271  }
1272  return nullptr;
1273 }

References C4GUI::Container::Element.

Referenced by CreateFromPropList().

Here is the caller graph for this function:

◆ GetClientRect()

C4Rect& C4GUI::Window::GetClientRect ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 864 of file C4Gui.h.

864 { return rcClientRect; }

References C4GUI::Window::rcClientRect.

Referenced by C4GameOverDlg::C4GameOverDlg(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4StartupMainDlg::C4StartupMainDlg(), C4StartupModsDlg::C4StartupModsDlg(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4StartupPlrColorPickerDlg::C4StartupPlrColorPickerDlg(), C4StartupPlrPropertiesDlg::C4StartupPlrPropertiesDlg(), C4StartupPlrSelDlg::C4StartupPlrSelDlg(), C4StartupScenSelDlg::C4StartupScenSelDlg(), C4GUI::ContextMenu::CheckOpenSubmenu(), C4GUI::ListBox::ContractToElementHeight(), C4MapFolderData::CreateGUIElements(), C4GUI::InfoDialog::CreateSubComponents(), C4GUI::Window::Draw(), C4GUI::ListBox::DrawElement(), C4GUI::ContextMenu::DrawElement(), C4GUI::FullscreenDialog::FullscreenDialog(), C4GUI::ListBox::GetItemWidth(), C4FileSelDlg::InitElements(), C4GUI::InputDialog::InputDialog(), C4GUI::LabeledEdit::LabeledEdit(), C4GameLobby::MainDlg::MainDlg(), C4GUI::MessageDialog::MessageDialog(), C4GUI::Window::MouseInput(), C4GUI::ContextMenu::MouseInput(), C4GUI::Screen::MouseInput(), C4GUI::ScrollBar::OnPosChanged(), C4GUI::ProgressDialog::ProgressDialog(), C4GameLobby::ScenDesc::ScenDesc(), C4StartupScenSelDlg::ScenListItem::ScenListItem(), C4GUI::ScrollWindow::ScrollBy(), C4GUI::ScrollWindow::ScrollRangeInView(), C4GUI::ScrollWindow::ScrollToBottom(), C4GUI::ScrollWindow::ScrollWindow(), C4GoalDisplay::SetGoals(), C4GUI::FullscreenDialog::SetTitle(), C4GUI::TextWindow::TextWindow(), C4GUI::ScrollBar::Update(), C4GUI::ListBox::UpdateColumnCount(), and C4GUI::TextWindow::UpdateSize().

Here is the caller graph for this function:

◆ GetClippingRect()

bool C4ScriptGuiWindow::GetClippingRect ( int32_t &  left,
int32_t &  top,
int32_t &  right,
int32_t &  bottom 
)

Definition at line 2023 of file C4ScriptGuiWindow.cpp.

2024 {
2025  const int32_t &style = props[C4ScriptGuiWindowPropertyName::style].GetInt();
2026  if (IsRoot() || (style & C4ScriptGuiWindowStyleFlag::NoCrop))
2027  return false;
2028 
2029  // Other windows always clip their children.
2030  // This implicitly clips childrens' text to the parent size, too.
2031  left = rcBounds.x;
2032  top = rcBounds.y;
2033  right = rcBounds.Wdt + left;
2034  bottom = rcBounds.Hgt + top;
2035  return true;
2036 }

References C4ScriptGuiWindowPropertyName::bottom, C4ScriptGuiWindowProperty::GetInt(), C4Rect::Hgt, C4ScriptGuiWindowPropertyName::left, C4ScriptGuiWindowStyleFlag::NoCrop, C4GUI::Element::rcBounds, C4ScriptGuiWindowPropertyName::right, C4ScriptGuiWindowPropertyName::style, C4ScriptGuiWindowPropertyName::top, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by DrawChildren().

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

◆ GetContainedClientRect()

C4Rect C4GUI::Element::GetContainedClientRect ( )
inlineinherited

Definition at line 448 of file C4Gui.h.

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

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

Referenced by C4GUI::Tabular::AddSheet(), C4ChartDialog::C4ChartDialog(), C4Network2ClientListDlg::C4Network2ClientListDlg(), C4Network2StartWaitDlg::C4Network2StartWaitDlg(), C4StartupAboutDlg::C4StartupAboutDlg(), C4StartupLegalDlg::C4StartupLegalDlg(), C4StartupModsDlg::C4StartupModsDlg(), C4StartupModsListEntry::C4StartupModsListEntry(), 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(), C4GUI::ScrollWindow::UpdateOwnPos(), C4StartupScenSelDlg::ScenListItem::UpdateOwnPos(), C4ChatControl::UpdateSize(), C4ChatDlg::UpdateSize(), C4GUI::Tabular::UpdateSize(), and C4GUI::TextWindow::UpdateSize().

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

◆ GetContainer()

Container* C4GUI::Container::GetContainer ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 831 of file C4Gui.h.

831 { return this; } // returns parent for elements; this for containers

◆ GetContextHandler()

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

Reimplemented in C4GUI::Dialog.

Definition at line 429 of file C4Gui.cpp.

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

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

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

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

◆ GetDialogWindow()

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

◆ GetDlg()

Dialog * C4GUI::Element::GetDlg ( )
virtualinherited

Reimplemented in C4GUI::Dialog.

Definition at line 288 of file C4Gui.cpp.

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

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

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

◆ GetElementByIndex()

Element * C4GUI::Container::GetElementByIndex ( int32_t  i)
inherited

Definition at line 223 of file C4GuiContainers.cpp.

224  {
225  // get next until end of list or queried index is reached
226  // if i is negative or equal or larger than childcount, the loop will never break and nullptr returned
227  Element *pEl;
228  for (pEl = pFirst; i-- && pEl; pEl=pEl->pNext) {}
229  return pEl;
230  }

References C4GUI::Container::pFirst, and C4GUI::Element::pNext.

Referenced by C4GUI::ContextMenu::GetIndexedEntry(), C4Menu::GetItem(), C4GUI::Tabular::GetSheet(), and C4GUI::ContextMenu::SelectItem().

Here is the caller graph for this function:

◆ GetElementCount()

int32_t C4GUI::Container::GetElementCount ( )
inherited

Definition at line 232 of file C4GuiContainers.cpp.

233  {
234  int32_t cnt=0;
235  for (Element *pEl = pFirst; pEl; pEl=pEl->pNext) ++cnt;
236  return cnt;
237  }

References C4GUI::Container::pFirst, and C4GUI::Element::pNext.

Referenced by ExecuteCommand(), C4GUI::Tabular::GetSheetCount(), and C4GUI::ListBox::SortElements().

Here is the caller graph for this function:

◆ GetFirst()

◆ GetFirstContained()

Element* C4GUI::Container::GetFirstContained ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 773 of file C4Gui.h.

773 { return pFirst; }

References C4GUI::Container::pFirst.

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

Here is the caller graph for this function:

◆ GetFirstNestedElement()

Element * C4GUI::Container::GetFirstNestedElement ( bool  fBackwards)
overridevirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 204 of file C4GuiContainers.cpp.

205  {
206  // get first/last in own list
207  if (pFirst) return (fBackwards ? pLast : pFirst)->GetFirstNestedElement(fBackwards);
208  // no own list: return this one
209  return this;
210  }

References C4GUI::Element::GetFirstNestedElement(), C4GUI::Container::pFirst, and C4GUI::Container::pLast.

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

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

◆ GetHeight()

int32_t C4GUI::Element::GetHeight ( )
inlineinherited

Definition at line 444 of file C4Gui.h.

444 { return rcBounds.Hgt; }

References C4Rect::Hgt, and C4GUI::Element::rcBounds.

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

Here is the caller graph for this function:

◆ GetID()

int32_t C4ScriptGuiWindow::GetID ( )
inline

Definition at line 262 of file C4ScriptGuiWindow.h.

262 { return id; }

Referenced by C4ScriptGuiWindowAction::Execute(), C4ScriptGuiWindowAction::ExecuteCommand(), and RemoveChild().

Here is the caller graph for this function:

◆ GetLast()

Element* C4GUI::Container::GetLast ( )
inlineinherited

Definition at line 830 of file C4Gui.h.

830 { return pLast; }

References C4GUI::Container::pLast.

Referenced by C4GUI::ListBox::GetLast(), C4Menu::InitSize(), and C4Menu::UpdateScrollBar().

Here is the caller graph for this function:

◆ GetLastContained()

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

Definition at line 774 of file C4Gui.h.

774 { return pLast; }

References C4GUI::Container::pLast.

◆ GetListItemTopSpacing()

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

Reimplemented in C4StartupNetListEntry, and C4StartupModsListEntry.

Definition at line 461 of file C4Gui.h.

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

References C4GUI_DefaultListSpacing.

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

Here is the caller graph for this function:

◆ GetListItemTopSpacingBar()

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

Definition at line 462 of file C4Gui.h.

462 { return false; }

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

Here is the caller graph for this function:

◆ GetMarginBottom()

virtual int32_t C4GUI::Window::GetMarginBottom ( )
inlinevirtualinherited

Reimplemented in C4StartupPlrPropertiesDlg, C4Menu, C4GUI::FullscreenDialog, C4GUI::Dialog, C4GUI::ContextMenu, C4GUI::TextWindow, C4GUI::Tabular, C4GUI::ListBox, C4GUI::Edit, and C4GUI::GroupBox.

Definition at line 876 of file C4Gui.h.

876 { return 0; }

Referenced by C4GUI::Dialog::GetMarginBottom(), C4Menu::InitSize(), C4GoalDisplay::SetGoals(), and C4GUI::Window::UpdateOwnPos().

Here is the caller graph for this function:

◆ GetMarginLeft()

virtual int32_t C4GUI::Window::GetMarginLeft ( )
inlinevirtualinherited

Reimplemented in C4StartupPlrPropertiesDlg, C4Menu, C4GUI::FullscreenDialog, C4GUI::Dialog, C4GUI::ContextMenu, C4GUI::TextWindow, C4GUI::Tabular, C4GUI::ListBox, C4GUI::Edit, and C4GUI::GroupBox.

Definition at line 874 of file C4Gui.h.

874 { return 0; }

Referenced by C4GUI::Dialog::GetMarginLeft(), C4Menu::InitSize(), and C4GUI::Window::UpdateOwnPos().

Here is the caller graph for this function:

◆ GetMarginRight()

virtual int32_t C4GUI::Window::GetMarginRight ( )
inlinevirtualinherited

Reimplemented in C4StartupPlrPropertiesDlg, C4Menu, C4GUI::FullscreenDialog, C4GUI::Dialog, C4GUI::ContextMenu, C4GUI::TextWindow, C4GUI::Tabular, C4GUI::ListBox, C4GUI::Edit, and C4GUI::GroupBox.

Definition at line 875 of file C4Gui.h.

875 { return 0; }

Referenced by C4GUI::Dialog::GetMarginRight(), C4Menu::InitSize(), and C4GUI::Window::UpdateOwnPos().

Here is the caller graph for this function:

◆ GetMarginTop()

virtual int32_t C4GUI::Window::GetMarginTop ( )
inlinevirtualinherited

Reimplemented in C4StartupScenSelDlg, C4StartupPlrPropertiesDlg, C4StartupPlrSelDlg, C4GUI::FullscreenDialog, C4GUI::Dialog, C4GUI::ContextMenu, C4GUI::TextWindow, C4GUI::Tabular, C4GUI::ListBox, C4GUI::Edit, and C4GUI::GroupBox.

Definition at line 873 of file C4Gui.h.

873 { return 0; }

Referenced by C4GUI::Dialog::GetMarginTop(), C4Menu::InitSize(), C4GoalDisplay::SetGoals(), and C4GUI::Window::UpdateOwnPos().

Here is the caller graph for this function:

◆ GetNext()

◆ GetNextNestedElement()

Element * C4GUI::Container::GetNextNestedElement ( Element pPrevElement,
bool  fBackwards 
)
inherited

Definition at line 171 of file C4GuiContainers.cpp.

172  {
173  if (fBackwards)
174  {
175  // this is last
176  if (pPrevElement == this) return nullptr;
177  // no previous given?
178  if (!pPrevElement)
179  // then use last nested for backwards search
180  return GetFirstNestedElement(true);
181  // get nested, previous element if present
182  if (pPrevElement->pPrev) return pPrevElement->pPrev->GetFirstNestedElement(true);
183  // if not, return parent (could be this)
184  return pPrevElement->pParent;
185  }
186  else
187  {
188  // forward search: first element is this
189  if (!pPrevElement) return this;
190  // check next nested
191  Element *pEl;
192  if ((pEl = pPrevElement->GetFirstContained())) return pEl;
193  // check next in list, going upwards until this container is reached
194  while (pPrevElement && pPrevElement != this)
195  {
196  if ((pEl = pPrevElement->pNext)) return pEl;
197  pPrevElement = pPrevElement->pParent;
198  }
199  // nothing found
200  }
201  return nullptr;
202  }
Element * GetFirstNestedElement(bool fBackwards) override

References C4GUI::Element::GetFirstContained(), C4GUI::Element::GetFirstNestedElement(), C4GUI::Container::GetFirstNestedElement(), C4GUI::Element::pNext, C4GUI::Element::pParent, and C4GUI::Element::pPrev.

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

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

◆ GetOwnToolTip()

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

Definition at line 440 of file C4Gui.h.

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

References StdStrBuf::getData().

Here is the call graph for this function:

◆ GetParent()

◆ GetPrev()

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

Definition at line 450 of file C4Gui.h.

450 { return pPrev; }

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

Here is the caller graph for this function:

◆ GetScreen()

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

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

Definition at line 289 of file C4Gui.cpp.

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

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(), C4StartupPlrPropertiesDlg::UserClose(), and C4ChatControl::UserQueryQuit().

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

◆ GetScrollY()

int32_t C4GUI::ScrollWindow::GetScrollY ( )
inlineinherited

Definition at line 987 of file C4Gui.h.

987 { return iScrollY; }

References C4GUI::ScrollWindow::iScrollY.

Referenced by Draw(), C4GUI::TextWindow::GetScrollPos(), and C4GUI::ListBox::MouseInput().

Here is the caller graph for this function:

◆ GetSubWindow()

C4ScriptGuiWindow * C4ScriptGuiWindow::GetSubWindow ( int32_t  childID,
C4Object childTarget 
)

Definition at line 1275 of file C4ScriptGuiWindow.cpp.

1276 {
1277  std::pair<std::multimap<int32_t, C4ScriptGuiWindow*>::iterator, std::multimap<int32_t, C4ScriptGuiWindow*>::iterator> range;
1278  range = childrenIDMap.equal_range(childID);
1279 
1280  for (std::multimap<int32_t, C4ScriptGuiWindow*>::iterator iter = range.first; iter != range.second; ++iter)
1281  {
1282  C4ScriptGuiWindow *subwindow = iter->second;
1283  if (subwindow->GetTarget() != childTarget) continue;
1284  return subwindow;
1285  }
1286  return nullptr;
1287 }

◆ GetToolTip()

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

Definition at line 423 of file C4Gui.cpp.

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

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

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

◆ GetToprightCornerRect()

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.

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
C4Rect GetContainedClientRect()
Definition: C4Gui.h:448

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

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

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

◆ GetWidth()

int32_t C4GUI::Element::GetWidth ( )
inlineinherited

Definition at line 443 of file C4Gui.h.

443 { return rcBounds.Wdt; }

References C4GUI::Element::rcBounds, and C4Rect::Wdt.

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

Here is the caller graph for this function:

◆ HasMouseFocus()

bool C4ScriptGuiWindow::HasMouseFocus ( )
inline

Definition at line 351 of file C4ScriptGuiWindow.h.

351 { return currentMouseState & MouseState::Focus; }

References currentMouseState.

Referenced by MouseInput(), OnMouseIn(), OnMouseOut(), and ProcessMouseInput().

Here is the caller graph for this function:

◆ InsertElement()

void C4GUI::Container::InsertElement ( Element pChild,
Element pInsertBefore 
)
inherited

Definition at line 150 of file C4GuiContainers.cpp.

151  {
152  // add?
153  if (!pInsertBefore) { AddElement(pChild); return; }
154  // safety
155  if (!pChild || pInsertBefore->pParent != this) return;
156  // remove from any previous container
157  if (pChild->pParent) pChild->pParent->RemoveElement(pChild);
158  // add before given element
159  if ((pChild->pPrev = pInsertBefore->pPrev))
160  pInsertBefore->pPrev->pNext = pChild;
161  else
162  pFirst = pChild;
163  pChild->pNext = pInsertBefore; pInsertBefore->pPrev = pChild;
164  pChild->pParent = this;
165 
166  assert(pChild->pNext != pChild);
167  assert(pChild->pPrev != pChild);
168  assert(pChild->pParent != pChild);
169  }
void AddElement(Element *pChild)

References C4GUI::Container::AddElement(), C4GUI::Container::pFirst, C4GUI::Element::pNext, C4GUI::Element::pParent, C4GUI::Element::pPrev, and C4GUI::Container::RemoveElement().

Referenced by C4GUI::ListBox::InsertElement(), and C4GUI::Screen::ShowDialog().

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

◆ IsComponentOutsideClientArea()

bool C4GUI::ScrollWindow::IsComponentOutsideClientArea ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Window.

Definition at line 966 of file C4Gui.h.

966 { return true; } // always clip drawing routine of subcomponents to Bounds

◆ IsExternalDrawDialog()

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

Reimplemented in C4Menu, and C4GUI::Dialog.

Definition at line 402 of file C4Gui.h.

402 { return false; }

◆ IsFocused()

virtual bool C4GUI::Container::IsFocused ( Control pCtrl)
inlinevirtualinherited

Reimplemented in C4GUI::Dialog, and C4GUI::ListBox.

Definition at line 836 of file C4Gui.h.

836 { return pParent ? pParent->IsFocused(pCtrl) : false; }
virtual bool IsFocused(Control *pCtrl)
Definition: C4Gui.h:836

References C4GUI::Container::IsFocused(), and C4GUI::Element::pParent.

Referenced by C4GUI::Control::HasFocus(), C4GUI::Container::IsFocused(), and C4GUI::ListBox::IsFocused().

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

◆ IsFocusElement()

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.

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

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

Here is the caller graph for this function:

◆ IsFrozen()

bool C4GUI::ScrollWindow::IsFrozen ( ) const
inlineinherited

Definition at line 971 of file C4Gui.h.

971 { return !!iFrozen; }

References C4GUI::ScrollWindow::iFrozen.

◆ IsImmediateToolTip()

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

Definition at line 441 of file C4Gui.h.

441 { return is_immediate_tooltip; }

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

Here is the caller graph for this function:

◆ IsInActiveDlg()

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

Definition at line 435 of file C4Gui.cpp.

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  }

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

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

◆ IsMenu()

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

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

Definition at line 403 of file C4Gui.h.

403 { return false; }

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

Here is the caller graph for this function:

◆ IsOwnPtrElement()

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

Reimplemented in C4Menu.

Definition at line 401 of file C4Gui.h.

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

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

Here is the caller graph for this function:

◆ IsParentOf()

bool C4GUI::Container::IsParentOf ( Element pEl)
overridevirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 239 of file C4GuiContainers.cpp.

240  {
241  // return whether this is the parent container (directly or recursively) of the passed element
242  for (Container *pC = pEl->GetParent(); pC; pC = pC->GetParent())
243  if (pC == this) return true;
244  return false;
245  }

References C4GUI::Element::GetParent().

Referenced by C4GUI::Control::MouseInput(), and C4GUI::Container::SetVisibility().

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

◆ IsRangeInView()

bool C4GUI::ScrollWindow::IsRangeInView ( int32_t  iY,
int32_t  iHgt 
)
inherited

Definition at line 605 of file C4GuiContainers.cpp.

606  {
607  // returns whether scrolling range is in view
608  // check top
609  if (iScrollY > iY) return false;
610  // check height
611  return iScrollY + GetBounds().Hgt >= iY+iHgt;
612  }
C4Rect & GetBounds()
Definition: C4Gui.h:445

References C4GUI::Element::GetBounds(), C4Rect::Hgt, and C4GUI::ScrollWindow::iScrollY.

Here is the call graph for this function:

◆ IsScrollBarEnabled()

bool C4GUI::ScrollWindow::IsScrollBarEnabled ( )
inlineinherited

Definition at line 990 of file C4Gui.h.

990 { return fHasBar; }

References C4GUI::ScrollWindow::fHasBar.

Referenced by C4Menu::UpdateScrollBar().

Here is the caller graph for this function:

◆ IsScrollingActive()

bool C4GUI::ScrollWindow::IsScrollingActive ( )
inlineinherited

Definition at line 992 of file C4Gui.h.

992 { return fHasBar && pScrollBar && pScrollBar->IsScrolling(); }
bool IsScrolling()
Definition: C4Gui.h:916

References C4GUI::ScrollWindow::fHasBar, C4GUI::ScrollBar::IsScrolling(), and C4GUI::ScrollWindow::pScrollBar.

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

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

◆ IsScrollingNecessary()

bool C4GUI::ScrollWindow::IsScrollingNecessary ( )
inlineinherited

Definition at line 993 of file C4Gui.h.

993 { return iClientHeight > rcBounds.Hgt; }
int32_t iClientHeight
Definition: C4Gui.h:944

References C4Rect::Hgt, C4GUI::ScrollWindow::iClientHeight, and C4GUI::Element::rcBounds.

Referenced by C4GUI::ListBox::IsScrollingNecessary(), and UpdateLayout().

Here is the caller graph for this function:

◆ IsSelectedChild()

virtual bool C4GUI::Container::IsSelectedChild ( Element pChild)
inlinevirtualinherited

Reimplemented in C4GUI::Tabular, and C4GUI::ListBox.

Definition at line 837 of file C4Gui.h.

837 { return pParent ? pParent->IsSelectedChild(pChild) : true; } // whether the child element is selected - only false for list-box-containers which can have unselected children
virtual bool IsSelectedChild(Element *pChild)
Definition: C4Gui.h:837

References C4GUI::Container::IsSelectedChild(), and C4GUI::Element::pParent.

Referenced by C4GUI::Dialog::AdvanceFocus(), C4StartupNetListEntry::DrawElement(), and C4GUI::Container::IsSelectedChild().

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

◆ IsVisible()

bool C4GUI::Element::IsVisible ( )
inherited

Definition at line 201 of file C4Gui.cpp.

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

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

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

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

◆ IsVisibleTo()

bool C4ScriptGuiWindow::IsVisibleTo ( int32_t  player)

Definition at line 2368 of file C4ScriptGuiWindow.cpp.

2369 {
2370  // Not visible at all?
2371  if (!IsVisible()) return false;
2372  // We have a player assigned and it's a different one?
2373  const int32_t &myPlayer = props[C4ScriptGuiWindowPropertyName::player].GetInt();
2374  if (myPlayer != ANY_OWNER && player != myPlayer) return false;
2375  // We have a target object which is invisible to the player?
2376  if (target && !target->IsVisible(player, false)) return false;
2377  // Default to visible!
2378  return true;
2379 }
const int ANY_OWNER
Definition: C4Constants.h:138
bool IsVisible(int32_t iForPlr, bool fAsOverlay) const

References ANY_OWNER, C4ScriptGuiWindowProperty::GetInt(), C4GUI::Element::IsVisible(), C4Object::IsVisible(), and C4ScriptGuiWindowPropertyName::player.

Referenced by Draw(), MouseInput(), and ProcessMouseInput().

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

◆ MakeLastElement()

void C4GUI::Container::MakeLastElement ( Element pChild)
inherited

Definition at line 106 of file C4GuiContainers.cpp.

107  {
108  // must be from same container
109  if (pChild->pParent != this) return;
110  // unlink from list
111  if (pChild->pPrev) pChild->pPrev->pNext = pChild->pNext; else pFirst = pChild->pNext;
112  if (pChild->pNext) pChild->pNext->pPrev = pChild->pPrev; else pLast = pChild->pPrev;
113  // readd to front of list
114  if (pLast) pLast->pNext = pChild; else pFirst = pChild;
115  pChild->pPrev = pLast; pChild->pNext = nullptr; pLast = pChild;
116  }

References C4GUI::Container::pFirst, C4GUI::Container::pLast, C4GUI::Element::pNext, C4GUI::Element::pParent, and C4GUI::Element::pPrev.

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

Here is the caller graph for this function:

◆ MouseEnter()

void C4ScriptGuiWindow::MouseEnter ( C4GUI::CMouse rMouse)
overridevirtual

Reimplemented from C4GUI::Element.

Definition at line 2054 of file C4ScriptGuiWindow.cpp.

2055 {
2056  assert(::MouseControl.GetPlayer() != NO_OWNER);
2057 }
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
int32_t GetPlayer()

References C4MouseControl::GetPlayer(), MouseControl, and NO_OWNER.

Here is the call graph for this function:

◆ MouseInput() [1/2]

void C4GUI::ScrollWindow::MouseInput ( CMouse rMouse,
int32_t  iButton,
int32_t  iX,
int32_t  iY,
DWORD  dwKeyParam 
)
overridevirtualinherited

Reimplemented from C4GUI::Window.

Definition at line 644 of file C4GuiContainers.cpp.

645  {
646  // process wheel: Scroll
647  if (iButton == C4MC_Button_Wheel)
648  {
649  short iDelta = (short)(dwKeyParam >> 16);
650  ScrollBy(-iDelta);
651  return;
652  }
653  // other mouse input: inherited (forward to children)
654  Window::MouseInput(rMouse, iButton, iX, iY, dwKeyParam);
655  }
const int32_t C4MC_Button_Wheel
void ScrollBy(int iAmount)
void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override

References C4MC_Button_Wheel, C4GUI::Window::MouseInput(), and C4GUI::ScrollWindow::ScrollBy().

Here is the call graph for this function:

◆ MouseInput() [2/2]

bool C4ScriptGuiWindow::MouseInput ( int32_t  iButton,
int32_t  iX,
int32_t  iY,
DWORD  dwKeyParam 
)
virtual

Definition at line 2114 of file C4ScriptGuiWindow.cpp.

2115 {
2116  // only called on root
2117  assert(IsRoot());
2118  // This is only called during a mouse move event, where the MouseControl's player is available.
2119  const int32_t &player = ::MouseControl.GetPlayer();
2120  assert(player != NO_OWNER);
2121  // Only allow one window to catch the mouse input.
2122  // Do not simply return, however, since other windows might need OnMouseOut().
2123  bool oneActionAlreadyExecuted = false;
2124  // non-multiple-windows have a higher priority
2125  // this is important since they are also drawn on top
2126  for (int withMultipleFlag = 0; withMultipleFlag <= 1; ++withMultipleFlag)
2127  {
2128  for (auto iter = rbegin(); iter != rend(); ++iter)
2129  {
2130  C4ScriptGuiWindow *child = static_cast<C4ScriptGuiWindow*>(*iter);
2131 
2132  const int32_t &style = child->props[C4ScriptGuiWindowPropertyName::style].GetInt();
2133  if ((withMultipleFlag == 0) && (style & C4ScriptGuiWindowStyleFlag::Multiple)) continue;
2134  if ((withMultipleFlag == 1) && !(style & C4ScriptGuiWindowStyleFlag::Multiple)) continue;
2135 
2136  // Do the visibility check first. The child itself won't do it, because we are handling mouse in/out here, too.
2137  if (!child->IsVisibleTo(player)) continue;
2138 
2139  // we are root, we have to adjust the position for the "main" windows that are centered
2140  int32_t adjustedMouseX = 0, adjustedMouseY = mouseY;
2141  int32_t offsetX = 0, offsetY = 0;
2142  if (withMultipleFlag == 0)
2143  {
2144  offsetX = -rcBounds.x;
2145  offsetY = -rcBounds.y;
2146  }
2147 
2148  adjustedMouseX = mouseX + offsetX;
2149  adjustedMouseY = mouseY + offsetY;
2150 
2151  int32_t childLeft = child->rcBounds.x;
2152  int32_t childRight = child->rcBounds.x + child->rcBounds.Wdt;
2153  int32_t childTop = child->rcBounds.y;
2154  int32_t childBottom = child->rcBounds.y + child->rcBounds.Hgt;
2155 
2156  bool inArea = true;
2157  if ((adjustedMouseX < childLeft) || (adjustedMouseX > childRight)) inArea = false;
2158  else if ((adjustedMouseY < childTop) || (adjustedMouseY > childBottom)) inArea = false;
2159 
2160  if (!inArea) // notify child if it had mouse focus before
2161  {
2162  if (child->HasMouseFocus())
2163  child->OnMouseOut(player);
2164  continue;
2165  }
2166  // Don't break since some more OnMouseOut might be necessary
2167  if (oneActionAlreadyExecuted) continue;
2168 
2169 
2170  // keep the mouse coordinates relative to the child's bounds
2171  if (child->ProcessMouseInput(button, adjustedMouseX - childLeft, adjustedMouseY - childTop - iScrollY, dwKeyParam, childLeft - offsetX, childTop + iScrollY - offsetY))
2172  {
2173  oneActionAlreadyExecuted = true;
2174  }
2175  }
2176  }
2177 
2178  return oneActionAlreadyExecuted;
2179 }
ReverseIterator rend()
Definition: C4Gui.h:827
ReverseIterator rbegin()
Definition: C4Gui.h:826
virtual bool ProcessMouseInput(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam, int32_t parentOffsetX, int32_t parentOffsetY)
void OnMouseOut(int32_t player)

References C4ScriptGuiWindowProperty::GetInt(), C4MouseControl::GetPlayer(), HasMouseFocus(), C4Rect::Hgt, C4GUI::ScrollWindow::iScrollY, IsVisibleTo(), MouseControl, C4ScriptGuiWindowStyleFlag::Multiple, NO_OWNER, OnMouseOut(), C4ScriptGuiWindowPropertyName::player, ProcessMouseInput(), C4GUI::Container::rbegin(), C4GUI::Element::rcBounds, C4GUI::Container::rend(), C4ScriptGuiWindowPropertyName::style, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Here is the call graph for this function:

◆ MouseLeave()

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

Reimplemented from C4GUI::Element.

Definition at line 2089 of file C4ScriptGuiWindow.cpp.

2090 {
2091  assert(::MouseControl.GetPlayer() != NO_OWNER);
2092 
2093 }

References C4MouseControl::GetPlayer(), MouseControl, and NO_OWNER.

Here is the call graph for this function:

◆ OnHotkey()

bool C4GUI::Container::OnHotkey ( uint32_t  cHotkey)
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Element.

Reimplemented in C4GUI::CheckBox, and C4GUI::Button.

Definition at line 212 of file C4GuiContainers.cpp.

213  {
214  if (!IsVisible()) return false;
215  // check all nested elements
216  for (Element *pEl = pFirst; pEl; pEl=pEl->pNext)
217  if (pEl->fVisible)
218  if (pEl->OnHotkey(cHotkey)) return true;
219  // no match found
220  return false;
221  }

References C4GUI::Element::IsVisible(), C4GUI::Container::pFirst, and C4GUI::Element::pNext.

Here is the call graph for this function:

◆ OnMouseIn()

void C4ScriptGuiWindow::OnMouseIn ( int32_t  player,
int32_t  parentOffsetX,
int32_t  parentOffsetY 
)

Definition at line 2059 of file C4ScriptGuiWindow.cpp.

2060 {
2061  assert(!HasMouseFocus() && "custom menu window properly loaded incorrectly!");
2062  currentMouseState = MouseState::Focus;
2063 
2064  // no need to notify children, this is done in MouseInput
2065 
2066  // update tooltip info if applicable
2068  if (strBuf)
2069  {
2070  C4Viewport * viewport = ::Viewports.GetViewport(player);
2071  if (viewport)
2072  {
2073  const float guiZoom = viewport->GetGUIZoom();
2074  const int32_t x = int32_t((parentOffsetX + rcBounds.x) / guiZoom);
2075  const int32_t y = int32_t((parentOffsetY + rcBounds.y) / guiZoom);
2076  const int32_t wdt = int32_t(rcBounds.Wdt / guiZoom);
2077  const int32_t hgt = int32_t(rcBounds.Hgt / guiZoom);
2078  ::MouseControl.SetTooltipRectangle(C4Rect(x, y, wdt, hgt));
2079  ::MouseControl.SetTooltipText(*strBuf);
2080  }
2081  }
2082  // execute action
2084  C4ScriptGuiWindowAction *action = props[actionType].GetAction();
2085  if (!action) return;
2086  action->Execute(this, player, actionType);
2087 }
C4ViewportList Viewports
void SetTooltipText(const StdStrBuf &text)
void SetTooltipRectangle(const C4Rect &rectangle)
void Execute(C4ScriptGuiWindow *parent, int32_t player, int32_t actionType)
float GetGUIZoom() const
Definition: C4Viewport.h:50
C4Viewport * GetViewport(int32_t player_nr, C4Viewport *prev=nullptr)

References currentMouseState, C4ScriptGuiWindowAction::Execute(), C4ScriptGuiWindowProperty::GetAction(), C4Viewport::GetGUIZoom(), C4ScriptGuiWindowProperty::GetStrBuf(), C4ViewportList::GetViewport(), HasMouseFocus(), C4Rect::Hgt, MouseControl, C4ScriptGuiWindowPropertyName::onMouseInAction, C4ScriptGuiWindowPropertyName::player, C4GUI::Element::rcBounds, C4MouseControl::SetTooltipRectangle(), C4MouseControl::SetTooltipText(), C4ScriptGuiWindowPropertyName::tooltip, Viewports, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by ProcessMouseInput().

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

◆ OnMouseOut()

void C4ScriptGuiWindow::OnMouseOut ( int32_t  player)

Definition at line 2094 of file C4ScriptGuiWindow.cpp.

2095 {
2096  assert(HasMouseFocus() && "custom menu window probably loaded incorrectly!");
2098 
2099  // needs to notify children
2100  for (C4GUI::Element *iter : *this)
2101  {
2102  C4ScriptGuiWindow *child = static_cast<C4ScriptGuiWindow*>(iter);
2103  if (child->HasMouseFocus())
2104  child->OnMouseOut(player);
2105  }
2106 
2107  // execute action
2109  C4ScriptGuiWindowAction *action = props[actionType].GetAction();
2110  if (!action) return;
2111  action->Execute(this, player, actionType);
2112 }

References currentMouseState, C4ScriptGuiWindowAction::Execute(), C4ScriptGuiWindowProperty::GetAction(), HasMouseFocus(), C4ScriptGuiWindowStyleFlag::None, OnMouseOut(), C4ScriptGuiWindowPropertyName::onMouseOutAction, and C4ScriptGuiWindowPropertyName::player.

Referenced by MouseInput(), OnMouseOut(), and ProcessMouseInput().

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

◆ ProcessMouseInput()

bool C4ScriptGuiWindow::ProcessMouseInput ( int32_t  iButton,
int32_t  iX,
int32_t  iY,
DWORD  dwKeyParam,
int32_t  parentOffsetX,
int32_t  parentOffsetY 
)
virtual

Definition at line 2181 of file C4ScriptGuiWindow.cpp.

2182 {
2183  const int32_t &player = ::MouseControl.GetPlayer();
2184  assert(player != NO_OWNER);
2185 
2186  // completely ignore mouse if the appropriate flag is set
2187  const int32_t &style = props[C4ScriptGuiWindowPropertyName::style].GetInt();
2189  return false;
2190 
2191  // we have mouse focus! Is this new?
2192  if (!HasMouseFocus())
2193  OnMouseIn(player, parentOffsetX, parentOffsetY);
2194 
2195  // Make sure the UI does not catch release events without matching key-down events.
2196  // Otherwise, you could e.g. open a menu on left-down and then the menu would block the left-up event, leading to issues.
2197  if (button == C4MC_Button_LeftUp)
2198  {
2199  // Do not catch up-events without prior down-events!
2200  if (!(currentMouseState & MouseState::MouseDown)) return false;
2201  }
2202 
2203  // do not simply break the loop since some OnMouseOut might go missing
2204  bool oneActionAlreadyExecuted = false;
2205 
2206  const int32_t scrollAdjustedMouseY = mouseY + iScrollY;
2207 
2208  // children actually have a higher priority
2209  bool overChild = false; // remember for later, catch all actions that are in theory over children, even if not reaction (if main window)
2210  // use reverse iterator since children with higher Priority appear later in the list
2211  for (auto iter = rbegin(); iter != rend(); ++iter)
2212  {
2213  C4ScriptGuiWindow *child = static_cast<C4ScriptGuiWindow*>(*iter);
2214 
2215  // Do the visibility check first. The child itself won't do it, because we are handling mouse in/out here, too.
2216  if (!child->IsVisibleTo(player)) continue;
2217 
2218  const int32_t childLeft = child->rcBounds.x;
2219  const int32_t childRight = child->rcBounds.x + child->rcBounds.Wdt;
2220  const int32_t childTop = child->rcBounds.y;
2221  const int32_t childBottom = child->rcBounds.y + child->rcBounds.Hgt;
2222 
2223  bool inArea = true;
2224  if ((mouseX <= childLeft) || (mouseX > childRight)) inArea = false;
2225  else if ((scrollAdjustedMouseY <= childTop) || (scrollAdjustedMouseY > childBottom)) inArea = false;
2226 
2227  if (!inArea) // notify child if it had mouse focus before
2228  {
2229  if (child->HasMouseFocus())
2230  child->OnMouseOut(player);
2231  continue;
2232  }
2233 
2234  if (oneActionAlreadyExecuted) continue;
2235 
2236  overChild = true;
2237  // keep coordinates relative to children
2238  if (child->ProcessMouseInput(button, mouseX - childLeft, scrollAdjustedMouseY - childTop, dwKeyParam, parentOffsetX + rcBounds.x, parentOffsetY + rcBounds.y - iScrollY))
2239  {
2240  oneActionAlreadyExecuted = true;
2241  }
2242  }
2243 
2244  if (oneActionAlreadyExecuted) return true;
2245 
2246  //C4GUI::Element::MouseInput(rMouse, button, mouseX, mouseY, dwKeyParam);
2247 
2248  // remember button-down events. The action will only be executed on button-up
2249  // The sequence for double-clicks is LeftDown-LeftUp-LeftDouble-LeftUp, so treat double as down
2250  if (button == C4MC_Button_LeftDown || button == C4MC_Button_LeftDouble)
2251  currentMouseState |= MouseState::MouseDown;
2252  // trigger!
2253  if (button == C4MC_Button_LeftUp)
2254  {
2257  if (action)
2258  {
2260  return true;
2261  }
2262  }
2263 
2264  // for scroll-enabled windows, scroll contents with wheel
2265  if (pScrollBar->IsVisible() && (button == C4MC_Button_Wheel))
2266  {
2267  short delta = (short)(dwKeyParam >> 16);
2268  ScrollBy(-delta);
2269  //float fac = (lastDrawPosition.bottomMostChild - lastDrawPosition.topMostChild);
2270  //if (fac == 0.0f) fac = 1.0f;
2271  //scrollBar->ScrollBy(-float(delta) / fac);
2272  return true;
2273  }
2274 
2275  // forward to scroll-bar if in area
2276  if (pScrollBar->IsVisible())
2277  {
2278  if ((mouseX > pScrollBar->rcBounds.x && mouseX < pScrollBar->rcBounds.x + pScrollBar->rcBounds.Wdt)
2279  && (mouseY > pScrollBar->rcBounds.y && mouseY < pScrollBar->rcBounds.y + pScrollBar->rcBounds.Hgt))
2280  {
2281  C4GUI::CMouse mouse(mouseX, mouseY);
2282  if (::MouseControl.IsLeftDown()) mouse.LDown = true;
2283  pScrollBar->MouseInput(mouse, button, mouseX - pScrollBar->rcBounds.x, mouseY - pScrollBar->rcBounds.y, dwKeyParam);
2284  }
2285  }
2286 
2287 
2288  // if the user still clicked on a menu - even if it didn't do anything, catch it
2289  // but do that only on the top-level to not stop traversing other branches
2290  if (isMainWindow)
2291  return overChild;
2292  return false;
2293 }
const int32_t C4MC_Button_LeftUp
const int32_t C4MC_Button_LeftDown
const int32_t C4MC_Button_LeftDouble
void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override
void OnMouseIn(int32_t player, int32_t parentOffsetX, int32_t parentOffsetY)

References C4MC_Button_LeftDouble, C4MC_Button_LeftDown, C4MC_Button_LeftUp, C4MC_Button_Wheel, currentMouseState, C4ScriptGuiWindowAction::Execute(), C4ScriptGuiWindowProperty::GetAction(), C4ScriptGuiWindowProperty::GetInt(), C4MouseControl::GetPlayer(), HasMouseFocus(), C4Rect::Hgt, C4ScriptGuiWindowStyleFlag::IgnoreMouse, C4GUI::ScrollWindow::iScrollY, C4MouseControl::IsLeftDown(), C4GUI::Element::IsVisible(), IsVisibleTo(), C4GUI::CMouse::LDown, MouseControl, MouseDown, C4GUI::ScrollBar::MouseInput(), NO_OWNER, C4ScriptGuiWindowPropertyName::onClickAction, OnMouseIn(), OnMouseOut(), C4ScriptGuiWindowPropertyName::player, ProcessMouseInput(), C4GUI::ScrollWindow::pScrollBar, C4GUI::Container::rbegin(), C4GUI::Element::rcBounds, C4GUI::Container::rend(), C4GUI::ScrollWindow::ScrollBy(), C4ScriptGuiWindowPropertyName::style, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by MouseInput(), and ProcessMouseInput().

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

◆ rbegin()

ReverseIterator C4GUI::Container::rbegin ( )
inlineinherited

Definition at line 826 of file C4Gui.h.

826 { return ReverseIterator(pLast); }

References C4GUI::Container::pLast.

Referenced by MouseInput(), and ProcessMouseInput().

Here is the caller graph for this function:

◆ ReaddElement()

void C4GUI::Container::ReaddElement ( Element pChild)
inherited

Definition at line 134 of file C4GuiContainers.cpp.

135  {
136  // safety
137  if (!pChild || pChild->pParent != this) return;
138  // remove from any previous container
139  if (pChild->pPrev) pChild->pPrev->pNext = pChild->pNext; else pFirst = pChild->pNext;
140  if (pChild->pNext) pChild->pNext->pPrev = pChild->pPrev; else pLast = pChild->pPrev;
141  // add to end of list
142  if (pLast) pLast->pNext = pChild; else pFirst = pChild;
143  pChild->pPrev = pLast; pChild->pNext = nullptr; pLast = pChild;
144 
145  assert(pChild->pNext != pChild);
146  assert(pChild->pPrev != pChild);
147  assert(pChild->pParent != pChild);
148  }

References C4GUI::Container::pFirst, C4GUI::Container::pLast, C4GUI::Element::pNext, C4GUI::Element::pParent, and C4GUI::Element::pPrev.

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

Here is the caller graph for this function:

◆ RemoveChild()

void C4ScriptGuiWindow::RemoveChild ( C4ScriptGuiWindow child,
bool  close = true,
bool  all = false 
)

Definition at line 1289 of file C4ScriptGuiWindow.cpp.

1290 {
1291  if (isRemovalLockedForClosingCallback())
1292  {
1293  // We are in potentially dangerous fields here (removing a window while another window is being removed).
1294  // This has a decent chance to lead to accessing dead memory.
1295  // It might still leave the GUI tree in an incorrect state (with dead target objects). But still better than a direct crash.
1296  throw C4AulExecError("Trying to remove script GUI window (or window target) from within window closing callback.");
1297  }
1298 
1299  // do a layout update asap
1300  if (!all && !IsRoot())
1302 
1303  if (child)
1304  {
1305  child->wasRemovedFromParent = true;
1306  if (close) child->Close();
1307  if (child->GetID() != 0)
1308  ChildWithIDRemoved(child);
1309  RemoveElement(static_cast<C4GUI::Element*>(child));
1310  MenuDebugLogF("Deleting child (%d, %s, @%p, target: %p) from parent (%d, %s, @%p, target: %p).",
1311  child->id, child->name, child, child->target,
1312  id, name, this, target);
1313  // RemoveElement does NOT delete the child itself.
1314  delete child;
1315  }
1316  else if (close) // close all children
1317  {
1318  assert(all);
1319  for (Element * element : *this)
1320  {
1321  C4ScriptGuiWindow * child = static_cast<C4ScriptGuiWindow*>(element);
1322  assert(child != nullptr);
1323  MenuDebugLogF("Closing child (%d, %s, @%p, target: %p) due to parent (%d, %s, @%p, target: %p) removal.",
1324  child->id, child->name, child, child->target,
1325  id, name, this, target);
1326  child->wasRemovedFromParent = true;
1327  child->Close();
1328  if (child->GetID() != 0)
1329  ChildWithIDRemoved(child);
1330  }
1331  }
1332 
1333  if (all)
1335 }
void RemoveElement(Element *pChild) override

References C4GUI::Container::ClearChildren(), Close(), C4GUI::Container::Element, GetID(), MenuDebugLogF, C4GUI::Container::RemoveElement(), and RequestLayoutUpdate().

Referenced by ClearChildren(), Close(), and CreateFromPropList().

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

◆ RemoveElement()

void C4GUI::Container::RemoveElement ( Element pChild)
overridevirtualinherited

Reimplemented from C4GUI::Element.

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

Definition at line 89 of file C4GuiContainers.cpp.

90  {
91  // safety
92  if (!pChild) return;
93  // inherited
94  Element::RemoveElement(pChild);
95  // must be from same container
96  if (pChild->pParent != this) return;
97  // unlink from list
98  if (pChild->pPrev) pChild->pPrev->pNext = pChild->pNext; else pFirst = pChild->pNext;
99  if (pChild->pNext) pChild->pNext->pPrev = pChild->pPrev; else pLast = pChild->pPrev;
100  // unset parent; invalidates pPrev/pNext
101  pChild->pParent = nullptr;
102  // element has been removed
104  }
virtual void RemoveElement(Element *pChild)
Definition: C4Gui.cpp:173

References C4GUI::Container::AfterElementRemoval(), C4GUI::Container::pFirst, C4GUI::Container::pLast, C4GUI::Element::pNext, C4GUI::Element::pParent, C4GUI::Element::pPrev, and C4GUI::Element::RemoveElement().

Referenced by C4GUI::Container::AddElement(), C4GUI::Container::InsertElement(), RemoveChild(), C4GUI::Element::RemoveElement(), C4GUI::ListBox::RemoveElement(), C4GUI::Tabular::RemoveElement(), C4GUI::ContextMenu::RemoveElement(), C4GUI::Dialog::RemoveElement(), C4GUI::Screen::RemoveElement(), and C4GUI::Element::~Element().

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

◆ rend()

ReverseIterator C4GUI::Container::rend ( )
inlineinherited

Definition at line 827 of file C4Gui.h.

827 { return ReverseIterator(nullptr); }

Referenced by MouseInput(), and ProcessMouseInput().

Here is the caller graph for this function:

◆ RequestLayoutUpdate()

void C4ScriptGuiWindow::RequestLayoutUpdate ( )

Definition at line 1663 of file C4ScriptGuiWindow.cpp.

1664 {
1665  // directly requested on the root window?
1666  // That usually comes from another part of the engine (f.e. C4Viewport::RecalculateViewports) or from a multiple-window child
1667  if (!GetParent())
1668  {
1669  mainWindowNeedsLayoutUpdate = true;
1670  return;
1671  }
1672 
1673  // are we a direct child of the root?
1674  if (isMainWindow)
1675  {
1676  const int32_t &style = props[C4ScriptGuiWindowPropertyName::style].GetInt();
1677 
1678  if (!(style & C4ScriptGuiWindowStyleFlag::Multiple)) // are we a simple centered window?
1679  {
1680  mainWindowNeedsLayoutUpdate = true;
1681  return;
1682  }
1683  else // we are one of the multiple windows.. the root better do a full refresh
1684  {}
1685  }
1686  // propagate to parent window
1687  static_cast<C4ScriptGuiWindow*>(GetParent())->RequestLayoutUpdate();
1688 }

References C4ScriptGuiWindowProperty::GetInt(), C4GUI::Element::GetParent(), C4ScriptGuiWindowStyleFlag::Multiple, and C4ScriptGuiWindowPropertyName::style.

Referenced by CreateFromPropList(), Denumerate(), RemoveChild(), and SetTag().

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

◆ ScreenPos2ClientPos()

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

Definition at line 218 of file C4Gui.cpp.

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  }
virtual void ApplyElementOffset(int32_t &riX, int32_t &riY)
Definition: C4Gui.h:840

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

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

◆ ScrollBy()

void C4GUI::ScrollWindow::ScrollBy ( int  iAmount)
inherited

Definition at line 564 of file C4GuiContainers.cpp.

565  {
566  int32_t iVisHgt = GetBounds().Hgt;
567  int32_t iClientHgt = GetClientRect().Hgt;
568  int32_t iMaxScroll = iClientHgt - iVisHgt;
569  int iNewScrollY = Clamp<int>(iScrollY + iAmount, 0, iMaxScroll);
570  if (iScrollY != iNewScrollY)
571  {
572  // scrolling possible: do it
573  iScrollY = iNewScrollY;
574  // update (self + bar)
575  Update();
576  }
577  }
C4Rect & GetClientRect() override
Definition: C4Gui.h:864

References C4GUI::Element::GetBounds(), C4GUI::Window::GetClientRect(), C4Rect::Hgt, C4GUI::ScrollWindow::iScrollY, and C4GUI::ScrollWindow::Update().

Referenced by C4GUI::ScrollWindow::MouseInput(), ProcessMouseInput(), and C4GUI::ScrollWindow::ScrollPages().

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

◆ ScrollPages()

void C4GUI::ScrollWindow::ScrollPages ( int  iPageCount)
inherited

Definition at line 558 of file C4GuiContainers.cpp.

559  {
560  int32_t iVisHgt = GetBounds().Hgt;
561  ScrollBy(iPageCount * iVisHgt);
562  }

References C4GUI::Element::GetBounds(), C4Rect::Hgt, and C4GUI::ScrollWindow::ScrollBy().

Here is the call graph for this function:

◆ ScrollRangeInView()

void C4GUI::ScrollWindow::ScrollRangeInView ( int32_t  iY,
int32_t  iHgt 
)
inherited

Definition at line 579 of file C4GuiContainers.cpp.

580  {
581  // safety bounds
582  if (iY<0) iY=0;
583  int32_t iClientHgt = GetClientRect().Hgt;
584  if (iY+iHgt > iClientHgt) { ScrollToBottom(); return; }
585  // check top
586  if (iScrollY > iY)
587  {
588  iScrollY = iY;
589  Update(); // update (self+bar)
590  }
591  else
592  {
593  // check bottom
594  int32_t iVisHgt = GetBounds().Hgt;
595  // if no height is given, scroll given Y-pos to top
596  if (!iHgt) iHgt = iVisHgt;
597  if (iScrollY + iVisHgt < iY + iHgt)
598  {
599  iScrollY = iY + iHgt - iVisHgt;
600  Update(); // update (self+bar)
601  }
602  }
603  }

References C4GUI::Element::GetBounds(), C4GUI::Window::GetClientRect(), C4Rect::Hgt, C4GUI::ScrollWindow::iScrollY, C4GUI::ScrollWindow::ScrollToBottom(), and C4GUI::ScrollWindow::Update().

Referenced by C4Menu::AdjustPosition(), C4GUI::ListBox::ScrollItemInView(), and C4GUI::TextWindow::SetScrollPos().

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

◆ ScrollToBottom()

void C4GUI::ScrollWindow::ScrollToBottom ( )
inherited

Definition at line 544 of file C4GuiContainers.cpp.

545  {
546  int32_t iVisHgt = GetBounds().Hgt;
547  int32_t iClientHgt = GetClientRect().Hgt;
548  int32_t iMaxScroll = iClientHgt - iVisHgt;
549  if (iScrollY < iMaxScroll)
550  {
551  // scrolling possible: do it
552  iScrollY = iMaxScroll;
553  // update (self + bar)
554  Update();
555  }
556  }

References C4GUI::Element::GetBounds(), C4GUI::Window::GetClientRect(), C4Rect::Hgt, C4GUI::ScrollWindow::iScrollY, and C4GUI::ScrollWindow::Update().

Referenced by C4GUI::ScrollWindow::ScrollRangeInView(), C4GUI::ListBox::ScrollToBottom(), and C4GUI::TextWindow::ScrollToBottom().

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

◆ SetBounds()

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

Definition at line 446 of file C4Gui.h.

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

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

Referenced by C4GameOptionButtons::C4GameOptionButtons(), C4GoalDisplay::C4GoalDisplay(), C4StartupModsListEntry::C4StartupModsListEntry(), 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(), C4StartupModsListEntry::MakeInfoEntry(), 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(), C4GUI::ListBox::UpdateElementPositions(), C4Menu::UpdateElementPositions(), C4GUI::ScrollWindow::UpdateOwnPos(), C4ChatControl::UpdateSize(), C4ChatDlg::UpdateSize(), C4GUI::TextWindow::UpdateSize(), and C4GUI::Dialog::UpdateSize().

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

◆ SetClientHeight()

void C4GUI::ScrollWindow::SetClientHeight ( int32_t  iToHgt)
inlineinherited

Definition at line 973 of file C4Gui.h.

974  { iClientHeight=iToHgt; Update(); }

References C4GUI::ScrollWindow::iClientHeight, and C4GUI::ScrollWindow::Update().

Referenced by C4GUI::ListBox::AddElement(), C4GUI::TextWindow::ElementPosChanged(), C4GUI::TextWindow::ElementSizeChanged(), C4GUI::TextWindow::TextWindow(), C4GUI::ListBox::UpdateElementPositions(), and C4Menu::UpdateElementPositions().

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

◆ SetContextHandler()

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

Definition at line 465 of file C4Gui.h.

466  {
468  if ((pContextHandler = pNewHd)) pNewHd->Ref();
469  }

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

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

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

◆ SetDecoration()

void C4GUI::ScrollWindow::SetDecoration ( ScrollBarFacets pToGfx,
bool  fAutoScroll 
)
inlineinherited

Definition at line 977 of file C4Gui.h.

978  { if (pScrollBar) pScrollBar->SetDecoration(pToGfx, fAutoScroll); }
void SetDecoration(ScrollBarFacets *pToGfx, bool fAutoHide)
Definition: C4Gui.h:929

References C4GUI::ScrollWindow::pScrollBar, and C4GUI::ScrollBar::SetDecoration().

Referenced by C4GUI::TextWindow::SetDecoration(), and C4GUI::ListBox::SetDecoration().

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

◆ SetDragTarget()

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

Definition at line 464 of file C4Gui.h.

464 { pDragTarget = pToWindow; }

References C4GUI::Element::pDragTarget.

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

Here is the caller graph for this function:

◆ SetEnumeratedID()

void C4ScriptGuiWindow::SetEnumeratedID ( int  enumID)
inline

Definition at line 282 of file C4ScriptGuiWindow.h.

282 { id = enumID; }

◆ SetPos()

void C4GUI::Window::SetPos ( int32_t  iXPos,
int32_t  iYPos 
)
inlineinherited

Definition at line 860 of file C4Gui.h.

861  { rcBounds.x=iXPos; rcBounds.y=iYPos; UpdatePos(); }

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

Referenced by C4ScoreboardDlg::DoPlacement(), C4Menu::InitLocation(), C4StartupPlrSelDlg::OnNewBtn(), C4StartupPlrSelDlg::OnPropertyBtn(), C4Menu::SetLocation(), and C4GUI::Screen::ShowDialog().

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

◆ SetScroll()

void C4GUI::ScrollWindow::SetScroll ( int32_t  iToScroll)
inherited

Definition at line 538 of file C4GuiContainers.cpp.

539  {
540  // set values
541  rcClientRect.y = -(iScrollY = iToScroll);
542  }

References C4GUI::ScrollWindow::iScrollY, C4GUI::Window::rcClientRect, and C4Rect::y.

Referenced by C4GUI::ScrollBar::OnPosChanged(), and C4Menu::SetPosition().

Here is the caller graph for this function:

◆ SetScrollBarEnabled()

void C4GUI::ScrollWindow::SetScrollBarEnabled ( bool  fToVal,
bool  noAutomaticPositioning = false 
)
inherited

Definition at line 635 of file C4GuiContainers.cpp.

636  {
637  if (fHasBar == fToVal) return;
638  pScrollBar->SetVisibility(fHasBar = fToVal);
639  // in some cases the windows will already care for the correct positioning themselves (see C4ScriptGuiWindow)
640  if (!noAutomaticPositioning)
641  UpdateOwnPos();
642  }
virtual void SetVisibility(bool fToValue)
Definition: C4Gui.cpp:207
void UpdateOwnPos() override

References C4GUI::ScrollWindow::fHasBar, C4GUI::ScrollWindow::pScrollBar, C4GUI::Element::SetVisibility(), and C4GUI::ScrollWindow::UpdateOwnPos().

Referenced by C4Menu::InitSize().

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

◆ SetTag()

void C4ScriptGuiWindow::SetTag ( C4String tag)

Definition at line 2038 of file C4ScriptGuiWindow.cpp.

2039 {
2040  // set tag on all properties
2041  for (uint32_t i = 0; i < C4ScriptGuiWindowPropertyName::_lastProp; ++i)
2042  if (props[i].SwitchTag(tag))
2043  {
2044  // only if tag could have changed position etc.
2047  }
2048 
2049  // .. and children
2050  for (C4GUI::Element * element : *this)
2051  (static_cast<C4ScriptGuiWindow*>(element))->SetTag(tag);
2052 }

References C4ScriptGuiWindowPropertyName::_lastProp, C4ScriptGuiWindowPropertyName::priority, C4ScriptGuiWindowPropertyName::relBottom, RequestLayoutUpdate(), C4ScriptGuiWindowPropertyName::style, and C4ScriptGuiWindowPropertyName::text.

Referenced by CreateFromPropList(), and C4ScriptGuiWindowAction::Execute().

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

◆ SetToolTip()

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

Definition at line 409 of file C4Gui.cpp.

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 Copy()
Definition: StdBuf.h:467
void Clear()
Definition: StdBuf.h:466

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

Referenced by C4GUI::ContextMenu::AddItem(), C4GameOverDlg::C4GameOverDlg(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4MenuItem::C4MenuItem(), C4StartupAboutDlg::C4StartupAboutDlg(), C4StartupLegalDlg::C4StartupLegalDlg(), C4StartupMainDlg::C4StartupMainDlg(), C4StartupModsDlg::C4StartupModsDlg(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4StartupPlrPropertiesDlg::C4StartupPlrPropertiesDlg(), C4StartupPlrSelDlg::C4StartupPlrSelDlg(), C4StartupScenSelDlg::C4StartupScenSelDlg(), C4MapFolderData::CreateGUIElements(), 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::FullscreenDialog::SetTitle(), C4GUI::Dialog::SetTitle(), C4ChatControl::ChatSheet::NickItem::Update(), and C4GameLobby::MainDlg::UpdateRightTab().

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

◆ SetVisibility()

void C4GUI::Container::SetVisibility ( bool  fToValue)
overridevirtualinherited

Reimplemented from C4GUI::Element.

Reimplemented in C4StartupNetListEntry, and C4StartupModsListEntry.

Definition at line 247 of file C4GuiContainers.cpp.

248  {
249  // inherited
250  Element::SetVisibility(fToValue);
251  // remove focus from contained elements
252  if (!fToValue)
253  {
254  Dialog *pDlg = GetDlg();
255  if (pDlg)
256  {
257  Control *pFocus = pDlg->GetFocus();
258  if (pFocus)
259  {
260  if (IsParentOf(pFocus))
261  {
262  pDlg->SetFocus(nullptr, false);
263  }
264  }
265  }
266  }
267  }
C4GameControl Control
bool IsParentOf(Element *pEl) override

References C4GUI::Element::GetDlg(), C4GUI::Dialog::GetFocus(), C4GUI::Container::IsParentOf(), C4GUI::Dialog::SetFocus(), and C4GUI::Element::SetVisibility().

Referenced by C4GUI::Tabular::AddCustomSheet(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4Menu::C4Menu(), C4StartupScenSelDlg::C4StartupScenSelDlg(), C4Menu::Draw(), C4Menu::InitLocation(), C4StartupModsDownloader::OnConfirmInstallation(), C4StartupModsListEntry::SetVisibility(), and C4StartupNetListEntry::SetVisibility().

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

◆ StartDragging()

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

Definition at line 259 of file C4Gui.cpp.

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  }
bool fDragging
Definition: C4Gui.h:380

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

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

Here is the caller graph for this function:

◆ StopDragging()

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

Definition at line 282 of file C4Gui.cpp.

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

References C4GUI::Element::DoDragging().

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

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

◆ ToC4Value()

const C4Value C4ScriptGuiWindow::ToC4Value ( )

Definition at line 886 of file C4ScriptGuiWindow.cpp.

887 {
888  C4PropList *proplist = C4PropList::New();
889 
890  // it is necessary that this list contains all of the properties which can also be set somehow
891  // if you add something, don't forget to also add the real serialization to the loop below
892  int32_t toSave[] =
893  {
894  P_Left,
895  P_Top,
896  P_Right,
897  P_Bottom,
898  P_Margin,
900  P_Decoration,
901  P_Symbol,
902  P_Target,
903  P_Text,
904  P_ID,
905  P_OnClick,
906  P_OnMouseIn,
907  P_OnMouseOut,
908  P_OnClose,
909  P_Style,
910  P_Mode,
911  P_Priority,
912  P_Player,
913  P_Tooltip
914  };
915 
916  for (int prop : toSave)
917  {
918  C4Value val;
919 
920  switch (prop)
921  {
922  case P_Left:
923  case P_Top:
924  case P_Right:
925  case P_Bottom:
926  {
927 #define PROPERTY_TUPLE(p, prop1, prop2) if (prop == p) { val = PositionToC4Value(prop1, prop2); }
932 #undef PROPERTY_TUPLE
933  break;
934  }
935  case P_Margin: val = MarginsToC4Value(); break;
938  case P_Symbol:
939  // either object or def
941  if (val == C4Value()) // is nil?
943  break;
944  case P_Target: val = C4Value(target); break;
945  case P_Text: val = props[C4ScriptGuiWindowPropertyName::text].ToC4Value(); break;
947  case P_Tooltip: val = props[C4ScriptGuiWindowPropertyName::tooltip].ToC4Value(); break;
948  case P_ID: val = C4Value(id); break;
953  case P_Style: val = props[C4ScriptGuiWindowPropertyName::style].ToC4Value(); break;
954  case P_Mode: val = C4Value(int32_t(currentMouseState)); break;
956  case P_Player: val = props[C4ScriptGuiWindowPropertyName::player].ToC4Value(); break;
957 
958  default:
959  assert(false);
960  break;
961  }
962 
963  // don't save "nil" values
964  if (val == C4Value()) continue;
965 
966  proplist->SetProperty(C4PropertyName(prop), val);
967  }
968 
969  // save children now, construct new names for them if necessary
970  int32_t childIndex = 0;
971  for (C4GUI::Element * element : *this)
972  {
973  C4ScriptGuiWindow *child = static_cast<C4ScriptGuiWindow*>(element);
974  C4Value val = child->ToC4Value();
975  C4String *childName = child->name;
976  if (!childName)
977  {
978  StdStrBuf childNameBuf;
979  childNameBuf.Format("_child_%03d", ++childIndex);
980  childName = Strings.RegString(childNameBuf);
981  }
982  proplist->SetPropertyByS(childName, val);
983  }
984 
985  return C4Value(proplist);
986 }
#define PROPERTY_TUPLE(p, prop1, prop2)
C4PropertyName
virtual void SetPropertyByS(C4String *k, const C4Value &to)
Definition: C4PropList.cpp:940
static C4PropList * New(C4PropList *prototype=nullptr)
Definition: C4PropList.cpp:40
void SetProperty(C4PropertyName k, const C4Value &to)
Definition: C4PropList.h:124
const C4Value ToC4Value()
C4String * RegString(StdStrBuf String)
void Format(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
Definition: StdBuf.cpp:174

References C4ScriptGuiWindowPropertyName::backgroundColor, C4ScriptGuiWindowPropertyName::bottom, currentMouseState, StdStrBuf::Format(), C4ScriptGuiWindowPropertyName::frameDecoration, C4ScriptGuiWindowPropertyName::left, C4PropList::New(), C4ScriptGuiWindowPropertyName::onClickAction, C4ScriptGuiWindowPropertyName::onCloseAction, C4ScriptGuiWindowPropertyName::onMouseInAction, C4ScriptGuiWindowPropertyName::onMouseOutAction, P_BackgroundColor, P_Bottom, P_Decoration, P_GraphicsName, P_ID, P_Left, P_Margin, P_Mode, P_OnClick, P_OnClose, P_OnMouseIn, P_OnMouseOut, P_Player, P_Priority, P_Right, P_Style, P_Symbol, P_Target, P_Text, P_Tooltip, P_Top, C4ScriptGuiWindowPropertyName::player, C4ScriptGuiWindowPropertyName::priority, PROPERTY_TUPLE, C4StringTable::RegString(), C4ScriptGuiWindowPropertyName::relBottom, C4ScriptGuiWindowPropertyName::relLeft, C4ScriptGuiWindowPropertyName::relRight, C4ScriptGuiWindowPropertyName::relTop, C4ScriptGuiWindowPropertyName::right, C4PropList::SetProperty(), C4PropList::SetPropertyByS(), Strings, C4ScriptGuiWindowPropertyName::style, C4ScriptGuiWindowPropertyName::symbolDef, C4ScriptGuiWindowPropertyName::symbolGraphicsName, C4ScriptGuiWindowPropertyName::symbolObject, C4ScriptGuiWindowPropertyName::text, C4ScriptGuiWindowProperty::ToC4Value(), ToC4Value(), C4ScriptGuiWindowPropertyName::tooltip, and C4ScriptGuiWindowPropertyName::top.

Referenced by ToC4Value().

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

◆ UnFreeze()

void C4GUI::ScrollWindow::UnFreeze ( )
inlineinherited

Definition at line 970 of file C4Gui.h.

970 { if (!--iFrozen) Update(); }

References C4GUI::ScrollWindow::iFrozen, and C4GUI::ScrollWindow::Update().

Referenced by C4Menu::RefillInternal(), and C4GUI::ListBox::UnFreezeScrolling().

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

◆ Update()

void C4GUI::ScrollWindow::Update ( )
inherited

Definition at line 523 of file C4GuiContainers.cpp.

524  {
525  // not if window is being refilled
526  if (iFrozen) return;
527  // do not scroll outside range
528  iScrollY = Clamp<int32_t>(iScrollY, 0, std::max<int32_t>(iClientHeight - GetBounds().Hgt, 0));
529  // update client rect
530  rcClientRect.x = 0;
534  // update scroll bar
535  if (pScrollBar) pScrollBar->Update();
536  }

References C4GUI::Element::GetBounds(), C4Rect::Hgt, C4GUI::ScrollWindow::iClientHeight, C4GUI::ScrollWindow::iFrozen, C4GUI::ScrollWindow::iScrollY, C4GUI::ScrollWindow::pScrollBar, C4GUI::Element::rcBounds, C4GUI::Window::rcClientRect, C4GUI::ScrollBar::Update(), C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by C4GUI::ScrollWindow::ScrollBy(), C4GUI::ScrollWindow::ScrollRangeInView(), C4GUI::ScrollWindow::ScrollToBottom(), C4GUI::ScrollWindow::SetClientHeight(), C4GUI::ScrollWindow::UnFreeze(), UpdateLayout(), and C4GUI::ScrollWindow::UpdateOwnPos().

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

◆ UpdateChildLayout()

bool C4ScriptGuiWindow::UpdateChildLayout ( C4TargetFacet cgo,
float  parentWidth,
float  parentHeight 
)

Definition at line 1690 of file C4ScriptGuiWindow.cpp.

1691 {
1692  for (Element * element : *this)
1693  {
1694  C4ScriptGuiWindow *window = static_cast<C4ScriptGuiWindow*>(element);
1695  window->UpdateLayout(cgo, parentWidth, parentHeight);
1696  }
1697  return true;
1698 }

References C4GUI::Container::Element, and UpdateLayout().

Referenced by UpdateLayout().

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

◆ UpdateLayout() [1/2]

bool C4ScriptGuiWindow::UpdateLayout ( C4TargetFacet cgo)

Definition at line 1700 of file C4ScriptGuiWindow.cpp.

1701 {
1702  assert(IsRoot()); // we are root
1703 
1704  // assume I am the root and use the a special rectangle in the viewport for drawing
1705  const float fullWidth = cgo.Wdt * cgo.Zoom - cgo.X;
1706  const float fullHeight = cgo.Hgt * cgo.Zoom - cgo.Y;
1707 
1708  // golden ratio defined default size!
1709  const float &targetWidthEm = C4ScriptGuiWindow::standardWidth;
1710  const float &targetHeightEm = C4ScriptGuiWindow::standardHeight;
1711 
1712  // adjust by viewport size
1713  const float minMarginPx = 50.0f;
1714  const float targetWidthPx = std::min(Em2Pix(targetWidthEm), fullWidth - 2.0f * minMarginPx);
1715  const float targetHeightPx = std::min(Em2Pix(targetHeightEm), fullHeight - 2.0f * minMarginPx);
1716 
1717  // calculate margins to center the window
1718  const float marginLeftRight = (fullWidth - targetWidthPx) / 2.0f;
1719  const float marginTopBottom = (fullHeight- targetHeightPx) / 2.0f;
1720 
1721  // we can only position the window by adjusting left/right/top/bottom
1722  const float &left = marginLeftRight;
1723  const float right = -marginLeftRight;
1724  const float &top = marginTopBottom;
1725  const float bottom = -marginTopBottom;
1726 
1727  // actual size, calculated from borders
1728  const float wdt = fullWidth - left + right;
1729  const float hgt = fullHeight - top + bottom;
1730 
1731  const bool needUpdate = mainWindowNeedsLayoutUpdate || (rcBounds.Wdt != int32_t(wdt)) || (rcBounds.Hgt != int32_t(hgt));
1732 
1733  if (needUpdate)
1734  {
1735  mainWindowNeedsLayoutUpdate = false;
1736 
1737  // these are the coordinates for the centered non-multiple windows
1738  rcBounds.x = static_cast<int>(left);
1739  rcBounds.y = static_cast<int>(top);
1740  rcBounds.Wdt = wdt;
1741  rcBounds.Hgt = hgt;
1742 
1743  // first update all multiple windows (that can cover the whole screen)
1744  for (Element * element : *this)
1745  {
1746  C4ScriptGuiWindow *child = static_cast<C4ScriptGuiWindow*>(element);
1747  const int32_t &style = child->props[C4ScriptGuiWindowPropertyName::style].GetInt();
1748  if (!(style & C4ScriptGuiWindowStyleFlag::Multiple)) continue;
1749  child->UpdateLayout(cgo, fullWidth, fullHeight);
1750  }
1751  // then update all "main" windows in the center of the screen
1752  // todo: adjust the size of the main window based on the border-windows drawn before
1753  for (Element * element : *this)
1754  {
1755  C4ScriptGuiWindow *child = static_cast<C4ScriptGuiWindow*>(element);
1756  const int32_t &style = child->props[C4ScriptGuiWindowPropertyName::style].GetInt();
1757  if ((style & C4ScriptGuiWindowStyleFlag::Multiple)) continue;
1758  child->UpdateLayout(cgo, wdt, hgt);
1759  }
1760 
1761  pScrollBar->SetVisibility(false);
1762  }
1763  return true;
1764 }
static const float standardHeight
static const float standardWidth

References C4ScriptGuiWindowPropertyName::bottom, C4GUI::Container::Element, C4ScriptGuiWindowProperty::GetInt(), C4Facet::Hgt, C4Rect::Hgt, C4ScriptGuiWindowPropertyName::left, C4ScriptGuiWindowStyleFlag::Multiple, C4GUI::ScrollWindow::pScrollBar, C4GUI::Element::rcBounds, C4ScriptGuiWindowPropertyName::right, C4GUI::Element::SetVisibility(), standardHeight, standardWidth, C4ScriptGuiWindowPropertyName::style, C4ScriptGuiWindowPropertyName::top, UpdateLayout(), C4Facet::Wdt, C4Rect::Wdt, C4Facet::X, C4Rect::x, C4Facet::Y, C4Rect::y, and C4TargetFacet::Zoom.

Referenced by Draw(), DrawAll(), UpdateChildLayout(), and UpdateLayout().

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

◆ UpdateLayout() [2/2]

bool C4ScriptGuiWindow::UpdateLayout ( C4TargetFacet cgo,
float  parentWidth,
float  parentHeight 
)

Definition at line 1766 of file C4ScriptGuiWindow.cpp.

1767 {
1768  // fetch style
1769  const int32_t &style = props[C4ScriptGuiWindowPropertyName::style].GetInt();
1770  // fetch current position as shortcut for overview
1771  const float &left = props[C4ScriptGuiWindowPropertyName::left].GetFloat();
1772  const float &right = props[C4ScriptGuiWindowPropertyName::right].GetFloat();
1773  const float &top = props[C4ScriptGuiWindowPropertyName::top].GetFloat();
1774  const float &bottom = props[C4ScriptGuiWindowPropertyName::bottom].GetFloat();
1775 
1778  const float &relTop = props[C4ScriptGuiWindowPropertyName::relTop].GetFloat();
1780 
1781  // same for margins
1786 
1791 
1792  // calculate drawing rectangle
1793  float leftDrawX = relLeft * parentWidth + Em2Pix(left) + (Em2Pix(leftMargin) + relLeftMargin * parentWidth);
1794  float rightDrawX = relRight * parentWidth + Em2Pix(right) - (Em2Pix(rightMargin) + relRightMargin * parentWidth);
1795  float topDrawY = relTop * parentHeight + Em2Pix(top) + (Em2Pix(topMargin) + relTopMargin * parentHeight);
1796  float bottomDrawY = relBottom * parentHeight + Em2Pix(bottom) - (Em2Pix(bottomMargin) + relBottomMargin * parentHeight);
1797  float width = rightDrawX - leftDrawX;
1798  float height = bottomDrawY - topDrawY;
1799 
1800  rcBounds.x = leftDrawX;
1801  rcBounds.y = topDrawY;
1802  rcBounds.Wdt = width;
1803  rcBounds.Hgt = height;
1804 
1805  // If this window contains text, we auto-fit to the text height;
1806  // but we only break text when the window /would/ crop it otherwise.
1808  int minRequiredTextHeight = 0;
1809  if (strBuf && !(style & C4ScriptGuiWindowStyleFlag::NoCrop))
1810  {
1811  StdStrBuf sText;
1812  const int32_t rawTextHeight = ::GraphicsResource.FontRegular.BreakMessage(strBuf->getData(), rcBounds.Wdt, &sText, true);
1813  // enable auto scroll
1814  if (rawTextHeight - 1 > rcBounds.Hgt)
1815  {
1816  // If we need to scroll, we will also have to add a scrollbar that takes up some width.
1817  // Recalculate the actual height, taking into account the scrollbar.
1818  // This is not done in the calculation earlier, because then e.g. a 2x1em field could not contain two letters
1819  // but would immediately add a linebreak.
1820  // In the case that this window auto-resizes (FitChildren), the small additional margin to the bottom should not matter much.
1821  const int32_t actualTextHeight = ::GraphicsResource.FontRegular.BreakMessage(strBuf->getData(), rcBounds.Wdt - pScrollBar->rcBounds.Wdt, &sText, true);
1822  minRequiredTextHeight = actualTextHeight;
1823  }
1824  else
1825  {
1826  // Otherwise, still set the minimum size to the text height (without scrollbar).
1827  // This is necessary so that e.g. Style::FitChildren works properly with pure text windows.
1828  minRequiredTextHeight = rawTextHeight;
1829  }
1830  }
1831 
1832  UpdateChildLayout(cgo, width, height);
1833 
1834  // update scroll bar
1835  // C4GUI::ScrollWindow::UpdateOwnPos();
1836 
1837  // special layout selected?
1839  UpdateLayoutGrid();
1844 
1845  // check if we need a scroll-bar
1846  int32_t topMostChild = 0;
1847  int32_t bottomMostChild = minRequiredTextHeight;
1848  for (Element * element : *this)
1849  {
1850  C4ScriptGuiWindow *child = static_cast<C4ScriptGuiWindow*>(element);
1851  const int32_t &childTop = child->rcBounds.y;
1852  const int32_t childBottom = childTop + child->rcBounds.Hgt;
1853  if (childTop < topMostChild) topMostChild = childTop;
1854  if (childBottom > bottomMostChild) bottomMostChild = childBottom;
1855  }
1856  // do we need to adjust our size to fit the child windows?
1858  {
1859  rcBounds.Hgt = bottomMostChild;
1860  }
1861  // update scroll rectangle:
1862  // (subtract one against rounding errors)
1863  bottomMostChild = std::max(bottomMostChild, rcBounds.Hgt);
1864  iClientHeight = bottomMostChild - topMostChild - 1;
1866 
1869  pScrollBar->rcBounds.y = 0;
1871  pScrollBar->Update();
1872 
1873  // never show scrollbar on non-cropping windows
1875  pScrollBar->SetVisibility(false);
1876  // The "dirty" flag is unset here. Note that it's only used for non "multiple"-style windows after startup.
1877  // The "multiple"-style windows are updated together when the root window does a full refresh.
1878  mainWindowNeedsLayoutUpdate = false;
1879  return true;
1880 }
#define C4GUI_ScrollBarWdt
Definition: C4Gui.h:103
bool IsScrollingNecessary()
Definition: C4Gui.h:993
bool UpdateChildLayout(C4TargetFacet &cgo, float parentWidth, float parentHeight)

References C4ScriptGuiWindowPropertyName::bottom, C4ScriptGuiWindowPropertyName::bottomMargin, CStdFont::BreakMessage(), C4GUI_ScrollBarWdt, C4GUI::Container::Element, C4ScriptGuiWindowStyleFlag::FitChildren, C4GraphicsResource::FontRegular, StdStrBuf::getData(), C4ScriptGuiWindowProperty::GetFloat(), C4ScriptGuiWindowProperty::GetInt(), C4ScriptGuiWindowProperty::GetStrBuf(), GraphicsResource, C4ScriptGuiWindowStyleFlag::GridLayout, C4Rect::Hgt, C4GUI::ScrollWindow::iClientHeight, C4GUI::ScrollWindow::IsScrollingNecessary(), C4ScriptGuiWindowPropertyName::left, C4ScriptGuiWindowPropertyName::leftMargin, C4ScriptGuiWindowStyleFlag::NoCrop, C4GUI::ScrollWindow::pScrollBar, C4GUI::Element::rcBounds, C4ScriptGuiWindowPropertyName::relBottom, C4ScriptGuiWindowPropertyName::relBottomMargin, C4ScriptGuiWindowPropertyName::relLeft, C4ScriptGuiWindowPropertyName::relLeftMargin, C4ScriptGuiWindowPropertyName::relRight, C4ScriptGuiWindowPropertyName::relRightMargin, C4ScriptGuiWindowPropertyName::relTop, C4ScriptGuiWindowPropertyName::relTopMargin, C4ScriptGuiWindowPropertyName::right, C4ScriptGuiWindowPropertyName::rightMargin, C4GUI::Element::SetVisibility(), C4ScriptGuiWindowPropertyName::style, C4ScriptGuiWindowPropertyName::text, C4ScriptGuiWindowStyleFlag::TightGridLayout, C4ScriptGuiWindowPropertyName::top, C4ScriptGuiWindowPropertyName::topMargin, C4GUI::ScrollBar::Update(), C4GUI::ScrollWindow::Update(), UpdateChildLayout(), UpdateLayoutGrid(), UpdateLayoutTightGrid(), UpdateLayoutVertical(), C4ScriptGuiWindowStyleFlag::VerticalLayout, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Here is the call graph for this function:

◆ UpdateLayoutGrid()

void C4ScriptGuiWindow::UpdateLayoutGrid ( )

Definition at line 1406 of file C4ScriptGuiWindow.cpp.

1407 {
1408  const int32_t &width = rcBounds.Wdt;
1409  const int32_t &height = rcBounds.Hgt;
1410 
1411  const int32_t borderX(0), borderY(0);
1412  int32_t currentX = borderX;
1413  int32_t currentY = borderY;
1414  int32_t lowestChildRelY = 0;
1415  int32_t maxChildHeight = 0;
1416 
1417  for (C4GUI::Element * element : *this)
1418  {
1419  C4ScriptGuiWindow *child = static_cast<C4ScriptGuiWindow*>(element);
1420  // calculate the space the child needs, correctly respecting the margins
1421  using namespace C4ScriptGuiWindowPropertyName;
1422  const float childLeftMargin = child->CalculateRelativeSize(width, leftMargin, relLeftMargin);
1423  const float childTopMargin = child->CalculateRelativeSize(height, topMargin, relTopMargin);
1424  const float childRightMargin = child->CalculateRelativeSize(width, rightMargin, relRightMargin);
1425  const float childBottomMargin = child->CalculateRelativeSize(height, bottomMargin, relBottomMargin);
1426 
1427  const float childWdtF = float(child->rcBounds.Wdt) + childLeftMargin + childRightMargin;
1428  const float childHgtF = float(child->rcBounds.Hgt) + childTopMargin + childBottomMargin;
1429 
1430  auto doLineBreak = [&]()
1431  {
1432  currentX = borderX;
1433  currentY += maxChildHeight + borderY;
1434  maxChildHeight = 0;
1435  };
1436 
1437  // do all the rounding after the calculations
1438  const auto childWdt = (int32_t)(childWdtF + 0.5f);
1439  const auto childHgt = (int32_t)(childHgtF + 0.5f);
1440 
1441  // Check if the child even fits in the remainder of the row
1442  const bool fitsInRow = (width - currentX) >= childWdt;
1443  if (!fitsInRow) doLineBreak();
1444 
1445  // remember the highest child to make sure rows don't overlap
1446  if (!maxChildHeight || (childHgt > maxChildHeight))
1447  {
1448  maxChildHeight = childHgt;
1449  lowestChildRelY = currentY + childHgt;
1450  }
1451  child->rcBounds.x = currentX + static_cast<int32_t>(childLeftMargin);
1452  child->rcBounds.y = currentY + static_cast<int32_t>(childTopMargin);
1453 
1454  currentX += childWdt + borderX;
1455  }
1456 
1457  // do we need a scroll bar?
1458  EnableScrollBar(lowestChildRelY > height, lowestChildRelY);
1459 }
float CalculateRelativeSize(float parentWidthOrHeight, C4ScriptGuiWindowPropertyName::type absoluteProperty, C4ScriptGuiWindowPropertyName::type relativeProperty)

References C4ScriptGuiWindowPropertyName::bottomMargin, CalculateRelativeSize(), C4Rect::Hgt, C4ScriptGuiWindowPropertyName::leftMargin, C4GUI::Element::rcBounds, C4ScriptGuiWindowPropertyName::relBottomMargin, C4ScriptGuiWindowPropertyName::relLeftMargin, C4ScriptGuiWindowPropertyName::relRightMargin, C4ScriptGuiWindowPropertyName::relTopMargin, C4ScriptGuiWindowPropertyName::rightMargin, C4ScriptGuiWindowPropertyName::topMargin, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by UpdateLayout().

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

◆ UpdateLayoutTightGrid()

void C4ScriptGuiWindow::UpdateLayoutTightGrid ( )

Definition at line 1463 of file C4ScriptGuiWindow.cpp.

1464 {
1465  const int32_t &width = rcBounds.Wdt;
1466  const int32_t &height = rcBounds.Hgt;
1467  const int32_t borderX(0), borderY(0);
1468  int32_t lowestChildRelY = 0;
1469 
1470  std::list<C4ScriptGuiWindow*> alreadyPlacedChildren;
1471 
1472  for (C4GUI::Element * element : *this)
1473  {
1474  C4ScriptGuiWindow *child = static_cast<C4ScriptGuiWindow*>(element);
1475  // calculate the space the child needs, correctly respecting the margins
1476  using namespace C4ScriptGuiWindowPropertyName;
1477  const float childLeftMargin = child->CalculateRelativeSize(width, leftMargin, relLeftMargin);
1478  const float childTopMargin = child->CalculateRelativeSize(height, topMargin, relTopMargin);
1479  const float childRightMargin = child->CalculateRelativeSize(width, rightMargin, relRightMargin);
1480  const float childBottomMargin = child->CalculateRelativeSize(height, bottomMargin, relBottomMargin);
1481 
1482  const float childWdtF = float(child->rcBounds.Wdt) + childLeftMargin + childRightMargin;
1483  const float childHgtF = float(child->rcBounds.Hgt) + childTopMargin + childBottomMargin;
1484 
1485  // do all the rounding after the calculations
1486  const auto childWdt = (int32_t)(childWdtF + 0.5f);
1487  const auto childHgt = (int32_t)(childHgtF + 0.5f);
1488 
1489  // Look for a free spot.
1490  int32_t currentX = borderX;
1491  int32_t currentY = borderY;
1492 
1493  bool hadOverlap = false;
1494  int overlapRepeats = 0;
1495  do
1496  {
1497  auto overlapsWithOther = [&currentX, &currentY, &childWdt, &childHgt](C4ScriptGuiWindow *other)
1498  {
1499  if (currentX + childWdt <= other->rcBounds.x) return false;
1500  if (currentY + childHgt <= other->rcBounds.y) return false;
1501  if (currentX >= other->rcBounds.GetRight()) return false;
1502  if (currentY >= other->rcBounds.GetBottom()) return false;
1503  return true;
1504  };
1505 
1506  int32_t currentMinY = 0;
1507  hadOverlap = false;
1508  for (auto &other : alreadyPlacedChildren)
1509  {
1510  // Check if the other element is not yet above the new child.
1511  if ((other->rcBounds.GetBottom() > currentY) && other->rcBounds.Hgt > 0)
1512  {
1513  if (currentMinY == 0 || (other->rcBounds.GetBottom() < currentMinY))
1514  currentMinY = other->rcBounds.GetBottom();
1515  }
1516  // If overlapping, we must advance.
1517  if (overlapsWithOther(other))
1518  {
1519  hadOverlap = true;
1520  currentX = other->rcBounds.GetRight();
1521  // Break line if the element doesn't fit anymore.
1522  if (currentX + childWdt > width)
1523  {
1524  currentX = borderX;
1525  // Start forcing change once we start repeating the check. Otherwise, there might
1526  // be a composition of children that lead to infinite loop. The worst-case number
1527  // of sensible checks might O(N^2) be with a really unfortunate children list.
1528  const int32_t forcedMinimalChange = (overlapRepeats > alreadyPlacedChildren.size()) ? 1 : 0;
1529  currentY = std::max(currentY + forcedMinimalChange, currentMinY);
1530  }
1531  }
1532  }
1533  overlapRepeats += 1;
1534  } while (hadOverlap);
1535 
1536  alreadyPlacedChildren.push_back(child);
1537 
1538  lowestChildRelY = std::max(lowestChildRelY, currentY + childHgt);
1539  child->rcBounds.x = currentX + static_cast<int32_t>(childLeftMargin);
1540  child->rcBounds.y = currentY + static_cast<int32_t>(childTopMargin);
1541  }
1542 
1543  // do we need a scroll bar?
1544  EnableScrollBar(lowestChildRelY > height, lowestChildRelY);
1545 }

References C4ScriptGuiWindowPropertyName::bottomMargin, CalculateRelativeSize(), C4Rect::Hgt, C4ScriptGuiWindowPropertyName::leftMargin, C4GUI::Element::rcBounds, C4ScriptGuiWindowPropertyName::relBottomMargin, C4ScriptGuiWindowPropertyName::relLeftMargin, C4ScriptGuiWindowPropertyName::relRightMargin, C4ScriptGuiWindowPropertyName::relTopMargin, C4ScriptGuiWindowPropertyName::rightMargin, C4ScriptGuiWindowPropertyName::topMargin, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by UpdateLayout().

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

◆ UpdateLayoutVertical()

void C4ScriptGuiWindow::UpdateLayoutVertical ( )

Definition at line 1547 of file C4ScriptGuiWindow.cpp.

1548 {
1549  const int32_t borderY(0);
1550  int32_t currentY = borderY;
1551 
1552  for (C4GUI::Element * element : *this)
1553  {
1554  C4ScriptGuiWindow *child = static_cast<C4ScriptGuiWindow*>(element);
1555 
1556  // Do the calculations in floats first to not lose accuracy.
1557  // Take the height of the child and then add the margins.
1558  using namespace C4ScriptGuiWindowPropertyName;
1559  const float childTopMargin = child->CalculateRelativeSize(rcBounds.Hgt, topMargin, relTopMargin);
1560  const float childBottomMargin = child->CalculateRelativeSize(rcBounds.Hgt, bottomMargin, relBottomMargin);
1561 
1562  const float childHgtF = float(child->rcBounds.Hgt) + childTopMargin + childBottomMargin;
1563  const int32_t childHgt = (int32_t)(childHgtF + 0.5f);
1564 
1565  child->rcBounds.y = currentY + childTopMargin;
1566  currentY += childHgt + borderY;
1567  }
1568 
1569  // do we need a scroll bar?
1570  EnableScrollBar(currentY > rcBounds.Hgt, currentY);
1571 }

References C4ScriptGuiWindowPropertyName::bottomMargin, CalculateRelativeSize(), C4Rect::Hgt, C4GUI::Element::rcBounds, C4ScriptGuiWindowPropertyName::relBottomMargin, C4ScriptGuiWindowPropertyName::relTopMargin, C4ScriptGuiWindowPropertyName::topMargin, and C4Rect::y.

Referenced by UpdateLayout().

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

◆ UpdateOwnPos()

void C4GUI::ScrollWindow::UpdateOwnPos ( )
overridevirtualinherited

Reimplemented from C4GUI::Window.

Definition at line 614 of file C4GuiContainers.cpp.

615  {
616  if (!GetParent()) { Update(); return; }
617  // place within client rect
618  C4Rect rtBounds = GetParent()->GetContainedClientRect();
619  rtBounds.x = rtBounds.y = 0;
620  if (fHasBar) rtBounds.Wdt -= C4GUI_ScrollBarWdt;
621  if (GetBounds() != rtBounds)
622  {
623  SetBounds(rtBounds);
624  // scroll bar
625  if (fHasBar)
626  {
627  rtBounds.x += rtBounds.Wdt; rtBounds.Wdt = C4GUI_ScrollBarWdt;
628  pScrollBar->SetBounds(rtBounds);
629  }
630  }
631  // standard updates
632  Update();
633  }
void SetBounds(const C4Rect &rcNewBound)
Definition: C4Gui.h:446

References C4GUI_ScrollBarWdt, C4GUI::ScrollWindow::fHasBar, C4GUI::Element::GetBounds(), C4GUI::Element::GetContainedClientRect(), C4GUI::Element::GetParent(), C4GUI::ScrollWindow::pScrollBar, C4GUI::Element::SetBounds(), C4GUI::ScrollWindow::Update(), C4Rect::Wdt, C4Rect::x, and C4Rect::y.

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

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

◆ UpdatePos()

void C4GUI::Element::UpdatePos ( )
protectedvirtualinherited

Reimplemented in C4GUI::Dialog.

Definition at line 193 of file C4Gui.cpp.

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

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

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

◆ UpdateSize()

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.

186  {
187  // update own fields
188  UpdateOwnPos();
189  // notify container
190  if (pParent) pParent->ElementSizeChanged(this);
191  }

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

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

Friends And Related Function Documentation

◆ C4ScriptGuiWindowAction

friend class C4ScriptGuiWindowAction
friend

Definition at line 181 of file C4ScriptGuiWindow.h.

◆ C4ScriptGuiWindowScrollBar

friend class C4ScriptGuiWindowScrollBar
friend

Definition at line 182 of file C4ScriptGuiWindow.h.

Member Data Documentation

◆ currentMouseState

int32_t C4ScriptGuiWindow::currentMouseState

◆ fDragging

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

Definition at line 380 of file C4Gui.h.

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

◆ fHasBar

◆ fVisible

◆ iClientHeight

int32_t C4GUI::ScrollWindow::iClientHeight
protectedinherited

◆ iDragX

int32_t C4GUI::Element::iDragX
protectedinherited

Definition at line 379 of file C4Gui.h.

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

◆ iDragY

int32_t C4GUI::Element::iDragY
protectedinherited

Definition at line 379 of file C4Gui.h.

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

◆ iFrozen

int32_t C4GUI::ScrollWindow::iFrozen
protectedinherited

◆ iScrollY

◆ pContextHandler

ContextHandler* C4GUI::Element::pContextHandler {nullptr}
protectedinherited

◆ pDragTarget

Window* C4GUI::Element::pDragTarget {nullptr}
protectedinherited

◆ pFirst

◆ pLast

◆ pNext

◆ pParent

◆ pPrev

◆ pScrollBar

◆ rcBounds

C4Rect C4GUI::Element::rcBounds
protectedinherited

Definition at line 385 of file C4Gui.h.

Referenced by C4Chart::C4Chart(), C4GameOptionButtons::C4GameOptionButtons(), C4GoalDisplay::C4GoalDisplay(), C4StartupMainDlg::C4StartupMainDlg(), C4StartupScenSelDlg::C4StartupScenSelDlg(), C4GUI::Element::ClientPos2ScreenPos(), C4GUI::ContextMenu::ContextMenu(), C4GUI::Dialog::CreateConsoleWindow(), C4GUI::ContextMenu::CtxMouseInput(), C4FileSelDlg::DefaultListItem::DefaultListItem(), C4GUI::Dialog::Dialog(), C4GUI::Element::DoContext(), C4GUI::Element::DoDragging(), C4ScoreboardDlg::DoPlacement(), C4GUI::Dialog::Draw(), Draw(), C4GUI::Element::Draw3DFrame(), C4GUI::Element::DrawBar(), DrawChildren(), C4GUI::Label::DrawElement(), C4GUI::WoodenLabel::DrawElement(), C4GUI::MultilineLabel::DrawElement(), C4GUI::ProgressBar::DrawElement(), C4GUI::HorizontalLine::DrawElement(), C4GUI::Picture::DrawElement(), C4GUI::OverlayPicture::DrawElement(), C4GUI::ScrollBar::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::Dialog::DrawElement(), C4MenuItem::DrawElement(), C4Menu::DrawElement(), C4StartupMainDlg::DrawElement(), C4StartupNetListEntry::DrawElement(), C4StartupPlrPropertiesDlg::DrawElement(), C4Chart::DrawElement(), C4GUI::Element::DrawHBarByVGfx(), C4GUI::Element::DrawHVBar(), C4GUI::Element::DrawVBar(), C4GUI::Element::Element(), C4GUI::ContextMenu::Entry::Entry(), C4GUI::Element::GetBounds(), C4GUI::Element::GetClientRect(), GetClippingRect(), C4GUI::Element::GetHeight(), C4GUI::WoodenLabel::GetLeftIndent(), C4GUI::Tabular::GetMarginBottom(), C4GUI::Tabular::GetMarginLeft(), C4GUI::Tabular::GetMarginRight(), C4GUI::Tabular::GetMarginTop(), C4StartupPlrSelDlg::GetMarginTop(), C4StartupScenSelDlg::GetMarginTop(), C4GUI::Element::GetWidth(), C4GUI::ScrollBar::HasPin(), C4Menu::InitLocation(), C4Menu::InitSize(), C4GUI::ScrollWindow::IsScrollingNecessary(), C4GUI::Label::Label(), C4GUI::LabeledEdit::LabeledEdit(), C4GUI::Window::MouseInput(), C4GUI::CheckBox::MouseInput(), C4GUI::Tabular::MouseInput(), C4GUI::ContextMenu::MouseInput(), MouseInput(), C4GUI::Screen::MouseInput(), C4GUI::MultilineLabel::MultilineLabel(), C4ChatControl::ChatSheet::NickItem::NickItem(), OnMouseIn(), C4GUI::ContextMenu::Open(), C4GUI::Picture::Picture(), ProcessMouseInput(), C4GUI::ProgressBar::ProgressBar(), C4GUI::Screen::Render(), C4GameLobby::ScenDesc::ScenDesc(), C4GUI::Element::ScreenPos2ClientPos(), C4GUI::ScrollBar::ScrollBar(), C4GUI::Element::SetBounds(), C4GUI::Dialog::SetClientSize(), C4GUI::Tabular::SetGfx(), C4GUI::Window::SetPos(), C4GUI::Label::SetText(), C4GUI::Dialog::SetTitle(), C4GUI::Label::SetX0(), C4GUI::Tabular::Sheet::Sheet(), C4GUI::ScrollWindow::Update(), C4ScoreboardDlg::Update(), C4GUI::MultilineLabel::UpdateHeight(), UpdateLayout(), UpdateLayoutGrid(), UpdateLayoutTightGrid(), UpdateLayoutVertical(), C4GUI::Label::UpdateOwnPos(), C4GUI::Window::UpdateOwnPos(), C4GUI::Dialog::UpdatePos(), C4GUI::MultilineLabel::UpdateSize(), C4GUI::Dialog::UpdateSize(), and C4GUI::WoodenLabel::WoodenLabel().

◆ rcClientRect

◆ standardHeight

const float C4ScriptGuiWindow::standardHeight = 31.0f
static

Definition at line 186 of file C4ScriptGuiWindow.h.

Referenced by UpdateLayout().

◆ standardWidth

const float C4ScriptGuiWindow::standardWidth = 50.0f
static

Definition at line 185 of file C4ScriptGuiWindow.h.

Referenced by UpdateLayout().


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