OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4ObjectMenu Class Reference

#include <C4ObjectMenu.h>

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

Public Types

enum  CallbackType { CB_None =0, CB_Object, CB_Scenario }
 

Public Member Functions

 C4ObjectMenu ()
 
void Default () override
 
void SetRefillObject (C4Object *pObj)
 
void ClearPointers (C4Object *pObj)
 
bool Init (C4FacetSurface &fctSymbol, const char *szEmpty, C4Object *pObject, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal, bool fUserMenu=false)
 
bool InitRefSym (const C4TargetFacet &fctSymbol, const char *szEmpty, C4Object *pObject, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal, bool fUserMenu=false)
 
void Execute ()
 
C4ObjectGetParentObject () override
 
bool IsCloseQuerying () const
 
void Clear ()
 
bool Refill ()
 
void SetPermanent (bool fPermanent)
 
void SetAlignment (int32_t iAlignment)
 
int32_t GetIdentification ()
 
int32_t GetItemCount ()
 
int32_t GetPosition ()
 
int32_t GetSelection ()
 
bool IsContextMenu ()
 
int GetSymbolSize ()
 
int32_t GetItemHeight ()
 
C4MenuItemGetSelectedItem ()
 
C4MenuItemGetItem (int32_t iIndex)
 
bool MoveSelection (int32_t iBy, bool fAdjustPosition, bool fDoCalls)
 
bool SetSelection (int32_t iSelection, bool fAdjustPosition, bool fDoCalls)
 
bool SetPosition (int32_t iPosition)
 
void SetSize (int32_t iToWdt, int32_t iToHgt)
 
bool Enter (bool fRight=false)
 
bool IsActive ()
 
bool IsActive (bool fForKeyboard)
 
bool Control (BYTE byCom, int32_t iData)
 
bool KeyControl (BYTE byCom)
 
bool AddRefSym (const char *szCaption, const C4Facet &fctSymbol, const char *szCommand, int32_t iCount=C4MN_Item_NoCount, C4Object *pObject=nullptr, const char *szInfoCaption=nullptr, C4ID idID=C4ID::None, const char *szCommand2=nullptr, bool fOwnValue=false, int32_t iValue=0, bool fIsSelectable=true)
 
bool Add (const char *szCaption, C4FacetSurface &fctSymbol, const char *szCommand, int32_t iCount=C4MN_Item_NoCount, C4Object *pObject=nullptr, const char *szInfoCaption=nullptr, C4ID idID=C4ID::None, const char *szCommand2=nullptr, bool fOwnValue=false, int32_t iValue=0, bool fIsSelectable=true)
 
bool Add (const char *szCaption, C4Object *pGfxObj, const char *szCommand, int32_t iCount=C4MN_Item_NoCount, C4Object *pObject=nullptr, const char *szInfoCaption=nullptr, C4ID idID=C4ID::None, const char *szCommand2=nullptr, bool fOwnValue=false, int32_t iValue=0, bool fIsSelectable=true)
 
bool Add (const char *szCaption, C4DefGraphics *pGfx, const char *szCommand, int32_t iCount=C4MN_Item_NoCount, C4Object *pObject=nullptr, const char *szInfoCaption=nullptr, C4ID idID=C4ID::None, const char *szCommand2=nullptr, bool fOwnValue=false, int32_t iValue=0, bool fIsSelectable=true)
 
void ClearItems ()
 
void ResetLocation ()
 
bool SetLocation (int32_t iX, int32_t iY)
 
bool SetTextProgress (int32_t iToProgress, bool fAdd)
 
void SetEqualItemHeight (bool fToVal)
 
bool TryClose (bool fOK, bool fControl)
 
void SetCloseCommand (const char *strCommand)
 
bool IsTextProgressing () const
 
void OnUserClose (C4GUI::Control *btn)
 
void RemoveElement (Element *pChild) override
 
bool IsComponentOutsideClientArea () override
 
void ApplyElementOffset (int32_t &riX, int32_t &riY) override
 
void ApplyInvElementOffset (int32_t &riX, int32_t &riY) override
 
bool IsFocused (Control *pCtrl) override
 
void SetFocus (Control *pCtrl, bool fByMouse)
 
ControlGetFocus ()
 
DialogGetDlg () override
 
DialogWindow * GetDialogWindow () override
 
virtual bool CharIn (const char *c)
 
void MouseInput (CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override
 
virtual class ControlGetDefaultControl ()
 
virtual bool OnEnter ()
 
bool KeyEnter ()
 
virtual bool OnEscape ()
 
bool KeyEscape ()
 
void AdvanceFocus (bool fBackwards)
 
bool KeyAdvanceFocus (bool fBackwards)
 
int32_t GetMarginTop () override
 
bool IsShown ()
 
bool IsOK ()
 
bool IsAborted ()
 
bool IsFading ()
 
virtual bool IsFullscreenDialog ()
 
virtual bool HasBackground ()
 
virtual bool IsFreePlaceDialog ()
 
virtual bool IsBottomPlacementDialog ()
 
virtual bool IsExclusiveDialog ()
 
bool IsViewportDialog ()
 
virtual bool DoPlacement (Screen *pOnScreen, const C4Rect &rPreferredDlgRect)
 
bool Show (Screen *pOnScreen, bool fCB)
 
void Close (bool fOK)
 
bool FadeIn (Screen *pOnScreen)
 
void FadeOut (bool fCloseWithOK)
 
bool DoModal ()
 
bool Execute2 ()
 
void SetDelOnClose (bool fToVal=true)
 
void SetTitle (const char *szToTitle, bool fShowCloseButton=true)
 
void SetFrameDeco (FrameDecoration *pNewDeco)
 
void ClearFrameDeco ()
 
FrameDecoration * GetFrameDecoration () const
 
void SetClientSize (int32_t iToWdt, int32_t iToHgt)
 
virtual void OnClosed (bool fOK)
 
virtual void OnShown ()
 
virtual void OnIdle ()
 
ContextHandler * GetContextHandler () override
 
void SetPos (int32_t iXPos, int32_t iYPos)
 
C4RectGetClientRect () override
 
void ClearChildren ()
 
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 IsSelectedChild (Element *pChild)
 
bool IsParentOf (Element *pEl) override
 
virtual void MouseEnter (CMouse &rMouse)
 
virtual void MouseLeave (CMouse &rMouse)
 
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 ScreenGetScreen ()
 
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)
 

Static Public Member Functions

static int32_t GetDefaultTitleHeight ()
 

Public Attributes

bool fVisible {true}
 

Protected Member Functions

void LocalInit (C4Object *pObject, bool fUserMenu)
 
bool MenuCommand (const char *szCommand, bool fIsCloseCommand) override
 
bool DoRefillInternal (bool &rfRefilled) override
 
void OnSelectionChanged (int32_t iNewSelection) override
 
bool IsCloseDenied () override
 
bool IsReadOnly () override
 
void OnUserSelectItem (int32_t Player, int32_t iIndex) override
 
void OnUserEnter (int32_t Player, int32_t iIndex, bool fRight) override
 
void OnUserClose () override
 
int32_t GetControllingPlayer () override
 
bool DoInitRefSym (const C4Facet &fctSymbol, const char *szEmpty, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal)
 
bool DoInit (C4FacetSurface &fctSymbol, const char *szEmpty, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal)
 
void DrawBuffer (C4Facet &cgo)
 
void AdjustSelection ()
 
void AdjustPosition ()
 
bool CheckBuffer ()
 
bool RefillInternal ()
 
void DrawButton (C4Facet &cgo)
 
void DrawScrollbar (C4Facet &cgo, int32_t iTotal, int32_t iVisible, int32_t iPosition)
 
void DrawFrame (C4Surface *sfcSurface, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt)
 
void InitLocation (C4Facet &cgo)
 
void InitSize ()
 
void UpdateScrollBar ()
 
void UserSelectItem (int32_t Player, C4MenuItem *pItem)
 
void UserEnter (int32_t Player, C4MenuItem *pItem, bool fRight)
 
bool HasMouse ()
 
const char * GetID () override
 
bool HasPortrait ()
 
C4ViewportGetViewport () override
 
bool IsExternalDrawDialog () override
 
bool IsMouseControlled () override
 
void UpdateOwnPos () override
 
void UpdateElementPositions ()
 
int32_t GetZOrdering () override
 
void Draw (C4TargetFacet &cgo) override
 
void DrawElement (C4TargetFacet &cgo) override
 
bool IsOwnPtrElement () override
 
void UserClose (bool fOK) override
 
int32_t GetMarginBottom () override
 
int32_t GetMarginLeft () override
 
int32_t GetMarginRight () override
 
bool CreateConsoleWindow ()
 
void DestroyConsoleWindow ()
 
void UpdateSize () override
 
void UpdatePos () override
 
virtual void ElementSizeChanged (Element *pOfElement)
 
virtual void ElementPosChanged (Element *pOfElement)
 
virtual void AfterElementRemoval ()
 
bool OnHotkey (uint32_t cHotkey) override
 
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 IsMenu ()
 
virtual bool CheckNameHotkey (const char *)
 

Protected Attributes

C4ObjectObject
 
C4ObjectParentObject
 
C4ObjectRefillObject
 
int32_t RefillObjectContentsCount
 
CallbackType eCallbackType
 
bool UserMenu
 
bool CloseQuerying
 
bool LocationSet
 
bool Permanent
 
bool NeedRefill
 
int32_t Style
 
int32_t Selection
 
int32_t TimeOnSelection
 
int32_t ItemCount
 
int32_t ItemWidth
 
int32_t ItemHeight
 
int32_t Extra
 
int32_t ExtraData
 
int32_t Identification
 
int32_t Columns
 
int32_t Lines
 
int32_t Alignment
 
int32_t VisibleCount
 
StdStrBuf CloseCommand
 
char Caption [C4MaxTitle+1]
 
C4FacetSurface Symbol
 
C4GUI::ScrollWindowpClientWindow
 
bool fHasPortrait
 
bool fTextProgressing
 
bool fEqualIconItemHeight
 
bool fActive
 
WoodenLabel * pTitle
 
CallbackButton< Dialog,
C4GUI::IconButton > * 
pCloseBtn
 
ControlpActiveCtrl
 
bool fShow
 
bool fOK
 
int32_t iFade
 
Fade eFade
 
bool fDelOnClose
 
StdStrBuf TitleString
 
bool fViewportDlg
 
DialogWindow * pWindow
 
FrameDecoration * pFrameDeco
 
C4Rect rcClientRect
 
ElementpFirst
 
ElementpLast
 
ContainerpParent {nullptr}
 
ElementpPrev
 
ElementpNext
 
WindowpDragTarget {nullptr}
 
int32_t iDragX
 
int32_t iDragY
 
bool fDragging {false}
 
ContextHandler * pContextHandler {nullptr}
 
C4Rect rcBounds
 

Detailed Description

Definition at line 47 of file C4ObjectMenu.h.

Member Enumeration Documentation

Enumerator
CB_None 
CB_Object 
CB_Scenario 

Definition at line 54 of file C4ObjectMenu.h.

Constructor & Destructor Documentation

C4ObjectMenu::C4ObjectMenu ( )

Definition at line 37 of file C4ObjectMenu.cpp.

References Default().

37  : C4Menu()
38 {
39  Default();
40 }
C4Menu()
Definition: C4Menu.cpp:237
void Default() override

Here is the call graph for this function:

Member Function Documentation

bool C4Menu::Add ( const char *  szCaption,
C4FacetSurface fctSymbol,
const char *  szCommand,
int32_t  iCount = C4MN_Item_NoCount,
C4Object pObject = nullptr,
const char *  szInfoCaption = nullptr,
C4ID  idID = C4ID::None,
const char *  szCommand2 = nullptr,
bool  fOwnValue = false,
int32_t  iValue = 0,
bool  fIsSelectable = true 
)
inherited

Definition at line 350 of file C4Menu.cpp.

References C4Menu::C4MenuItem, C4MenuItem::GrabSymbol(), C4Menu::IsActive(), C4Menu::ItemCount, and C4Menu::Style.

Referenced by C4MainMenu::ActivateClient(), C4MainMenu::ActivateGoals(), C4Object::ActivateMenu(), C4MainMenu::ActivateNewPlayer(), C4MainMenu::ActivateRules(), C4MainMenu::ActivateSurrender(), C4MainMenu::DoRefillInternal(), and DoRefillInternal().

353 {
354  if (!IsActive()) return false;
355  // Create new menu item
356  C4MenuItem *pNew = new C4MenuItem(this, ItemCount, szCaption,szCommand,iCount,pObject,szInfoCaption,idID,szCommand2,fOwnValue,iValue,Style,fIsSelectable);
357  // Set Symbol
358  pNew->GrabSymbol(fctSymbol);
359  // Add
360  return AddItem(pNew, szCaption, szCommand, iCount, pObject, szInfoCaption, idID, szCommand2, fOwnValue, iValue, fIsSelectable);
361 }
friend class C4MenuItem
Definition: C4Menu.h:263
int32_t Style
Definition: C4Menu.h:136
int32_t ItemCount
Definition: C4Menu.h:138
bool IsActive()
Definition: C4Menu.cpp:480
void GrabSymbol(C4FacetSurface &fctSymbol)
Definition: C4Menu.h:102

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Menu::Add ( const char *  szCaption,
C4Object pGfxObj,
const char *  szCommand,
int32_t  iCount = C4MN_Item_NoCount,
C4Object pObject = nullptr,
const char *  szInfoCaption = nullptr,
C4ID  idID = C4ID::None,
const char *  szCommand2 = nullptr,
bool  fOwnValue = false,
int32_t  iValue = 0,
bool  fIsSelectable = true 
)
inherited

Definition at line 363 of file C4Menu.cpp.

References C4Menu::C4MenuItem, C4Menu::IsActive(), C4Menu::ItemCount, C4MenuItem::SetGraphics(), and C4Menu::Style.

366 {
367  if (!IsActive()) return false;
368  // Create new menu item
369  C4MenuItem *pNew = new C4MenuItem(this, ItemCount, szCaption,szCommand,iCount,pObject,szInfoCaption,idID,szCommand2,fOwnValue,iValue,Style,fIsSelectable);
370  // Set Symbol
371  pNew->SetGraphics(pGfxObj);
372  // Add
373  return AddItem(pNew, szCaption, szCommand, iCount, pObject, szInfoCaption, idID, szCommand2, fOwnValue, iValue, fIsSelectable);
374 }
friend class C4MenuItem
Definition: C4Menu.h:263
int32_t Style
Definition: C4Menu.h:136
int32_t ItemCount
Definition: C4Menu.h:138
void SetGraphics(C4Object *pObj)
Definition: C4Menu.h:103
bool IsActive()
Definition: C4Menu.cpp:480

Here is the call graph for this function:

bool C4Menu::Add ( const char *  szCaption,
C4DefGraphics pGfx,
const char *  szCommand,
int32_t  iCount = C4MN_Item_NoCount,
C4Object pObject = nullptr,
const char *  szInfoCaption = nullptr,
C4ID  idID = C4ID::None,
const char *  szCommand2 = nullptr,
bool  fOwnValue = false,
int32_t  iValue = 0,
bool  fIsSelectable = true 
)
inherited

Definition at line 376 of file C4Menu.cpp.

References C4Menu::C4MenuItem, C4Menu::IsActive(), C4Menu::ItemCount, C4MenuItem::SetGraphics(), and C4Menu::Style.

379 {
380  if (!IsActive()) return false;
381  // Create new menu item
382  C4MenuItem *pNew = new C4MenuItem(this, ItemCount, szCaption,szCommand,iCount,pObject,szInfoCaption,idID,szCommand2,fOwnValue,iValue,Style,fIsSelectable);
383  // Set Symbol
384  pNew->SetGraphics(pGfx);
385  // Add
386  return AddItem(pNew, szCaption, szCommand, iCount, pObject, szInfoCaption, idID, szCommand2, fOwnValue, iValue, fIsSelectable);
387 }
friend class C4MenuItem
Definition: C4Menu.h:263
int32_t Style
Definition: C4Menu.h:136
int32_t ItemCount
Definition: C4Menu.h:138
void SetGraphics(C4Object *pObj)
Definition: C4Menu.h:103
bool IsActive()
Definition: C4Menu.cpp:480

Here is the call graph for this function:

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

Definition at line 118 of file C4GuiContainers.cpp.

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(), C4StartupMainDlg::C4StartupMainDlg(), 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(), C4GameLobby::ScenDesc::ScenDesc(), C4StartupScenSelDlg::ScenListItem::ScenListItem(), C4GUI::ScrollWindow::ScrollWindow(), C4GUI::InputDialog::SetCustomEdit(), C4GoalDisplay::SetGoals(), C4GUI::Dialog::SetTitle(), C4GUI::FullscreenDialog::SetTitle(), and C4GUI::TextWindow::TextWindow().

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 * pLast
Definition: C4Gui.h:750
Element * pFirst
Definition: C4Gui.h:750
Element * pPrev
Definition: C4Gui.h:377
Container * pParent
Definition: C4Gui.h:376
Element * pNext
Definition: C4Gui.h:377

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Menu::AddRefSym ( const char *  szCaption,
const C4Facet fctSymbol,
const char *  szCommand,
int32_t  iCount = C4MN_Item_NoCount,
C4Object pObject = nullptr,
const char *  szInfoCaption = nullptr,
C4ID  idID = C4ID::None,
const char *  szCommand2 = nullptr,
bool  fOwnValue = false,
int32_t  iValue = 0,
bool  fIsSelectable = true 
)
inherited

Definition at line 337 of file C4Menu.cpp.

References C4Menu::C4MenuItem, C4Menu::IsActive(), C4Menu::ItemCount, C4MenuItem::RefSymbol(), and C4Menu::Style.

Referenced by C4MainMenu::ActivateDisplay(), C4MainMenu::ActivateHost(), C4MainMenu::ActivateMain(), C4MainMenu::ActivateOptions(), C4MainMenu::ActivateSavegame(), and C4MainMenu::DoRefillInternal().

340 {
341  if (!IsActive()) return false;
342  // Create new menu item
343  C4MenuItem *pNew = new C4MenuItem(this, ItemCount, szCaption,szCommand,iCount,pObject,szInfoCaption,idID,szCommand2,fOwnValue,iValue,Style,fIsSelectable);
344  // Ref Symbol
345  pNew->RefSymbol(fctSymbol);
346  // Add
347  return AddItem(pNew, szCaption, szCommand, iCount, pObject, szInfoCaption, idID, szCommand2, fOwnValue, iValue, fIsSelectable);
348 }
friend class C4MenuItem
Definition: C4Menu.h:263
int32_t Style
Definition: C4Menu.h:136
int32_t ItemCount
Definition: C4Menu.h:138
void RefSymbol(const C4Facet &fctSymbol)
Definition: C4Menu.h:105
bool IsActive()
Definition: C4Menu.cpp:480

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Menu::AdjustPosition ( )
protectedinherited

Definition at line 588 of file C4Menu.cpp.

References C4Menu::Columns, C4GUI::Element::GetBounds(), C4Menu::GetSelectedItem(), C4Rect::Hgt, C4Menu::Lines, C4Menu::pClientWindow, C4GUI::ScrollWindow::ScrollRangeInView(), and C4Rect::y.

Referenced by C4Menu::InitLocation(), and C4Menu::SetSelection().

589 {
590  // Adjust position by selection (works only after InitLocation)
591  if ((Lines > 1) && Columns)
592  {
593  C4MenuItem *pSel = GetSelectedItem();
594  if (pSel)
596  }
597 }
C4GUI::ScrollWindow * pClientWindow
Definition: C4Menu.h:149
int32_t y
Definition: C4Rect.h:30
C4MenuItem * GetSelectedItem()
Definition: C4Menu.cpp:583
C4Rect & GetBounds()
Definition: C4Gui.h:445
int32_t Columns
Definition: C4Menu.h:142
int32_t Hgt
Definition: C4Rect.h:30
void ScrollRangeInView(int32_t iY, int32_t iHgt)
int32_t Lines
Definition: C4Menu.h:143

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Menu::AdjustSelection ( )
protectedinherited

Definition at line 925 of file C4Menu.cpp.

References C4Menu::GetItem(), C4MenuItem::IsSelectable, C4Menu::Selection, and C4Menu::SetSelection().

Referenced by C4Menu::RefillInternal().

926 {
927  // selection valid?
928  C4MenuItem *pSelection = GetItem(Selection);
929  int iSel = Selection;
930  if (!pSelection || !pSelection->IsSelectable)
931  {
932  // set to new first valid selection: Downwards first
933  iSel = Selection;
934  while (--iSel>=0)
935  if ((pSelection = GetItem(iSel)))
936  if (pSelection->IsSelectable)
937  break;
938  // no success: upwards then
939  if (iSel<0)
940  for (iSel=Selection+1; (pSelection = GetItem(iSel)); ++iSel)
941  if (pSelection->IsSelectable)
942  break;
943  }
944  // set it then
945  if (!pSelection)
946  SetSelection(-1, Selection >= 0, false);
947  else
948  SetSelection(iSel, iSel != Selection, true);
949 }
int32_t Selection
Definition: C4Menu.h:137
bool SetSelection(int32_t iSelection, bool fAdjustPosition, bool fDoCalls)
Definition: C4Menu.cpp:544
bool IsSelectable
Definition: C4Menu.h:88
C4MenuItem * GetItem(int32_t iIndex)
Definition: C4Menu.cpp:512

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Dialog::AdvanceFocus ( bool  fBackwards)
inherited

Definition at line 580 of file C4GuiDialogs.cpp.

References C4GUI::Container::GetNextNestedElement(), C4GUI::Element::GetParent(), C4GUI::Element::IsFocusElement(), C4GUI::Container::IsSelectedChild(), C4GUI::Element::IsVisible(), C4GUI::Dialog::pActiveCtrl, and C4GUI::Dialog::SetFocus().

Referenced by C4GUI::Control::DisableFocus(), C4GUI::Dialog::KeyAdvanceFocus(), and C4ChatControl::OnLoginDataEnter().

581  {
582  // get element to start from
583  Element *pCurrElement = pActiveCtrl;
584  // find new control
585  for (;;)
586  {
587  // get next element
588  pCurrElement = GetNextNestedElement(pCurrElement, fBackwards);
589  // end reached: start from beginning
590  if (!pCurrElement && pActiveCtrl) if (!(pCurrElement = GetNextNestedElement(nullptr, fBackwards))) return;
591  // cycled?
592  if (pCurrElement == pActiveCtrl)
593  {
594  // but current is no longer a focus element? Then defocus it and return
595  if (pCurrElement && !pCurrElement->IsFocusElement())
596  SetFocus(nullptr, false);
597  return;
598  }
599  // for list elements, check whether the child can be selected
600  if (pCurrElement->GetParent() && !pCurrElement->GetParent()->IsSelectedChild(pCurrElement)) continue;
601  // check if this is a new control
602  Control *pFocusCtrl = pCurrElement->IsFocusElement();
603  if (pFocusCtrl && pFocusCtrl != pActiveCtrl && pFocusCtrl->IsVisible())
604  {
605  // set focus here...
606  SetFocus(pFocusCtrl, false);
607  // ...done!
608  return;
609  }
610  }
611  // never reached
612  }
bool IsVisible()
Definition: C4Gui.cpp:201
Control * pActiveCtrl
Definition: C4Gui.h:2080
C4GameControl Control
void SetFocus(Control *pCtrl, bool fByMouse)
Element * GetNextNestedElement(Element *pPrevElement, bool fBackwards)

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented in C4GUI::ListBox.

Definition at line 756 of file C4Gui.h.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Dialog::ApplyElementOffset ( int32_t &  riX,
int32_t &  riY 
)
overridevirtualinherited

Reimplemented from C4GUI::Window.

Definition at line 743 of file C4GuiDialogs.cpp.

References C4GUI::Window::ApplyElementOffset(), C4Viewport::GetOutputRect(), C4GUI::Dialog::GetViewport(), and C4Rect::x.

744  {
745  // inherited
746  Window::ApplyElementOffset(riX, riY);
747  // apply viewport offset, if a viewport is assigned
748  C4Viewport *pVP = GetViewport();
749  if (pVP)
750  {
751  C4Rect rcVP(pVP->GetOutputRect());
752  riX -= rcVP.x; riY -= rcVP.y;
753  }
754  }
Definition: C4Rect.h:27
virtual C4Viewport * GetViewport()
Definition: C4Gui.h:2171
C4Rect GetOutputRect()
Definition: C4Viewport.h:64
int32_t x
Definition: C4Rect.h:30
void ApplyElementOffset(int32_t &riX, int32_t &riY) override
Definition: C4Gui.h:866

Here is the call graph for this function:

void C4GUI::Dialog::ApplyInvElementOffset ( int32_t &  riX,
int32_t &  riY 
)
overridevirtualinherited

Reimplemented from C4GUI::Window.

Definition at line 756 of file C4GuiDialogs.cpp.

References C4GUI::Window::ApplyInvElementOffset(), C4Viewport::GetOutputRect(), C4GUI::Dialog::GetViewport(), and C4Rect::x.

757  {
758  // inherited
760  // apply viewport offset, if a viewport is assigned
761  C4Viewport *pVP = GetViewport();
762  if (pVP)
763  {
764  C4Rect rcVP(pVP->GetOutputRect());
765  riX += rcVP.x; riY += rcVP.y;
766  }
767  }
void ApplyInvElementOffset(int32_t &riX, int32_t &riY) override
Definition: C4Gui.h:868
Definition: C4Rect.h:27
virtual C4Viewport * GetViewport()
Definition: C4Gui.h:2171
C4Rect GetOutputRect()
Definition: C4Viewport.h:64
int32_t x
Definition: C4Rect.h:30

Here is the call graph for this function:

Iterator C4GUI::Container::begin ( )
inlineinherited

Definition at line 824 of file C4Gui.h.

Referenced by C4ScriptGuiWindow::ClearPointers().

824 { return Iterator(pFirst); }
Element * pFirst
Definition: C4Gui.h:750

Here is the caller graph for this function:

bool C4GUI::Dialog::CharIn ( const char *  c)
virtualinherited

Definition at line 519 of file C4GuiDialogs.cpp.

References C4GUI::Control::CharIn(), C4GUI::Dialog::GetDefaultControl(), C4GUI::Dialog::pActiveCtrl, and C4GUI::Dialog::SetFocus().

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

520  {
521  // reroute to active control
522  if (pActiveCtrl && pActiveCtrl->CharIn(c)) return true;
523  // unprocessed: Focus default control
524  // Except for space, which may have been processed as a key already
525  // (changing focus here would render buttons unusable, because they switch on KeyUp)
526  Control *pDefCtrl = GetDefaultControl();
527  if (pDefCtrl && pDefCtrl != pActiveCtrl && (!c || *c != 0x20))
528  {
529  SetFocus(pDefCtrl, false);
530  if (pActiveCtrl && pActiveCtrl->CharIn(c))
531  return true;
532  }
533  return false;
534  }
Control * pActiveCtrl
Definition: C4Gui.h:2080
C4GameControl Control
virtual bool CharIn(const char *)
Definition: C4Gui.h:1051
void SetFocus(Control *pCtrl, bool fByMouse)
virtual class Control * GetDefaultControl()
Definition: C4Gui.h:2129

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented in C4StartupScenSelDlg::ScenListItem.

Definition at line 407 of file C4Gui.h.

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

407 { return false; }

Here is the caller graph for this function:

void C4Menu::Clear ( )
inherited

Definition at line 271 of file C4Menu.cpp.

References C4FacetSurface::Clear(), C4GUI::Dialog::ClearFrameDeco(), C4Menu::ClearItems(), C4GUI::Dialog::Close(), C4Menu::fActive, and C4Menu::Symbol.

Referenced by C4MainMenu::C4MainMenu(), C4Menu::DoInit(), C4Menu::DoInitRefSym(), C4Menu::TryClose(), C4Menu::~C4Menu(), and C4Player::~C4Player().

272 {
273  Close(false);
274  Symbol.Clear();
275  ClearItems();
276  ClearFrameDeco();
277  fActive = false;
278 }
void Close(bool fOK)
void ClearItems()
Definition: C4Menu.cpp:895
bool fActive
Definition: C4Menu.h:153
C4FacetSurface Symbol
Definition: C4Menu.h:148
void ClearFrameDeco()
Definition: C4Gui.h:2199
void Clear()
Definition: C4FacetEx.h:44

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Container::ClearChildren ( )
inherited

Definition at line 68 of file C4GuiContainers.cpp.

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(), C4ScriptGuiWindow::Close(), C4ScriptGuiWindow::RemoveChild(), C4GoalDisplay::SetGoals(), and C4ScriptGuiWindow::~C4ScriptGuiWindow().

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  }
Element * pLast
Definition: C4Gui.h:750
Element * pFirst
Definition: C4Gui.h:750
Element * pPrev
Definition: C4Gui.h:377
Container * pParent
Definition: C4Gui.h:376
virtual bool IsOwnPtrElement()
Definition: C4Gui.h:401
Element * pNext
Definition: C4Gui.h:377

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Dialog::ClearFrameDeco ( )
inlineinherited

Definition at line 2199 of file C4Gui.h.

References C4GUI::FrameDecoration::Deref().

Referenced by C4Menu::Clear().

2200  {if (pFrameDeco) pFrameDeco->Deref(); pFrameDeco = nullptr; }
FrameDecoration * pFrameDeco
Definition: C4Gui.h:2089

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Menu::ClearItems ( )
inherited

Definition at line 895 of file C4Menu.cpp.

References C4Menu::GetItem(), C4Menu::ItemCount, and C4Menu::UpdateScrollBar().

Referenced by C4Object::ActivateMenu(), C4Menu::Clear(), C4MainMenu::DoRefillInternal(), and DoRefillInternal().

896 {
897  C4MenuItem *pItem;
898  while ((pItem = GetItem(0))) delete pItem;
899  ItemCount=0;
900  UpdateScrollBar();
901 }
int32_t ItemCount
Definition: C4Menu.h:138
void UpdateScrollBar()
Definition: C4Menu.cpp:766
C4MenuItem * GetItem(int32_t iIndex)
Definition: C4Menu.cpp:512

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ObjectMenu::ClearPointers ( C4Object pObj)

Definition at line 108 of file C4ObjectMenu.cpp.

References C4Menu::ClearPointers(), Object, ParentObject, and RefillObject.

Referenced by C4Object::ClearPointers().

109 {
110  if (Object==pObj) { Object=nullptr; }
111  if (ParentObject==pObj) ParentObject=nullptr; // Reason for menu close anyway.
112  if (RefillObject==pObj) RefillObject=nullptr;
113  C4Menu::ClearPointers(pObj);
114 }
void ClearPointers(C4Object *pObj)
Definition: C4Menu.cpp:1158
C4Object * Object
Definition: C4ObjectMenu.h:56
C4Object * RefillObject
Definition: C4ObjectMenu.h:58
C4Object * ParentObject
Definition: C4ObjectMenu.h:57

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 231 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Dialog::Close ( bool  fOK)
inherited

Definition at line 631 of file C4GuiDialogs.cpp.

References C4GUI::Screen::CloseDialog(), C4GUI::Dialog::DestroyConsoleWindow(), C4GUI::Dialog::fOK, C4GUI::Dialog::fShow, C4GUI::Element::GetScreen(), C4GUI::Dialog::OnClosed(), and C4GUI::Dialog::pWindow.

Referenced by C4MainMenu::ActivateMain(), C4Menu::Clear(), C4GUI::Screen::CloseAllDialogs(), C4FullScreen::CloseMenu(), C4Player::CloseMenu(), C4MessageInput::CloseTypeIn(), DialogWinProc(), C4StartupScenSelDlg::DoBack(), C4Scoreboard::DoDlgShow(), C4Network2::DoLobby(), C4Startup::DontStartup(), C4Menu::Enter(), C4Menu::Execute(), C4Scoreboard::HideDlg(), C4Network2::LeaguePlrAuth(), C4Network2::LeagueStart(), C4MainMenu::MenuCommand(), C4GUI::MessageDialog::OnEnter(), C4GameLobby::MainDlg::OnExitBtn(), C4DownloadDlg::OnIdle(), C4Menu::Refill(), C4ChatDlg::StopChat(), C4Network2ClientListDlg::Toggle(), C4ChartDialog::Toggle(), C4ChatDlg::ToggleChat(), C4Menu::TryClose(), C4FileSelDlg::UserClose(), C4StartupPlrPropertiesDlg::UserClose(), and C4GUI::Dialog::UserClose().

632  {
633  // already closed?
634  if (!fShow) return;
635  // set OK flag
636  this->fOK = fOK;
637  // get screen
638  Screen *pScreen = GetScreen();
639  if (pScreen) pScreen->CloseDialog(this, false); else fShow = false;
640  // developer mode: Remove window
642  // do callback - last call, because it might do perilous things
643  OnClosed(fOK);
644  }
void DestroyConsoleWindow()
bool fShow
Definition: C4Gui.h:2081
DialogWindow * pWindow
Definition: C4Gui.h:2088
bool fOK
Definition: C4Gui.h:2082
virtual void OnClosed(bool fOK)
friend class Screen
Definition: C4Gui.h:2216
virtual Screen * GetScreen()
Definition: C4Gui.cpp:289

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Menu::Control ( BYTE  byCom,
int32_t  iData 
)
inherited

Definition at line 420 of file C4Menu.cpp.

References C4MN_AdjustPosition, C4Menu::Columns, COM_MenuClose, COM_MenuDown, COM_MenuEnter, COM_MenuEnterAll, COM_MenuLeft, COM_MenuRight, COM_MenuSelect, COM_MenuShowText, COM_MenuUp, C4Menu::Enter(), C4Menu::IsActive(), C4Menu::ItemCount, C4Menu::MoveSelection(), C4Menu::Selection, C4Menu::SetSelection(), C4Menu::SetTextProgress(), and C4Menu::TryClose().

Referenced by C4Menu::Draw(), C4Menu::KeyControl(), and C4MainMenu::MenuCommand().

421 {
422  if (!IsActive()) return false;
423 
424  switch (byCom)
425  {
426  case COM_MenuEnter: Enter(); break;
427  case COM_MenuEnterAll: Enter(true); break;
428  case COM_MenuClose: TryClose(false, true); break;
429 
430  // organize with nicer subfunction...
431  case COM_MenuLeft:
432  // Top wrap-around
433  if (Selection-1 < 0)
434  MoveSelection(ItemCount - 1 - Selection, true, true);
435  else
436  MoveSelection(-1, true, true);
437  break;
438  case COM_MenuRight:
439  // Bottom wrap-around
440  if (Selection+1 >= ItemCount)
441  MoveSelection(-Selection, true, true);
442  else
443  MoveSelection(+1, true, true);
444  break;
445  case COM_MenuUp:
446  iData = -Columns;
447  // Top wrap-around
448  if (Selection + iData < 0)
449  while (Selection + iData + Columns < ItemCount)
450  iData += Columns;
451  MoveSelection(iData, true, true);
452  break;
453  case COM_MenuDown:
454  iData = +Columns;
455  // Bottom wrap-around
456  if (Selection+iData >= ItemCount)
457  while (Selection+iData-Columns >= 0)
458  iData-=Columns;
459  MoveSelection(iData, true, true);
460  break;
461  case COM_MenuSelect:
462  if (ItemCount)
463  SetSelection(iData & (~C4MN_AdjustPosition), !!(iData & C4MN_AdjustPosition), true);
464  break;
465  case COM_MenuShowText:
466  SetTextProgress(-1, false);
467  break;
468  }
469 
470  return true;
471 }
int32_t Selection
Definition: C4Menu.h:137
bool SetSelection(int32_t iSelection, bool fAdjustPosition, bool fDoCalls)
Definition: C4Menu.cpp:544
const BYTE COM_MenuLeft
Definition: C4Constants.h:129
const BYTE COM_MenuShowText
Definition: C4Constants.h:128
bool SetTextProgress(int32_t iToProgress, bool fAdd)
Definition: C4Menu.cpp:958
const BYTE COM_MenuEnterAll
Definition: C4Constants.h:126
const BYTE COM_MenuEnter
Definition: C4Constants.h:125
int32_t ItemCount
Definition: C4Menu.h:138
const BYTE COM_MenuUp
Definition: C4Constants.h:131
const BYTE COM_MenuDown
Definition: C4Constants.h:132
bool IsActive()
Definition: C4Menu.cpp:480
bool TryClose(bool fOK, bool fControl)
Definition: C4Menu.cpp:280
const BYTE COM_MenuSelect
Definition: C4Constants.h:133
const BYTE COM_MenuClose
Definition: C4Constants.h:127
const BYTE COM_MenuRight
Definition: C4Constants.h:130
int32_t Columns
Definition: C4Menu.h:142
bool Enter(bool fRight=false)
Definition: C4Menu.cpp:485
bool MoveSelection(int32_t iBy, bool fAdjustPosition, bool fDoCalls)
Definition: C4Menu.cpp:522

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::CreateConsoleWindow ( )
protectedinherited

Definition at line 239 of file C4GuiDialogs.cpp.

References Application, StdStrBuf::getData(), C4GUI::Dialog::GetID(), C4GUI::DialogWindow::Init(), C4GUI::DialogWindow::pDialog, C4Window::pSurface, C4GUI::Dialog::pWindow, C4GUI::Element::rcBounds, and C4GUI::Dialog::TitleString.

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

240  {
241 #ifdef WITH_QT_EDITOR
242  // TODO: Implement these as Qt editor windows.
243  // This currently creates an empty window in Windows and a segfault in Linux.
244  return false;
245 #endif
246  // already created?
247  if (pWindow) return true;
248  // create it!
249  pWindow = new DialogWindow();
251  {
252  delete pWindow;
253  pWindow = nullptr;
254  return false;
255  }
256  // create rendering context
258  pWindow->pDialog = this;
259  return true;
260  }
const char * getData() const
Definition: StdBuf.h:442
C4Surface * pSurface
Definition: C4Window.h:274
virtual const char * GetID()
Definition: C4Gui.h:2107
DialogWindow * pWindow
Definition: C4Gui.h:2088
C4Window * Init(C4AbstractApp *pApp, const char *Title, const C4Rect &rcBounds, const char *szID)
StdStrBuf TitleString
Definition: C4Gui.h:2086
Dialog * pDialog
Definition: C4Gui.h:2032
C4Rect rcBounds
Definition: C4Gui.h:385
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ObjectMenu::Default ( )
overridevirtual

Reimplemented from C4Menu.

Definition at line 42 of file C4ObjectMenu.cpp.

References CB_None, CloseQuerying, C4Menu::Default(), eCallbackType, Object, ParentObject, RefillObject, RefillObjectContentsCount, and UserMenu.

Referenced by C4ObjectMenu().

43 {
46  Object = ParentObject = RefillObject = nullptr;
48  UserMenu = false;
49  CloseQuerying = false;
50 }
bool CloseQuerying
Definition: C4ObjectMenu.h:62
CallbackType eCallbackType
Definition: C4ObjectMenu.h:60
virtual void Default()
Definition: C4Menu.cpp:246
C4Object * Object
Definition: C4ObjectMenu.h:56
int32_t RefillObjectContentsCount
Definition: C4ObjectMenu.h:59
C4Object * RefillObject
Definition: C4ObjectMenu.h:58
C4Object * ParentObject
Definition: C4ObjectMenu.h:57

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Dialog::DestroyConsoleWindow ( )
protectedinherited

Definition at line 262 of file C4GuiDialogs.cpp.

References C4Window::Clear(), C4Window::pSurface, and C4GUI::Dialog::pWindow.

Referenced by C4GUI::Dialog::Close(), C4GUI::Dialog::OnClosed(), and C4GUI::Dialog::~Dialog().

263  {
264  if (pWindow)
265  {
266  delete pWindow->pSurface;
267  pWindow->Clear();
268  delete pWindow;
269  pWindow = nullptr;
270  }
271  }
C4Surface * pSurface
Definition: C4Window.h:274
DialogWindow * pWindow
Definition: C4Gui.h:2088
virtual void Clear()
Definition: C4AppT.cpp:99

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Element::DoContext ( )
inherited

Definition at line 417 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::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.

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

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 y
Definition: C4Rect.h:30
C4Rect rcBounds
Definition: C4Gui.h:385
int32_t x
Definition: C4Rect.h:30
Window * pDragTarget
Definition: C4Gui.h:378
virtual void UpdatePos()
Definition: C4Gui.cpp:193
int32_t iDragX
Definition: C4Gui.h:379

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Menu::DoInit ( C4FacetSurface fctSymbol,
const char *  szEmpty,
int32_t  iExtra = C4MN_Extra_None,
int32_t  iExtraData = 0,
int32_t  iId = 0,
int32_t  iStyle = C4MN_Style_Normal 
)
protectedinherited

Definition at line 300 of file C4Menu.cpp.

References C4Menu::Clear(), C4Menu::Default(), C4FacetSurface::GrabFrom(), and C4Menu::Symbol.

Referenced by C4MainMenu::Init(), and Init().

301 {
302  Clear(); Default();
303  Symbol.GrabFrom(fctSymbol);
304  return InitMenu(szEmpty, iExtra, iExtraData, iId, iStyle);
305 }
void GrabFrom(C4FacetSurface &rSource)
Definition: C4FacetEx.h:57
virtual void Default()
Definition: C4Menu.cpp:246
C4FacetSurface Symbol
Definition: C4Menu.h:148
void Clear()
Definition: C4Menu.cpp:271

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Menu::DoInitRefSym ( const C4Facet fctSymbol,
const char *  szEmpty,
int32_t  iExtra = C4MN_Extra_None,
int32_t  iExtraData = 0,
int32_t  iId = 0,
int32_t  iStyle = C4MN_Style_Normal 
)
protectedinherited

Definition at line 307 of file C4Menu.cpp.

References C4Menu::Clear(), C4Menu::Default(), C4FacetSurface::Set(), and C4Menu::Symbol.

Referenced by C4MainMenu::InitRefSym(), and InitRefSym().

308 {
309  Clear(); Default();
310  Symbol.Set(fctSymbol);
311  return InitMenu(szEmpty, iExtra, iExtraData, iId, iStyle);
312 }
void Set(const C4Facet &cpy)
Definition: C4FacetEx.h:46
virtual void Default()
Definition: C4Menu.cpp:246
C4FacetSurface Symbol
Definition: C4Menu.h:148
void Clear()
Definition: C4Menu.cpp:271

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::DoModal ( )
inherited

Definition at line 658 of file C4GuiDialogs.cpp.

References Application, C4GUI::Dialog::fOK, C4GUI::Dialog::fShow, Game, C4Application::IsQuittingGame(), C4Game::IsRunning, C4GUI::Dialog::OnIdle(), and StdScheduler::ScheduleProcs().

Referenced by C4DownloadDlg::ShowModal(), and C4GUI::Screen::ShowModalDlg().

659  {
660  // Cancel all dialogues if game is left (including e.g. league dialogues)
661  if (::Application.IsQuittingGame()) return false;
662  // main message loop
663  while (fShow)
664  {
665  // dialog idle proc
666  OnIdle();
667  // Modal dialogue during running game is tricky. Do not execute game!
668  bool fGameWasRunning = ::Game.IsRunning;
669  ::Game.IsRunning = false;
670  // handle messages - this may block until the next timer
671  if (!Application.ScheduleProcs())
672  return false; // game GUI and lobby will deleted in Game::Clear()
673  // reset game run state
674  if (fGameWasRunning) ::Game.IsRunning = true;
675  }
676  // return whether dlg was OK
677  return fOK;
678  }
bool IsRunning
Definition: C4Game.h:139
bool fShow
Definition: C4Gui.h:2081
C4Game Game
Definition: C4Globals.cpp:52
virtual void OnIdle()
Definition: C4Gui.h:2209
bool fOK
Definition: C4Gui.h:2082
bool IsQuittingGame() const
Definition: C4Application.h:70
bool ScheduleProcs(int iTimeout=1000/36)
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool C4GUI::Dialog::DoPlacement ( Screen pOnScreen,
const C4Rect rPreferredDlgRect 
)
inlinevirtualinherited

Reimplemented in C4GUI::FullscreenDialog, C4ChatDlg, and C4ScoreboardDlg.

Definition at line 2175 of file C4Gui.h.

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

2175 { return false; }

Here is the caller graph for this function:

bool C4ObjectMenu::DoRefillInternal ( bool &  rfRefilled)
overrideprotectedvirtual

Reimplemented from C4Menu.

Definition at line 131 of file C4ObjectMenu.cpp.

References C4Menu::Add(), ANY_OWNER, C4MN_Activate, C4MN_Contents, C4MN_Get, C4SymbolSize, C4PropList::Call(), C4Object::CanConcatPictureWith(), C4Menu::ClearItems(), C4Object::Contents, C4Object::Def, C4FacetSurface::Default(), C4ObjectList::Find(), C4PropList::GetName(), C4ObjectListIterator::GetNext(), C4Object::GetValue(), C4Def::id, C4Menu::Identification, LoadResStr(), NO_OWNER, C4Def::NoGet, C4PropListNumbered::Number, Object, C4ObjectList::ObjectCount(), C4Object::OCF, OCF_Carryable, OCF_Entrance, OCF_FullCon, C4Object::Picture2Facet(), PSF_RejectCollection, RefillObject, C4FacetSurface::Set(), sprintf, C4Facet::Surface, and C4ID::ToString().

132 {
133  // Variables
134  C4FacetSurface fctSymbol;
135  C4Object *pObj;
136  char szCaption[256+1],szCommand[256+1],szCommand2[256+1];
137  int32_t iCount;
138  C4Def *pDef;
139  C4IDList ListItems;
140  C4Object *pTarget;
141  C4Facet fctTarget;
142 
143  // Refill
144  switch (Identification)
145  {
146  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
147  case C4MN_Activate:
148  // Clear items
149  ClearItems();
150  // Refill target
151  if (!(pTarget=RefillObject)) return false;
152  {
153  // Add target contents items
154  C4ObjectListIterator iter(pTarget->Contents);
155  while ((pObj = iter.GetNext(&iCount)))
156  {
157  pDef = pObj->Def;
158  if (pDef->NoGet) continue;
159  // Prefer fully constructed objects
160  if (~pObj->OCF & OCF_FullCon)
161  {
162  // easy way: only if first concat check matches
163  // this doesn't catch all possibilities, but that will rarely matter
164  C4Object *pObj2=pTarget->Contents.Find(pDef, ANY_OWNER, OCF_FullCon);
165  if (pObj2) if (pObj2->CanConcatPictureWith(pObj)) pObj = pObj2;
166  }
167  // Caption
168  sprintf(szCaption,LoadResStr("IDS_MENU_ACTIVATE"),(const char *) pObj->GetName());
169  // Picture
170  fctSymbol.Set(fctSymbol.Surface, 0,0,C4SymbolSize,C4SymbolSize);
171  pObj->Picture2Facet(fctSymbol);
172  // Commands
173  sprintf(szCommand,R"(SetCommand("Activate",Object(%d))&&ExecuteCommand())",pObj->Number);
174  sprintf(szCommand2,R"(SetCommand("Activate",nil,%d,0,Object(%d),%s)&&ExecuteCommand())",pTarget->Contents.ObjectCount(pDef->id),pTarget->Number,pDef->id.ToString());
175  // Add menu item
176  Add(szCaption,fctSymbol,szCommand,iCount,pObj,"",pDef->id,szCommand2,true,pObj->GetValue(pTarget, NO_OWNER));
177  // facet taken over (arrg!)
178  fctSymbol.Default();
179  }
180  }
181  break;
182  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
183  case C4MN_Get:
184  case C4MN_Contents:
185  // Clear items
186  ClearItems();
187  // Refill target
188  if (!(pTarget = RefillObject)) return false;
189  {
190  // Add target contents items
191  C4ObjectListIterator iter(pTarget->Contents);
192  while ((pObj = iter.GetNext(&iCount)))
193  {
194  pDef = pObj->Def;
195  if (pDef->NoGet) continue;
196  // Prefer fully constructed objects
197  if (~pObj->OCF & OCF_FullCon)
198  {
199  // easy way: only if first concat check matches
200  // this doesn't catch all possibilities, but that will rarely matter
201  C4Object *pObj2 = pTarget->Contents.Find(pDef, ANY_OWNER, OCF_FullCon);
202  if (pObj2) if (pObj2->CanConcatPictureWith(pObj)) pObj = pObj2;
203  }
204  // Determine whether to get or activate
205  bool fGet = true;
206  if (!(pObj->OCF & OCF_Carryable)) fGet = false; // not a carryable item
208  {
209  if (Object && !!Object->Call(PSF_RejectCollection, &C4AulParSet(pObj->Def, pObj))) fGet = false; // collection rejected
210  }
211  if (!(pTarget->OCF & OCF_Entrance)) fGet = true; // target object has no entrance: cannot activate - force get
212  // Caption
213  sprintf(szCaption, LoadResStr(fGet ? "IDS_MENU_GET" : "IDS_MENU_ACTIVATE"), (const char *)pObj->GetName());
214  // Picture
215  fctSymbol.Set(fctSymbol.Surface, 0, 0, C4SymbolSize, C4SymbolSize);
216  pObj->Picture2Facet(fctSymbol);
217  // Primary command: get/activate single object
218  sprintf(szCommand, R"(SetCommand("%s", Object(%d)) && ExecuteCommand())", fGet ? "Get" : "Activate", pObj->Number);
219  // Secondary command: get/activate all objects of the chosen type
220  szCommand2[0] = 0; int32_t iAllCount;
221  if ((iAllCount = pTarget->Contents.ObjectCount(pDef->id)) > 1)
222  sprintf(szCommand2, R"(SetCommand("%s", nil, %d,0, Object(%d), %s) && ExecuteCommand())", fGet ? "Get" : "Activate", iAllCount, pTarget->Number, pDef->id.ToString());
223  // Add menu item (with object)
224  Add(szCaption, fctSymbol, szCommand, iCount, pObj, "", pDef->id, szCommand2);
225  fctSymbol.Default();
226  }
227  }
228  break;
229  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
230  default:
231  // Not an internal menu
232  return true;
233  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
234  }
235 
236  // Successfull internal refill
237  rfRefilled = true;
238  return true;
239 }
C4ID id
Definition: C4Def.h:101
bool Add(const char *szCaption, C4FacetSurface &fctSymbol, const char *szCommand, int32_t iCount=C4MN_Item_NoCount, C4Object *pObject=nullptr, const char *szInfoCaption=nullptr, C4ID idID=C4ID::None, const char *szCommand2=nullptr, bool fOwnValue=false, int32_t iValue=0, bool fIsSelectable=true)
Definition: C4Menu.cpp:350
const uint32_t OCF_Entrance
Definition: C4Constants.h:90
int32_t GetValue(C4Object *pInBase, int32_t iForPlayer)
Definition: C4Object.cpp:1691
#define sprintf
Definition: Standard.h:164
#define PSF_RejectCollection
Definition: C4GameScript.h:133
const int ANY_OWNER
Definition: C4Constants.h:139
void Set(const C4Facet &cpy)
Definition: C4FacetEx.h:46
const uint32_t OCF_FullCon
Definition: C4Constants.h:85
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
void Default()
Definition: C4FacetEx.h:43
C4NotifyingObjectList Contents
Definition: C4Object.h:152
C4Def * Def
Definition: C4Object.h:143
void ClearItems()
Definition: C4Menu.cpp:895
virtual const char * GetName() const
Definition: C4PropList.cpp:645
Definition: C4Def.h:98
const int NO_OWNER
Definition: C4Constants.h:138
int ObjectCount(C4ID id=C4ID::None) const
C4Object * Find(C4Def *def, int iOwner=ANY_OWNER, DWORD dwOCF=OCF_All)
const int C4SymbolSize
Definition: C4Constants.h:58
const char * ToString() const
Definition: C4Id.h:59
const uint32_t OCF_Carryable
Definition: C4Constants.h:82
void Picture2Facet(C4FacetSurface &cgo)
Definition: C4Object.cpp:2346
bool CanConcatPictureWith(C4Object *pOtherObject) const
Definition: C4Object.cpp:4755
int32_t NoGet
Definition: C4Def.h:145
C4Object * Object
Definition: C4ObjectMenu.h:56
C4Surface * Surface
Definition: C4Facet.h:117
C4Object * RefillObject
Definition: C4ObjectMenu.h:58
uint32_t OCF
Definition: C4Object.h:134
int32_t Identification
Definition: C4Menu.h:141
C4Value Call(C4PropertyName k, C4AulParSet *pPars=nullptr, bool fPassErrors=false)
Definition: C4PropList.h:110

Here is the call graph for this function:

void C4Menu::Draw ( C4TargetFacet cgo)
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 775 of file C4Menu.cpp.

References C4MN_InfoCaption_Delay, C4MN_Style_Info, C4GUI::Element::ClientPos2ScreenPos(), C4Menu::Control(), C4GUI::Screen::DrawToolTip(), C4Menu::fTextProgressing, C4Menu::GetSelectedItem(), C4MenuItem::InfoCaption, C4Menu::InitLocation(), C4Menu::IsActive(), C4GUI::CMouse::IsActiveInput(), C4Menu::LocationSet, C4GUI::Screen::Mouse, pGUI, C4GUI::Container::SetVisibility(), C4Menu::Style, and C4Menu::TimeOnSelection.

Referenced by C4Viewport::DrawMenu().

776 {
777  // Inactive
778  if (!IsActive()) return;
779 
780  // Location
781  if (!LocationSet) { InitLocation(cgo); LocationSet=true; }
782 
783  // If drawn by a viewport, then it's made visible
784  SetVisibility(true);
785 
786  // do drawing
787  typedef C4GUI::Dialog ParentClass;
788  ParentClass::Draw(cgo);
789 
790  // draw tooltip if selection time has been long enough
793  if (Style != C4MN_Style_Info) // No tooltips in info menus - doesn't make any sense...
794  if (!::Control.isReplay())
795  if (!::pGUI->Mouse.IsActiveInput())
796  {
797  C4MenuItem *pSel = GetSelectedItem();
798  if (pSel && *pSel->InfoCaption)
799  {
800  int32_t iX=0, iY=0;
801  pSel->ClientPos2ScreenPos(iX, iY);
802  C4GUI::Screen::DrawToolTip(pSel->InfoCaption, cgo, iX, iY);
803  }
804  }
805 }
void InitLocation(C4Facet &cgo)
Definition: C4Menu.cpp:624
int32_t Style
Definition: C4Menu.h:136
bool fTextProgressing
Definition: C4Menu.h:151
static void DrawToolTip(const char *szTip, C4TargetFacet &cgo, float guix, float guiy)
Definition: C4Gui.cpp:1009
bool LocationSet
Definition: C4Menu.h:133
C4GUIScreen * pGUI
Definition: C4Gui.cpp:1191
C4MenuItem * GetSelectedItem()
Definition: C4Menu.cpp:583
bool IsActive()
Definition: C4Menu.cpp:480
const int32_t C4MN_InfoCaption_Delay
Definition: C4Menu.cpp:43
char InfoCaption[2 *C4MaxTitle+1]
Definition: C4Menu.h:74
int32_t TimeOnSelection
Definition: C4Menu.h:137
bool Control(BYTE byCom, int32_t iData)
Definition: C4Menu.cpp:420
void ClientPos2ScreenPos(int32_t &riX, int32_t &riY)
Definition: C4Gui.cpp:231
void SetVisibility(bool fToValue) override
CMouse Mouse
Definition: C4Gui.h:2587
bool IsActiveInput()
Definition: C4Gui.h:2578

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Element::Draw3DFrame ( C4TargetFacet cgo,
bool  fUp = false,
int32_t  iIndent = 1,
BYTE  byAlpha = C4GUI_BorderAlpha,
bool  fDrawTop = true,
int32_t  iTopOff = 0,
bool  fDrawLeft = true,
int32_t  iLeftOff = 0 
)
protectedinherited

Definition at line 291 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 308 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Menu::DrawBuffer ( C4Facet cgo)
protectedinherited
void C4Menu::DrawButton ( C4Facet cgo)
protectedinherited
void C4Menu::DrawElement ( C4TargetFacet cgo)
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 808 of file C4Menu.cpp.

References C4FCT_Right, C4Id2Def(), C4MN_Extra_Value, C4MN_SymbolSize, C4Menu::DrawFrame(), C4Facet::DrawValue(), C4Menu::Extra, C4GraphicsResource::fctWealth, C4MenuItem::fOwnValue, C4Menu::GetSelectedItem(), C4Def::GetValue(), GraphicsResource, C4Rect::Hgt, C4Facet::Hgt, C4MenuItem::id, C4MenuItem::iValue, NO_OWNER, C4ID::None, C4GUI::Element::rcBounds, C4Facet::Surface, C4TargetFacet::TargetX, C4TargetFacet::TargetY, C4Rect::Wdt, C4Facet::Wdt, C4Rect::x, C4Facet::X, C4Rect::y, and C4Facet::Y.

809 {
810  // inherited (background)
811  typedef C4GUI::Dialog ParentClass;
812  ParentClass::DrawElement(cgo);
813 
814  // Get selected item id
815  C4ID idSelected; C4MenuItem *pItem;
816  if ((pItem = GetSelectedItem())) idSelected = pItem->id; else idSelected = C4ID::None;
817  C4Def *pDef = C4Id2Def(idSelected);
818  // Get item value
819  int32_t iValue = 0;
820  if (pDef)
821  {
822  if (pItem && pItem->fOwnValue)
823  iValue = pItem->iValue;
824  else
825  iValue = pDef->GetValue(nullptr, NO_OWNER);
826  }
827 
828  // Store and clear global clipper
829 // int32_t iX1,iY1,iX2,iY2;
830 // pDraw->GetPrimaryClipper(iX1,iY1,iX2,iY2);
831 // pDraw->SubPrimaryClipper(rcBounds.x, rcBounds.y, rcBounds.x+rcBounds.Wdt-1, rcBounds.y+rcBounds.Hgt-1);
832 
834 
835  // Draw bar divider
836  if (Extra)
837  {
838  DrawFrame(cgoExtra.Surface, cgoExtra.X-1, cgoExtra.Y-1, cgoExtra.Wdt+1, cgoExtra.Hgt+1);
839  }
840 
841  // Draw specified extra
842  switch (Extra)
843  {
844  case C4MN_Extra_Value:
845  {
846  if (pDef) ::GraphicsResource.fctWealth.DrawValue(cgoExtra,iValue,0,0,C4FCT_Right);
847  }
848  break;
849  }
850 }
void DrawFrame(C4Surface *sfcSurface, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt)
Definition: C4Menu.cpp:852
bool fOwnValue
Definition: C4Menu.h:82
const int32_t C4FCT_Right
Definition: C4Facet.h:28
C4GraphicsResource GraphicsResource
C4ID id
Definition: C4Menu.h:76
int32_t Wdt
Definition: C4Rect.h:30
void DrawValue(C4Facet &cgo, int32_t iValue, int32_t iPhaseX=0, int32_t iPhaseY=0, int32_t iAlign=C4FCT_Center)
Definition: C4Facet.cpp:308
int32_t y
Definition: C4Rect.h:30
C4MenuItem * GetSelectedItem()
Definition: C4Menu.cpp:583
static const C4ID None
Definition: C4Id.h:39
C4Rect rcBounds
Definition: C4Gui.h:385
int32_t iValue
Definition: C4Menu.h:83
Definition: C4Def.h:98
const int NO_OWNER
Definition: C4Constants.h:138
Definition: C4Id.h:25
int32_t x
Definition: C4Rect.h:30
int32_t GetValue(C4Object *pInBase, int32_t iBuyPlayer)
Definition: C4Def.cpp:613
float TargetX
Definition: C4Facet.h:165
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:80
int32_t Extra
Definition: C4Menu.h:140
int32_t Hgt
Definition: C4Rect.h:30
C4Surface * Surface
Definition: C4Facet.h:117
float TargetY
Definition: C4Facet.h:165

Here is the call graph for this function:

void C4Menu::DrawFrame ( C4Surface sfcSurface,
int32_t  iX,
int32_t  iY,
int32_t  iWdt,
int32_t  iHgt 
)
protectedinherited

Definition at line 852 of file C4Menu.cpp.

References C4RGB, C4Draw::DrawFrameDw(), and pDraw.

Referenced by C4Menu::DrawElement().

853 {
854  pDraw->DrawFrameDw(sfcSurface, iX+1, iY+1, iX+iWdt-1,iY+iHgt-1, C4RGB(0x44, 0, 0));
855 }
void DrawFrameDw(C4Surface *sfcDest, int x1, int y1, int x2, int y2, DWORD dwClr, float width=1.0f)
Definition: C4Draw.cpp:641
C4Draw * pDraw
Definition: C4Draw.cpp:42
#define C4RGB(r, g, b)
Definition: StdColors.h:26

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 365 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 375 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Menu::DrawScrollbar ( C4Facet cgo,
int32_t  iTotal,
int32_t  iVisible,
int32_t  iPosition 
)
protectedinherited
void C4GUI::Element::DrawVBar ( C4TargetFacet cgo,
DynBarFacet rFacets 
)
protectedinherited

Definition at line 359 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void C4GUI::Container::ElementPosChanged ( Element pOfElement)
inlineprotectedvirtualinherited

Reimplemented in C4GUI::Screen, C4GUI::ContextMenu, C4GUI::TextWindow, C4GUI::ListBox, and C4GUI::ScrollWindow.

Definition at line 754 of file C4Gui.h.

Referenced by C4GUI::ScrollWindow::ElementPosChanged(), and C4GUI::Element::UpdatePos().

754 { } // called when an element position is changed

Here is the caller graph for this function:

virtual void C4GUI::Container::ElementSizeChanged ( Element pOfElement)
inlineprotectedvirtualinherited

Reimplemented in C4GUI::ContextMenu, C4GUI::TextWindow, C4GUI::ListBox, and C4GUI::ScrollWindow.

Definition at line 753 of file C4Gui.h.

Referenced by C4GUI::ListBox::ElementPosChanged(), C4GUI::TextWindow::ElementPosChanged(), C4GUI::ContextMenu::ElementPosChanged(), C4GUI::ScrollWindow::ElementSizeChanged(), C4GUI::ListBox::ElementSizeChanged(), C4GUI::TextWindow::ElementSizeChanged(), C4GUI::ContextMenu::ElementSizeChanged(), and C4GUI::Element::UpdateSize().

753 { } // called when an element size is changed

Here is the caller graph for this function:

Iterator C4GUI::Container::end ( )
inlineinherited

Definition at line 825 of file C4Gui.h.

Referenced by C4ScriptGuiWindow::ClearPointers().

825 { return Iterator(nullptr); }

Here is the caller graph for this function:

bool C4Menu::Enter ( bool  fRight = false)
inherited

Definition at line 485 of file C4Menu.cpp.

References _MAX_FNAME, C4MN_Style_Dialog, C4MN_Style_Info, C4GUI::Dialog::Close(), C4MenuItem::Command, C4MenuItem::Command2, C4Menu::fActive, C4Menu::GetSelectedItem(), C4Menu::IsActive(), C4Menu::MenuCommand(), C4Menu::Permanent, SCopy(), C4Menu::Style, and C4Menu::TryClose().

Referenced by C4Menu::Control(), and C4MainMenu::OnUserEnter().

486 {
487  // Not active
488  if (!IsActive()) return false;
489  if (Style==C4MN_Style_Info) return false;
490  // Get selected item
491  C4MenuItem *pItem = GetSelectedItem();
492  if (!pItem)
493  {
494  // okay for dialogs: Just close them
495  if (Style == C4MN_Style_Dialog) TryClose(false, true);
496  return true;
497  }
498  // Copy command to buffer (menu might be cleared)
499  char szCommand[_MAX_FNAME+30+1];
500  SCopy(pItem->Command,szCommand);
501  if (fRight && pItem->Command2[0]) SCopy(pItem->Command2,szCommand);
502 
503  // Close if not permanent
504  if (!Permanent) { Close(true); fActive = false; }
505 
506  // exec command (note that menu callback may delete this!)
507  MenuCommand(szCommand, false);
508 
509  return true;
510 }
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
Definition: Standard.cpp:130
int32_t Style
Definition: C4Menu.h:136
virtual bool MenuCommand(const char *szCommand, bool fIsCloseCommand)
Definition: C4Menu.h:231
void Close(bool fOK)
char Command[_MAX_FNAME+30+1]
Definition: C4Menu.h:72
C4MenuItem * GetSelectedItem()
Definition: C4Menu.cpp:583
bool fActive
Definition: C4Menu.h:153
#define _MAX_FNAME
bool IsActive()
Definition: C4Menu.cpp:480
bool TryClose(bool fOK, bool fControl)
Definition: C4Menu.cpp:280
bool Permanent
Definition: C4Menu.h:134
char Command2[_MAX_FNAME+30+1]
Definition: C4Menu.h:73

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ObjectMenu::Execute ( )

Definition at line 241 of file C4ObjectMenu.cpp.

References C4Object::Contents, C4Menu::Execute(), C4Menu::IsActive(), C4Menu::NeedRefill, C4ObjectList::ObjectCount(), RefillObject, and RefillObjectContentsCount.

Referenced by C4Object::Execute().

242 {
243  if (!IsActive()) return;
244  // Immediate refill check by RefillObject contents count check
245  if (RefillObject)
248  // inherited
249  C4Menu::Execute();
250 }
C4NotifyingObjectList Contents
Definition: C4Object.h:152
bool IsActive()
Definition: C4Menu.cpp:480
int ObjectCount(C4ID id=C4ID::None) const
void Execute()
Definition: C4Menu.cpp:903
bool NeedRefill
Definition: C4Menu.h:135
int32_t RefillObjectContentsCount
Definition: C4ObjectMenu.h:59
C4Object * RefillObject
Definition: C4ObjectMenu.h:58

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::Execute2 ( )
inherited

Definition at line 690 of file C4GuiDialogs.cpp.

References C4GUI::Dialog::Execute().

691  {
692  // execute
693  if (Execute()) return true;
694  // delete self if closed
695  delete this;
696  return false;
697  }

Here is the call graph for this function:

bool C4GUI::Dialog::FadeIn ( Screen pOnScreen)
inherited

Definition at line 714 of file C4GuiDialogs.cpp.

References C4GUI::Dialog::eFade, C4GUI::Element::fVisible, C4GUI::Screen::GetScreenS(), C4GUI::Dialog::iFade, C4GUI::Dialog::OnShown(), and C4GUI::Screen::ShowDialog().

Referenced by C4Network2::DoLobby(), and C4Startup::SwitchDialog().

715  {
716  // default screen
717  if (!pOnScreen) pOnScreen = Screen::GetScreenS();
718  // fade in there
719  pOnScreen->ShowDialog(this, true);
720  iFade = 0;
721  eFade = eFadeIn;
722  fVisible = true;
723  OnShown();
724  // done, success
725  return true;
726  }
Fade eFade
Definition: C4Gui.h:2084
virtual void OnShown()
Definition: C4Gui.h:2208
static Screen * GetScreenS()
Definition: C4Gui.h:2626
bool fVisible
Definition: C4Gui.h:383
int32_t iFade
Definition: C4Gui.h:2083

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Dialog::FadeOut ( bool  fCloseWithOK)
inherited

Definition at line 728 of file C4GuiDialogs.cpp.

References C4GUI::Screen::CloseDialog(), C4GUI::Dialog::eFade, C4GUI::Dialog::fOK, C4GUI::Element::fVisible, C4GUI::Element::GetScreen(), C4GUI::Dialog::IsShown(), and C4GUI::Dialog::OnClosed().

Referenced by C4Startup::SwitchDialog().

729  {
730  // only if shown, or being faded in
731  if (!IsShown() && (!fVisible || eFade!=eFadeIn)) return;
732  // set OK flag
733  this->fOK = fCloseWithOK;
734  // fade out
735  Screen *pOnScreen = GetScreen();
736  if (!pOnScreen) return;
737  pOnScreen->CloseDialog(this, true);
738  eFade = eFadeOut;
739  // do callback - last call, because it might do perilous things
740  OnClosed(fCloseWithOK);
741  }
Fade eFade
Definition: C4Gui.h:2084
bool IsShown()
Definition: C4Gui.h:2147
bool fOK
Definition: C4Gui.h:2082
virtual void OnClosed(bool fOK)
bool fVisible
Definition: C4Gui.h:383
friend class Screen
Definition: C4Gui.h:2216
virtual Screen * GetScreen()
Definition: C4Gui.cpp:289

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 445 of file C4Gui.h.

References C4GUI::Element::rcBounds.

Referenced by C4GUI::ListBox::AddElement(), C4Menu::AdjustPosition(), C4GameOverDlg::C4GameOverDlg(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupNetListEntry::C4StartupNetListEntry(), C4StartupScenSelDlg::C4StartupScenSelDlg(), C4GUI::ContextMenu::CheckOpenSubmenu(), C4GUI::ListBox::ContractToElementHeight(), C4MapFolderData::CreateGUIElements(), C4GUI::Screen::DoContext(), C4GUI::Window::Draw(), C4GUI::ListBox::DrawElement(), C4GUI::ContextMenu::DrawElement(), C4GUI::TextWindow::ElementPosChanged(), C4GUI::TextWindow::ElementSizeChanged(), C4GUI::Dialog::GetMarginTop(), 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(), C4Menu::UpdateElementPositions(), C4GUI::ListBox::UpdateElementPositions(), C4GUI::ScrollWindow::UpdateOwnPos(), C4Menu::UpdateScrollBar(), and C4GUI::TextWindow::UpdateSize().

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

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Element.

Definition at line 864 of file C4Gui.h.

References C4GUI::Window::rcClientRect.

Referenced by C4GameOverDlg::C4GameOverDlg(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4StartupMainDlg::C4StartupMainDlg(), 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().

864 { return rcClientRect; }
C4Rect rcClientRect
Definition: C4Gui.h:851

Here is the caller graph for this function:

C4Rect C4GUI::Element::GetContainedClientRect ( )
inlineinherited

Definition at line 448 of file C4Gui.h.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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
ContextHandler* C4GUI::Dialog::GetContextHandler ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 2211 of file C4Gui.h.

References C4GUI::Element::pContextHandler.

2212  { return pContextHandler; }
ContextHandler * pContextHandler
Definition: C4Gui.h:381
int32_t C4ObjectMenu::GetControllingPlayer ( )
overrideprotectedvirtual

Reimplemented from C4Menu.

Definition at line 290 of file C4ObjectMenu.cpp.

References C4Object::Controller, NO_OWNER, and Object.

291 {
292  // menu controlled by object controller
293  return Object ? Object->Controller : NO_OWNER;
294 }
const int NO_OWNER
Definition: C4Constants.h:138
C4Object * Object
Definition: C4ObjectMenu.h:56
int32_t Controller
Definition: C4Object.h:111
virtual class Control* C4GUI::Dialog::GetDefaultControl ( )
inlinevirtualinherited

Reimplemented in C4ChatDlg, C4StartupNetDlg, and C4GameLobby::MainDlg.

Definition at line 2129 of file C4Gui.h.

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

2129 { return nullptr; }

Here is the caller graph for this function:

int32_t C4GUI::Dialog::GetDefaultTitleHeight ( )
staticinherited

Definition at line 330 of file C4GuiDialogs.cpp.

References C4GUI_MinWoodBarHgt, CStdFont::GetLineHeight(), GraphicsResource, and C4GraphicsResource::TextFont.

331  {
332  // default title font
333  return std::min<int32_t>(::GraphicsResource.TextFont.GetLineHeight(), C4GUI_MinWoodBarHgt);
334  }
int GetLineHeight() const
Definition: C4FontLoader.h:125
#define C4GUI_MinWoodBarHgt
Definition: C4Gui.h:158
C4GraphicsResource GraphicsResource

Here is the call graph for this function:

DialogWindow* C4GUI::Dialog::GetDialogWindow ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 2117 of file C4Gui.h.

References C4GUI::Dialog::pWindow.

2117 { return pWindow; }
DialogWindow * pWindow
Definition: C4Gui.h:2088
Dialog* C4GUI::Dialog::GetDlg ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 2116 of file C4Gui.h.

Referenced by C4GUI::Screen::GetDialog(), C4GUI::Screen::GetFullscreenDialog(), C4GUI::Screen::GetMouseControlledDialogCount(), C4GUI::Screen::GetTopDialog(), C4GUI::Screen::MouseInput(), and C4StartupPlrSelDlg::PlayerListItem::UpdateCore().

2116 { return this; } // this is the dialog

Here is the caller graph for this function:

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

Definition at line 223 of file C4GuiContainers.cpp.

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

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

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  }
Element * pFirst
Definition: C4Gui.h:750
Element * pNext
Definition: C4Gui.h:377

Here is the caller graph for this function:

int32_t C4GUI::Container::GetElementCount ( )
inherited

Definition at line 232 of file C4GuiContainers.cpp.

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

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

233  {
234  int32_t cnt=0;
235  for (Element *pEl = pFirst; pEl; pEl=pEl->pNext) ++cnt;
236  return cnt;
237  }
Element * pFirst
Definition: C4Gui.h:750
Element * pNext
Definition: C4Gui.h:377

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Element.

Definition at line 773 of file C4Gui.h.

References C4GUI::Container::pFirst.

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

773 { return pFirst; }
Element * pFirst
Definition: C4Gui.h:750

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Element.

Definition at line 204 of file C4GuiContainers.cpp.

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

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

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  }
Element * pLast
Definition: C4Gui.h:750
Element * pFirst
Definition: C4Gui.h:750

Here is the call graph for this function:

Here is the caller graph for this function:

Control* C4GUI::Dialog::GetFocus ( )
inlineinherited

Definition at line 2115 of file C4Gui.h.

References C4GUI::Dialog::pActiveCtrl.

Referenced by C4StartupScenSelDlg::DeselectAll(), C4StartupNetDlg::DoOK(), C4GUI::Control::MouseInput(), C4GUI::RenameEdit::OnFinishInput(), C4GUI::RenameEdit::RenameEdit(), and C4GUI::Container::SetVisibility().

2115 { return pActiveCtrl; }
Control * pActiveCtrl
Definition: C4Gui.h:2080

Here is the caller graph for this function:

FrameDecoration* C4GUI::Dialog::GetFrameDecoration ( ) const
inlineinherited

Definition at line 2201 of file C4Gui.h.

References C4GUI::Dialog::pFrameDeco.

2201 { return pFrameDeco; }
FrameDecoration * pFrameDeco
Definition: C4Gui.h:2089
int32_t C4GUI::Element::GetHeight ( )
inlineinherited

Definition at line 444 of file C4Gui.h.

References C4Rect::Hgt.

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

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

Here is the caller graph for this function:

const char* C4Menu::GetID ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 240 of file C4Menu.h.

240 { return nullptr; } // no ID needed, because it's a viewport dlg
int32_t C4Menu::GetIdentification ( )
inherited

Definition at line 612 of file C4Menu.cpp.

References C4Menu::Identification.

Referenced by C4Player::Execute().

613 {
614  return Identification;
615 }
int32_t Identification
Definition: C4Menu.h:141

Here is the caller graph for this function:

C4MenuItem * C4Menu::GetItem ( int32_t  iIndex)
inherited

Definition at line 512 of file C4Menu.cpp.

References C4GUI::Container::GetElementByIndex(), and C4Menu::pClientWindow.

Referenced by C4Menu::AdjustSelection(), C4Menu::ClearItems(), C4Menu::ClearPointers(), C4Menu::GetSelectedItem(), C4Menu::InitLocation(), C4Menu::MoveSelection(), C4Menu::SetSelection(), and C4Menu::SetTextProgress().

513 {
514  return static_cast<C4MenuItem *>(pClientWindow->GetElementByIndex(iIndex));
515 }
C4GUI::ScrollWindow * pClientWindow
Definition: C4Menu.h:149
Element * GetElementByIndex(int32_t i)

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4Menu::GetItemCount ( )
inherited

Definition at line 517 of file C4Menu.cpp.

References C4Menu::ItemCount.

Referenced by C4MainMenu::ActivateMain(), and C4MainMenu::DoRefillInternal().

518 {
519  return ItemCount;
520 }
int32_t ItemCount
Definition: C4Menu.h:138

Here is the caller graph for this function:

int32_t C4Menu::GetItemHeight ( )
inlineinherited

Definition at line 166 of file C4Menu.h.

References C4Menu::ItemHeight.

166 { return ItemHeight; }
int32_t ItemHeight
Definition: C4Menu.h:139
Element* C4GUI::Container::GetLast ( )
inlineinherited

Definition at line 830 of file C4Gui.h.

References C4GUI::Container::pLast.

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

830 { return pLast; }
Element * pLast
Definition: C4Gui.h:750

Here is the caller graph for this function:

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

Definition at line 774 of file C4Gui.h.

References C4GUI::Container::pLast.

774 { return pLast; }
Element * pLast
Definition: C4Gui.h:750
virtual int32_t C4GUI::Element::GetListItemTopSpacing ( )
inlinevirtualinherited

Reimplemented in C4StartupNetListEntry.

Definition at line 461 of file C4Gui.h.

References C4GUI_DefaultListSpacing.

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

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

Here is the caller graph for this function:

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

Definition at line 462 of file C4Gui.h.

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

462 { return false; }

Here is the caller graph for this function:

int32_t C4Menu::GetMarginBottom ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 258 of file C4Menu.h.

References C4MN_FrameWidth, C4MN_SymbolSize, and C4GUI::Dialog::GetMarginBottom().

Referenced by C4Menu::InitSize().

int32_t GetMarginBottom() override
Definition: C4Gui.h:2143
int32_t Extra
Definition: C4Menu.h:140

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4Menu::GetMarginLeft ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 259 of file C4Menu.h.

References C4MN_FrameWidth, and C4GUI::Dialog::GetMarginLeft().

Referenced by C4Menu::InitSize().

int32_t GetMarginLeft() override
Definition: C4Gui.h:2141

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4Menu::GetMarginRight ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 260 of file C4Menu.h.

References C4MN_FrameWidth, and C4GUI::Dialog::GetMarginRight().

Referenced by C4Menu::InitSize().

int32_t GetMarginRight() override
Definition: C4Gui.h:2142

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4GUI::Dialog::GetMarginTop ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Window.

Reimplemented in C4GUI::FullscreenDialog, C4StartupScenSelDlg, C4StartupPlrPropertiesDlg, and C4StartupPlrSelDlg.

Definition at line 2140 of file C4Gui.h.

References C4GUI::Element::GetBounds(), C4GUI::Window::GetMarginTop(), C4Rect::Hgt, and C4GUI::FrameDecoration::iBorderTop.

Referenced by C4Menu::InitSize(), C4GUI::Dialog::SetClientSize(), and C4ScoreboardDlg::Update().

FrameDecoration * pFrameDeco
Definition: C4Gui.h:2089
virtual int32_t GetMarginTop()
Definition: C4Gui.h:873
C4Rect & GetBounds()
Definition: C4Gui.h:445
WoodenLabel * pTitle
Definition: C4Gui.h:2078
int32_t Hgt
Definition: C4Rect.h:30

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 171 of file C4GuiContainers.cpp.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 440 of file C4Gui.h.

References StdStrBuf::getData().

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

Here is the call graph for this function:

C4Object * C4ObjectMenu::GetParentObject ( )
overridevirtual

Reimplemented from C4Menu.

Definition at line 116 of file C4ObjectMenu.cpp.

References Objects.

Referenced by LocalInit().

117 {
118  for (C4Object *cObj : Objects)
119  if (cObj->Menu == this)
120  return cObj;
121  return nullptr;
122 }
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the caller graph for this function:

int32_t C4Menu::GetPosition ( )
inherited
Element* C4GUI::Element::GetPrev ( ) const
inlineinherited

Definition at line 450 of file C4Gui.h.

References C4GUI::Element::pPrev.

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

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

Here is the caller graph for this function:

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

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

Definition at line 289 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

C4MenuItem * C4Menu::GetSelectedItem ( )
inherited

Definition at line 583 of file C4Menu.cpp.

References C4Menu::GetItem(), and C4Menu::Selection.

Referenced by C4Menu::AdjustPosition(), C4Menu::Draw(), C4Menu::DrawElement(), C4Menu::Enter(), C4Player::Execute(), C4MainMenu::OnSelectionChanged(), C4Menu::SetSelection(), and C4Menu::UpdateElementPositions().

584 {
585  return GetItem(Selection);
586 }
int32_t Selection
Definition: C4Menu.h:137
C4MenuItem * GetItem(int32_t iIndex)
Definition: C4Menu.cpp:512

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4Menu::GetSelection ( )
inherited

Definition at line 599 of file C4Menu.cpp.

References C4Menu::Selection.

Referenced by C4MainMenu::MenuCommand().

600 {
601  return Selection;
602 }
int32_t Selection
Definition: C4Menu.h:137

Here is the caller graph for this function:

int C4Menu::GetSymbolSize ( )
inlineinherited

Definition at line 165 of file C4Menu.h.

References C4MN_Style_Dialog, and C4SymbolSize.

165 { return (Style == C4MN_Style_Dialog) ? 64 : C4SymbolSize; }
int32_t Style
Definition: C4Menu.h:136
const int C4SymbolSize
Definition: C4Constants.h:58
const char * C4GUI::Element::GetToolTip ( )
inherited

Definition at line 423 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 399 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

C4Viewport * C4Menu::GetViewport ( )
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 993 of file C4Menu.cpp.

References C4ViewportList::GetFirstViewport(), C4Viewport::GetNext(), and Viewports.

Referenced by IsReadOnly().

994 {
995  // ask all viewports
996  for (C4Viewport *pVP = ::Viewports.GetFirstViewport(); pVP; pVP = pVP->GetNext())
997  if (pVP->IsViewportMenu(this))
998  return pVP;
999  // none matching
1000  return nullptr;
1001 }
C4Viewport * GetFirstViewport()
Definition: C4Viewport.h:156
C4Viewport * GetNext()
Definition: C4Viewport.h:66
C4ViewportList Viewports
Definition: C4Viewport.cpp:841

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4GUI::Element::GetWidth ( )
inlineinherited

Definition at line 443 of file C4Gui.h.

References C4Rect::Wdt.

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

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

Here is the caller graph for this function:

int32_t C4Menu::GetZOrdering ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 251 of file C4Menu.h.

251 { return -1; }
virtual bool C4GUI::Dialog::HasBackground ( )
inlinevirtualinherited

Reimplemented in C4StartupScenSelDlg, C4StartupPlrSelDlg, and C4StartupNetDlg.

Definition at line 2154 of file C4Gui.h.

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

2154 { return false; } // true if dlg draws screen background (fullscreen dialogs only)

Here is the caller graph for this function:

bool C4Menu::HasMouse ( )
protectedinherited

Definition at line 1149 of file C4Menu.cpp.

References C4PlayerList::Get(), C4Menu::GetControllingPlayer(), C4Player::MouseControl, NO_OWNER, and Players.

Referenced by C4Menu::SetSelection(), and C4Menu::UpdateElementPositions().

1150 {
1151  int32_t iPlayer = GetControllingPlayer();
1152  if (iPlayer == NO_OWNER) return true; // free view dialog also has the mouse
1153  C4Player *pPlr = ::Players.Get(iPlayer);
1154  if (pPlr && pPlr->MouseControl) return true;
1155  return false;
1156 }
int32_t MouseControl
Definition: C4Player.h:92
C4Player * Get(int iPlayer) const
C4PlayerList Players
const int NO_OWNER
Definition: C4Constants.h:138
virtual int32_t GetControllingPlayer()
Definition: C4Menu.h:238

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Menu::HasPortrait ( )
inlineprotectedinherited

Definition at line 242 of file C4Menu.h.

References C4Menu::fHasPortrait.

Referenced by C4Menu::InitLocation(), C4Menu::InitSize(), C4Menu::SetTextProgress(), and C4Menu::UpdateElementPositions().

242 { return fHasPortrait; } // dialog menus only: Whether a portrait is shown in the topleft
bool fHasPortrait
Definition: C4Menu.h:150

Here is the caller graph for this function:

bool C4ObjectMenu::Init ( C4FacetSurface fctSymbol,
const char *  szEmpty,
C4Object pObject,
int32_t  iExtra = C4MN_Extra_None,
int32_t  iExtraData = 0,
int32_t  iId = 0,
int32_t  iStyle = C4MN_Style_Normal,
bool  fUserMenu = false 
)

Definition at line 81 of file C4ObjectMenu.cpp.

References C4Menu::DoInit(), and LocalInit().

Referenced by C4Object::ActivateMenu().

82 {
83  if (!DoInit(fctSymbol, szEmpty, iExtra, iExtraData, iId, iStyle)) return false;
84  LocalInit(pObject, fUserMenu);
85  return true;
86 }
bool DoInit(C4FacetSurface &fctSymbol, const char *szEmpty, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal)
Definition: C4Menu.cpp:300
void LocalInit(C4Object *pObject, bool fUserMenu)

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Menu::InitLocation ( C4Facet cgo)
protectedinherited

Definition at line 624 of file C4Menu.cpp.

References C4Menu::AdjustPosition(), C4Menu::Alignment, CStdFont::BreakMessage(), C4MN_Align_Bottom, C4MN_Align_Free, C4MN_Align_Left, C4MN_Align_Right, C4MN_Align_Top, C4MN_DefInfoWdt, C4MN_DlgLines, C4MN_DlgPortraitIndent, C4MN_DlgPortraitWdt, C4MN_DlgWdt, C4MN_FrameWidth, C4MN_Style_Context, C4MN_Style_Dialog, C4MN_Style_Info, C4MN_Style_Normal, C4MN_SymbolSize, C4PictureSize, C4SymbolSize, C4MenuItem::Caption, C4Menu::Caption, C4Menu::Columns, C4GraphicsResource::FontRegular, StdStrBuf::getData(), C4Menu::GetItem(), CStdFont::GetLineHeight(), CStdFont::GetTextExtent(), GraphicsResource, C4Menu::HasPortrait(), C4Rect::Hgt, C4Facet::Hgt, C4MenuItem::InfoCaption, C4Menu::InitSize(), C4Menu::ItemCount, C4Menu::ItemHeight, C4Menu::ItemWidth, C4Menu::Lines, C4GUI::Element::rcBounds, C4GUI::Window::SetPos(), C4GUI::Container::SetVisibility(), C4Menu::Style, C4Menu::UpdateElementPositions(), C4Menu::UpdateScrollBar(), C4Rect::Wdt, C4Facet::Wdt, C4Rect::x, X, and C4Rect::y.

Referenced by C4Menu::Draw().

625 {
626 
627  // Item size by style
628  switch (Style)
629  {
630  case C4MN_Style_Normal:
632  break;
633  case C4MN_Style_Context:
634  {
636  int32_t iWdt, iHgt;
638  // FIXME: Blah. This stuff should be calculated correctly by pTitle.
639  ItemWidth += ItemHeight + 16;
640  C4MenuItem *pItem;
641  for (int i = 0; (pItem = GetItem(i)); ++i)
642  {
643  ::GraphicsResource.FontRegular.GetTextExtent(pItem->Caption, iWdt, iHgt, true);
644  ItemWidth = std::max(ItemWidth, iWdt + pItem->GetSymbolWidth(ItemHeight));
645  }
646  ItemWidth += 3; // Add some extra space so text doesn't touch right border frame...
647  break;
648  }
649  case C4MN_Style_Info:
650  {
651  // calculate size from a default size determined by a window width of C4MN_DefInfoWdt
652  int32_t iWdt,iHgt,iLargestTextWdt;
654  iLargestTextWdt = iWdt + 2 * C4MN_SymbolSize + C4MN_FrameWidth;
655  ItemWidth=std::min<int>(cgoArea.Wdt - 2*C4MN_FrameWidth, std::max(iLargestTextWdt, C4MN_DefInfoWdt));
656  ItemHeight=0;
657  StdStrBuf sText;
658  C4MenuItem *pItem;
659  for (int32_t i=0; (pItem=GetItem(i)); ++i)
660  {
662  ::GraphicsResource.FontRegular.GetTextExtent(sText.getData(),iWdt,iHgt, true);
663  assert(iWdt <= ItemWidth);
664  ItemWidth=std::max(ItemWidth,iWdt); ItemHeight=std::max(ItemHeight,iHgt);
665  iLargestTextWdt = std::max(iLargestTextWdt, iWdt);
666  }
667  // although width calculation is done from C4MN_DefInfoWdt, this may be too large for some very tiny info windows
668  // so make sure no space is wasted
669  ItemWidth = std::min(ItemWidth, iLargestTextWdt);
670  // Add some extra space so text doesn't touch right border frame...
671  ItemWidth += 3;
672  // Now add some space to show the picture on the left
674  // And set a minimum item height (again, for the picture)
675  ItemHeight = std::max<int>(ItemHeight, C4PictureSize);
676  break;
677  }
678 
679  case C4MN_Style_Dialog:
680  {
681  // dialog window: Item width is whole dialog, portrait subtracted if any
682  // Item height varies
683  int32_t iWdt,iHgt;
685  ItemWidth=std::min<int>(cgoArea.Wdt - 2*C4MN_FrameWidth, std::max<int>(iWdt + 2 * C4MN_SymbolSize + C4MN_FrameWidth, C4MN_DlgWdt));
686  ItemHeight=iHgt; // Items may be multiline and higher
687  if (HasPortrait())
688  {
689  // subtract portrait only if this would not make the dialog too small
690  if (ItemWidth > C4MN_DlgPortraitWdt*2 && cgoArea.Hgt > cgoArea.Wdt)
692  }
693  }
694  }
695 
696  int DisplayedItemCount = ItemCount - HasPortrait();
697  if (Style == C4MN_Style_Dialog)
699  else
700  Lines = DisplayedItemCount/Columns+std::min<int32_t>(DisplayedItemCount%Columns,1);
701  // adjust by max. height
702  Lines=std::max<int32_t>(std::min<int32_t>((cgoArea.Hgt-100)/std::max<int32_t>(ItemHeight,1),Lines),1);
703 
704  InitSize();
705  int32_t X,Y;
707  {
708  X = rcBounds.x;
709  Y = rcBounds.y;
710  }
711  else
712  {
713  X = (cgoArea.Wdt - rcBounds.Wdt)/2;
714  Y = (cgoArea.Hgt - rcBounds.Hgt)/2;
715  }
716  // Alignment
718  if (Alignment & C4MN_Align_Right) X=cgoArea.Wdt-2*C4SymbolSize-rcBounds.Wdt;
720  if (Alignment & C4MN_Align_Bottom) Y=cgoArea.Hgt-C4SymbolSize-rcBounds.Hgt;
721  if (Alignment & C4MN_Align_Free) { X=Clamp<int32_t>(X,0,cgoArea.Wdt-rcBounds.Wdt); Y=Clamp<int32_t>(Y,0,cgoArea.Hgt-rcBounds.Hgt); }
722  // Centered (due to small viewport size)
723  if (rcBounds.Wdt>cgoArea.Wdt-2*C4SymbolSize) X=(cgoArea.Wdt-rcBounds.Wdt)/2;
724  if (rcBounds.Hgt>cgoArea.Hgt-2*C4SymbolSize) Y=(cgoArea.Hgt-rcBounds.Hgt)/2;
725  SetPos(X, Y);
726 
727  // Position initialized: Make it visible to be used!
728  SetVisibility(true);
729 
730  // now align all menu items correctly
732 
733  // and correct scroll pos
734  UpdateScrollBar();
735  AdjustPosition();
736 }
const char * getData() const
Definition: StdBuf.h:442
int32_t ItemHeight
Definition: C4Menu.h:139
int GetLineHeight() const
Definition: C4FontLoader.h:125
void SetPos(int32_t iXPos, int32_t iYPos)
Definition: C4Gui.h:860
const int32_t C4MN_DlgWdt
Definition: C4Menu.cpp:36
int32_t Style
Definition: C4Menu.h:136
int32_t ItemWidth
Definition: C4Menu.h:139
int32_t Alignment
Definition: C4Menu.h:144
bool GetTextExtent(const char *szText, int32_t &rsx, int32_t &rsy, bool fCheckMarkup=true)
C4GraphicsResource GraphicsResource
int32_t Wdt
Definition: C4Rect.h:30
int32_t ItemCount
Definition: C4Menu.h:138
int32_t y
Definition: C4Rect.h:30
C4Rect rcBounds
Definition: C4Gui.h:385
const int32_t C4MN_DefInfoWdt
Definition: C4Menu.cpp:35
void UpdateScrollBar()
Definition: C4Menu.cpp:766
const int32_t C4MN_DlgPortraitIndent
Definition: C4Menu.cpp:41
const int32_t C4MN_DlgLines
Definition: C4Menu.cpp:37
std::tuple< std::string, int > BreakMessage(const char *szMsg, int iWdt, bool fCheckMarkup, float fZoom=1.0f)
C4MenuItem * GetItem(int32_t iIndex)
Definition: C4Menu.cpp:512
void AdjustPosition()
Definition: C4Menu.cpp:588
int32_t x
Definition: C4Rect.h:30
const int C4PictureSize
Definition: C4Constants.h:60
char InfoCaption[2 *C4MaxTitle+1]
Definition: C4Menu.h:74
bool HasPortrait()
Definition: C4Menu.h:242
const int C4SymbolSize
Definition: C4Constants.h:58
void InitSize()
Definition: C4Menu.cpp:739
void SetVisibility(bool fToValue) override
int32_t Columns
Definition: C4Menu.h:142
#define X(sdl, oc)
const int32_t C4MN_DlgPortraitWdt
Definition: C4Menu.cpp:40
int32_t Hgt
Definition: C4Rect.h:30
void UpdateElementPositions()
Definition: C4Menu.cpp:1003
char Caption[C4MaxTitle+1]
Definition: C4Menu.h:147
int32_t Lines
Definition: C4Menu.h:143
char Caption[C4MaxTitle+1]
Definition: C4Menu.h:71

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4ObjectMenu::InitRefSym ( const C4TargetFacet fctSymbol,
const char *  szEmpty,
C4Object pObject,
int32_t  iExtra = C4MN_Extra_None,
int32_t  iExtraData = 0,
int32_t  iId = 0,
int32_t  iStyle = C4MN_Style_Normal,
bool  fUserMenu = false 
)

Definition at line 88 of file C4ObjectMenu.cpp.

References C4Menu::DoInitRefSym(), and LocalInit().

89 {
90  if (!DoInitRefSym(fctSymbol, szEmpty, iExtra, iExtraData, iId, iStyle)) return false;
91  LocalInit(pObject, fUserMenu);
92  return true;
93 }
bool DoInitRefSym(const C4Facet &fctSymbol, const char *szEmpty, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal)
Definition: C4Menu.cpp:307
void LocalInit(C4Object *pObject, bool fUserMenu)

Here is the call graph for this function:

void C4Menu::InitSize ( )
protectedinherited

Definition at line 739 of file C4Menu.cpp.

References C4GUI_ScrollBarWdt, C4MN_DlgLineMargin, C4MN_DlgPortraitIndent, C4MN_DlgPortraitWdt, C4MN_Style_Dialog, C4Menu::Columns, C4GUI::Element::GetBounds(), C4GUI::Container::GetLast(), C4Menu::GetMarginBottom(), C4GUI::Window::GetMarginBottom(), C4Menu::GetMarginLeft(), C4GUI::Window::GetMarginLeft(), C4Menu::GetMarginRight(), C4GUI::Window::GetMarginRight(), C4GUI::Window::GetMarginTop(), C4GUI::Dialog::GetMarginTop(), C4Menu::HasPortrait(), C4Rect::Hgt, C4Menu::ItemHeight, C4Menu::ItemWidth, C4Menu::Lines, C4Menu::pClientWindow, C4GUI::Container::pLast, C4GUI::Element::rcBounds, C4GUI::Element::SetBounds(), C4GUI::ScrollWindow::SetScrollBarEnabled(), C4Menu::Style, C4Menu::UpdateOwnPos(), C4Menu::VisibleCount, C4Rect::x, and C4Rect::y.

Referenced by C4Menu::InitLocation(), C4Menu::SetSize(), and C4Menu::UpdateScrollBar().

740 {
742  // Size calculation
743  int Width, Height;
744  Width=Columns*ItemWidth;
745  Height=Lines*ItemHeight;
747  bool fBarNeeded;
749  // dialogs have auto-enlarge vertically
750  if (pLast && Style == C4MN_Style_Dialog)
751  {
752  Height = std::max<int>(Height, pLast->GetBounds().y + pLast->GetBounds().Hgt + C4MN_DlgLineMargin);
753  fBarNeeded = false;
754  }
755  else
756  fBarNeeded = pLast && pLast->GetBounds().y + pLast->GetBounds().Hgt > pClientWindow->GetBounds().Hgt;
757  // add dlg margins
760  if (fBarNeeded) Width += C4GUI_ScrollBarWdt;
761  SetBounds(C4Rect(rcBounds.x, rcBounds.y, Width, Height));
762  pClientWindow->SetScrollBarEnabled(fBarNeeded);
763  UpdateOwnPos();
764 }
int32_t ItemHeight
Definition: C4Menu.h:139
int32_t GetMarginRight() override
Definition: C4Menu.h:260
const int32_t C4MN_DlgLineMargin
Definition: C4Menu.cpp:38
int32_t Style
Definition: C4Menu.h:136
int32_t ItemWidth
Definition: C4Menu.h:139
Element * pLast
Definition: C4Gui.h:750
Definition: C4Rect.h:27
C4GUI::ScrollWindow * pClientWindow
Definition: C4Menu.h:149
int32_t GetMarginLeft() override
Definition: C4Menu.h:259
virtual int32_t GetMarginTop()
Definition: C4Gui.h:873
int32_t GetMarginTop() override
Definition: C4Gui.h:2140
int32_t y
Definition: C4Rect.h:30
int32_t GetMarginBottom() override
Definition: C4Menu.h:258
C4Rect rcBounds
Definition: C4Gui.h:385
void SetScrollBarEnabled(bool fToVal, bool noAutomaticPositioning=false)
virtual int32_t GetMarginRight()
Definition: C4Gui.h:875
const int32_t C4MN_DlgPortraitIndent
Definition: C4Menu.cpp:41
virtual int32_t GetMarginLeft()
Definition: C4Gui.h:874
C4Rect & GetBounds()
Definition: C4Gui.h:445
int32_t x
Definition: C4Rect.h:30
bool HasPortrait()
Definition: C4Menu.h:242
void SetBounds(const C4Rect &rcNewBound)
Definition: C4Gui.h:446
int32_t Columns
Definition: C4Menu.h:142
Element * GetLast()
Definition: C4Gui.h:830
int32_t VisibleCount
Definition: C4Menu.h:145
void UpdateOwnPos() override
Definition: C4Menu.cpp:1108
#define C4GUI_ScrollBarWdt
Definition: C4Gui.h:103
const int32_t C4MN_DlgPortraitWdt
Definition: C4Menu.cpp:40
int32_t Hgt
Definition: C4Rect.h:30
int32_t Lines
Definition: C4Menu.h:143
virtual int32_t GetMarginBottom()
Definition: C4Gui.h:876

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 150 of file C4GuiContainers.cpp.

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

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  }
Element * pFirst
Definition: C4Gui.h:750
void AddElement(Element *pChild)
Element * pPrev
Definition: C4Gui.h:377
Container * pParent
Definition: C4Gui.h:376
Element * pNext
Definition: C4Gui.h:377

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::IsAborted ( )
inlineinherited

Definition at line 2149 of file C4Gui.h.

References C4GUI::Dialog::fOK.

Referenced by C4Network2::DoLobby(), C4Network2::FinalInit(), and C4Network2::RetrieveRes().

2149 { return !fShow && !fOK; } // returns whether dialog has been aborted
bool fShow
Definition: C4Gui.h:2081
bool fOK
Definition: C4Gui.h:2082

Here is the caller graph for this function:

bool C4Menu::IsActive ( )
inherited
bool C4GUI::Dialog::IsActive ( bool  fForKeyboard)
inherited

Definition at line 699 of file C4GuiDialogs.cpp.

References C4GUI::Element::GetScreen(), C4GUI::Screen::HasContext(), C4GUI::Screen::IsExclusive(), C4GUI::Dialog::IsFading(), C4GUI::Dialog::IsShown(), and C4GUI::Screen::pActiveDlg.

Referenced by C4GUI::Control::HasDrawFocus(), C4GUI::Element::IsInActiveDlg(), and C4StartupNetDlg::OnSec1Timer().

700  {
701  // must be fully visible
702  if (!IsShown() || IsFading()) return false;
703  // screen-less dialogs are always inactive (not yet added)
704  Screen *pScreen = GetScreen();
705  if (!pScreen) return false;
706  // no keyboard focus if screen is in context mode
707  if (fForKeyboard && pScreen->HasContext()) return false;
708  // always okay in shared mode: all dlgs accessible by mouse
709  if (!pScreen->IsExclusive() && !fForKeyboard) return true;
710  // exclusive mode or keyboard input: Only one dlg active
711  return pScreen->pActiveDlg == this;
712  }
bool IsShown()
Definition: C4Gui.h:2147
bool IsFading()
Definition: C4Gui.h:2151
friend class Screen
Definition: C4Gui.h:2216
virtual Screen * GetScreen()
Definition: C4Gui.cpp:289

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool C4GUI::Dialog::IsBottomPlacementDialog ( )
inlinevirtualinherited

Reimplemented in C4ChatInputDialog.

Definition at line 2161 of file C4Gui.h.

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

2161 { return false; }

Here is the caller graph for this function:

bool C4ObjectMenu::IsCloseDenied ( )
overrideprotectedvirtual

Reimplemented from C4Menu.

Definition at line 52 of file C4ObjectMenu.cpp.

References C4PropList::Call(), C4GameScriptHost::Call(), CB_Object, CB_Scenario, CloseQuerying, eCallbackType, GameScript, Object, ParentObject, PSF_MenuQueryCancel, C4Menu::Selection, and UserMenu.

53 {
54  // abort if menu is permanented by script; stop endless recursive calls if user opens a new menu by CloseQuerying-flag
55  if (UserMenu && !CloseQuerying)
56  {
57  CloseQuerying = true;
58  bool fResult = false;
60  if (eCallbackType == CB_Object)
61  {
62  if (Object) fResult = !!Object->Call(PSF_MenuQueryCancel, &pars);
63  }
64  else if (eCallbackType == CB_Scenario)
65  fResult = !!::GameScript.Call(PSF_MenuQueryCancel, &pars);
66  CloseQuerying = false;
67  if (fResult) return true;
68  }
69  // close OK
70  return false;
71 }
int32_t Selection
Definition: C4Menu.h:137
bool CloseQuerying
Definition: C4ObjectMenu.h:62
C4GameScriptHost GameScript
C4Value Call(const char *szFunction, C4AulParSet *pPars=nullptr, bool fPassError=false)
CallbackType eCallbackType
Definition: C4ObjectMenu.h:60
#define PSF_MenuQueryCancel
Definition: C4GameScript.h:83
C4Object * Object
Definition: C4ObjectMenu.h:56
C4Object * ParentObject
Definition: C4ObjectMenu.h:57
C4Value Call(C4PropertyName k, C4AulParSet *pPars=nullptr, bool fPassErrors=false)
Definition: C4PropList.h:110

Here is the call graph for this function:

bool C4ObjectMenu::IsCloseQuerying ( ) const
inline

Definition at line 74 of file C4ObjectMenu.h.

References CloseQuerying.

Referenced by C4Object::CloseMenu().

74 { return !!CloseQuerying; }
bool CloseQuerying
Definition: C4ObjectMenu.h:62

Here is the caller graph for this function:

bool C4GUI::Dialog::IsComponentOutsideClientArea ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Window.

Reimplemented in C4GUI::FullscreenDialog, and C4StartupPlrPropertiesDlg.

Definition at line 2105 of file C4Gui.h.

References C4GUI::Dialog::pTitle.

2105 { return !!pTitle; } // pTitle lies outside client area
WoodenLabel * pTitle
Definition: C4Gui.h:2078
bool C4Menu::IsContextMenu ( )
inlineinherited

Definition at line 164 of file C4Menu.h.

References C4MN_Style_Context.

Referenced by C4Object::DirectComContents(), and C4Menu::RefillInternal().

164 { return Style == C4MN_Style_Context; }
int32_t Style
Definition: C4Menu.h:136

Here is the caller graph for this function:

virtual bool C4GUI::Dialog::IsExclusiveDialog ( )
inlinevirtualinherited

Reimplemented in C4ChatDlg, C4GameOverDlg, C4ChatInputDialog, and C4AbortGameDialog.

Definition at line 2164 of file C4Gui.h.

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

2164 { return false; }

Here is the caller graph for this function:

bool C4Menu::IsExternalDrawDialog ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 247 of file C4Menu.h.

247 { return true; } // drawn by viewport drawing proc
bool C4GUI::Dialog::IsFading ( )
inlineinherited

Definition at line 2151 of file C4Gui.h.

Referenced by C4GUI::Screen::CloseDialog(), C4GUI::Screen::GetFullscreenDialog(), C4GUI::Dialog::IsActive(), C4GUI::Screen::MouseInput(), and C4GUI::Screen::RecheckActiveDialog().

2151 { return eFade != eFadeNone; }
Fade eFade
Definition: C4Gui.h:2084

Here is the caller graph for this function:

bool C4GUI::Dialog::IsFocused ( Control pCtrl)
inlineoverridevirtualinherited

Reimplemented from C4GUI::Container.

Definition at line 2113 of file C4Gui.h.

References C4GUI::Dialog::pActiveCtrl.

Referenced by C4GameLobby::MainDlg::KeyHistoryUpDown().

2113 { return pCtrl == pActiveCtrl; }
Control * pActiveCtrl
Definition: C4Gui.h:2080

Here is the caller graph for this function:

virtual Control* C4GUI::Element::IsFocusElement ( )
inlinevirtualinherited

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

Definition at line 432 of file C4Gui.h.

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

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

Here is the caller graph for this function:

virtual bool C4GUI::Dialog::IsFreePlaceDialog ( )
inlinevirtualinherited

Reimplemented in C4ChatDlg, C4GameOverDlg, C4ChatInputDialog, and C4AbortGameDialog.

Definition at line 2158 of file C4Gui.h.

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

2158 { return false; }

Here is the caller graph for this function:

virtual bool C4GUI::Dialog::IsFullscreenDialog ( )
inlinevirtualinherited

Reimplemented in C4GUI::FullscreenDialog.

Definition at line 2153 of file C4Gui.h.

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

2153 { return false; }

Here is the caller graph for this function:

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

Definition at line 441 of file C4Gui.h.

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

441 { return is_immediate_tooltip; }

Here is the caller graph for this function:

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

Definition at line 435 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Definition at line 403 of file C4Gui.h.

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

403 { return false; }

Here is the caller graph for this function:

bool C4Menu::IsMouseControlled ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 248 of file C4Menu.h.

248 { return false; }
bool C4GUI::Dialog::IsOK ( )
inlineinherited

Definition at line 2148 of file C4Gui.h.

References C4GUI::Dialog::fOK.

2148 { return fOK; } // returns whether user pressed OK
bool fOK
Definition: C4Gui.h:2082
bool C4Menu::IsOwnPtrElement ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 254 of file C4Menu.h.

254 { return true; }
bool C4GUI::Container::IsParentOf ( Element pEl)
overridevirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 239 of file C4GuiContainers.cpp.

References C4GUI::Element::GetParent().

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

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  }

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4ObjectMenu::IsReadOnly ( )
overrideprotectedvirtual

Reimplemented from C4Menu.

Definition at line 270 of file C4ObjectMenu.cpp.

References CB_Object, CB_Scenario, eCallbackType, C4Player::Eliminated, C4Viewport::fIsNoOwnerViewport, C4PlayerList::Get(), C4MouseControl::GetPlayer(), C4Menu::GetViewport(), MouseControl, and Players.

271 {
272  // get viewport
273  C4Viewport *pVP = GetViewport();
274  if (!pVP) return false;
275  // is it an observer viewport?
276  if (pVP->fIsNoOwnerViewport)
277  // is this a synced menu?
279  // then don't control it!
280  return true;
281  // if the player is eliminated, do not control either!
282  if (!pVP->fIsNoOwnerViewport)
283  {
285  if (pPlr && pPlr->Eliminated) return true;
286  }
287  return false;
288 }
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
CallbackType eCallbackType
Definition: C4ObjectMenu.h:60
C4Player * Get(int iPlayer) const
int32_t GetPlayer()
bool fIsNoOwnerViewport
Definition: C4Viewport.h:43
C4PlayerList Players
C4Viewport * GetViewport() override
Definition: C4Menu.cpp:993
int32_t Eliminated
Definition: C4Player.h:83

Here is the call graph for this function:

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

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

Definition at line 837 of file C4Gui.h.

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

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

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
Container * pParent
Definition: C4Gui.h:376

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::IsShown ( )
inlineinherited

Definition at line 2147 of file C4Gui.h.

References C4GUI::Dialog::fShow.

Referenced by C4Network2::DoLobby(), C4Startup::DontStartup(), C4ScenarioListLoader::DoProcessCallback(), C4GUI::Dialog::FadeOut(), C4GUI::Screen::GetMouseControlledDialogCount(), C4GUI::Screen::GetTopDialog(), C4GUI::Dialog::IsActive(), C4GUI::Screen::MouseInput(), C4FileSelDlg::SetPath(), C4Startup::SwitchDialog(), and C4ChatDlg::ToggleChat().

2147 { return fShow; } // returns whether dlg is on screen (may be invisible)
bool fShow
Definition: C4Gui.h:2081

Here is the caller graph for this function:

bool C4Menu::IsTextProgressing ( ) const
inlineinherited

Definition at line 201 of file C4Menu.h.

References C4Menu::fTextProgressing.

201 { return fTextProgressing; }
bool fTextProgressing
Definition: C4Menu.h:151
bool C4GUI::Dialog::IsViewportDialog ( )
inlineinherited

Definition at line 2172 of file C4Gui.h.

References C4GUI::Dialog::fViewportDlg.

Referenced by C4GUI::Dialog::SetTitle(), C4GUI::Dialog::Show(), and C4GUI::Screen::ShowDialog().

2172 { return fViewportDlg; }
bool fViewportDlg
Definition: C4Gui.h:2087

Here is the caller graph for this function:

bool C4GUI::Element::IsVisible ( )
inherited

Definition at line 201 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::KeyAdvanceFocus ( bool  fBackwards)
inlineinherited

Definition at line 2138 of file C4Gui.h.

References C4GUI::Dialog::AdvanceFocus().

Referenced by C4StartupMainDlg::C4StartupMainDlg(), and C4GUI::Dialog::Dialog().

2138 { AdvanceFocus(fBackwards); return true; }
void AdvanceFocus(bool fBackwards)

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Menu::KeyControl ( BYTE  byCom)
inherited

Definition at line 473 of file C4Menu.cpp.

References C4Menu::Control(), and C4Menu::IsActive().

Referenced by C4FullScreen::MenuKeyControl().

474 {
475  // direct keyboard callback
476  if (!IsActive()) return false;
477  return !!Control(byCom, 0);
478 }
bool IsActive()
Definition: C4Menu.cpp:480
bool Control(BYTE byCom, int32_t iData)
Definition: C4Menu.cpp:420

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::KeyEnter ( )
inlineinherited

Definition at line 2133 of file C4Gui.h.

References C4GUI::Dialog::OnEnter().

Referenced by C4FileSelDlg::C4FileSelDlg(), and C4GUI::Dialog::Dialog().

2133 { return OnEnter(); }
virtual bool OnEnter()
Definition: C4Gui.h:2132

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::KeyEscape ( )
inlineinherited

Definition at line 2135 of file C4Gui.h.

References C4GUI::Dialog::OnEscape().

Referenced by C4ChatInputDialog::C4ChatInputDialog(), and C4GUI::Dialog::Dialog().

2135 { return OnEscape(); }
virtual bool OnEscape()
Definition: C4Gui.h:2134

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ObjectMenu::LocalInit ( C4Object pObject,
bool  fUserMenu 
)
protected

Definition at line 73 of file C4ObjectMenu.cpp.

References CB_Object, CB_Scenario, eCallbackType, GetParentObject(), Object, ParentObject, and UserMenu.

Referenced by Init(), and InitRefSym().

74 {
75  Object=pObject;
76  UserMenu=fUserMenu;
78  if (pObject) eCallbackType = CB_Object; else eCallbackType = CB_Scenario;
79 }
C4Object * GetParentObject() override
CallbackType eCallbackType
Definition: C4ObjectMenu.h:60
C4Object * Object
Definition: C4ObjectMenu.h:56
C4Object * ParentObject
Definition: C4ObjectMenu.h:57

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 106 of file C4GuiContainers.cpp.

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

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

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  }
Element * pLast
Definition: C4Gui.h:750
Element * pFirst
Definition: C4Gui.h:750
Element * pPrev
Definition: C4Gui.h:377
Element * pNext
Definition: C4Gui.h:377

Here is the caller graph for this function:

bool C4ObjectMenu::MenuCommand ( const char *  szCommand,
bool  fIsCloseCommand 
)
overrideprotectedvirtual

Reimplemented from C4Menu.

Definition at line 296 of file C4ObjectMenu.cpp.

References AulExec, CB_None, CB_Object, CB_Scenario, C4AulExec::DirectExec(), eCallbackType, C4Object::MenuCommand(), and Object.

297 {
298  switch (eCallbackType)
299  {
300  case CB_Object:
301  // Object menu
302  if (Object) Object->MenuCommand(szCommand);
303  break;
304 
305  case CB_Scenario:
306  // Object menu with scenario script callback
307  ::AulExec.DirectExec(nullptr, szCommand, "MenuCommand");
308  break;
309 
310  case CB_None:
311  // TODO
312  break;
313  }
314 
315  return true;
316 }
bool MenuCommand(const char *szCommand)
Definition: C4Object.cpp:2455
C4AulExec AulExec
Definition: C4AulExec.cpp:29
CallbackType eCallbackType
Definition: C4ObjectMenu.h:60
C4Object * Object
Definition: C4ObjectMenu.h:56
C4Value DirectExec(C4PropList *p, const char *szScript, const char *szContext, bool fPassErrors=false, C4AulScriptContext *context=nullptr, bool parse_function=false)
Definition: C4AulExec.cpp:1013

Here is the call graph for this function:

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

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

Definition at line 413 of file C4Gui.h.

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

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

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Window.

Definition at line 557 of file C4GuiDialogs.cpp.

References C4GUI::Window::MouseInput().

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

558  {
559  // inherited will do...
560  Window::MouseInput(rMouse, iButton, iX, iY, dwKeyParam);
561  }
void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented in C4GUI::ComboBox, C4GUI::ContextButton, C4GUI::ContextMenu::Entry, C4GUI::Tabular, C4GUI::CheckBox, C4GUI::Button, C4GUI::ScrollBar, and C4ScriptGuiWindow.

Definition at line 414 of file C4Gui.h.

Referenced by C4GUI::Screen::MouseInput(), C4GUI::ScrollBar::MouseLeave(), C4GUI::Button::MouseLeave(), C4GUI::CheckBox::MouseLeave(), C4GUI::Tabular::MouseLeave(), C4GUI::ContextButton::MouseLeave(), C4GUI::ComboBox::MouseLeave(), C4GUI::CMouse::ReleaseElements(), and C4GUI::CMouse::RemoveElement().

414 {}; // called when mouse cursor leaves element region

Here is the caller graph for this function:

bool C4Menu::MoveSelection ( int32_t  iBy,
bool  fAdjustPosition,
bool  fDoCalls 
)
inherited

Definition at line 522 of file C4Menu.cpp.

References C4Menu::GetItem(), C4MenuItem::IsSelectable, C4Menu::ItemCount, C4Menu::Selection, and C4Menu::SetSelection().

Referenced by C4Menu::Control().

523 {
524  if (!iBy) return false;
525  // find next item that can be selected by moving in iBy steps
526  int32_t iNewSel = Selection;
527  for (;;)
528  {
529  // determine new selection
530  iNewSel += iBy;
531  // selection is out of menu range
532  if (!Inside<int32_t>(iNewSel, 0, ItemCount-1)) return false;
533  // determine newly selected item
534  C4MenuItem *pNewSel = GetItem(iNewSel);
535  // nothing selectable
536  if (!pNewSel || !pNewSel->IsSelectable) continue;
537  // got something: go select it
538  break;
539  }
540  // select it
541  return !!SetSelection(iNewSel, fAdjustPosition, fDoCalls);
542 }
int32_t Selection
Definition: C4Menu.h:137
bool SetSelection(int32_t iSelection, bool fAdjustPosition, bool fDoCalls)
Definition: C4Menu.cpp:544
int32_t ItemCount
Definition: C4Menu.h:138
bool IsSelectable
Definition: C4Menu.h:88
C4MenuItem * GetItem(int32_t iIndex)
Definition: C4Menu.cpp:512

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Dialog::OnClosed ( bool  fOK)
virtualinherited

Reimplemented in C4GUI::InputDialog, C4GUI::ConfirmationDialog, C4StartupPlrColorPickerDlg, C4StartupScenSelDlg, C4StartupPlrPropertiesDlg, C4PortraitSelDlg, C4ChatDlg, C4StartupNetDlg, C4FileSelDlg, C4GameLobby::MainDlg, C4GameOverDlg, C4ChatInputDialog, C4StartupOptionsDlg, C4StartupMainDlg, and C4AbortGameDialog.

Definition at line 646 of file C4GuiDialogs.cpp.

References C4GUI::Dialog::DestroyConsoleWindow(), C4GUI::Dialog::fDelOnClose, and C4GUI::Dialog::pWindow.

Referenced by C4GUI::Dialog::Close(), C4GUI::Dialog::FadeOut(), C4StartupOptionsDlg::OnClosed(), C4FileSelDlg::OnClosed(), C4GUI::ConfirmationDialog::OnClosed(), and C4GUI::InputDialog::OnClosed().

647  {
648  // developer mode: Remove window
650  // delete when closing?
651  if (fDelOnClose)
652  {
653  fDelOnClose=false;
654  delete this;
655  }
656  }
void DestroyConsoleWindow()
DialogWindow * pWindow
Definition: C4Gui.h:2088
bool fDelOnClose
Definition: C4Gui.h:2085

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool C4GUI::Dialog::OnEnter ( )
inlinevirtualinherited

Reimplemented in C4GUI::ProgressDialog, C4GUI::MessageDialog, C4GUI::FullscreenDialog, C4StartupScenSelDlg, C4StartupPlrSelDlg, C4StartupNetDlg, C4ChatInputDialog, C4GameOverDlg, C4StartupOptionsDlg, and C4StartupAboutDlg.

Definition at line 2132 of file C4Gui.h.

References C4GUI::Dialog::UserClose().

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

2132 { UserClose(true); return true; }
virtual void UserClose(bool fOK)
Definition: C4Gui.h:2206

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool C4GUI::Dialog::OnEscape ( )
inlinevirtualinherited

Reimplemented in C4StartupScenSelDlg, C4StartupPlrSelDlg, C4StartupNetDlg, C4GameOverDlg, C4StartupOptionsDlg, and C4StartupAboutDlg.

Definition at line 2134 of file C4Gui.h.

References C4GUI::Dialog::UserClose().

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

2134 { UserClose(false); return true; }
virtual void UserClose(bool fOK)
Definition: C4Gui.h:2206

Here is the call graph for this function:

Here is the caller graph for this function:

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.

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

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  }
bool IsVisible()
Definition: C4Gui.cpp:201
Element * pFirst
Definition: C4Gui.h:750
Element * pNext
Definition: C4Gui.h:377

Here is the call graph for this function:

virtual void C4GUI::Dialog::OnIdle ( )
inlinevirtualinherited

Reimplemented in C4PortraitSelDlg, and C4DownloadDlg.

Definition at line 2209 of file C4Gui.h.

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

2209 {} // idle proc in DoModal

Here is the caller graph for this function:

void C4ObjectMenu::OnSelectionChanged ( int32_t  iNewSelection)
overrideprotectedvirtual

Reimplemented from C4Menu.

Definition at line 95 of file C4ObjectMenu.cpp.

References C4PropList::Call(), C4GameScriptHost::Call(), CB_Object, CB_Scenario, eCallbackType, GameScript, Object, ParentObject, PSF_MenuSelection, and UserMenu.

96 {
97  // do selection callback
98  if (UserMenu)
99  {
100  C4AulParSet pars(iNewSelection, ParentObject);
101  if (eCallbackType == CB_Object && Object)
102  Object->Call(PSF_MenuSelection, &pars);
103  else if (eCallbackType == CB_Scenario)
105  }
106 }
C4GameScriptHost GameScript
C4Value Call(const char *szFunction, C4AulParSet *pPars=nullptr, bool fPassError=false)
CallbackType eCallbackType
Definition: C4ObjectMenu.h:60
#define PSF_MenuSelection
Definition: C4GameScript.h:139
C4Object * Object
Definition: C4ObjectMenu.h:56
C4Object * ParentObject
Definition: C4ObjectMenu.h:57
C4Value Call(C4PropertyName k, C4AulParSet *pPars=nullptr, bool fPassErrors=false)
Definition: C4PropList.h:110

Here is the call graph for this function:

virtual void C4GUI::Dialog::OnShown ( )
inlinevirtualinherited

Reimplemented in C4StartupScenSelDlg, C4ChatDlg, C4DefinitionSelDlg, C4StartupNetDlg, C4FileSelDlg, C4GameOverDlg, C4StartupMainDlg, and C4AbortGameDialog.

Definition at line 2208 of file C4Gui.h.

Referenced by C4GUI::Dialog::FadeIn(), C4FileSelDlg::OnShown(), C4StartupNetDlg::OnShown(), C4StartupScenSelDlg::OnShown(), and C4GUI::Dialog::Show().

2208 {} // callback when shown - should not delete the dialog

Here is the caller graph for this function:

void C4ObjectMenu::OnUserClose ( )
overrideprotectedvirtual

Reimplemented from C4Menu.

Definition at line 264 of file C4ObjectMenu.cpp.

References C4Control::Add(), CID_PlrControl, C4PlayerControlDefs::CInternalCons::CON_ObjectMenuCancel, Game, C4MouseControl::GetPlayer(), C4Game::Input, C4PlayerControlDefs::InternalCons, MouseControl, and C4Game::PlayerControlDefs.

265 {
266  // Queue 2do
268 }
C4Game Game
Definition: C4Globals.cpp:52
struct C4PlayerControlDefs::CInternalCons InternalCons
void Add(C4PacketType eType, C4ControlPacket *pCtrl)
Definition: C4Control.h:82
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
int32_t GetPlayer()
C4PlayerControlDefs PlayerControlDefs
Definition: C4Game.h:92
C4Control & Input
Definition: C4Game.h:82

Here is the call graph for this function:

void C4GUI::Dialog::OnUserClose ( C4GUI::Control btn)
inlineinherited

Definition at line 2204 of file C4Gui.h.

References C4GUI::Dialog::UserClose().

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

2205  { UserClose(false); }
virtual void UserClose(bool fOK)
Definition: C4Gui.h:2206

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ObjectMenu::OnUserEnter ( int32_t  Player,
int32_t  iIndex,
bool  fRight 
)
overrideprotectedvirtual

Reimplemented from C4Menu.

Definition at line 258 of file C4ObjectMenu.cpp.

References C4Control::Add(), CID_PlrControl, C4PlayerControlDefs::CInternalCons::CON_ObjectMenuOK, C4PlayerControlDefs::CInternalCons::CON_ObjectMenuOKAll, Game, C4Game::Input, C4PlayerControlDefs::InternalCons, and C4Game::PlayerControlDefs.

259 {
260  // object menu: Through queue 2do
262 }
C4Game Game
Definition: C4Globals.cpp:52
struct C4PlayerControlDefs::CInternalCons InternalCons
void Add(C4PacketType eType, C4ControlPacket *pCtrl)
Definition: C4Control.h:82
C4PlayerControlDefs PlayerControlDefs
Definition: C4Game.h:92
C4Control & Input
Definition: C4Game.h:82

Here is the call graph for this function:

void C4ObjectMenu::OnUserSelectItem ( int32_t  Player,
int32_t  iIndex 
)
overrideprotectedvirtual

Reimplemented from C4Menu.

Definition at line 252 of file C4ObjectMenu.cpp.

References C4Control::Add(), C4MN_AdjustPosition, CID_PlrControl, C4PlayerControlDefs::CInternalCons::CON_ObjectMenuSelect, Game, C4Game::Input, C4PlayerControlDefs::InternalCons, and C4Game::PlayerControlDefs.

253 {
254  // queue.... 2do
256 }
C4Game Game
Definition: C4Globals.cpp:52
struct C4PlayerControlDefs::CInternalCons InternalCons
void Add(C4PacketType eType, C4ControlPacket *pCtrl)
Definition: C4Control.h:82
C4PlayerControlDefs PlayerControlDefs
Definition: C4Game.h:92
C4Control & Input
Definition: C4Game.h:82

Here is the call graph for this function:

ReverseIterator C4GUI::Container::rbegin ( )
inlineinherited

Definition at line 826 of file C4Gui.h.

Referenced by C4ScriptGuiWindow::MouseInput(), and C4ScriptGuiWindow::ProcessMouseInput().

826 { return ReverseIterator(pLast); }
Element * pLast
Definition: C4Gui.h:750

Here is the caller graph for this function:

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

Definition at line 134 of file C4GuiContainers.cpp.

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

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

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  }
Element * pLast
Definition: C4Gui.h:750
Element * pFirst
Definition: C4Gui.h:750
Element * pPrev
Definition: C4Gui.h:377
Element * pNext
Definition: C4Gui.h:377

Here is the caller graph for this function:

bool C4Menu::Refill ( )
inherited

Definition at line 915 of file C4Menu.cpp.

References C4GUI::Dialog::Close(), C4Menu::IsActive(), and C4Menu::RefillInternal().

Referenced by C4MainMenu::ActivateHostility(), C4Player::ActivateMenuTeamSelection(), C4MainMenu::ActivateObserver(), C4Object::DirectComContents(), and SetRefillObject().

916 {
917  if (!IsActive()) return false;
918  // Refill (close if failure)
919  if (!RefillInternal())
920  { Close(false); return false; }
921  // Success
922  return true;
923 }
bool RefillInternal()
Definition: C4Menu.cpp:867
void Close(bool fOK)
bool IsActive()
Definition: C4Menu.cpp:480

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Menu::RefillInternal ( )
protectedinherited

Definition at line 867 of file C4Menu.cpp.

References C4Menu::AdjustSelection(), C4Menu::DoRefillInternal(), C4GUI::ScrollWindow::Freeze(), C4Menu::IsContextMenu(), C4Menu::ItemCount, C4Menu::LocationSet, C4Menu::NeedRefill, C4Menu::pClientWindow, C4GUI::ScrollWindow::UnFreeze(), and C4Menu::UpdateElementPositions().

Referenced by C4Menu::Execute(), and C4Menu::Refill().

868 {
869  // Reset flag
870  NeedRefill=false;
871 
872  // do the refill in frozen window (no scrolling update)
873  int32_t iLastItemCount=ItemCount;
874  bool fRefilled = false;
876  bool fSuccess = DoRefillInternal(fRefilled);
879  if (!fSuccess) return false;
880 
881  // menu contents may have changed: Adjust menu size and selection
882  if (fRefilled)
883  {
884  // Adjust selection
885  AdjustSelection();
886  // Item count increased: resize
887  if (ItemCount > iLastItemCount) LocationSet = false;
888  // Item count decreased: resize if we are a context menu
889  if ((ItemCount < iLastItemCount) && IsContextMenu()) LocationSet = false;
890  }
891  // Success
892  return true;
893 }
bool IsContextMenu()
Definition: C4Menu.h:164
void UnFreeze()
Definition: C4Gui.h:970
C4GUI::ScrollWindow * pClientWindow
Definition: C4Menu.h:149
bool LocationSet
Definition: C4Menu.h:133
virtual bool DoRefillInternal(bool &rfRefilled)
Definition: C4Menu.h:230
int32_t ItemCount
Definition: C4Menu.h:138
void AdjustSelection()
Definition: C4Menu.cpp:925
bool NeedRefill
Definition: C4Menu.h:135
void UpdateElementPositions()
Definition: C4Menu.cpp:1003

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Container.

Definition at line 427 of file C4GuiDialogs.cpp.

References C4GUI::Dialog::pActiveCtrl, and C4GUI::Container::RemoveElement().

428  {
429  // inherited
430  Window::RemoveElement(pChild);
431  // clear ptr
432  if (pChild == pActiveCtrl) pActiveCtrl = nullptr;
433  }
Control * pActiveCtrl
Definition: C4Gui.h:2080
void RemoveElement(Element *pChild) override

Here is the call graph for this function:

ReverseIterator C4GUI::Container::rend ( )
inlineinherited

Definition at line 827 of file C4Gui.h.

Referenced by C4ScriptGuiWindow::MouseInput(), and C4ScriptGuiWindow::ProcessMouseInput().

827 { return ReverseIterator(nullptr); }

Here is the caller graph for this function:

void C4Menu::ResetLocation ( )
inlineinherited

Definition at line 195 of file C4Menu.h.

Referenced by C4Viewport::DrawMenu().

195 { LocationSet = false; }
bool LocationSet
Definition: C4Menu.h:133

Here is the caller graph for this function:

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

Definition at line 218 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Menu::SetAlignment ( int32_t  iAlignment)
inherited