OpenClonk
C4MainMenu Class Reference

#include <C4MainMenu.h>

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

Public Member Functions

 C4MainMenu ()
 
void Default () override
 
bool Init (C4FacetSurface &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal)
 
bool InitRefSym (const C4Facet &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal)
 
bool ActivateMain (int32_t iPlayer)
 
bool ActivateNewPlayer (int32_t iPlayer)
 
bool ActivateHostility (int32_t iPlayer)
 
bool ActivateGoals (int32_t iPlayer, bool fDoActivate)
 
bool ActivateRules (int32_t iPlayer)
 
bool ActivateSavegame (int32_t iPlayer)
 
bool ActivateHost (int32_t iPlayer)
 
bool ActivateClient (int32_t iPlayer)
 
bool ActivateOptions (int32_t iPlayer, int32_t selection=0)
 
bool ActivateDisplay (int32_t iPlayer, int32_t selection=0)
 
bool ActivateSurrender (int32_t iPlayer)
 
bool ActivateObserver ()
 
bool ActivateCommand (int32_t iPlayer, const char *szCommand)
 
void Clear ()
 
void ClearPointers (C4Object *pObj)
 
bool Refill ()
 
void Execute ()
 
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)
 
virtual C4ObjectGetParentObject ()
 
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

bool MenuCommand (const char *szCommand, bool fIsCloseCommand) override
 
bool DoRefillInternal (bool &rfRefilled) override
 
void OnSelectionChanged (int32_t iNewSelection) 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 ()
 
virtual bool IsCloseDenied ()
 
virtual bool IsReadOnly ()
 
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

int32_t Player
 
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 33 of file C4MainMenu.h.

Constructor & Destructor Documentation

◆ C4MainMenu()

C4MainMenu::C4MainMenu ( )

Definition at line 38 of file C4MainMenu.cpp.

38  : C4Menu() // will be re-adjusted later
39 {
40  Clear();
41 }
C4Menu()
Definition: C4Menu.cpp:237
void Clear()
Definition: C4Menu.cpp:271

References C4Menu::Clear().

Here is the call graph for this function:

Member Function Documentation

◆ ActivateClient()

bool C4MainMenu::ActivateClient ( int32_t  iPlayer)

Definition at line 490 of file C4MainMenu.cpp.

491 {
492  // Menu symbol/init
493  C4FacetSurface fctSymbol;
494  InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_Disconnect), LoadResStr("IDS_MENU_DISCONNECTFROMSERVER"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context);
496  fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctOKCancel.Draw(fctSymbol,true,3,0);
497  Add(LoadResStr("IDS_BTN_YES"), fctSymbol, "Part");
498  fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctOKCancel.Draw(fctSymbol,true,1,0);
499  Add(LoadResStr("IDS_BTN_NO"), fctSymbol, "");
500  SetCloseCommand("ActivateMenu:Main");
501  return true;
502 }
const int C4SymbolSize
Definition: C4Constants.h:58
#define GfxR
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
@ C4MN_Extra_None
Definition: C4Menu.h:44
@ C4MN_Style_Context
Definition: C4Menu.h:36
@ C4MN_Align_Left
Definition: C4Menu.h:50
@ C4MN_Align_Bottom
Definition: C4Menu.h:53
bool Create(int iWdt, int iHgt, int iWdt2=C4FCT_Full, int iHgt2=C4FCT_Full)
Definition: C4FacetEx.cpp:54
static C4Facet GetIconFacet(Icons icoIconIndex)
bool InitRefSym(const C4Facet &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal)
Definition: C4MainMenu.cpp:56
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
void SetAlignment(int32_t iAlignment)
Definition: C4Menu.cpp:857
void SetCloseCommand(const char *strCommand)
Definition: C4Menu.cpp:1144
@ Ico_Disconnect
Definition: C4Gui.h:693

References C4Menu::Add(), C4MN_Align_Bottom, C4MN_Align_Left, C4MN_Extra_None, C4MN_Style_Context, C4SymbolSize, C4FacetSurface::Create(), C4GUI::Icon::GetIconFacet(), GfxR, C4GUI::Ico_Disconnect, InitRefSym(), LoadResStr(), C4Menu::SetAlignment(), and C4Menu::SetCloseCommand().

Referenced by MenuCommand().

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

◆ ActivateCommand()

bool C4MainMenu::ActivateCommand ( int32_t  iPlayer,
const char *  szCommand 
)

Definition at line 865 of file C4MainMenu.cpp.

866 {
867  // init menu for player and activate with command
868  Player = iPlayer;
869  return MenuCommand(szCommand, false);
870 }
int32_t Player
Definition: C4MainMenu.h:41
bool MenuCommand(const char *szCommand, bool fIsCloseCommand) override
Definition: C4MainMenu.cpp:653

References MenuCommand(), and Player.

Here is the call graph for this function:

◆ ActivateDisplay()

bool C4MainMenu::ActivateDisplay ( int32_t  iPlayer,
int32_t  selection = 0 
)

Definition at line 537 of file C4MainMenu.cpp.

538 {
539  // Menu symbol/init
540  InitRefSym(GfxR->fctMenu.GetPhase(8), LoadResStr("IDS_MENU_DISPLAY"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context);
542  SetPermanent(true);
543  // Crew player names
544  AddRefSym(LoadResStr("IDS_MNU_PLAYERNAMES"), GfxR->fctOptions.GetPhase(7 + Config.Graphics.ShowCrewNames), "Display:PlayerNames", C4MN_Item_NoCount, nullptr, LoadResStr("IDS_MENU_PLAYERNAMES_DESC"));
545  // Crew clonk names
546  AddRefSym(LoadResStr("IDS_MNU_CLONKNAMES"), GfxR->fctOptions.GetPhase(9 + Config.Graphics.ShowCrewCNames), "Display:ClonkNames", C4MN_Item_NoCount, nullptr, LoadResStr("IDS_MENU_CLONKNAMES_DESC"));
547  // Upper Board
548  if (!Application.isEditor)
549  {
550  AddRefSym(LoadResStr("IDS_MNU_UPPERBOARD"),GfxR->fctOptions.GetPhase(3 + Config.Graphics.UpperBoard),"Display:UpperBoard",C4MN_Item_NoCount);
551  }
552  // FPS
553  if (!Application.isEditor)
554  AddRefSym(LoadResStr("IDS_MNU_FPS"), GfxR->fctOptions.GetPhase(5 + Config.General.FPS), "Display:FPS", C4MN_Item_NoCount);
555  // Clock
556  if (!Application.isEditor)
557  AddRefSym(LoadResStr("IDS_MNU_CLOCK"), GfxR->fctOptions.GetPhase(15 + Config.Graphics.ShowClock), "Display:Clock", C4MN_Item_NoCount);
558  // Restore selection
559  SetSelection(selection, false, true);
560  // Go back to options menu on close
561  SetCloseCommand("ActivateMenu:Options");
562  // Done
563  return true;
564 }
C4Config Config
Definition: C4Config.cpp:930
C4Application Application
Definition: C4Globals.cpp:44
@ C4MN_Item_NoCount
Definition: C4Menu.h:58
int32_t FPS
Definition: C4Config.h:48
int32_t UpperBoard
Definition: C4Config.h:102
int32_t ShowCrewNames
Definition: C4Config.h:108
int32_t ShowCrewCNames
Definition: C4Config.h:109
int32_t ShowClock
Definition: C4Config.h:103
C4ConfigGeneral General
Definition: C4Config.h:255
C4ConfigGraphics Graphics
Definition: C4Config.h:257
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)
Definition: C4Menu.cpp:337
void SetPermanent(bool fPermanent)
Definition: C4Menu.cpp:862
bool SetSelection(int32_t iSelection, bool fAdjustPosition, bool fDoCalls)
Definition: C4Menu.cpp:544

References C4Menu::AddRefSym(), Application, C4MN_Align_Bottom, C4MN_Align_Left, C4MN_Extra_None, C4MN_Item_NoCount, C4MN_Style_Context, Config, C4ConfigGeneral::FPS, C4Config::General, GfxR, C4Config::Graphics, InitRefSym(), C4Application::isEditor, LoadResStr(), C4Menu::SetAlignment(), C4Menu::SetCloseCommand(), C4Menu::SetPermanent(), C4Menu::SetSelection(), C4ConfigGraphics::ShowClock, C4ConfigGraphics::ShowCrewCNames, C4ConfigGraphics::ShowCrewNames, and C4ConfigGraphics::UpperBoard.

Referenced by MenuCommand().

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

◆ ActivateGoals()

bool C4MainMenu::ActivateGoals ( int32_t  iPlayer,
bool  fDoActivate 
)

Definition at line 304 of file C4MainMenu.cpp.

305 {
306  C4FacetSurface fctSymbol;
307  C4Facet fctGF; // goal fulfilled facet
308 
309  if (fDoActivate)
310  {
311  // Menu symbol/init
312  InitRefSym(GfxR->fctMenu.GetPhase(4),LoadResStr("IDS_MENU_CPGOALS"),iPlayer);
314  SetPermanent(false);
316  }
317  // determine if the goals are fulfilled - do the calls even if the menu is not to be opened to ensure synchronization
318  C4IDList GoalList, FulfilledGoalList;
319  C4RoundResults::EvaluateGoals(GoalList, FulfilledGoalList, iPlayer);
320  // Add Items
321  if (fDoActivate)
322  {
323  int32_t iNumGoals = GoalList.GetNumberOfIDs(), cnt;
324  C4ID idGoal; C4Def *pDef;
325  for (int32_t i=0; i<iNumGoals; ++i)
326  if ((idGoal = GoalList.GetID(i, &cnt)))
327  if ((pDef = C4Id2Def(idGoal)))
328  {
329  fctSymbol.Create(C4SymbolSize,C4SymbolSize);
330  // 2do: If an object instance is known, draw the object instead?
331  // this would allow us to do dynamic pictures and overlays; e.g. draw the actual, required settlement score
332  // for settlement score goals
333  // Same for pDef->GetName(), pDef->GetDesc()
334  pDef->Draw(fctSymbol);
335  if (FulfilledGoalList.GetIDCount(idGoal))
336  {
337  fctGF.Surface=fctSymbol.Surface;
339  }
340  StdStrBuf Command; Command.Format("Player:Goal:%s", idGoal.ToString());
341  Add(pDef->GetName(),fctSymbol,Command.getData(),C4MN_Item_NoCount,nullptr,"");
342  }
343  // Go back to options menu on close
344  SetCloseCommand("ActivateMenu:Main");
345  }
346  // Done
347  return true;
348 }
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:84
C4GraphicsResource GraphicsResource
Definition: C4Def.h:99
void Draw(C4Facet &cgo, bool fSelected=false, DWORD iColor=0, C4Object *pObj=nullptr, int32_t iPhaseX=0, int32_t iPhaseY=0, C4DrawTransform *trans=nullptr, const char *graphicsName=nullptr)
Definition: C4Def.cpp:607
void Set(C4Surface &rSfc)
Definition: C4Facet.cpp:459
C4Surface * Surface
Definition: C4Facet.h:117
float Hgt
Definition: C4Facet.h:118
float Wdt
Definition: C4Facet.h:118
void Draw(C4Facet &cgo, bool fAspect=true, int32_t iPhaseX=0, int32_t iPhaseY=0, bool fTransparent=true)
Definition: C4Facet.cpp:154
Definition: C4Id.h:26
const char * ToString() const
Definition: C4Id.h:56
C4ID GetID(size_t index, int32_t *ipCount=nullptr) const
Definition: C4IDList.cpp:103
int32_t GetNumberOfIDs() const
Definition: C4IDList.cpp:231
int32_t GetIDCount(C4ID c_id, int32_t iZeroDefVal=0) const
Definition: stub-handle.cpp:67
const char * GetName() const override
Definition: C4PropList.cpp:243
static void EvaluateGoals(C4IDList &GoalList, C4IDList &FulfilledGoalList, int32_t iPlayerNumber)
const char * getData() const
Definition: StdBuf.h:442
void Format(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
Definition: StdBuf.cpp:174

References C4Menu::Add(), C4Id2Def(), C4MN_Align_Bottom, C4MN_Align_Left, C4MN_Item_NoCount, C4SymbolSize, C4FacetSurface::Create(), C4Facet::Draw(), C4Def::Draw(), C4RoundResults::EvaluateGoals(), C4GraphicsResource::fctCaptain, StdStrBuf::Format(), StdStrBuf::getData(), C4IDList::GetID(), C4IDList::GetIDCount(), C4PropListStatic::GetName(), C4IDList::GetNumberOfIDs(), GfxR, GraphicsResource, C4Facet::Hgt, InitRefSym(), LoadResStr(), C4Facet::Set(), C4Menu::SetAlignment(), C4Menu::SetCloseCommand(), C4Menu::SetPermanent(), C4Facet::Surface, C4ID::ToString(), and C4Facet::Wdt.

Here is the call graph for this function:

◆ ActivateHost()

bool C4MainMenu::ActivateHost ( int32_t  iPlayer)

Definition at line 469 of file C4MainMenu.cpp.

470 {
471  // Menu symbol/init
474  SetPermanent(true);
475  // Clients
476  for (C4Network2Client *pClient=::Network.Clients.GetNextClient(nullptr); pClient; pClient=::Network.Clients.GetNextClient(pClient))
477  {
478  bool fHost = (pClient->getID() == 0);
479  StdStrBuf strText, strCommand;
480  strText.Format("%s (%s)", pClient->getName(), pClient->getCore().getNick());
481  strCommand.Format("Host:Kick:%d", pClient->getID());
482  C4GUI::Icons iIcon = fHost ? C4GUI::Ico_Host : (pClient->isActivated() ? C4GUI::Ico_Client : C4GUI::Ico_ObserverClient);
483  AddRefSym(strText.getData(), C4GUI::Icon::GetIconFacet(iIcon), strCommand.getData());
484  }
485  // Go back to options menu on close
486  SetCloseCommand("ActivateMenu:Main");
487  return true;
488 }
C4Network2 Network
Definition: C4Globals.cpp:53
bool fHost
Definition: TstC4NetIO.cpp:31
C4Network2Client * GetNextClient(C4Network2Client *pClient)
C4Network2ClientList Clients
Definition: C4Network2.h:116
Icons
Definition: C4Gui.h:638
@ Ico_Host
Definition: C4Gui.h:645
@ Ico_ObserverClient
Definition: C4Gui.h:649
@ Ico_Client
Definition: C4Gui.h:646

References C4Menu::AddRefSym(), C4MN_Align_Bottom, C4MN_Align_Left, C4MN_Extra_None, C4MN_Style_Context, C4Network2::Clients, fHost, StdStrBuf::Format(), StdStrBuf::getData(), C4GUI::Icon::GetIconFacet(), C4Network2ClientList::GetNextClient(), C4GUI::Ico_Client, C4GUI::Ico_Disconnect, C4GUI::Ico_Host, C4GUI::Ico_ObserverClient, InitRefSym(), LoadResStr(), Network, C4Menu::SetAlignment(), C4Menu::SetCloseCommand(), and C4Menu::SetPermanent().

Referenced by MenuCommand().

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

◆ ActivateHostility()

bool C4MainMenu::ActivateHostility ( int32_t  iPlayer)

Definition at line 638 of file C4MainMenu.cpp.

639 {
640  // Init menu
641  C4FacetSurface fctSymbol;
642  fctSymbol.Create(C4SymbolSize, C4SymbolSize);
643  GfxR->fctMenu.GetPhase(7).Draw(fctSymbol);
644  Init(fctSymbol, LoadResStr("IDS_MENU_CPATTACK"), iPlayer, C4MN_Extra_None, 0, C4MN_Hostility);
646  SetPermanent(true);
647  Refill();
648  // Go back to options menu on close
649  SetCloseCommand("ActivateMenu:Main");
650  return true;
651 }
@ C4MN_Hostility
Definition: C4MainMenu.h:26
bool Init(C4FacetSurface &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal)
Definition: C4MainMenu.cpp:49
bool Refill()
Definition: C4Menu.cpp:915

References C4MN_Align_Bottom, C4MN_Align_Left, C4MN_Extra_None, C4MN_Hostility, C4SymbolSize, C4FacetSurface::Create(), GfxR, Init(), LoadResStr(), C4Menu::Refill(), C4Menu::SetAlignment(), C4Menu::SetCloseCommand(), and C4Menu::SetPermanent().

Referenced by MenuCommand().

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

◆ ActivateMain()

bool C4MainMenu::ActivateMain ( int32_t  iPlayer)

Definition at line 566 of file C4MainMenu.cpp.

567 {
568  // Determine player
569  C4Player *pPlr = ::Players.Get(iPlayer);
570  // Menu symbol/init
571  C4FacetSurface fctSymbol;
572  fctSymbol.Create(C4SymbolSize, C4SymbolSize);
573  GfxR->fctOKCancel.Draw(fctSymbol, true, 1, 1);
574  Init(fctSymbol, LoadResStr(pPlr ? "IDS_MENU_CPMAIN" : "IDS_MENU_OBSERVER"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context);
576  // Goals+Rules (player menu only)
577  // Goal menu can't be shown because of script callbacks
578  // Rule menu could be shown, but rule activation would issue script callbacks and trigger client activation
579  // Showing rules but not showing goals would be strange anyway
580  if (pPlr)
581  {
582  // Goals
583  AddRefSym(LoadResStr("IDS_MENU_CPGOALS"),GfxR->fctMenu.GetPhase(4),"ActivateMenu:Goals",C4MN_Item_NoCount,nullptr,LoadResStr("IDS_MENU_CPGOALSINFO"));
584  // Rules
585  AddRefSym(LoadResStr("IDS_MENU_CPRULES"),GfxR->fctMenu.GetPhase(5),"ActivateMenu:Rules",C4MN_Item_NoCount,nullptr,LoadResStr("IDS_MENU_CPRULESINFO"));
586  }
587  // Observer menu in free viewport
588  if (!pPlr)
589  {
590  AddRefSym(LoadResStr("IDS_TEXT_VIEW"),C4GUI::Icon::GetIconFacet(C4GUI::Ico_View),"ActivateMenu:Observer",C4MN_Item_NoCount,nullptr,LoadResStr("IDS_TEXT_DETERMINEPLAYERVIEWTOFOLL"));
591  }
592  // Hostility (player menu only)
593  if (pPlr && (::Players.GetCount() > 1))
594  {
595  GfxR->fctFlagClr.Surface->SetClr(0xff0000);
596  AddRefSym(LoadResStr("IDS_MENU_CPATTACK"),GfxR->fctMenu.GetPhase(7),"ActivateMenu:Hostility",C4MN_Item_NoCount,nullptr,LoadResStr("IDS_MENU_CPATTACKINFO"));
597  }
598  // Team change
599  if (pPlr && Game.Teams.IsTeamSwitchAllowed())
600  {
601  C4Facet fctTeams; fctTeams = C4GUI::Icon::GetIconFacet(C4GUI::Ico_Team);
602  AddRefSym(LoadResStr("IDS_MSG_SELTEAM"),fctTeams,"ActivateMenu:TeamSel",C4MN_Item_NoCount,nullptr,LoadResStr("IDS_MSG_ALLOWSYOUTOJOINADIFFERENT"));
603  }
604  // Player join
606  {
607  AddRefSym(LoadResStr("IDS_MENU_CPNEWPLAYER"),GfxR->fctPlayerClr.GetPhase(),"ActivateMenu:NewPlayer",C4MN_Item_NoCount,nullptr,LoadResStr("IDS_MENU_CPNEWPLAYERINFO"));
608  }
609  // Save game (player menu only - should we allow saving games with no players in it?)
610  if (pPlr && (!::Network.isEnabled() || ::Network.isHost()))
611  {
612  AddRefSym(LoadResStr("IDS_MENU_CPSAVEGAME"),GfxR->fctMenu.GetPhase(0),"ActivateMenu:Save:Game",C4MN_Item_NoCount,nullptr,LoadResStr("IDS_MENU_CPSAVEGAMEINFO"));
613  }
614  // Options
615  AddRefSym(LoadResStr("IDS_MNU_OPTIONS"), GfxR->fctOptions.GetPhase(0), "ActivateMenu:Options",C4MN_Item_NoCount, nullptr, LoadResStr("IDS_MNU_OPTIONSINFO"));
616  // Disconnect
617  if (::Network.isEnabled())
618  {
619  // Host
620  if (::Network.isHost() && Game.Clients.getClient(nullptr))
621  AddRefSym(LoadResStr("IDS_MENU_DISCONNECT"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Disconnect), "ActivateMenu:Host", C4MN_Item_NoCount, nullptr, LoadResStr("IDS_TEXT_KICKCERTAINCLIENTSFROMTHE"));
622  // Client
623  if (!::Network.isHost())
624  AddRefSym(LoadResStr("IDS_MENU_DISCONNECT"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Disconnect), "ActivateMenu:Client", C4MN_Item_NoCount, nullptr, LoadResStr("IDS_TEXT_DISCONNECTTHEGAMEFROMTHES"));
625  }
626  // Surrender (player menu only)
627  if (pPlr)
628  AddRefSym(LoadResStr("IDS_MENU_CPSURRENDER"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Surrender), "ActivateMenu:Surrender", C4MN_Item_NoCount, nullptr, LoadResStr("IDS_MENU_CPSURRENDERINFO"));
629  // Abort
630  if (!Application.isEditor)
631  AddRefSym(LoadResStr("IDS_MENU_ABORT"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Exit), "Abort", C4MN_Item_NoCount, nullptr, LoadResStr("IDS_MENU_ABORT_DESC"));
632  // No empty menus
633  if (GetItemCount()==0) Close(false);
634  // Done
635  return true;
636 }
C4Game Game
Definition: C4Globals.cpp:52
C4PlayerList Players
C4Client * getClient(const C4Client *pAfter=nullptr) const
Definition: C4Client.h:160
void Close(bool fOK)
C4TeamList & Teams
Definition: C4Game.h:70
C4ClientList & Clients
Definition: C4Game.h:69
C4GameParameters & Parameters
Definition: C4Game.h:67
bool isLeague() const
int32_t GetItemCount()
Definition: C4Menu.cpp:517
bool isEnabled() const
Definition: C4Network2.h:203
bool isHost() const
Definition: C4Network2.h:209
C4Player * Get(int iPlayer) const
int GetCount() const
bool IsTeamSwitchAllowed() const
Definition: C4Teams.h:165
@ Ico_View
Definition: C4Gui.h:694
@ Ico_Team
Definition: C4Gui.h:662
@ Ico_Surrender
Definition: C4Gui.h:689
@ Ico_Exit
Definition: C4Gui.h:677

References C4Menu::AddRefSym(), Application, C4MN_Align_Bottom, C4MN_Align_Left, C4MN_Extra_None, C4MN_Item_NoCount, C4MN_Style_Context, C4SymbolSize, C4Game::Clients, C4GUI::Dialog::Close(), C4FacetSurface::Create(), Game, C4PlayerList::Get(), C4ClientList::getClient(), C4PlayerList::GetCount(), C4GUI::Icon::GetIconFacet(), C4Menu::GetItemCount(), GfxR, C4GUI::Ico_Disconnect, C4GUI::Ico_Exit, C4GUI::Ico_Surrender, C4GUI::Ico_Team, C4GUI::Ico_View, Init(), C4Application::isEditor, C4Network2::isEnabled(), C4Network2::isHost(), C4GameParameters::isLeague(), C4TeamList::IsTeamSwitchAllowed(), LoadResStr(), C4GameParameters::MaxPlayers, Network, C4Game::Parameters, Players, C4Menu::SetAlignment(), and C4Game::Teams.

Referenced by C4FullScreen::ActivateMenuMain(), C4Player::ActivateMenuMain(), and MenuCommand().

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

◆ ActivateNewPlayer()

bool C4MainMenu::ActivateNewPlayer ( int32_t  iPlayer)

Definition at line 63 of file C4MainMenu.cpp.

64 {
65  // league or replay game
66  if (Game.Parameters.isLeague() || Game.C4S.Head.Replay) return false;
67  // Max player limit
68  if (::Players.GetCount() >= Game.Parameters.MaxPlayers) return false;
69 
70  // Menu symbol/init
71  if (GfxR->fctPlayerClr.Surface)
72  GfxR->fctPlayerClr.Surface->SetClr(0xff);
73  InitRefSym(GfxR->fctPlayerClr, LoadResStr("IDS_MENU_NOPLRFILES"), iPlayer);
74  for (DirectoryIterator iter(Config.General.UserDataPath); *iter; ++iter)
75  if (WildcardMatch("*.ocp", *iter))
76  {
77  char szFilename[_MAX_PATH_LEN], szCommand[_MAX_PATH_LEN+30];
78  SCopy(*iter, szFilename, _MAX_PATH);
79  if (DirectoryExists(szFilename)) continue;
80  if (::Players.FileInUse(szFilename)) continue;
81  // Open group
82  C4Group hGroup;
83  if (!hGroup.Open(szFilename)) continue;
84  // Load player info
85  C4PlayerInfoCore C4P;
86  if (!C4P.Load(hGroup)) { hGroup.Close(); continue; }
87  // Close group
88  hGroup.Close();
89  // Add player item
90  sprintf(szCommand, "JoinPlayer:%s", szFilename);
91  StdStrBuf sItemText;
92  sItemText.Format(LoadResStr("IDS_MENU_NEWPLAYER"), C4P.PrefName);
93  C4FacetSurface fctSymbol;
94  // Add menu item
95  Add(sItemText.getData(), fctSymbol, szCommand);
96  // Reset symbol facet (menu holds on to the surface)
97  fctSymbol.Default();
98  }
99 
100  // Alignment
102  // Go back to options menu on close
103  SetCloseCommand("ActivateMenu:Main");
104 
105  return true;
106 }
#define _MAX_PATH
#define _MAX_PATH_LEN
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
Definition: Standard.cpp:152
#define sprintf
Definition: Standard.h:162
bool DirectoryExists(const char *szFilename)
Definition: StdFile.cpp:708
bool WildcardMatch(const char *szWildcard, const char *szString)
Definition: StdFile.cpp:396
char UserDataPath[CFG_MaxString+1]
Definition: C4Config.h:56
void Default()
Definition: C4FacetEx.h:43
C4Scenario C4S
Definition: C4Game.h:74
bool Close()
Definition: C4Group.cpp:971
bool Open(const char *group_name, bool do_create=false)
Definition: C4Group.cpp:660
bool Load(C4Group &hGroup)
Definition: C4InfoCore.cpp:88
char PrefName[C4MaxName+1]
Definition: C4InfoCore.h:85
bool FileInUse(const char *szFilename) const
bool Replay
Definition: C4Scenario.h:72
C4SHead Head
Definition: C4Scenario.h:232

References _MAX_PATH, _MAX_PATH_LEN, C4Menu::Add(), C4MN_Align_Bottom, C4MN_Align_Left, C4Game::C4S, C4Group::Close(), Config, C4FacetSurface::Default(), DirectoryExists(), C4PlayerList::FileInUse(), StdStrBuf::Format(), Game, C4Config::General, C4PlayerList::GetCount(), StdStrBuf::getData(), GfxR, C4Scenario::Head, InitRefSym(), C4GameParameters::isLeague(), C4PlayerInfoCore::Load(), LoadResStr(), C4GameParameters::MaxPlayers, C4Group::Open(), C4Game::Parameters, Players, C4PlayerInfoCore::PrefName, C4SHead::Replay, SCopy(), C4Menu::SetAlignment(), C4Menu::SetCloseCommand(), sprintf, C4ConfigGeneral::UserDataPath, and WildcardMatch().

Referenced by MenuCommand().

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

◆ ActivateObserver()

bool C4MainMenu::ActivateObserver ( )

Definition at line 872 of file C4MainMenu.cpp.

873 {
874  // Safety: Viewport lost?
875  if (!::Viewports.GetViewport(NO_OWNER)) return false;
876  // Menu symbol/init
879  // Players added in Refill
880  Refill();
881  // Go back to main menu on close
882  SetCloseCommand("ActivateMenu:Main");
883  return true;
884 }
const int NO_OWNER
Definition: C4Constants.h:137
@ C4MN_Observer
Definition: C4MainMenu.h:30
C4ViewportList Viewports
C4Viewport * GetViewport(int32_t player_nr, C4Viewport *prev=nullptr)

References C4MN_Align_Bottom, C4MN_Align_Left, C4MN_Extra_None, C4MN_Observer, C4MN_Style_Context, C4GUI::Icon::GetIconFacet(), C4ViewportList::GetViewport(), C4GUI::Ico_View, InitRefSym(), LoadResStr(), NO_OWNER, C4Menu::Refill(), C4Menu::SetAlignment(), C4Menu::SetCloseCommand(), and Viewports.

Referenced by MenuCommand().

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

◆ ActivateOptions()

bool C4MainMenu::ActivateOptions ( int32_t  iPlayer,
int32_t  selection = 0 
)

Definition at line 517 of file C4MainMenu.cpp.

518 {
519  // Menu symbol/init
520  InitRefSym(GfxR->fctOptions.GetPhase(0), LoadResStr("IDS_MNU_OPTIONS"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context);
522  SetPermanent(true);
523  // Sound
524  AddRefSym(LoadResStr("IDS_DLG_SOUND"), GfxR->fctOptions.GetPhase(17 + Config.Sound.RXSound),"Options:Sound",C4MN_Item_NoCount);
525  // Music
526  AddRefSym(LoadResStr("IDS_MNU_MUSIC"), GfxR->fctOptions.GetPhase(1 + Config.Sound.RXMusic),"Options:Music",C4MN_Item_NoCount);
527  // Music
528  AddRefSym(LoadResStr("IDS_MENU_DISPLAY"), GfxR->fctMenu.GetPhase(8), "ActivateMenu:Display");
529  // Restore selection
530  SetSelection(selection, false, true);
531  // Go back to main menu on close
532  SetCloseCommand("ActivateMenu:Main");
533  // Done
534  return true;
535 }
C4ConfigSound Sound
Definition: C4Config.h:258
int32_t RXSound
Definition: C4Config.h:126
int32_t RXMusic
Definition: C4Config.h:127

References C4Menu::AddRefSym(), C4MN_Align_Bottom, C4MN_Align_Left, C4MN_Extra_None, C4MN_Item_NoCount, C4MN_Style_Context, Config, GfxR, InitRefSym(), LoadResStr(), C4ConfigSound::RXMusic, C4ConfigSound::RXSound, C4Menu::SetAlignment(), C4Menu::SetCloseCommand(), C4Menu::SetPermanent(), C4Menu::SetSelection(), and C4Config::Sound.

Referenced by MenuCommand().

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

◆ ActivateRules()

bool C4MainMenu::ActivateRules ( int32_t  iPlayer)

Definition at line 350 of file C4MainMenu.cpp.

351 {
352  // Menu symbol/init
353  char Command[256];
354  C4FacetSurface fctSymbol;
355  InitRefSym(GfxR->fctMenu.GetPhase(5),LoadResStr("IDS_MENU_CPRULES"),iPlayer);
357  SetPermanent(false);
358  // Items
359  int32_t cnt; C4ID idGoal; C4Def *pDef;
360  for (cnt=0; (idGoal=::Objects.GetListID(C4D_Rule,cnt)); cnt++)
361  if ((pDef=C4Id2Def(idGoal)))
362  {
363  fctSymbol.Create(C4SymbolSize,C4SymbolSize); pDef->Draw(fctSymbol);
364  sprintf(Command, "Player:Rule:%s", idGoal.ToString());
365  Add(pDef->GetName(),fctSymbol,Command,C4MN_Item_NoCount,nullptr,"");
366  }
367  // Go back to options menu on close
368  SetCloseCommand("ActivateMenu:Main");
369  // Done
370  return true;
371 }
const int32_t C4D_Rule
Definition: C4Def.h:47
C4GameObjects Objects
Definition: C4Globals.cpp:48
C4ID GetListID(int32_t dwCategory, int index) const

References C4Menu::Add(), C4D_Rule, C4Id2Def(), C4MN_Align_Bottom, C4MN_Align_Left, C4MN_Item_NoCount, C4SymbolSize, C4FacetSurface::Create(), C4Def::Draw(), C4ObjectList::GetListID(), C4PropListStatic::GetName(), GfxR, InitRefSym(), LoadResStr(), Objects, C4Menu::SetAlignment(), C4Menu::SetCloseCommand(), C4Menu::SetPermanent(), sprintf, and C4ID::ToString().

Referenced by MenuCommand().

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

◆ ActivateSavegame()

bool C4MainMenu::ActivateSavegame ( int32_t  iPlayer)

Definition at line 388 of file C4MainMenu.cpp.

389 {
390  // Check if saving is possible
391  if (!Game.CanQuickSave()) return false;
392 
393  // Menu symbol/init
394  char DirPath[_MAX_PATH_LEN];
395  char ScenName[_MAX_PATH_LEN]; *ScenName=0;
396 
397  InitRefSym(GfxR->fctMenu.GetPhase(0), LoadResStr("IDS_MENU_CPSAVEGAME"), iPlayer);
399  SetPermanent(true);
400 
401  // target file name mask
402  // get folder & filename to store in
403  // some magic is needed to ensure savegames are stored properly into their folders
405  if (DirPath[strlen(DirPath) - 1] == '\\') DirPath[strlen(DirPath) - 1] = 0;
406  RemoveExtension(DirPath);
407  if (LooksLikeInteger(DirPath))
408  {
409  // ScenTitle.ocf\%d.ocs-names (old-style savegames)
410  // get owning folder
411  if (Game.pParentGroup)
412  {
413  // owning folder determines filename
415  }
416  else
417  {
418  // no owning folder known: too bad
419  // make a vague guess based on the scenario title
421  }
422  }
423  else
424  {
425  // DirPath is a valid filename for now...
426  SCopy(DirPath, ScenName);
427  // but remove trailing numbers to adjust new-style savegames
428  char *pScenNameEnd = ScenName+SLen(ScenName);
429  while (Inside<char>(*--pScenNameEnd, '0', '9'))
430  if (pScenNameEnd == ScenName)
431  {
432  // should not happen: digit-only-filenames should have been caught earlier
433  SCopy("dbg_error!", ScenName);
434  pScenNameEnd = ScenName+SLen(ScenName)-1;
435  }
436  pScenNameEnd[1]=0;
437  }
438 
439  // New Style 2007:
440  // * scenarios are saved into ScenName.ocf/ScenName123.ocs to keep umlauts out of filenames
441  // * language titles are stored in folders as title component
442  StdStrBuf strFilename, strTitle;
443  strFilename.Format("%s.ocf%c%s%%d.ocs", ScenName, DirectorySeparator, ScenName);
444  strTitle = Game.ScenarioTitle;
445 
446  // Create menu items
447  StdStrBuf strFilenameIndexed, strCommand, strCaption, strSavePath;
448  for (int32_t i = 1; i <= 10; i++)
449  {
450  // Index filename
451  strFilenameIndexed.Format(strFilename.getData(), i);
452  // Compose commmand
453  strCommand.Format("Save:Game:%s:%s", strFilenameIndexed.getData(), strTitle.getData()); // Notice: the language title might contain ':' and thus confuse the segment list - but C4Menu::MenuCommand will try to handle this...
454  // Check free slot
455  strSavePath.Format("%s%c%s", Config.AtUserDataPath(C4CFN_Savegames), DirectorySeparator, strFilenameIndexed.getData());
456  bool fFree = !C4Group_IsGroup(strSavePath.getData());
457  // Item caption
458  strCaption = LoadResStr("IDS_MENU_CPSAVEGAME");
459  // add menu item
460  AddRefSym(strCaption.getData(), GfxR->fctMenu.GetPhase(i - 1, fFree ? 2 : 1), strCommand.getData(), C4MN_Item_NoCount, nullptr, LoadResStr("IDS_MENU_CPSAVEGAMEINFO"));
461  }
462 
463  // Go back to options menu on close
464  SetCloseCommand("ActivateMenu:Main");
465 
466  return true;
467 }
#define C4CFN_Savegames
Definition: C4Components.h:35
bool C4Group_IsGroup(const char *filename)
Definition: C4Group.cpp:104
bool LooksLikeInteger(const char *szInt)
Definition: C4MainMenu.cpp:373
#define DirectorySeparator
size_t SLen(const char *sptr)
Definition: Standard.h:74
const char * GetFilenameOnly(const char *strFilename)
Definition: StdFile.cpp:57
char * GetFilename(char *szPath)
Definition: StdFile.cpp:42
void RemoveExtension(char *szFilename)
Definition: StdFile.cpp:303
const char * AtUserDataPath(const char *filename)
Definition: C4Config.cpp:586
char ScenarioFilename[_MAX_PATH_LEN]
Definition: C4Game.h:102
C4Group * pParentGroup
Definition: C4Game.h:88
bool CanQuickSave()
Definition: C4Game.cpp:2374
StdCopyStrBuf ScenarioTitle
Definition: C4Game.h:103
const char * GetName() const
Definition: C4Group.cpp:2309

References _MAX_PATH_LEN, C4Menu::AddRefSym(), C4Config::AtUserDataPath(), C4CFN_Savegames, C4Group_IsGroup(), C4MN_Align_Bottom, C4MN_Align_Left, C4MN_Item_NoCount, C4Game::CanQuickSave(), Config, DirectorySeparator, StdStrBuf::Format(), Game, StdStrBuf::getData(), GetFilename(), GetFilenameOnly(), C4Group::GetName(), GfxR, InitRefSym(), LoadResStr(), LooksLikeInteger(), C4Game::pParentGroup, RemoveExtension(), C4Game::ScenarioFilename, C4Game::ScenarioTitle, SCopy(), C4Menu::SetAlignment(), C4Menu::SetCloseCommand(), C4Menu::SetPermanent(), and SLen().

Referenced by MenuCommand().

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

◆ ActivateSurrender()

bool C4MainMenu::ActivateSurrender ( int32_t  iPlayer)

Definition at line 504 of file C4MainMenu.cpp.

505 {
506  C4FacetSurface fctSymbol;
509  fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctOKCancel.Draw(fctSymbol,true,3,0);
510  Add(LoadResStr("IDS_BTN_YES"), fctSymbol, "Surrender");
511  fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctOKCancel.Draw(fctSymbol,true,1,0);
512  Add(LoadResStr("IDS_BTN_NO"), fctSymbol, "");
513  SetCloseCommand("ActivateMenu:Main");
514  return true;
515 }

References C4Menu::Add(), C4MN_Align_Bottom, C4MN_Align_Left, C4MN_Extra_None, C4MN_Style_Context, C4SymbolSize, C4FacetSurface::Create(), C4GUI::Icon::GetIconFacet(), GfxR, C4GUI::Ico_Surrender, InitRefSym(), LoadResStr(), C4Menu::SetAlignment(), and C4Menu::SetCloseCommand().

Referenced by MenuCommand().

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

◆ Add() [1/3]

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.

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 }
int32_t ItemCount
Definition: C4Menu.h:138
friend class C4MenuItem
Definition: C4Menu.h:263
int32_t Style
Definition: C4Menu.h:136
bool IsActive()
Definition: C4Menu.cpp:480
void SetGraphics(C4Object *pObj)
Definition: C4Menu.h:103

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

Here is the call graph for this function:

◆ Add() [2/3]

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.

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 }
void GrabSymbol(C4FacetSurface &fctSymbol)
Definition: C4Menu.h:102

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

Referenced by ActivateClient(), ActivateGoals(), ActivateNewPlayer(), ActivateRules(), ActivateSurrender(), DoRefillInternal(), and C4ObjectMenu::DoRefillInternal().

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

◆ Add() [3/3]

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.

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 }

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

Here is the call graph for this function:

◆ AddElement()

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

Definition at line 118 of file C4GuiContainers.cpp.

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

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

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

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

◆ AddRefSym()

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.

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 }
void RefSymbol(const C4Facet &fctSymbol)
Definition: C4Menu.h:105

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

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

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

◆ AdjustPosition()

void C4Menu::AdjustPosition ( )
protectedinherited

Definition at line 588 of file C4Menu.cpp.

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 }
C4Rect & GetBounds()
Definition: C4Gui.h:445
void ScrollRangeInView(int32_t iY, int32_t iHgt)
int32_t Lines
Definition: C4Menu.h:143
C4GUI::ScrollWindow * pClientWindow
Definition: C4Menu.h:149
C4MenuItem * GetSelectedItem()
Definition: C4Menu.cpp:583
int32_t Columns
Definition: C4Menu.h:142
int32_t y
Definition: C4Rect.h:30
int32_t Hgt
Definition: C4Rect.h:30

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

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

◆ AdjustSelection()

void C4Menu::AdjustSelection ( )
protectedinherited

Definition at line 925 of file C4Menu.cpp.

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 }
C4MenuItem * GetItem(int32_t iIndex)
Definition: C4Menu.cpp:512
int32_t Selection
Definition: C4Menu.h:137
bool IsSelectable
Definition: C4Menu.h:88

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

Referenced by C4Menu::RefillInternal().

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

◆ AdvanceFocus()

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

Definition at line 580 of file C4GuiDialogs.cpp.

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  }
C4GameControl Control
friend class Element
Definition: C4Gui.h:844
Element * GetNextNestedElement(Element *pPrevElement, bool fBackwards)
void SetFocus(Control *pCtrl, bool fByMouse)
Control * pActiveCtrl
Definition: C4Gui.h:2081
bool IsVisible()
Definition: C4Gui.cpp:201

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

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

◆ AfterElementRemoval()

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

Reimplemented in C4GUI::ListBox.

Definition at line 756 of file C4Gui.h.

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

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

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

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

◆ ApplyElementOffset()

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

Reimplemented from C4GUI::Window.

Definition at line 743 of file C4GuiDialogs.cpp.

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  }
virtual C4Viewport * GetViewport()
Definition: C4Gui.h:2172
void ApplyElementOffset(int32_t &riX, int32_t &riY) override
Definition: C4Gui.h:866
Definition: C4Rect.h:28
C4Rect GetOutputRect()
Definition: C4Viewport.h:67

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

Here is the call graph for this function:

◆ ApplyInvElementOffset()

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

Reimplemented from C4GUI::Window.

Definition at line 756 of file C4GuiDialogs.cpp.

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

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

Here is the call graph for this function:

◆ begin()

Iterator C4GUI::Container::begin ( )
inlineinherited

Definition at line 824 of file C4Gui.h.

824 { return Iterator(pFirst); }

References C4GUI::Container::pFirst.

Referenced by C4ScriptGuiWindow::ClearPointers().

Here is the caller graph for this function:

◆ CharIn()

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

Definition at line 519 of file C4GuiDialogs.cpp.

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  }
virtual bool CharIn(const char *)
Definition: C4Gui.h:1051
virtual class Control * GetDefaultControl()
Definition: C4Gui.h:2130

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

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

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

◆ CheckBuffer()

bool C4Menu::CheckBuffer ( )
protectedinherited

◆ CheckNameHotkey()

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

Reimplemented in C4StartupScenSelDlg::ScenListItem.

Definition at line 407 of file C4Gui.h.

407 { return false; }

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

Here is the caller graph for this function:

◆ Clear()

void C4Menu::Clear ( )
inherited

Definition at line 271 of file C4Menu.cpp.

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

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

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

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

◆ ClearChildren()

void C4GUI::Container::ClearChildren ( )
inherited

Definition at line 68 of file C4GuiContainers.cpp.

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

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

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

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

◆ ClearFrameDeco()

void C4GUI::Dialog::ClearFrameDeco ( )
inlineinherited

Definition at line 2200 of file C4Gui.h.

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

References C4GUI::FrameDecoration::Deref(), and C4GUI::Dialog::pFrameDeco.

Referenced by C4Menu::Clear().

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

◆ ClearItems()

void C4Menu::ClearItems ( )
inherited

Definition at line 895 of file C4Menu.cpp.

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

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

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

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

◆ ClearPointers()

void C4Menu::ClearPointers ( C4Object pObj)
inherited

Definition at line 1158 of file C4Menu.cpp.

1159 {
1160  C4MenuItem *pItem;
1161  for (int32_t i=0; (pItem = GetItem(i)); ++i)
1162  pItem->ClearPointers(pObj);
1163 }
void ClearPointers(C4Object *pObj)
Definition: C4Menu.h:115

References C4MenuItem::ClearPointers(), and C4Menu::GetItem().

Referenced by C4ObjectMenu::ClearPointers(), and C4Player::ClearPointers().

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

◆ ClientPos2ScreenPos()

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

Definition at line 231 of file C4Gui.cpp.

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

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

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

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

◆ Close()

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

Definition at line 631 of file C4GuiDialogs.cpp.

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  }
bool fShow
Definition: C4Gui.h:2082
friend class Screen
Definition: C4Gui.h:2217
bool fOK
Definition: C4Gui.h:2083
DialogWindow * pWindow
Definition: C4Gui.h:2089
virtual void OnClosed(bool fOK)
void DestroyConsoleWindow()
virtual Screen * GetScreen()
Definition: C4Gui.cpp:289

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

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

◆ Control()

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

Definition at line 420 of file C4Menu.cpp.

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 }
const BYTE COM_MenuSelect
Definition: C4Constants.h:132
const BYTE COM_MenuLeft
Definition: C4Constants.h:128
const BYTE COM_MenuUp
Definition: C4Constants.h:130
const BYTE COM_MenuClose
Definition: C4Constants.h:126
const BYTE COM_MenuRight
Definition: C4Constants.h:129
const BYTE COM_MenuDown
Definition: C4Constants.h:131
const BYTE COM_MenuEnterAll
Definition: C4Constants.h:125
const BYTE COM_MenuEnter
Definition: C4Constants.h:124
const BYTE COM_MenuShowText
Definition: C4Constants.h:127
@ C4MN_AdjustPosition
Definition: C4Menu.h:62
bool MoveSelection(int32_t iBy, bool fAdjustPosition, bool fDoCalls)
Definition: C4Menu.cpp:522
bool TryClose(bool fOK, bool fControl)
Definition: C4Menu.cpp:280
bool SetTextProgress(int32_t iToProgress, bool fAdd)
Definition: C4Menu.cpp:958
bool Enter(bool fRight=false)
Definition: C4Menu.cpp:485

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

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

◆ CreateConsoleWindow()

bool C4GUI::Dialog::CreateConsoleWindow ( )
protectedinherited

Definition at line 239 of file C4GuiDialogs.cpp.

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  }
virtual const char * GetID()
Definition: C4Gui.h:2108
StdStrBuf TitleString
Definition: C4Gui.h:2087
C4Window * Init(C4AbstractApp *pApp, const char *Title, const C4Rect &rcBounds, const char *szID)
Dialog * pDialog
Definition: C4Gui.h:2033
C4Surface * pSurface
Definition: C4Window.h:275

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

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

◆ Default()

void C4MainMenu::Default ( )
overridevirtual

Reimplemented from C4Menu.

Definition at line 43 of file C4MainMenu.cpp.

44 {
47 }
virtual void Default()
Definition: C4Menu.cpp:246

References C4Menu::Default(), NO_OWNER, and Player.

Referenced by C4Player::C4Player().

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

◆ DestroyConsoleWindow()

void C4GUI::Dialog::DestroyConsoleWindow ( )
protectedinherited

Definition at line 262 of file C4GuiDialogs.cpp.

263  {
264  if (pWindow)
265  {
266  delete pWindow->pSurface;
267  pWindow->Clear();
268  delete pWindow;
269  pWindow = nullptr;
270  }
271  }
virtual void Clear()
Definition: C4AppT.cpp:102

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

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

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

◆ DoContext()

bool C4GUI::Element::DoContext ( )
inherited

Definition at line 417 of file C4Gui.cpp.

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

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

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

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

◆ DoDragging()

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

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

Definition at line 269 of file C4Gui.cpp.

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

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

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

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

◆ DoInit()

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.

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

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

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

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

◆ DoInitRefSym()

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.

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

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

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

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

◆ DoModal()

bool C4GUI::Dialog::DoModal ( )
inherited

Definition at line 658 of file C4GuiDialogs.cpp.

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 IsQuittingGame() const
Definition: C4Application.h:70
virtual void OnIdle()
Definition: C4Gui.h:2210
bool IsRunning
Definition: C4Game.h:140
bool ScheduleProcs(int iTimeout=1000/36)

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

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

◆ DoPlacement()

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

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

Definition at line 2176 of file C4Gui.h.

2176 { return false; }

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

Here is the caller graph for this function:

◆ DoRefillInternal()

bool C4MainMenu::DoRefillInternal ( bool &  rfRefilled)
overrideprotectedvirtual

Reimplemented from C4Menu.

Definition at line 108 of file C4MainMenu.cpp.

109 {
110  // Variables
111  C4FacetSurface fctSymbol;
112  C4Player *pPlayer;
113  C4IDList ListItems;
114  C4Facet fctTarget;
115  bool fWasEmpty = !GetItemCount();
116 
117  // Refill
118  switch (Identification)
119  {
120  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
121  case C4MN_Hostility:
122  {
123  // Clear items
124  ClearItems();
125  // Refill player
126  if (!(pPlayer = ::Players.Get(Player))) return false;
127  // Refill items
128  C4Player *pPlr; int32_t iIndex;
129  for (iIndex=0; (pPlr = ::Players.GetByIndex(iIndex)); iIndex++)
130  // Ignore player self and invisible
131  if (pPlr != pPlayer) if (!pPlr->IsInvisible())
132  {
133  // Symbol
134  fctSymbol.Create(C4SymbolSize,C4SymbolSize);
135  pPlayer->DrawHostility(fctSymbol,iIndex);
136  // Message
137  StdStrBuf sMsg;
138  bool isFriendly = pPlayer->Hostility.find(pPlr) == pPlayer->Hostility.end();
139  if (isFriendly)
140  sMsg.Format(LoadResStr("IDS_MENU_ATTACK"),pPlr->GetName());
141  else
142  sMsg.Format(LoadResStr("IDS_MENU_NOATTACK"),pPlr->GetName());
143  // Command
144  char szCommand[1000];
145  sprintf(szCommand,"SetHostility:%i",pPlr->Number);
146  // Info caption
147  char szInfoCaption[C4MaxTitle+1],szFriendly[50],szNot[30]="";
148  SCopy(LoadResStr(isFriendly ? "IDS_MENU_ATTACKHOSTILE" : "IDS_MENU_ATTACKFRIENDLY"),szFriendly);
149  if (!isFriendly) SCopy(LoadResStr("IDS_MENU_ATTACKNOT"),szNot);
150  sprintf(szInfoCaption,LoadResStr("IDS_MENU_ATTACKINFO"),pPlr->GetName(),szFriendly,szNot);
151  if (iIndex==pPlayer->Number) SCopy(LoadResStr("IDS_MENU_ATTACKSELF"),szInfoCaption);
152  // Add item
153  Add(sMsg.getData(),fctSymbol,szCommand,C4MN_Item_NoCount,nullptr,szInfoCaption);
154  fctSymbol.Default();
155  }
156  break;
157  }
158  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
159  case C4MN_TeamSelection:
160  case C4MN_TeamSwitch:
161  {
162  // Clear items
163  ClearItems();
164  // add all teams as menu items
165  // 2do: Icon
166  C4Team *pTeam; int32_t i=0; bool fAddNewTeam=Game.Teams.IsAutoGenerateTeams();
167  for (;;)
168  {
169  pTeam = Game.Teams.GetTeamByIndex(i);
170  if (pTeam)
171  {
172  // next regular team
173  ++i;
174  // do not add a new team if an empty team exists
175  if (!pTeam->GetPlayerCount()) fAddNewTeam = false;
176  }
177  else if (fAddNewTeam)
178  {
179  // join new team
180  fAddNewTeam = false;
181  }
182  else
183  {
184  // all teams done
185  break;
186  }
187  // create team symbol: Icon spec if specified; otherwise flag for empty and crew for nonempty team
188  fctSymbol.Create(C4SymbolSize,C4SymbolSize);
189  const char *szIconSpec = pTeam ? pTeam->GetIconSpec() : nullptr;
190  bool fHasIcon = false;
191  if (szIconSpec && *szIconSpec)
192  {
193  fHasIcon = Game.DrawTextSpecImage(fctSymbol, szIconSpec, nullptr, pTeam->GetColor());
194  }
195  if (!fHasIcon)
196  {
197  if (pTeam && pTeam->GetPlayerCount())
198  ::GraphicsResource.fctCrewClr.DrawClr(fctSymbol, true, pTeam->GetColor());
199  else
201  }
202  StdStrBuf sTeamName;
203  if (pTeam)
204  {
205  sTeamName.Take(pTeam->GetNameWithParticipants());
206  }
207  else
208  sTeamName.Ref(LoadResStr("IDS_PRC_NEWTEAM"));
209  const char *szOperation = (Identification == C4MN_TeamSwitch) ? "TeamSwitch" : "TeamSel";
210  Add(sTeamName.getData(), fctSymbol,FormatString("%s:%d", szOperation, pTeam ? pTeam->GetID() : TEAMID_New).getData(),
211  C4MN_Item_NoCount,nullptr,FormatString(LoadResStr("IDS_MSG_JOINTEAM"), sTeamName.getData()).getData(), C4ID(pTeam ? pTeam->GetID() : 0));
212  fctSymbol.Default();
213  }
214  break;
215  }
216  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
217  case C4MN_Observer: // observer menu
218  {
219  // Clear items
220  ClearItems();
221  // Check validity
223  if (!pVP) return false;
224  int32_t iInitialSelection = 0;
225  // Add free view
226  AddRefSym(LoadResStr("IDS_MSG_FREEVIEW"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Star), "Observe:Free", C4MN_Item_NoCount, nullptr, LoadResStr("IDS_MSG_FREELYSCROLLAROUNDTHEMAP"));
227  // Add players
228  C4Player *pPlr; int32_t iIndex;
229  for (iIndex=0; (pPlr = ::Players.GetByIndex(iIndex)); iIndex++)
230  {
231  // Ignore invisible
232  if (!pPlr->IsInvisible())
233  {
234  // Symbol
235  fctSymbol.Create(C4SymbolSize,C4SymbolSize);
236  ::GraphicsResource.fctPlayerClr.DrawClr(fctSymbol, true, pPlr->ColorDw);
237  // Message
238  StdStrBuf sMsg;
239  DWORD dwClr = pPlr->ColorDw;
240  sMsg.Format("<c %x>%s</c>", (unsigned int)C4GUI::MakeColorReadableOnBlack(dwClr), pPlr->GetName());
241  // Command
242  StdStrBuf sCommand;
243  sCommand.Format("Observe:%d", (int)pPlr->Number);
244  // Info caption
245  StdStrBuf sInfo;
246  sInfo.Format(LoadResStr("IDS_TEXT_FOLLOWVIEWOFPLAYER"), pPlr->GetName());
247  // Add item
248  Add(sMsg.getData(),fctSymbol,sCommand.getData(),C4MN_Item_NoCount,nullptr,sInfo.getData());
249  fctSymbol.Default();
250  // check if this is the currently selected player
251  if (pVP->GetPlayer() == pPlr->Number) iInitialSelection = GetItemCount()-1;
252  }
253  // Initial selection on followed player
254  if (fWasEmpty) SetSelection(iInitialSelection, false, true);
255  }
256  }
257  break;
258  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
259  default:
260  // No internal refill needed
261  return true;
262  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
263  }
264 
265  // Successfull internal refill
266  rfRefilled = true;
267  return true;
268 }
const size_t C4MaxTitle
Definition: C4Constants.h:25
@ C4MN_TeamSwitch
Definition: C4MainMenu.h:29
@ C4MN_TeamSelection
Definition: C4MainMenu.h:28
const int32_t TEAMID_New
Definition: C4Teams.h:27
uint32_t DWORD
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270
void DrawClr(C4Facet &cgo, bool fAspect=true, DWORD dwClr=0)
Definition: C4Facet.cpp:213
bool DrawTextSpecImage(C4Facet &target, const char *spec, class C4DrawTransform *transform, uint32_t color=0xff)
Definition: C4Game.cpp:4626
int32_t Identification
Definition: C4Menu.h:141
uint32_t ColorDw
Definition: C4Player.h:89
HostilitySet Hostility
Definition: C4Player.h:118
bool IsInvisible() const
Definition: C4Player.cpp:1734
const char * GetName() const
Definition: C4Player.h:151
void DrawHostility(C4Facet &cgo, int32_t iIndex)
Definition: C4Player.cpp:995
int32_t Number
Definition: C4Player.h:86
C4Player * GetByIndex(int iIndex) const
Definition: C4Teams.h:31
StdStrBuf GetNameWithParticipants() const
Definition: C4Teams.cpp:209
uint32_t GetColor() const
Definition: C4Teams.h:70
int32_t GetID() const
Definition: C4Teams.h:66
const char * GetIconSpec() const
Definition: C4Teams.h:71
int32_t GetPlayerCount() const
Definition: C4Teams.h:64
C4Team * GetTeamByIndex(int32_t iIndex) const
Definition: C4Teams.cpp:404
bool IsAutoGenerateTeams() const
Definition: C4Teams.h:172
int32_t GetPlayer()
Definition: C4Viewport.h:70
void Ref(const char *pnData)
Definition: StdBuf.h:455
void Take(char *pnData)
Definition: StdBuf.h:457
@ Ico_Star
Definition: C4Gui.h:692
DWORD MakeColorReadableOnBlack(DWORD &rdwClr)
Definition: C4Gui.cpp:98

References C4Menu::Add(), C4Menu::AddRefSym(), C4MaxTitle, C4MN_Hostility, C4MN_Item_NoCount, C4MN_Observer, C4MN_TeamSelection, C4MN_TeamSwitch, C4SymbolSize, C4Menu::ClearItems(), C4Player::ColorDw, C4FacetSurface::Create(), C4FacetSurface::Default(), C4Facet::Draw(), C4Facet::DrawClr(), C4Player::DrawHostility(), C4Game::DrawTextSpecImage(), C4GraphicsResource::fctCrewClr, C4GraphicsResource::fctPlayerClr, StdStrBuf::Format(), FormatString(), Game, C4PlayerList::Get(), C4PlayerList::GetByIndex(), C4Team::GetColor(), StdStrBuf::getData(), C4GUI::Icon::GetIconFacet(), C4Team::GetIconSpec(), C4Team::GetID(), C4Menu::GetItemCount(), C4Player::GetName(), C4Team::GetNameWithParticipants(), C4Viewport::GetPlayer(), C4Team::GetPlayerCount(), C4TeamList::GetTeamByIndex(), C4ViewportList::GetViewport(), GraphicsResource, C4Player::Hostility, C4GUI::Ico_Star, C4GUI::Ico_Team, C4Menu::Identification, C4TeamList::IsAutoGenerateTeams(), C4Player::IsInvisible(), LoadResStr(), C4GUI::MakeColorReadableOnBlack(), NO_OWNER, C4Player::Number, Player, Players, StdStrBuf::Ref(), SCopy(), C4Menu::SetSelection(), sprintf, StdStrBuf::Take(), TEAMID_New, C4Game::Teams, and Viewports.

Here is the call graph for this function:

◆ Draw()

void C4Menu::Draw ( C4TargetFacet cgo)
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 775 of file C4Menu.cpp.

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 }
C4GUIScreen * pGUI
Definition: C4Gui.cpp:1191
const int32_t C4MN_InfoCaption_Delay
Definition: C4Menu.cpp:43
@ C4MN_Style_Info
Definition: C4Menu.h:37
bool IsActiveInput()
Definition: C4Gui.h:2581
void SetVisibility(bool fToValue) override
void ClientPos2ScreenPos(int32_t &riX, int32_t &riY)
Definition: C4Gui.cpp:231
static void DrawToolTip(const char *szTip, C4TargetFacet &cgo, float guix, float guiy)
Definition: C4Gui.cpp:1009
CMouse Mouse
Definition: C4Gui.h:2590
void InitLocation(C4Facet &cgo)
Definition: C4Menu.cpp:624
bool Control(BYTE byCom, int32_t iData)
Definition: C4Menu.cpp:420
int32_t TimeOnSelection
Definition: C4Menu.h:137
bool LocationSet
Definition: C4Menu.h:133
bool fTextProgressing
Definition: C4Menu.h:151
char InfoCaption[2 *C4MaxTitle+1]
Definition: C4Menu.h:74

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

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

◆ Draw3DFrame()

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

Definition at line 291 of file C4Gui.cpp.

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

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

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

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

◆ DrawBar()

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

Definition at line 308 of file C4Gui.cpp.

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

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

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

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

◆ DrawBuffer()

void C4Menu::DrawBuffer ( C4Facet cgo)
protectedinherited

◆ DrawButton()

void C4Menu::DrawButton ( C4Facet cgo)
protectedinherited

◆ DrawElement()

void C4Menu::DrawElement ( C4TargetFacet cgo)
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 808 of file C4Menu.cpp.

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 }
const int32_t C4FCT_Right
Definition: C4Facet.h:28
@ C4MN_Extra_Value
Definition: C4Menu.h:45
@ C4MN_SymbolSize
Definition: C4Menu.h:30
int32_t GetValue(C4Object *pInBase, int32_t iBuyPlayer)
Definition: C4Def.cpp:621
void DrawValue(C4Facet &cgo, int32_t iValue, int32_t iPhaseX=0, int32_t iPhaseY=0, int32_t iAlign=C4FCT_Center)
Definition: C4Facet.cpp:308
static const C4ID None
Definition: C4Id.h:39
int32_t Extra
Definition: C4Menu.h:140
void DrawFrame(C4Surface *sfcSurface, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt)
Definition: C4Menu.cpp:852
C4ID id
Definition: C4Menu.h:76
int32_t iValue
Definition: C4Menu.h:83
bool fOwnValue
Definition: C4Menu.h:82

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

Here is the call graph for this function:

◆ DrawFrame()

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.

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

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

Referenced by C4Menu::DrawElement().

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

◆ DrawHBarByVGfx()

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

Definition at line 365 of file C4Gui.cpp.

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

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

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

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

◆ DrawHVBar()

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

Definition at line 375 of file C4Gui.cpp.

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

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

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

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

◆ DrawScrollbar()

void C4Menu::DrawScrollbar ( C4Facet cgo,
int32_t  iTotal,
int32_t  iVisible,
int32_t  iPosition 
)
protectedinherited

◆ DrawVBar()

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

Definition at line 359 of file C4Gui.cpp.

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

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

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

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

◆ ElementPosChanged()

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.

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

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

Here is the caller graph for this function:

◆ ElementSizeChanged()

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.

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

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

Here is the caller graph for this function:

◆ end()

Iterator C4GUI::Container::end ( )
inlineinherited

Definition at line 825 of file C4Gui.h.

825 { return Iterator(nullptr); }

Referenced by C4ScriptGuiWindow::ClearPointers().

Here is the caller graph for this function:

◆ Enter()

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

Definition at line 485 of file C4Menu.cpp.

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_LEN+30];
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 }
@ C4MN_Style_Dialog
Definition: C4Menu.h:38
#define _MAX_FNAME_LEN
virtual bool MenuCommand(const char *szCommand, bool fIsCloseCommand)
Definition: C4Menu.h:231
bool Permanent
Definition: C4Menu.h:134
char Command[_MAX_FNAME_LEN+30]
Definition: C4Menu.h:72
char Command2[_MAX_FNAME_LEN+30]
Definition: C4Menu.h:73

References _MAX_FNAME_LEN, 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 OnUserEnter().

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

◆ Execute()

void C4Menu::Execute ( )
inherited

Definition at line 903 of file C4Menu.cpp.

904 {
905  if (!IsActive()) return;
906  // Refill (timer or flag)
907  if (!Game.iTick35 || NeedRefill)
908  if (!RefillInternal())
909  Close(false);
910  // text progress
911  if (fTextProgressing)
912  SetTextProgress(+1, true);
913 }
int32_t iTick35
Definition: C4Game.h:130
bool NeedRefill
Definition: C4Menu.h:135
bool RefillInternal()
Definition: C4Menu.cpp:867

References C4GUI::Dialog::Close(), C4Menu::fTextProgressing, Game, C4Menu::IsActive(), C4Game::iTick35, C4Menu::NeedRefill, C4Menu::RefillInternal(), and C4Menu::SetTextProgress().

Referenced by C4FullScreen::Execute(), C4ObjectMenu::Execute(), and C4Player::Execute().

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

◆ Execute2()

bool C4GUI::Dialog::Execute2 ( )
inherited

Definition at line 690 of file C4GuiDialogs.cpp.

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

References C4GUI::Dialog::Execute().

Here is the call graph for this function:

◆ FadeIn()

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

Definition at line 714 of file C4GuiDialogs.cpp.

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  }
int32_t iFade
Definition: C4Gui.h:2084
Fade eFade
Definition: C4Gui.h:2085
virtual void OnShown()
Definition: C4Gui.h:2209
bool fVisible
Definition: C4Gui.h:383
static Screen * GetScreenS()
Definition: C4Gui.h:2629

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

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

◆ FadeOut()

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

Definition at line 728 of file C4GuiDialogs.cpp.

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  }
bool IsShown()
Definition: C4Gui.h:2148

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

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

◆ GetBounds()

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

Definition at line 445 of file C4Gui.h.

445 { return rcBounds; }

References C4GUI::Element::rcBounds.

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

Here is the caller graph for this function:

◆ GetClientRect()

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

Reimplemented from C4GUI::Element.

Definition at line 864 of file C4Gui.h.

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

References C4GUI::Window::rcClientRect.

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

Here is the caller graph for this function:

◆ GetContainedClientRect()

C4Rect C4GUI::Element::GetContainedClientRect ( )
inlineinherited

Definition at line 448 of file C4Gui.h.

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

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

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

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

◆ GetContainer()

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

Reimplemented from C4GUI::Element.

Definition at line 831 of file C4Gui.h.

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

◆ GetContextHandler()

ContextHandler* C4GUI::Dialog::GetContextHandler ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 2212 of file C4Gui.h.

2213  { return pContextHandler; }

References C4GUI::Element::pContextHandler.

◆ GetControllingPlayer()

int32_t C4MainMenu::GetControllingPlayer ( )
inlineoverrideprotectedvirtual

Reimplemented from C4Menu.

Definition at line 69 of file C4MainMenu.h.

69 { return Player; }

References Player.

◆ GetDefaultControl()

virtual class Control* C4GUI::Dialog::GetDefaultControl ( )
inlinevirtualinherited

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

Definition at line 2130 of file C4Gui.h.

2130 { return nullptr; }

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

Here is the caller graph for this function:

◆ GetDefaultTitleHeight()

int32_t C4GUI::Dialog::GetDefaultTitleHeight ( )
staticinherited

Definition at line 330 of file C4GuiDialogs.cpp.

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

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

Here is the call graph for this function:

◆ GetDialogWindow()

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

Reimplemented from C4GUI::Element.

Definition at line 2118 of file C4Gui.h.

2118 { return pWindow; }

References C4GUI::Dialog::pWindow.

◆ GetDlg()

Dialog* C4GUI::Dialog::GetDlg ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 2117 of file C4Gui.h.

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

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

Here is the caller graph for this function:

◆ GetElementByIndex()

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

Definition at line 223 of file C4GuiContainers.cpp.

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

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

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

Here is the caller graph for this function:

◆ GetElementCount()

int32_t C4GUI::Container::GetElementCount ( )
inherited

Definition at line 232 of file C4GuiContainers.cpp.

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

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

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

Here is the caller graph for this function:

◆ GetFirst()

◆ GetFirstContained()

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

Reimplemented from C4GUI::Element.

Definition at line 773 of file C4Gui.h.

773 { return pFirst; }

References C4GUI::Container::pFirst.

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

Here is the caller graph for this function:

◆ GetFirstNestedElement()

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

Reimplemented from C4GUI::Element.

Definition at line 204 of file C4GuiContainers.cpp.

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

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

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

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

◆ GetFocus()

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

Definition at line 2116 of file C4Gui.h.

2116 { return pActiveCtrl; }

References C4GUI::Dialog::pActiveCtrl.

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

Here is the caller graph for this function:

◆ GetFrameDecoration()

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

Definition at line 2202 of file C4Gui.h.

2202 { return pFrameDeco; }

References C4GUI::Dialog::pFrameDeco.

◆ GetHeight()

int32_t C4GUI::Element::GetHeight ( )
inlineinherited

Definition at line 444 of file C4Gui.h.

444 { return rcBounds.Hgt; }

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

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

Here is the caller graph for this function:

◆ GetID()

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

◆ GetIdentification()

int32_t C4Menu::GetIdentification ( )
inherited

Definition at line 612 of file C4Menu.cpp.

613 {
614  return Identification;
615 }

References C4Menu::Identification.

Referenced by C4Player::Execute().

Here is the caller graph for this function:

◆ GetItem()

C4MenuItem * C4Menu::GetItem ( int32_t  iIndex)
inherited

Definition at line 512 of file C4Menu.cpp.

513 {
514  return static_cast<C4MenuItem *>(pClientWindow->GetElementByIndex(iIndex));
515 }
Element * GetElementByIndex(int32_t i)

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

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

◆ GetItemCount()

int32_t C4Menu::GetItemCount ( )
inherited

Definition at line 517 of file C4Menu.cpp.

518 {
519  return ItemCount;
520 }

References C4Menu::ItemCount.

Referenced by ActivateMain(), and DoRefillInternal().

Here is the caller graph for this function:

◆ GetItemHeight()

int32_t C4Menu::GetItemHeight ( )
inlineinherited

Definition at line 166 of file C4Menu.h.

166 { return ItemHeight; }
int32_t ItemHeight
Definition: C4Menu.h:139

References C4Menu::ItemHeight.

◆ GetLast()

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

Definition at line 830 of file C4Gui.h.

830 { return pLast; }

References C4GUI::Container::pLast.

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

Here is the caller graph for this function:

◆ GetLastContained()

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

Definition at line 774 of file C4Gui.h.

774 { return pLast; }

References C4GUI::Container::pLast.

◆ GetListItemTopSpacing()

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

Reimplemented in C4StartupNetListEntry, and C4StartupModsListEntry.

Definition at line 461 of file C4Gui.h.

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

References C4GUI_DefaultListSpacing.

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

Here is the caller graph for this function:

◆ GetListItemTopSpacingBar()

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

Definition at line 462 of file C4Gui.h.

462 { return false; }

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

Here is the caller graph for this function:

◆ GetMarginBottom()

int32_t C4Menu::GetMarginBottom ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 258 of file C4Menu.h.

@ C4MN_FrameWidth
Definition: C4Menu.h:31
int32_t GetMarginBottom() override
Definition: C4Gui.h:2144

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

Referenced by C4Menu::InitSize().

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

◆ GetMarginLeft()

int32_t C4Menu::GetMarginLeft ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 259 of file C4Menu.h.

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

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

Referenced by C4Menu::InitSize().

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

◆ GetMarginRight()

int32_t C4Menu::GetMarginRight ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 260 of file C4Menu.h.

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

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

Referenced by C4Menu::InitSize().

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

◆ GetMarginTop()

int32_t C4GUI::Dialog::GetMarginTop ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Window.

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

Definition at line 2141 of file C4Gui.h.

WoodenLabel * pTitle
Definition: C4Gui.h:2079
virtual int32_t GetMarginTop()
Definition: C4Gui.h:873

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

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

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

◆ GetNext()

◆ GetNextNestedElement()

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

Definition at line 171 of file C4GuiContainers.cpp.

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

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

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

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

◆ GetOwnToolTip()

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

Definition at line 440 of file C4Gui.h.

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

References StdStrBuf::getData().

Here is the call graph for this function:

◆ GetParent()

◆ GetParentObject()

virtual C4Object* C4Menu::GetParentObject ( )
inlinevirtualinherited

Reimplemented in C4ObjectMenu.

Definition at line 169 of file C4Menu.h.

169 { return nullptr; }

◆ GetPosition()

int32_t C4Menu::GetPosition ( )
inherited

◆ GetPrev()

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

Definition at line 450 of file C4Gui.h.

450 { return pPrev; }

References C4GUI::Element::pPrev.

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

Here is the caller graph for this function:

◆ GetScreen()

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

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

Definition at line 289 of file C4Gui.cpp.

289 { if (pParent) return pParent->GetScreen(); return nullptr; }

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

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

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

◆ GetSelectedItem()

C4MenuItem * C4Menu::GetSelectedItem ( )
inherited

Definition at line 583 of file C4Menu.cpp.

584 {
585  return GetItem(Selection);
586 }

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

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

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

◆ GetSelection()

int32_t C4Menu::GetSelection ( )
inherited

Definition at line 599 of file C4Menu.cpp.

600 {
601  return Selection;
602 }

References C4Menu::Selection.

Referenced by MenuCommand().

Here is the caller graph for this function:

◆ GetSymbolSize()

int C4Menu::GetSymbolSize ( )
inlineinherited

Definition at line 165 of file C4Menu.h.

165 { return (Style == C4MN_Style_Dialog) ? 64 : C4SymbolSize; }

References C4MN_Style_Dialog, C4SymbolSize, and C4Menu::Style.

◆ GetToolTip()

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

Definition at line 423 of file C4Gui.cpp.

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

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

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

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

◆ GetToprightCornerRect()

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

Definition at line 399 of file C4Gui.cpp.

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

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

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

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

◆ GetViewport()

C4Viewport * C4Menu::GetViewport ( )
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 993 of file C4Menu.cpp.

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 * GetNext()
Definition: C4Viewport.h:69
C4Viewport * GetFirstViewport()
Definition: C4Viewport.h:159

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

Referenced by C4ObjectMenu::IsReadOnly().

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

◆ GetWidth()

int32_t C4GUI::Element::GetWidth ( )
inlineinherited

Definition at line 443 of file C4Gui.h.

443 { return rcBounds.Wdt; }

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

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

Here is the caller graph for this function:

◆ GetZOrdering()

int32_t C4Menu::GetZOrdering ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 251 of file C4Menu.h.

251 { return -1; }

◆ HasBackground()

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

Reimplemented in C4StartupScenSelDlg, C4StartupPlrSelDlg, C4StartupNetDlg, and C4StartupModsDlg.

Definition at line 2155 of file C4Gui.h.

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

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

Here is the caller graph for this function:

◆ HasMouse()

bool C4Menu::HasMouse ( )
protectedinherited

Definition at line 1149 of file C4Menu.cpp.

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 }
virtual int32_t GetControllingPlayer()
Definition: C4Menu.h:238
int32_t MouseControl
Definition: C4Player.h:92

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

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

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

◆ HasPortrait()

bool C4Menu::HasPortrait ( )
inlineprotectedinherited

Definition at line 242 of file C4Menu.h.

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

References C4Menu::fHasPortrait.

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

Here is the caller graph for this function:

◆ Init()

bool C4MainMenu::Init ( C4FacetSurface fctSymbol,
const char *  szEmpty,
int32_t  iPlayer,
int32_t  iExtra = C4MN_Extra_None,
int32_t  iExtraData = 0,
int32_t  iId = 0,
int32_t  iStyle = C4MN_Style_Normal 
)

Definition at line 49 of file C4MainMenu.cpp.

50 {
51  if (!DoInit(fctSymbol, szEmpty, iExtra, iExtraData, iId, iStyle)) return false;
52  Player=iPlayer;
53  return true;
54 }
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

References C4Menu::DoInit(), and Player.

Referenced by ActivateHostility(), and ActivateMain().

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

◆ InitLocation()

void C4Menu::InitLocation ( C4Facet cgo)
protectedinherited

Definition at line 624 of file C4Menu.cpp.

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 }
#define X(sdl, oc)
const int C4PictureSize
Definition: C4Constants.h:60
const int32_t C4MN_DefInfoWdt
Definition: C4Menu.cpp:35
const int32_t C4MN_DlgPortraitIndent
Definition: C4Menu.cpp:41
const int32_t C4MN_DlgLines
Definition: C4Menu.cpp:37
const int32_t C4MN_DlgWdt
Definition: C4Menu.cpp:36
const int32_t C4MN_DlgPortraitWdt
Definition: C4Menu.cpp:40
@ C4MN_Style_Normal
Definition: C4Menu.h:35
@ C4MN_Align_Right
Definition: C4Menu.h:51
@ C4MN_Align_Free
Definition: C4Menu.h:54
@ C4MN_Align_Top
Definition: C4Menu.h:52
void SetPos(int32_t iXPos, int32_t iYPos)
Definition: C4Gui.h:860
char Caption[C4MaxTitle+1]
Definition: C4Menu.h:147
void InitSize()
Definition: C4Menu.cpp:739
bool HasPortrait()
Definition: C4Menu.h:242
void UpdateElementPositions()
Definition: C4Menu.cpp:1003
void AdjustPosition()
Definition: C4Menu.cpp:588
int32_t ItemWidth
Definition: C4Menu.h:139
int32_t Alignment
Definition: C4Menu.h:144
char Caption[C4MaxTitle+1]
Definition: C4Menu.h:71
std::tuple< std::string, int > BreakMessage(const char *szMsg, int iWdt, bool fCheckMarkup, float fZoom=1.0f)
bool GetTextExtent(const char *szText, int32_t &rsx, int32_t &rsy, bool fCheckMarkup=true)

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(), C4Facet::Hgt, C4Rect::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(), C4Facet::Wdt, C4Rect::Wdt, C4Rect::x, X, and C4Rect::y.

Referenced by C4Menu::Draw().

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

◆ InitRefSym()

bool C4MainMenu::InitRefSym ( const C4Facet fctSymbol,
const char *  szEmpty,
int32_t  iPlayer,
int32_t  iExtra = C4MN_Extra_None,
int32_t  iExtraData = 0,
int32_t  iId = 0,
int32_t  iStyle = C4MN_Style_Normal 
)

Definition at line 56 of file C4MainMenu.cpp.

57 {
58  if (!DoInitRefSym(fctSymbol, szEmpty, iExtra, iExtraData, iId, iStyle)) return false;
59  Player=iPlayer;
60  return true;
61 }
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

References C4Menu::DoInitRefSym(), and Player.

Referenced by ActivateClient(), ActivateDisplay(), ActivateGoals(), ActivateHost(), C4Player::ActivateMenuTeamSelection(), ActivateNewPlayer(), ActivateObserver(), ActivateOptions(), ActivateRules(), ActivateSavegame(), and ActivateSurrender().

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

◆ InitSize()

void C4Menu::InitSize ( )
protectedinherited

Definition at line 739 of file C4Menu.cpp.

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 }
#define C4GUI_ScrollBarWdt
Definition: C4Gui.h:103
const int32_t C4MN_DlgLineMargin
Definition: C4Menu.cpp:38
Element * GetLast()
Definition: C4Gui.h:830
int32_t GetMarginTop() override
Definition: C4Gui.h:2141
void SetBounds(const C4Rect &rcNewBound)
Definition: C4Gui.h:446
void SetScrollBarEnabled(bool fToVal, bool noAutomaticPositioning=false)
virtual int32_t GetMarginRight()
Definition: C4Gui.h:875
virtual int32_t GetMarginLeft()
Definition: C4Gui.h:874
virtual int32_t GetMarginBottom()
Definition: C4Gui.h:876
int32_t GetMarginLeft() override
Definition: C4Menu.h:259
int32_t VisibleCount
Definition: C4Menu.h:145
int32_t GetMarginRight() override
Definition: C4Menu.h:260
void UpdateOwnPos() override
Definition: C4Menu.cpp:1108
int32_t GetMarginBottom() override
Definition: C4Menu.h:258

References C4GUI_ScrollBarWdt, C4MN_DlgLineMargin, C4MN_DlgPortraitIndent, C4MN_DlgPortraitWdt, C4MN_Style_Dialog, C4Menu::Columns, C4GUI::Element::GetBounds(), C4GUI::Container::GetLast(), C4GUI::Window::GetMarginBottom(), C4Menu::GetMarginBottom(), C4GUI::Window::GetMarginLeft(), C4Menu::GetMarginLeft(), C4GUI::Window::GetMarginRight(), C4Menu::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().

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

◆ InsertElement()

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

Definition at line 150 of file C4GuiContainers.cpp.

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

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

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

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

◆ IsAborted()

bool C4GUI::Dialog::IsAborted ( )
inlineinherited

Definition at line 2150 of file C4Gui.h.

2150 { return !fShow && !fOK; } // returns whether dialog has been aborted

References C4GUI::Dialog::fOK, and C4GUI::Dialog::fShow.

Referenced by C4Network2::DoLobby(), C4Network2::FinalInit(), C4Game::InitNetworkFromAddress(), C4Network2::LeaguePlrAuth(), C4Network2::LeagueStart(), and C4Network2::RetrieveRes().

Here is the caller graph for this function:

◆ IsActive() [1/2]

bool C4Menu::IsActive ( )
inherited

◆ IsActive() [2/2]

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

Definition at line 699 of file C4GuiDialogs.cpp.

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 IsFading()
Definition: C4Gui.h:2152

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(), C4StartupModsDlg::OnSec1Timer(), and C4StartupNetDlg::OnSec1Timer().

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

◆ IsBottomPlacementDialog()

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

Reimplemented in C4ChatInputDialog.

Definition at line 2162 of file C4Gui.h.

2162 { return false; }

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

Here is the caller graph for this function:

◆ IsCloseDenied()

virtual bool C4Menu::IsCloseDenied ( )
inlineprotectedvirtualinherited

Reimplemented in C4ObjectMenu.

Definition at line 233 of file C4Menu.h.

233 { return false; } // do MenuQueryCancel-callbacks for user menus

Referenced by C4Menu::TryClose().

Here is the caller graph for this function:

◆ IsComponentOutsideClientArea()

bool C4GUI::Dialog::IsComponentOutsideClientArea ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Window.

Reimplemented in C4StartupPlrPropertiesDlg, and C4GUI::FullscreenDialog.

Definition at line 2106 of file C4Gui.h.

2106 { return !!pTitle; } // pTitle lies outside client area

References C4GUI::Dialog::pTitle.

◆ IsContextMenu()

bool C4Menu::IsContextMenu ( )
inlineinherited

Definition at line 164 of file C4Menu.h.

164 { return Style == C4MN_Style_Context; }

References C4MN_Style_Context, and C4Menu::Style.

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

Here is the caller graph for this function:

◆ IsExclusiveDialog()

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

Reimplemented in C4ChatInputDialog, C4GameOverDlg, C4AbortGameDialog, and C4ChatDlg.

Definition at line 2165 of file C4Gui.h.

2165 { return false; }

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

Here is the caller graph for this function:

◆ IsExternalDrawDialog()

bool C4Menu::IsExternalDrawDialog ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 247 of file C4Menu.h.

247 { return true; } // drawn by viewport drawing proc

◆ IsFading()

bool C4GUI::Dialog::IsFading ( )
inlineinherited

Definition at line 2152 of file C4Gui.h.

2152 { return eFade != eFadeNone; }

References C4GUI::Dialog::eFade.

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

Here is the caller graph for this function:

◆ IsFocused()

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

Reimplemented from C4GUI::Container.

Definition at line 2114 of file C4Gui.h.

2114 { return pCtrl == pActiveCtrl; }

References C4GUI::Dialog::pActiveCtrl.

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

Here is the caller graph for this function:

◆ IsFocusElement()

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

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

Definition at line 432 of file C4Gui.h.

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

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

Here is the caller graph for this function:

◆ IsFreePlaceDialog()

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

Reimplemented in C4ChatInputDialog, C4GameOverDlg, C4AbortGameDialog, and C4ChatDlg.

Definition at line 2159 of file C4Gui.h.

2159 { return false; }

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

Here is the caller graph for this function:

◆ IsFullscreenDialog()

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

Reimplemented in C4GUI::FullscreenDialog.

Definition at line 2154 of file C4Gui.h.

2154 { return false; }

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

Here is the caller graph for this function:

◆ IsImmediateToolTip()

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

Definition at line 441 of file C4Gui.h.

441 { return is_immediate_tooltip; }

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

Here is the caller graph for this function:

◆ IsInActiveDlg()

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

Definition at line 435 of file C4Gui.cpp.

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

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

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

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

◆ IsMenu()

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

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

Definition at line 403 of file C4Gui.h.

403 { return false; }

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

Here is the caller graph for this function:

◆ IsMouseControlled()

bool C4Menu::IsMouseControlled ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 248 of file C4Menu.h.

248 { return false; }

◆ IsOK()

bool C4GUI::Dialog::IsOK ( )
inlineinherited

Definition at line 2149 of file C4Gui.h.

2149 { return fOK; } // returns whether user pressed OK

References C4GUI::Dialog::fOK.

◆ IsOwnPtrElement()

bool C4Menu::IsOwnPtrElement ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 254 of file C4Menu.h.

254 { return true; }

◆ IsParentOf()

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

Reimplemented from C4GUI::Element.

Definition at line 239 of file C4GuiContainers.cpp.

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

References C4GUI::Element::GetParent().

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

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

◆ IsReadOnly()

virtual bool C4Menu::IsReadOnly ( )
inlineprotectedvirtualinherited

Reimplemented in C4ObjectMenu.

Definition at line 237 of file C4Menu.h.

237 { return false; } // determine whether the menu is just viewed by an observer, and should not issue any calls

Referenced by C4Menu::UserClose(), C4Menu::UserEnter(), and C4Menu::UserSelectItem().

Here is the caller graph for this function:

◆ IsSelectedChild()

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

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

Definition at line 837 of file C4Gui.h.

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

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

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

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

◆ IsShown()

bool C4GUI::Dialog::IsShown ( )
inlineinherited

Definition at line 2148 of file C4Gui.h.

2148 { return fShow; } // returns whether dlg is on screen (may be invisible)

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

Here is the caller graph for this function:

◆ IsTextProgressing()

bool C4Menu::IsTextProgressing ( ) const
inlineinherited

Definition at line 201 of file C4Menu.h.

201 { return fTextProgressing; }

References C4Menu::fTextProgressing.

◆ IsViewportDialog()

bool C4GUI::Dialog::IsViewportDialog ( )
inlineinherited

Definition at line 2173 of file C4Gui.h.

2173 { return fViewportDlg; }
bool fViewportDlg
Definition: C4Gui.h:2088

References C4GUI::Dialog::fViewportDlg.

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

Here is the caller graph for this function:

◆ IsVisible()

bool C4GUI::Element::IsVisible ( )
inherited

◆ KeyAdvanceFocus()

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

Definition at line 2139 of file C4Gui.h.

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

References C4GUI::Dialog::AdvanceFocus().

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

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

◆ KeyControl()

bool C4Menu::KeyControl ( BYTE  byCom)
inherited

Definition at line 473 of file C4Menu.cpp.

474 {
475  // direct keyboard callback
476  if (!IsActive()) return false;
477  return !!Control(byCom, 0);
478 }

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

Referenced by C4FullScreen::MenuKeyControl().

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

◆ KeyEnter()

bool C4GUI::Dialog::KeyEnter ( )
inlineinherited

Definition at line 2134 of file C4Gui.h.

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

References C4GUI::Dialog::OnEnter().

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

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

◆ KeyEscape()

bool C4GUI::Dialog::KeyEscape ( )
inlineinherited

Definition at line 2136 of file C4Gui.h.

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

References C4GUI::Dialog::OnEscape().

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

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

◆ MakeLastElement()

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

Definition at line 106 of file C4GuiContainers.cpp.

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

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

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

Here is the caller graph for this function:

◆ MenuCommand()

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

Reimplemented from C4Menu.

Definition at line 653 of file C4MainMenu.cpp.

654 {
655  // Determine player
656  C4Player *pPlr = ::Players.Get(Player);
657  // Activate
658  if (SEqual2(szCommand,"ActivateMenu:"))
659  {
660  if (C4GameOverDlg::IsShown()) return false; // no new menus during game over dlg
661  if (SEqual(szCommand+13,"Main")) return ActivateMain(Player);
662  if (SEqual(szCommand+13,"Hostility")) return ActivateHostility(Player);
663  if (SEqual(szCommand+13,"NewPlayer")) return ActivateNewPlayer(Player);
664  if (SEqual(szCommand+13,"Goals"))
665  {
667  return true;
668  }
669  if (SEqual(szCommand+13,"Rules")) return ActivateRules(Player);
670  if (SEqual(szCommand+13,"Host")) return ActivateHost(Player);
671  if (SEqual(szCommand+13,"Client")) return ActivateClient(Player);
672  if (SEqual(szCommand+13,"Options")) return ActivateOptions(Player);
673  if (SEqual(szCommand+13,"Display")) return ActivateDisplay(Player);
674  if (SEqual(szCommand+13,"Save:Game")) return ActivateSavegame(Player);
675  if (SEqual(szCommand+13,"TeamSel")) return pPlr ? pPlr->ActivateMenuTeamSelection(true) : false;
676  if (SEqual(szCommand+13,"Surrender")) return ActivateSurrender(Player);
677  if (SEqual(szCommand+13,"Observer")) return ActivateObserver();
678  }
679  // JoinPlayer
680  if (SEqual2(szCommand,"JoinPlayer:"))
681  {
682  // not in league or replay mode
683  if (Game.Parameters.isLeague() || Game.C4S.Head.Replay) return false;
684  // join player
685  // 2do: not for observers and such?
686  Players.JoinNew(szCommand+11);
687  return true;
688  }
689  // SetHostility
690  if (SEqual2(szCommand,"SetHostility:"))
691  {
692  // only if allowed
693  if (!Game.Teams.IsHostilityChangeAllowed()) return false;
694  int32_t iOpponent; sscanf(szCommand+13,"%i",&iOpponent);
695  C4Player *pOpponent = ::Players.Get(iOpponent);
696  if (!pOpponent || pOpponent->GetType() != C4PT_User) return false;
698  return true;
699  }
700  // Abort
701  if (SEqual2(szCommand,"Abort"))
702  {
704  return true;
705  }
706  // Surrender
707  if (SEqual2(szCommand,"Surrender"))
708  {
710  return true;
711  }
712  // Save game
713  if (SEqual2(szCommand, "Save:Game:"))
714  {
715  char strFilename[_MAX_PATH_LEN]; SCopySegment(szCommand, 2, strFilename, ':', _MAX_PATH);
716  char strTitle[_MAX_PATH_LEN]; SCopy(szCommand + SCharPos(':', szCommand, 2) + 1, strTitle, _MAX_PATH);
717  Game.QuickSave(strFilename, strTitle);
719  return true;
720  }
721  // Kick
722  if (SEqual2(szCommand,"Host:Kick:"))
723  {
724  int iClientID = atoi(szCommand+10);
725  if (iClientID && ::Network.isEnabled())
726  {
727  if (Game.Parameters.isLeague() && ::Players.GetAtClient(iClientID))
728  ::Network.Vote(VT_Kick, true, iClientID);
729  else
730  {
731  C4Client *pClient = Game.Clients.getClientByID(iClientID);
732  if (pClient) Game.Clients.CtrlRemove(pClient, LoadResStr("IDS_MSG_KICKBYMENU"));
733  Close(true);
734  }
735  }
736  return true;
737  }
738  // Part
739  if (SEqual2(szCommand,"Part"))
740  {
741  if (::Network.isEnabled())
742  {
744  ::Network.Vote(VT_Kick, true, ::Control.ClientID());
745  else
746  {
747  Game.RoundResults.EvaluateNetwork(C4RoundResults::NR_NetError, LoadResStr("IDS_ERR_GAMELEFTVIAPLAYERMENU"));
748  ::Network.Clear();
749  }
750  }
751  return true;
752  }
753  // Options
754  if (SEqual2(szCommand,"Options:"))
755  {
756  // Music
757  if (SEqual(szCommand + 8, "Music"))
758  {
760  }
761  // Sound
762  if (SEqual(szCommand + 8, "Sound"))
763  {
764  if (Config.Sound.RXSound)
765  {
767  Config.Sound.RXSound = false;
768  }
769  else
770  {
771  Config.Sound.RXSound = true;
773  { Log(LoadResStr("IDS_PRC_NOSND")); }
774  }
775  }
776  // Reopen with updated options
778  return true;
779  }
780  // Display
781  if (SEqual2(szCommand,"Display:"))
782  {
783  // Upper board
784  if (SEqual(szCommand + 8, "UpperBoard"))
785  {
788  }
789  // FPS
790  if (SEqual(szCommand + 8, "FPS")) Config.General.FPS = !Config.General.FPS;
791  // Player names
792  if (SEqual(szCommand + 8, "PlayerNames")) Config.Graphics.ShowCrewNames = !Config.Graphics.ShowCrewNames;
793  // Clonk names
794  if (SEqual(szCommand + 8, "ClonkNames")) Config.Graphics.ShowCrewCNames = !Config.Graphics.ShowCrewCNames;
795  // Clock
796  if (SEqual(szCommand + 8, "Clock")) Config.Graphics.ShowClock = !Config.Graphics.ShowClock;
797  // Reopen with updated options
799  return true;
800  }
801  // Goal info
802  if (SEqual2(szCommand,"Player:Goal:") || SEqual2(szCommand,"Player:Rule:"))
803  {
804  if (!ValidPlr(Player)) return false; // observers may not look at goal/rule info, because it requires queue activation
805  Close(true);
806  C4Object *pObj; C4ID idItem(szCommand+12); C4Def * pDef = C4Id2Def(idItem);
807  if (pDef && (pObj = ::Objects.Find(pDef)))
809  else
810  return false;
811  return true;
812  }
813  // Team selection
814  if (SEqual2(szCommand, "TeamSel:"))
815  {
816  Close(true);
817  int32_t idTeam = atoi(szCommand+8);
818 
819  // OK, join this team
820  if (pPlr) pPlr->DoTeamSelection(idTeam);
821  return true;
822  }
823  // Team switch
824  if (SEqual2(szCommand, "TeamSwitch:"))
825  {
826  Close(true);
827  int32_t idTeam = atoi(szCommand+11);
828 
829  // check if it's still allowed
830  if (!Game.Teams.IsTeamSwitchAllowed()) return false;
831  // OK, join this team
833  return true;
834  }
835  // Observe
836  if (SEqual2(szCommand, "Observe:"))
837  {
838  const char *szObserverTarget = szCommand+8;
840  if (pVP) // viewport may have closed meanwhile
841  {
842  if (SEqual(szObserverTarget, "Free"))
843  {
844  // free view
845  pVP->Init(NO_OWNER, true);
846  return true;
847  }
848  else
849  {
850  // view following player
851  int32_t iPlr = atoi(szObserverTarget);
852  if (ValidPlr(iPlr))
853  {
854  pVP->Init(iPlr, true);
855  return true;
856  }
857  }
858  }
859  return false;
860  }
861  // No valid command
862  return false;
863 }
@ C4PT_User
Definition: C4Constants.h:154
@ VT_Kick
Definition: C4Control.h:563
@ CDT_Queue
Definition: C4GameControl.h:34
C4FullScreen FullScreen
Definition: C4Globals.cpp:46
bool Log(const char *szMessage)
Definition: C4Log.cpp:204
@ CID_PlrAction
Definition: C4PacketBase.h:166
int32_t ValidPlr(int32_t plr)
int SCharPos(char cTarget, const char *szInStr, int iIndex)
Definition: Standard.cpp:239
bool SEqual2(const char *szStr1, const char *szStr2)
Definition: Standard.cpp:204
bool SCopySegment(const char *szString, int iSegment, char *sTarget, char cSeparator, int iMaxL, bool fSkipWhitespace)
Definition: Standard.cpp:279
bool SEqual(const char *szStr1, const char *szStr2)
Definition: Standard.h:93
C4MusicSystem MusicSystem
Definition: C4Application.h:41
C4SoundSystem SoundSystem
Definition: C4Application.h:42
C4Client * getClientByID(int32_t iID) const
Definition: C4Client.cpp:200
void CtrlRemove(const C4Client *pClient, const char *szReason)
Definition: C4Client.cpp:333
static C4ControlPlayerAction * SetHostility(const C4Player *source, const C4Player *target, bool hostile)
Definition: C4Control.cpp:587
static C4ControlPlayerAction * ActivateGoal(const C4Player *source, const C4Object *target)
Definition: C4Control.cpp:571
static C4ControlPlayerAction * SetTeam(const C4Player *source, int32_t team)
Definition: C4Control.cpp:597
static C4ControlPlayerAction * ActivateGoalMenu(const C4Player *source)
Definition: C4Control.cpp:580
static C4ControlPlayerAction * Surrender(const C4Player *source)
Definition: C4Control.cpp:557
bool ShowAbortDlg()
C4RoundResults & RoundResults
Definition: C4Game.h:73
bool QuickSave(const char *filename, const char *title, bool force_save=false)
Definition: C4Game.cpp:2386
static bool IsShown()
Definition: C4GameOverDlg.h:91
bool ActivateDisplay(int32_t iPlayer, int32_t selection=0)
Definition: C4MainMenu.cpp:537
bool ActivateHost(int32_t iPlayer)
Definition: C4MainMenu.cpp:469
bool ActivateHostility(int32_t iPlayer)
Definition: C4MainMenu.cpp:638
bool ActivateMain(int32_t iPlayer)
Definition: C4MainMenu.cpp:566
bool ActivateOptions(int32_t iPlayer, int32_t selection=0)
Definition: C4MainMenu.cpp:517
bool ActivateClient(int32_t iPlayer)
Definition: C4MainMenu.cpp:490
bool ActivateNewPlayer(int32_t iPlayer)
Definition: C4MainMenu.cpp:63
bool ActivateRules(int32_t iPlayer)
Definition: C4MainMenu.cpp:350
bool ActivateObserver()
Definition: C4MainMenu.cpp:872
bool ActivateSavegame(int32_t iPlayer)
Definition: C4MainMenu.cpp:388
bool ActivateSurrender(int32_t iPlayer)
Definition: C4MainMenu.cpp:504
int32_t GetSelection()
Definition: C4Menu.cpp:599
void Clear()
Definition: C4Network2.cpp:712
void Vote(C4ControlVoteType eType, bool fApprove=true, int32_t iData=0)
C4Object * Find(C4Def *def, int owner=ANY_OWNER, DWORD dwOCF=OCF_All)
void DoTeamSelection(int32_t idTeam)
Definition: C4Player.cpp:1250
C4PlayerType GetType() const
Definition: C4Player.cpp:1727
bool ActivateMenuTeamSelection(bool fFromMain)
Definition: C4Player.cpp:1238
C4Player * GetAtClient(int iClient, int iIndex=0) const
void JoinNew(const char *szFilename)
C4Player * GetLocalByIndex(int iIndex) const
bool HostilityDeclared(int iPlayer1, int iPlayer2) const
void EvaluateNetwork(NetResult eResult, const char *szResultsString)
bool IsHostilityChangeAllowed() const
Definition: C4Teams.h:164
bool Init(int32_t for_player, bool set_temporary_only)
Definition: C4Viewport.cpp:786
void RecalculateViewports()

References _MAX_PATH, _MAX_PATH_LEN, ActivateClient(), ActivateDisplay(), C4ControlPlayerAction::ActivateGoal(), C4ControlPlayerAction::ActivateGoalMenu(), ActivateHost(), ActivateHostility(), ActivateMain(), C4Player::ActivateMenuTeamSelection(), ActivateNewPlayer(), ActivateObserver(), ActivateOptions(), ActivateRules(), ActivateSavegame(), ActivateSurrender(), Application, C4Id2Def(), C4PT_User, C4Game::C4S, CDT_Queue, CID_PlrAction, C4Network2::Clear(), C4SoundSystem::Clear(), C4Game::Clients, C4GUI::Dialog::Close(), Config, C4Menu::Control(), C4ClientList::CtrlRemove(), C4Player::DoTeamSelection(), C4RoundResults::EvaluateNetwork(), C4ObjectList::Find(), C4ConfigGeneral::FPS, FullScreen, Game, C4Config::General, C4PlayerList::Get(), C4PlayerList::GetAtClient(), C4ClientList::getClientByID(), C4PlayerList::GetLocalByIndex(), C4Menu::GetSelection(), C4Player::GetType(), C4ViewportList::GetViewport(), C4Config::Graphics, C4Scenario::Head, C4PlayerList::HostilityDeclared(), C4SoundSystem::Init(), C4Viewport::Init(), C4Network2::isEnabled(), C4TeamList::IsHostilityChangeAllowed(), C4GameParameters::isLeague(), C4GameOverDlg::IsShown(), C4TeamList::IsTeamSwitchAllowed(), C4PlayerList::JoinNew(), LoadResStr(), Log(), C4Application::MusicSystem, Network, NO_OWNER, C4RoundResults::NR_NetError, C4Player::Number, Objects, C4Game::Parameters, Player, Players, C4Game::QuickSave(), C4ViewportList::RecalculateViewports(), C4SHead::Replay, C4Game::RoundResults, C4ConfigSound::RXSound, SCharPos(), SCopy(), SCopySegment(), SEqual(), SEqual2(), C4ControlPlayerAction::SetHostility(), C4ControlPlayerAction::SetTeam(), C4FullScreen::ShowAbortDlg(), C4ConfigGraphics::ShowClock, C4ConfigGraphics::ShowCrewCNames, C4ConfigGraphics::ShowCrewNames, C4Config::Sound, C4Application::SoundSystem, C4ControlPlayerAction::Surrender(), C4Game::Teams, C4MusicSystem::ToggleOnOff(), C4ConfigGraphics::UpperBoard, ValidPlr(), Viewports, C4Network2::Vote(), and VT_Kick.

Referenced by ActivateCommand(), and OnSelectionChanged().

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

◆ MouseEnter()

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

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

Definition at line 413 of file C4Gui.h.

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

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

Here is the caller graph for this function:

◆ MouseInput()

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.

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

References C4GUI::Window::MouseInput().

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

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

◆ MouseLeave()

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.

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

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

Here is the caller graph for this function:

◆ MoveSelection()

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

Definition at line 522 of file C4Menu.cpp.

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 }

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

Referenced by C4Menu::Control().

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

◆ OnClosed()

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

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

Definition at line 646 of file C4GuiDialogs.cpp.

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

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

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

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

◆ OnEnter()

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

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

Definition at line 2133 of file C4Gui.h.

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

References C4GUI::Dialog::UserClose().

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

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

◆ OnEscape()

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

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

Definition at line 2135 of file C4Gui.h.

2135 { UserClose(false); return true; }

References C4GUI::Dialog::UserClose().

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

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

◆ OnHotkey()

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

Reimplemented from C4GUI::Element.

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

Definition at line 212 of file C4GuiContainers.cpp.

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

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

Here is the call graph for this function:

◆ OnIdle()

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

Reimplemented in C4PortraitSelDlg, and C4DownloadDlg.

Definition at line 2210 of file C4Gui.h.

2210 {} // idle proc in DoModal

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

Here is the caller graph for this function:

◆ OnSelectionChanged()

void C4MainMenu::OnSelectionChanged ( int32_t  iNewSelection)
overrideprotectedvirtual

Reimplemented from C4Menu.

Definition at line 270 of file C4MainMenu.cpp.

271 {
272  // immediate player highlight in observer menu
274  {
275  C4MenuItem *pItem = GetSelectedItem();
276  if (pItem)
277  {
278  if (SEqual2(pItem->GetCommand(), "Observe:"))
279  MenuCommand(pItem->GetCommand(), false);
280  }
281  }
282 }
const char * GetCommand() const
Definition: C4Menu.h:113

References C4MN_Observer, C4MenuItem::GetCommand(), C4Menu::GetSelectedItem(), C4Menu::Identification, MenuCommand(), and SEqual2().

Here is the call graph for this function:

◆ OnShown()

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

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

Definition at line 2209 of file C4Gui.h.

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

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

Here is the caller graph for this function:

◆ OnUserClose() [1/2]

void C4MainMenu::OnUserClose ( )
overrideprotectedvirtual

Reimplemented from C4Menu.

Definition at line 298 of file C4MainMenu.cpp.

299 {
300  // just close
301  TryClose(false, true);
302 }

References C4Menu::TryClose().

Here is the call graph for this function:

◆ OnUserClose() [2/2]

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

Definition at line 2205 of file C4Gui.h.

2206  { UserClose(false); }

References C4GUI::Dialog::UserClose().

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

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

◆ OnUserEnter()

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

Reimplemented from C4Menu.

Definition at line 290 of file C4MainMenu.cpp.

291 {
292  // direct menu control
293  // but ensure selection is Okay before
294  SetSelection(iIndex, true, false);
295  Enter(fRight);
296 }

References C4Menu::Enter(), and C4Menu::SetSelection().

Here is the call graph for this function:

◆ OnUserSelectItem()

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

Reimplemented from C4Menu.

Definition at line 284 of file C4MainMenu.cpp.

285 {
286  // direct selection for non-sync-menus
287  SetSelection(iIndex, true, true);
288 }

References C4Menu::SetSelection().

Here is the call graph for this function:

◆ rbegin()

ReverseIterator C4GUI::Container::rbegin ( )
inlineinherited

Definition at line 826 of file C4Gui.h.

826 { return ReverseIterator(pLast); }

References C4GUI::Container::pLast.

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

Here is the caller graph for this function:

◆ ReaddElement()

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

Definition at line 134 of file C4GuiContainers.cpp.

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

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

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

Here is the caller graph for this function:

◆ Refill()

bool C4Menu::Refill ( )
inherited

Definition at line 915 of file C4Menu.cpp.

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 }

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

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

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

◆ RefillInternal()

bool C4Menu::RefillInternal ( )
protectedinherited

Definition at line 867 of file C4Menu.cpp.

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 }
void UnFreeze()
Definition: C4Gui.h:970
virtual bool DoRefillInternal(bool &rfRefilled)
Definition: C4Menu.h:230
void AdjustSelection()
Definition: C4Menu.cpp:925
bool IsContextMenu()
Definition: C4Menu.h:164

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

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

◆ RemoveElement()

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

Reimplemented from C4GUI::Container.

Definition at line 427 of file C4GuiDialogs.cpp.

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

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

Here is the call graph for this function:

◆ rend()

ReverseIterator C4GUI::Container::rend ( )
inlineinherited

Definition at line 827 of file C4Gui.h.

827 { return ReverseIterator(nullptr); }

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

Here is the caller graph for this function:

◆ ResetLocation()

void C4Menu::ResetLocation ( )
inlineinherited

Definition at line 195 of file C4Menu.h.

195 { LocationSet = false; }

References C4Menu::LocationSet.

Referenced by C4Viewport::DrawMenu().

Here is the caller graph for this function:

◆ ScreenPos2ClientPos()

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

Definition at line 218 of file C4Gui.cpp.

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

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

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

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

◆ SetAlignment()

void C4Menu::SetAlignment ( int32_t  iAlignment)
inherited

Definition at line 857 of file C4Menu.cpp.

858 {
859  Alignment = iAlignment;
860 }

References C4Menu::Alignment.

Referenced by ActivateClient(), ActivateDisplay(), ActivateGoals(), ActivateHost(), ActivateHostility(), ActivateMain(), C4Player::ActivateMenuTeamSelection(), ActivateNewPlayer(), ActivateObserver(), ActivateOptions(), ActivateRules(), ActivateSavegame(), and ActivateSurrender().

Here is the caller graph for this function:

◆ SetBounds()

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

Definition at line 446 of file C4Gui.h.

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

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

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

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

◆ SetClientSize()

void C4GUI::Dialog::SetClientSize ( int32_t  iToWdt,
int32_t  iToHgt 
)
inherited

Definition at line 769 of file C4GuiDialogs.cpp.

770  {
771  // calc new bounds
772  iToWdt += GetMarginLeft()+GetMarginRight();
773  iToHgt += GetMarginTop()+GetMarginBottom();
774  rcBounds.x += (rcBounds.Wdt - iToWdt)/2;
775  rcBounds.y += (rcBounds.Hgt - iToHgt)/2;
776  rcBounds.Wdt = iToWdt; rcBounds.Hgt = iToHgt;
777  // reflect changes
778  UpdatePos();
779  }
void UpdatePos() override

References C4GUI::Dialog::GetMarginBottom(), C4GUI::Dialog::GetMarginLeft(), C4GUI::Dialog::GetMarginRight(), C4GUI::Dialog::GetMarginTop(), C4Rect::Hgt, C4GUI::Element::rcBounds, C4GUI::Dialog::UpdatePos(), C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by C4LeagueSignupDialog::C4LeagueSignupDialog(), and C4GUI::MessageDialog::MessageDialog().

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

◆ SetCloseCommand()

void C4Menu::SetCloseCommand ( const char *  strCommand)
inherited

Definition at line 1144 of file C4Menu.cpp.

1145 {
1146  CloseCommand.Copy(strCommand);
1147 }
StdStrBuf CloseCommand
Definition: C4Menu.h:146
void Copy()
Definition: StdBuf.h:467

References C4Menu::CloseCommand, and StdStrBuf::Copy().

Referenced by ActivateClient(), ActivateDisplay(), ActivateGoals(), ActivateHost(), ActivateHostility(), C4Player::ActivateMenuTeamSelection(), ActivateNewPlayer(), ActivateObserver(), ActivateOptions(), ActivateRules(), ActivateSavegame(), and ActivateSurrender().

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

◆ SetContextHandler()

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

Definition at line 465 of file C4Gui.h.

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

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

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

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

◆ SetDelOnClose()

void C4GUI::Dialog::SetDelOnClose ( bool  fToVal = true)
inlineinherited

Definition at line 2191 of file C4Gui.h.

2191 { fDelOnClose=fToVal; } // dialog will delete itself when closed

References C4GUI::Dialog::fDelOnClose.

Referenced by C4ChatDlg::C4ChatDlg(), C4ChatInputDialog::C4ChatInputDialog(), C4StartupPlrPropertiesDlg::C4StartupPlrPropertiesDlg(), C4GUI::ConfirmationDialog::ConfirmationDialog(), C4GUI::InputDialog::InputDialog(), C4Network2::OpenSurrenderDialog(), C4Network2::OpenVoteDialog(), C4Network2::QueryClientPassword(), C4Game::ShowGameOverDlg(), and C4GUI::Screen::ShowRemoveDlg().

Here is the caller graph for this function:

◆ SetDragTarget()

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

Definition at line 464 of file C4Gui.h.

464 { pDragTarget = pToWindow; }

References C4GUI::Element::pDragTarget.

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

Here is the caller graph for this function:

◆ SetEqualItemHeight()

void C4Menu::SetEqualItemHeight ( bool  fToVal)
inlineinherited

Definition at line 198 of file C4Menu.h.

198 { fEqualIconItemHeight = fToVal; } // enable/disable equal item heights
bool fEqualIconItemHeight
Definition: C4Menu.h:152

References C4Menu::fEqualIconItemHeight.

◆ SetFocus()

void C4GUI::Dialog::SetFocus ( Control pCtrl,
bool  fByMouse 
)
inherited

Definition at line 563 of file C4GuiDialogs.cpp.

564  {
565  // no change?
566  if (pCtrl == pActiveCtrl) return;
567  // leave old focus
568  if (pActiveCtrl)
569  {
570  Control *pC = pActiveCtrl;
571  pActiveCtrl = nullptr;
572  pC->OnLooseFocus();
573  // if leaving the old focus set a new one, abort here because it looks like the control didn't want to lose focus
574  if (pActiveCtrl) return;
575  }
576  // set new
577  if ((pActiveCtrl = pCtrl)) pCtrl->OnGetFocus(fByMouse);
578  }
virtual void OnLooseFocus()
Definition: C4Gui.h:1057

References C4GUI::Control::OnGetFocus(), C4GUI::Control::OnLooseFocus(), and C4GUI::Dialog::pActiveCtrl.

Referenced by C4GUI::Dialog::AdvanceFocus(), C4ChatDlg::C4ChatDlg(), C4GameOverDlg::C4GameOverDlg(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4StartupModsDlg::C4StartupModsDlg(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4StartupPlrPropertiesDlg::C4StartupPlrPropertiesDlg(), C4StartupPlrSelDlg::C4StartupPlrSelDlg(), C4StartupScenSelDlg::C4StartupScenSelDlg(), C4GUI::Dialog::CharIn(), C4StartupScenSelDlg::DeselectAll(), C4StartupNetDlg::DoOK(), C4FileSelDlg::InitElements(), C4GameLobby::MainDlg::MainDlg(), C4GUI::MessageDialog::MessageDialog(), C4GUI::Label::MouseInput(), C4GUI::Control::MouseInput(), C4StartupScenSelDlg::OnButtonScenario(), C4ChatControl::OnConnectBtn(), C4GUI::RenameEdit::OnFinishInput(), C4GUI::Label::OnHotkey(), C4StartupMainDlg::OnShown(), C4StartupScenSelDlg::OpenFolder(), C4GUI::RenameEdit::RenameEdit(), C4GUI::InputDialog::SetCustomEdit(), C4GUI::Container::SetVisibility(), and C4LeagueSignupDialog::UserClose().

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

◆ SetFrameDeco()

void C4GUI::Dialog::SetFrameDeco ( FrameDecoration pNewDeco)
inlineinherited

Definition at line 2194 of file C4Gui.h.

2195  {
2196  if (pFrameDeco) pFrameDeco->Deref();
2197  if ((pFrameDeco = pNewDeco)) pNewDeco->Ref();
2198  UpdateOwnPos(); // margin may have changed; might need to reposition stuff
2199  }
void UpdateOwnPos() override

References C4GUI::FrameDecoration::Deref(), C4GUI::Dialog::pFrameDeco, C4GUI::FrameDecoration::Ref(), and C4GUI::Window::UpdateOwnPos().

Here is the call graph for this function:

◆ SetLocation()

bool C4Menu::SetLocation ( int32_t  iX,
int32_t  iY 
)
inherited

Definition at line 951 of file C4Menu.cpp.

952 {
953  // just set position...
954  SetPos(iX, iY);
955  return true;
956 }

References C4GUI::Window::SetPos().

Here is the call graph for this function:

◆ SetPermanent()

void C4Menu::SetPermanent ( bool  fPermanent)
inherited

Definition at line 862 of file C4Menu.cpp.

863 {
864  Permanent = fPermanent;
865 }

References C4Menu::Permanent.

Referenced by ActivateDisplay(), ActivateGoals(), ActivateHost(), ActivateHostility(), C4Object::ActivateMenu(), ActivateOptions(), ActivateRules(), and ActivateSavegame().

Here is the caller graph for this function:

◆ SetPos()

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

Definition at line 860 of file C4Gui.h.

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

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

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

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

◆ SetPosition()

bool C4Menu::SetPosition ( int32_t  iPosition)
inherited

Definition at line 604 of file C4Menu.cpp.

605 {
606  if (!IsActive()) return false;
607  // update scroll pos, if location is initialized
609  return true;
610 }
void SetScroll(int32_t iToScroll)

References C4Menu::Columns, C4Menu::IsActive(), C4GUI::Element::IsVisible(), C4Menu::ItemHeight, C4Menu::pClientWindow, and C4GUI::ScrollWindow::SetScroll().

Here is the call graph for this function:

◆ SetSelection()

bool C4Menu::SetSelection ( int32_t  iSelection,
bool  fAdjustPosition,
bool  fDoCalls 
)
inherited

Definition at line 544 of file C4Menu.cpp.

545 {
546  // Not active
547  if (!IsActive()) return false;
548  // Outside Limits / Selectable
549  C4MenuItem *pNewSel = GetItem(iSelection);
550  if ((iSelection==-1 && !ItemCount) || (pNewSel && pNewSel->IsSelectable))
551  {
552  // Selection change
553  if (iSelection!=Selection)
554  {
555  // calls
556  C4MenuItem *pSel = GetSelectedItem();
557  if (pSel) pSel->SetSelected(false);
558  // Set selection
559  Selection=iSelection;
560  // Reset time on selection
561  TimeOnSelection=0;
562  }
563  // always recheck selection for internal refill
564  C4MenuItem *pSel = GetSelectedItem();
565  if (pSel) pSel->SetSelected(true);
566  // set main caption by selection
567  if (Style == C4MN_Style_Normal)
568  {
569  if (pSel)
570  SetTitle(*(pSel->Caption) ? pSel->Caption : " ", HasMouse());
571  else
572  SetTitle(*Caption ? Caption : " ", HasMouse());
573  }
574  }
575  // adjust position, if desired
576  if (fAdjustPosition) AdjustPosition();
577  // do selection callback
578  if (fDoCalls) OnSelectionChanged(Selection);
579  // Done
580  return true;
581 }
void SetTitle(const char *szToTitle, bool fShowCloseButton=true)
virtual void OnSelectionChanged(int32_t iNewSelection)
Definition: C4Menu.h:232
bool HasMouse()
Definition: C4Menu.cpp:1149
void SetSelected(bool fToVal)
Definition: C4Menu.h:106

References C4Menu::AdjustPosition(), C4MN_Style_Normal, C4MenuItem::Caption, C4Menu::Caption, C4Menu::GetItem(), C4Menu::GetSelectedItem(), C4Menu::HasMouse(), C4Menu::IsActive(), C4MenuItem::IsSelectable, C4Menu::ItemCount, C4Menu::OnSelectionChanged(), C4Menu::Selection, C4MenuItem::SetSelected(), C4GUI::Dialog::SetTitle(), C4Menu::Style, and C4Menu::TimeOnSelection.

Referenced by ActivateDisplay(), ActivateOptions(), C4Menu::AdjustSelection(), C4Menu::Control(), DoRefillInternal(), C4Menu::MoveSelection(), OnUserEnter(), and OnUserSelectItem().

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

◆ SetSize()

void C4Menu::SetSize ( int32_t  iToWdt,
int32_t  iToHgt 
)
inherited

Definition at line 617 of file C4Menu.cpp.

618 {
619  if (iToWdt) Columns=iToWdt;
620  if (iToHgt) Lines=iToHgt;
621  InitSize();
622 }

References C4Menu::Columns, C4Menu::InitSize(), and C4Menu::Lines.

Here is the call graph for this function:

◆ SetTextProgress()

bool C4Menu::SetTextProgress ( int32_t  iToProgress,
bool  fAdd 
)
inherited

Definition at line 958 of file C4Menu.cpp.

959 {
960  // menu active at all?
961  if (!IsActive()) return false;
962  // set: enable or disable progress?
963  if (!fAdd)
964  fTextProgressing = (iToProgress >= 0);
965  else
966  {
967  // add: Does not enable progressing
968  if (!fTextProgressing) return false;
969  }
970  // update menu items
971  C4MenuItem *pItem;
972  bool fAnyItemUnfinished = false;
973  for (int32_t i=HasPortrait(); (pItem = GetItem(i)); ++i)
974  {
975  // disabled progress: set all progresses to shown
976  if (!fTextProgressing)
977  {
978  pItem->TextDisplayProgress = -1;
979  continue;
980  }
981  // do progress on item, if any is left
982  // this call automatically reduces iToProgress as it's used up
983  if (!fAdd) pItem->TextDisplayProgress = 0;
984  if (iToProgress) pItem->DoTextProgress(iToProgress);
985  if (pItem->TextDisplayProgress > -1) fAnyItemUnfinished = true;
986  }
987  // if that progress showed everything already, mark as not progressing
988  fTextProgressing = fAnyItemUnfinished;
989  // done, success
990  return true;
991 }
void DoTextProgress(int32_t &riByVal)
Definition: C4Menu.cpp:71
int32_t TextDisplayProgress
Definition: C4Menu.h:89

References C4MenuItem::DoTextProgress(), C4Menu::fTextProgressing, C4Menu::GetItem(), C4Menu::HasPortrait(), C4Menu::IsActive(), and C4MenuItem::TextDisplayProgress.

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

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

◆ SetTitle()

void C4GUI::Dialog::SetTitle ( const char *  szToTitle,
bool  fShowCloseButton = true 
)
inherited

Definition at line 336 of file C4GuiDialogs.cpp.

337  {
338  // always keep local copy of title
339  TitleString.Copy(szTitle);
340  // console mode dialogs: Use window bar
342  {
343  if (pWindow) pWindow->SetTitle(szTitle ? szTitle : "");
344  return;
345  }
346  // set new
347  if (szTitle && *szTitle)
348  {
350  if (pTitle)
351  {
352  pTitle->GetBounds() = C4Rect(-GetMarginLeft(), -iTextHgt, rcBounds.Wdt, iTextHgt);
353  // noupdate if title is same - this is necessary to prevent scrolling reset when refilling internal menus
354  if (SEqual(pTitle->GetText(), szTitle)) return;
355  pTitle->SetText(szTitle);
356  }
357  else
358  AddElement(pTitle = new WoodenLabel(szTitle, C4Rect(-GetMarginLeft(), -iTextHgt, rcBounds.Wdt, iTextHgt), C4GUI_CaptionFontClr, &::GraphicsResource.TextFont, ALeft, false));
359  pTitle->SetToolTip(szTitle);
360  pTitle->SetDragTarget(this);
362  if (fShowCloseButton)
363  {
364  pTitle->SetRightIndent(20); // for close button
365  if (!pCloseBtn)
366  {
367  AddElement(pCloseBtn = new CallbackButton<Dialog, IconButton>(Ico_Close, pTitle->GetToprightCornerRect(16,16,4,4,0), '\0', &Dialog::OnUserClose));
368  pCloseBtn->SetToolTip(LoadResStr("IDS_MNU_CLOSE"));
369  }
370  else
371  pCloseBtn->GetBounds() = pTitle->GetToprightCornerRect(16,16,4,4,0);
372  }
373  }
374  else
375  {
376  if (pTitle) { delete pTitle; pTitle=nullptr; }
377  if (pCloseBtn) { delete pCloseBtn; pCloseBtn = nullptr; }
378  }
379  }
#define C4GUI_TitleAutoScrollTime
Definition: C4Gui.h:146
#define C4GUI_CaptionFontClr
Definition: C4Gui.h:37
const int ALeft
Definition: C4Surface.h:41
CallbackButton< Dialog, C4GUI::IconButton > * pCloseBtn
Definition: C4Gui.h:2080
bool IsViewportDialog()
Definition: C4Gui.h:2173
void OnUserClose(C4GUI::Control *btn)
Definition: C4Gui.h:2205
void SetDragTarget(Window *pToWindow)
Definition: C4Gui.h:464
C4Rect GetToprightCornerRect(int32_t iWidth=16, int32_t iHeight=16, int32_t iHIndent=4, int32_t iVIndent=4, int32_t iIndexX=0)
Definition: C4Gui.cpp:399
void SetToolTip(const char *szNewTooltip, bool is_immediate=false)
Definition: C4Gui.cpp:409
void SetText(const char *szToText, bool fAllowHotkey=true)
Definition: C4GuiLabels.cpp:74
const char * GetText()
Definition: C4Gui.h:503
static int32_t GetDefaultHeight(CStdFont *pUseFont=nullptr)
void SetRightIndent(int32_t iNewIndent)
Definition: C4Gui.h:540
void SetAutoScrollTime(uint32_t tDelay)
Definition: C4Gui.h:537
void SetTitle(const char *Title)
Definition: C4AppT.cpp:114
@ Ico_Close
Definition: C4Gui.h:678

References C4GUI::Container::AddElement(), ALeft, Application, C4GUI_CaptionFontClr, C4GUI_TitleAutoScrollTime, StdStrBuf::Copy(), C4GUI::Element::GetBounds(), C4GUI::WoodenLabel::GetDefaultHeight(), C4GUI::Dialog::GetMarginLeft(), C4GUI::Label::GetText(), C4GUI::Element::GetToprightCornerRect(), GraphicsResource, C4GUI::Ico_Close, C4Application::isEditor, C4GUI::Dialog::IsViewportDialog(), LoadResStr(), C4GUI::Dialog::OnUserClose(), C4GUI::Dialog::pCloseBtn, C4GUI::Dialog::pTitle, C4GUI::Dialog::pWindow, C4GUI::Element::rcBounds, SEqual(), C4GUI::WoodenLabel::SetAutoScrollTime(), C4GUI::Element::SetDragTarget(), C4GUI::WoodenLabel::SetRightIndent(), C4GUI::Label::SetText(), C4Window::SetTitle(), C4GUI::Element::SetToolTip(), C4GraphicsResource::TextFont, C4GUI::Dialog::TitleString, and C4Rect::Wdt.

Referenced by C4GUI::Dialog::Dialog(), C4ChatDlg::OnChatTitleChange(), C4StartupModsDownloader::OnConfirmInstallation(), C4Menu::SetSelection(), C4ScoreboardDlg::Update(), and C4Menu::UpdateElementPositions().

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

◆ SetToolTip()

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

Definition at line 409 of file C4Gui.cpp.

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

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

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

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

◆ SetVisibility()

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

Reimplemented from C4GUI::Element.

Reimplemented in C4StartupNetListEntry, and C4StartupModsListEntry.

Definition at line 247 of file C4GuiContainers.cpp.

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

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

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

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

◆ Show()

bool C4GUI::Dialog::Show ( Screen pOnScreen,
bool  fCB 
)
inherited

Definition at line 614 of file C4GuiDialogs.cpp.

615  {
616  // already shown?
617  if (fShow) return false;
618  // default screen
619  if (!pOnScreen) if (!(pOnScreen = Screen::GetScreenS())) return false;
620  // show there
621  pOnScreen->ShowDialog(this, false);
622  fVisible = true;
623  // developer mode: Create window
625  if (!CreateConsoleWindow()) return false;
626  // CB
627  if (fCB) OnShown();
628  return true;
629  }
bool CreateConsoleWindow()

References Application, C4GUI::Dialog::CreateConsoleWindow(), C4GUI::Dialog::fShow, C4GUI::Element::fVisible, C4GUI::Screen::GetScreenS(), C4Application::isEditor, C4GUI::Dialog::IsViewportDialog(), C4GUI::Dialog::OnShown(), and C4GUI::Screen::ShowDialog().

Referenced by C4Network2::FinalInit(), C4Game::InitNetworkFromAddress(), C4Network2::LeaguePlrAuth(), C4Network2::LeagueStart(), C4Network2::OpenSurrenderDialog(), C4Network2::OpenVoteDialog(), C4Network2::RetrieveRes(), C4ChatDlg::ShowChat(), C4Game::ShowGameOverDlg(), C4DownloadDlg::ShowModal(), C4GUI::Screen::ShowModalDlg(), C4GUI::Screen::ShowProgressDlg(), C4GUI::Screen::ShowRemoveDlg(), and C4Startup::SwitchDialog().

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

◆ StartDragging()

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

Definition at line 259 of file C4Gui.cpp.

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

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

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

Here is the caller graph for this function:

◆ StopDragging()

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

Definition at line 282 of file C4Gui.cpp.

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

References C4GUI::Element::DoDragging().

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

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

◆ TryClose()

bool C4Menu::TryClose ( bool  fOK,
bool  fControl 
)
inherited

Definition at line 280 of file C4Menu.cpp.

281 {
282  // abort if menu is permanented by script
283  if (!fOK) if (IsCloseDenied()) return false;
284 
285  // close the menu
286  Close(fOK);
287  Clear();
288  ::pGUI->RemoveElement(this);
289 
290  // invoke close command
291  if (fControl && CloseCommand.getData())
292  {
294  }
295 
296  // done
297  return true;
298 }
void RemoveElement(Element *pChild) override
Definition: C4Gui.cpp:556
virtual bool IsCloseDenied()
Definition: C4Menu.h:233

References C4Menu::Clear(), C4GUI::Dialog::Close(), C4Menu::CloseCommand, C4GUI::Dialog::fOK, StdStrBuf::getData(), C4Menu::IsCloseDenied(), C4Menu::MenuCommand(), pGUI, and C4GUI::Screen::RemoveElement().

Referenced by C4Object::ActivateMenu(), C4Object::CloseMenu(), C4Menu::Control(), C4Menu::Enter(), C4Player::Execute(), and OnUserClose().

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

◆ UpdateElementPositions()

void C4Menu::UpdateElementPositions ( )
protectedinherited

Definition at line 1003 of file C4Menu.cpp.

1004 {
1005  // only if already shown and made visible by first drawing
1006  // this will postpone the call of menu initialization until it's really needed
1007  if (!IsVisible() || !pClientWindow) return;
1008  // reposition client scrolling window
1010  // re-stack all list items
1011  int xOff, yOff = 0;
1012  C4MenuItem *pCurr = static_cast<C4MenuItem *>(pClientWindow->GetFirst()), *pPrev = nullptr;
1013  if (HasPortrait() && pCurr)
1014  {
1015  // recheck portrait
1017  C4Facet &fctPortrait = pCurr->Symbol;
1018  C4Rect rcPortraitBounds(0,0, C4MN_DlgPortraitWdt + C4MN_DlgPortraitIndent, fctPortrait.Hgt * C4MN_DlgPortraitWdt / std::max<int>(fctPortrait.Wdt, 1));
1019  if (pCurr->GetBounds() != rcPortraitBounds)
1020  {
1021  pCurr->GetBounds() = rcPortraitBounds;
1022  pCurr->UpdateOwnPos();
1023  }
1024  pCurr = static_cast<C4MenuItem *>(pCurr->GetNext());
1025  }
1026  else xOff = 0;
1027  // recheck list items
1028  int32_t iMaxDlgOptionHeight = -1;
1029  int32_t iIndex = 0; C4Rect rcNewBounds(0,0,ItemWidth,ItemHeight);
1030  C4MenuItem *pFirstStack = pCurr, *pNext = pFirstStack;
1031  while ((pCurr = pNext))
1032  {
1033  pNext = static_cast<C4MenuItem *>(pCurr->GetNext());
1034  if (Style == C4MN_Style_Dialog)
1035  {
1036  // y-margin always, except between options
1037  if (!pPrev || (!pPrev->IsSelectable || !pCurr->IsSelectable)) yOff += C4MN_DlgLineMargin; else yOff += C4MN_DlgOptionLineMargin;
1038  // determine item height.
1039  StdStrBuf sText;
1040  int32_t iAssumedItemHeight = ::GraphicsResource.FontRegular.GetLineHeight();
1041  int32_t iWdt, iAvailWdt = ItemWidth, iSymWdt;
1042  for (;;)
1043  {
1044  iSymWdt = std::min<int32_t>(pCurr->GetSymbolWidth(iAssumedItemHeight), iAvailWdt/2);
1045  iAvailWdt = ItemWidth - iSymWdt;
1046  ::GraphicsResource.FontRegular.BreakMessage(pCurr->Caption, iAvailWdt, &sText, true);
1047  ::GraphicsResource.FontRegular.GetTextExtent(sText.getData(),iWdt,rcNewBounds.Hgt, true);
1048  if (!iSymWdt || rcNewBounds.Hgt <= iAssumedItemHeight) break;
1049  // If there is a symbol, the symbol grows as more lines become available
1050  // Thus, less space is available for the text, and it might become larger
1051  iAssumedItemHeight = rcNewBounds.Hgt;
1052  }
1053  if (fEqualIconItemHeight && iSymWdt)
1054  {
1055  // force equal height for all symbol items
1056  if (iMaxDlgOptionHeight < 0)
1057  {
1058  // first selectable item inits field
1059  iMaxDlgOptionHeight = rcNewBounds.Hgt;
1060  }
1061  else if (rcNewBounds.Hgt <= iMaxDlgOptionHeight)
1062  {
1063  // following item height smaller or equal: Force equal
1064  rcNewBounds.Hgt = iMaxDlgOptionHeight;
1065  }
1066  else
1067  {
1068  // following item larger height: Need to re-stack from beginning
1069  iMaxDlgOptionHeight = rcNewBounds.Hgt;
1070  pNext = pFirstStack;
1071  pPrev = nullptr;
1072  yOff = 0;
1073  iIndex = 0;
1074  continue;
1075  }
1076  }
1077  assert(iWdt <= iAvailWdt);
1078  rcNewBounds.x = 0;
1079  rcNewBounds.y = yOff;
1080  yOff += rcNewBounds.Hgt;
1081  }
1082  else
1083  {
1084  rcNewBounds.x = (iIndex % std::max<int32_t>(Columns, 1)) * ItemWidth;
1085  rcNewBounds.y = (iIndex / std::max<int32_t>(Columns, 1)) * ItemHeight;
1086  }
1087  rcNewBounds.x += xOff;
1088  if (pCurr->GetBounds() != rcNewBounds)
1089  {
1090  pCurr->GetBounds() = rcNewBounds;
1091  pCurr->UpdateOwnPos();
1092  }
1093  ++iIndex;
1094  pPrev = pCurr;
1095  }
1096  // update scrolling
1097  pClientWindow->SetClientHeight(rcNewBounds.y + rcNewBounds.Hgt);
1098  // re-set caption
1099  C4MenuItem *pSel = GetSelectedItem();
1100  const char *szCapt;
1101  if (pSel && Style == C4MN_Style_Normal)
1102  szCapt = pSel->Caption;
1103  else
1104  szCapt = Caption;
1105  SetTitle((*szCapt || Style == C4MN_Style_Dialog) ? szCapt : " ", HasMouse());
1106 }
const int32_t C4MN_DlgOptionLineMargin
Definition: C4Menu.cpp:39
Element * GetFirst()
Definition: C4Gui.h:829
Element * GetNext() const
Definition: C4Gui.h:449
virtual void UpdateOwnPos()
Definition: C4Gui.h:434
void SetClientHeight(int32_t iToHgt)
Definition: C4Gui.h:973
C4FacetSurface Symbol
Definition: C4Menu.h:78

References CStdFont::BreakMessage(), C4MN_DlgLineMargin, C4MN_DlgOptionLineMargin, C4MN_DlgPortraitIndent, C4MN_DlgPortraitWdt, C4MN_Style_Dialog, C4MN_Style_Normal, C4MenuItem::Caption, C4Menu::Caption, C4Menu::Columns, C4Menu::fEqualIconItemHeight, C4GraphicsResource::FontRegular, C4GUI::Element::GetBounds(), C4GUI::Element::GetContainedClientRect(), StdStrBuf::getData(), C4GUI::Container::GetFirst(), CStdFont::GetLineHeight(), C4GUI::Element::GetNext(), C4Menu::GetSelectedItem(), CStdFont::GetTextExtent(), GraphicsResource, C4Menu::HasMouse(), C4Menu::HasPortrait(), C4Facet::Hgt, C4Rect::Hgt, C4MenuItem::IsSelectable, C4GUI::Element::IsVisible(), C4Menu::ItemHeight, C4Menu::ItemWidth, C4Menu::pClientWindow, C4GUI::Element::pNext, C4GUI::Element::pPrev, C4GUI::Element::SetBounds(), C4GUI::ScrollWindow::SetClientHeight(), C4GUI::Dialog::SetTitle(), C4Menu::Style, C4MenuItem::Symbol, C4GUI::Element::UpdateOwnPos(), C4Facet::Wdt, C4Rect::x, and C4Rect::y.

Referenced by C4Menu::InitLocation(), C4Menu::RefillInternal(), and C4Menu::UpdateOwnPos().

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

◆ UpdateOwnPos()

void C4Menu::UpdateOwnPos ( )
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Window.

Definition at line 1108 of file C4Menu.cpp.

1109 {
1110  // client rect and stuff
1111  typedef C4GUI::Dialog ParentClass;
1112  ParentClass::UpdateOwnPos();
1114 }

References C4Menu::UpdateElementPositions().

Referenced by C4Menu::InitSize().

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

◆ UpdatePos()

void C4GUI::Dialog::UpdatePos ( )
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 416 of file C4GuiDialogs.cpp.

417  {
418  // Dialogs with their own windows can only be at 0/0
419  if (pWindow)
420  {
421  rcBounds.x = 0;
422  rcBounds.y = 0;
423  }
425  }

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

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

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

◆ UpdateScrollBar()

void C4Menu::UpdateScrollBar ( )
protectedinherited

Definition at line 766 of file C4Menu.cpp.

767 {
769  bool fBarNeeded = pLast && pLast->GetBounds().y + pLast->GetBounds().Hgt > pClientWindow->GetBounds().Hgt;
770  if (pClientWindow->IsScrollBarEnabled() == fBarNeeded) return;
771  // resize for bar
772  InitSize();
773 }
bool IsScrollBarEnabled()
Definition: C4Gui.h:990

References C4GUI::Element::GetBounds(), C4GUI::Container::GetLast(), C4Rect::Hgt, C4Menu::InitSize(), C4GUI::ScrollWindow::IsScrollBarEnabled(), C4Menu::pClientWindow, C4GUI::Container::pLast, and C4Rect::y.

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

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

◆ UpdateSize()

void C4GUI::Dialog::UpdateSize ( )
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 398 of file C4GuiDialogs.cpp.

399  {
400  // update title bar position
401  if (pTitle)
402  {
404  pTitle->SetBounds(C4Rect(-GetMarginLeft(), -iTextHgt, rcBounds.Wdt, iTextHgt));
405  if (pCloseBtn) pCloseBtn->SetBounds(pTitle->GetToprightCornerRect(16,16,4,4,0));
406  }
407  // inherited
409  // update assigned window
410  if (pWindow)
411  {
413  }
414  }
void SetSize(unsigned int cx, unsigned int cy)
Definition: C4AppT.cpp:113

References C4GUI::WoodenLabel::GetDefaultHeight(), C4GUI::Dialog::GetMarginLeft(), C4GUI::Element::GetToprightCornerRect(), GraphicsResource, C4Rect::Hgt, C4GUI::Dialog::pCloseBtn, C4GUI::Dialog::pTitle, C4GUI::Dialog::pWindow, C4GUI::Element::rcBounds, C4GUI::Element::SetBounds(), C4Window::SetSize(), C4GraphicsResource::TextFont, C4GUI::Element::UpdateSize(), and C4Rect::Wdt.

Referenced by C4StartupAboutDlg::C4StartupAboutDlg(), C4StartupLegalDlg::C4StartupLegalDlg(), C4StartupModsDlg::C4StartupModsDlg(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4StartupPlrPropertiesDlg::C4StartupPlrPropertiesDlg(), C4StartupPlrSelDlg::C4StartupPlrSelDlg(), C4StartupScenSelDlg::C4StartupScenSelDlg(), and C4FileSelDlg::InitElements().

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

◆ UserClose()

void C4Menu::UserClose ( bool  fOK)
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 1136 of file C4Menu.cpp.

1137 {
1138  // not if user con't control anything
1139  if (IsReadOnly()) return;
1140  // queue or direct enter
1141  OnUserClose();
1142 }
virtual void OnUserClose()
Definition: C4Menu.h:236
virtual bool IsReadOnly()
Definition: C4Menu.h:237

References C4Menu::IsReadOnly(), and C4Menu::OnUserClose().

Here is the call graph for this function:

◆ UserEnter()

void C4Menu::UserEnter ( int32_t  Player,
C4MenuItem pItem,
bool  fRight 
)
protectedinherited

Definition at line 1126 of file C4Menu.cpp.

1127 {
1128  // not if user con't control anything
1129  if (IsReadOnly()) return;
1130  // the item must be selectable
1131  if (!pItem || !pItem->IsSelectable) return;
1132  // queue or direct enter
1133  OnUserEnter(Player, pItem->iIndex, fRight);
1134 }
virtual void OnUserEnter(int32_t Player, int32_t iIndex, bool fRight)
Definition: C4Menu.h:235
int32_t iIndex
Definition: C4Menu.h:87

References C4MenuItem::iIndex, C4Menu::IsReadOnly(), C4MenuItem::IsSelectable, and C4Menu::OnUserEnter().

Referenced by C4MenuItem::MouseInput().

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

◆ UserSelectItem()

void C4Menu::UserSelectItem ( int32_t  Player,
C4MenuItem pItem 
)
protectedinherited

Definition at line 1116 of file C4Menu.cpp.

1117 {
1118  // not if user con't control anything
1119  if (IsReadOnly()) return;
1120  // the item must be selectable
1121  if (!pItem || !pItem->IsSelectable) return;
1122  // queue or direct selection
1123  OnUserSelectItem(Player, pItem->iIndex);
1124 }
virtual void OnUserSelectItem(int32_t Player, int32_t iIndex)
Definition: C4Menu.h:234

References C4MenuItem::iIndex, C4Menu::IsReadOnly(), C4MenuItem::IsSelectable, and C4Menu::OnUserSelectItem().

Referenced by C4MenuItem::MouseEnter().

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

Member Data Documentation

◆ Alignment

int32_t C4Menu::Alignment
protectedinherited

Definition at line 144 of file C4Menu.h.

Referenced by C4Menu::Default(), C4Menu::InitLocation(), and C4Menu::SetAlignment().

◆ Caption

char C4Menu::Caption[C4MaxTitle+1]
protectedinherited

◆ CloseCommand

StdStrBuf C4Menu::CloseCommand
protectedinherited

Definition at line 146 of file C4Menu.h.

Referenced by C4Menu::Default(), C4Menu::SetCloseCommand(), and C4Menu::TryClose().

◆ Columns

◆ eFade

Fade C4GUI::Dialog::eFade
protectedinherited

◆ Extra

int32_t C4Menu::Extra
protectedinherited

Definition at line 140 of file C4Menu.h.

Referenced by C4Menu::Default(), C4Menu::DrawElement(), and C4Menu::GetMarginBottom().

◆ ExtraData

int32_t C4Menu::ExtraData
protectedinherited

Definition at line 140 of file C4Menu.h.

Referenced by C4Menu::Default().

◆ fActive

bool C4Menu::fActive
protectedinherited

Definition at line 153 of file C4Menu.h.

Referenced by C4Menu::Clear(), C4Menu::Default(), C4Menu::Enter(), and C4Menu::IsActive().

◆ fDelOnClose

bool C4GUI::Dialog::fDelOnClose
protectedinherited

◆ fDragging

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

Definition at line 380 of file C4Gui.h.

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

◆ fEqualIconItemHeight

bool C4Menu::fEqualIconItemHeight
protectedinherited

◆ fHasPortrait

bool C4Menu::fHasPortrait
protectedinherited

Definition at line 150 of file C4Menu.h.

Referenced by C4Menu::Default(), and C4Menu::HasPortrait().

◆ fOK

◆ fShow

◆ fTextProgressing

bool C4Menu::fTextProgressing
protectedinherited

◆ fViewportDlg

bool C4GUI::Dialog::fViewportDlg
protectedinherited

Definition at line 2088 of file C4Gui.h.

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

◆ fVisible

◆ Identification

int32_t C4Menu::Identification
protectedinherited

◆ iDragX

int32_t C4GUI::Element::iDragX
protectedinherited

Definition at line 379 of file C4Gui.h.

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

◆ iDragY

int32_t C4GUI::Element::iDragY
protectedinherited

Definition at line 379 of file C4Gui.h.

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

◆ iFade

int32_t C4GUI::Dialog::iFade
protectedinherited

◆ ItemCount

◆ ItemHeight

int32_t C4Menu::ItemHeight
protectedinherited

◆ ItemWidth

int32_t C4Menu::ItemWidth
protectedinherited

◆ Lines

int32_t C4Menu::Lines
protectedinherited

◆ LocationSet

bool C4Menu::LocationSet
protectedinherited

◆ NeedRefill

bool C4Menu::NeedRefill
protectedinherited

◆ pActiveCtrl

◆ pClientWindow

◆ pCloseBtn

CallbackButton<Dialog, C4GUI::IconButton>* C4GUI::Dialog::pCloseBtn
protectedinherited

Definition at line 2080 of file C4Gui.h.

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

◆ pContextHandler

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

◆ pDragTarget

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

◆ Permanent

bool C4Menu::Permanent
protectedinherited

Definition at line 134 of file C4Menu.h.

Referenced by C4Menu::Default(), C4Menu::Enter(), and C4Menu::SetPermanent().

◆ pFirst

◆ pFrameDeco

◆ pLast

◆ Player

int32_t C4MainMenu::Player
protected

◆ pNext

◆ pParent

◆ pPrev

◆ pTitle

WoodenLabel* C4GUI::Dialog::pTitle
protectedinherited

◆ pWindow

◆ rcBounds

C4Rect C4GUI::Element::rcBounds
protectedinherited

Definition at line 385 of file C4Gui.h.

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

◆ rcClientRect

◆ Selection

◆ Style

◆ Symbol

C4FacetSurface C4Menu::Symbol
protectedinherited

Definition at line 148 of file C4Menu.h.

Referenced by C4Menu::Clear(), C4Menu::Default(), C4Menu::DoInit(), and C4Menu::DoInitRefSym().

◆ TimeOnSelection

int32_t C4Menu::TimeOnSelection
protectedinherited

Definition at line 137 of file C4Menu.h.

Referenced by C4Menu::Default(), C4Menu::Draw(), and C4Menu::SetSelection().

◆ TitleString

StdStrBuf C4GUI::Dialog::TitleString
protectedinherited

Definition at line 2087 of file C4Gui.h.

Referenced by C4GUI::Dialog::CreateConsoleWindow(), and C4GUI::Dialog::SetTitle().

◆ VisibleCount

int32_t C4Menu::VisibleCount
protectedinherited

Definition at line 145 of file C4Menu.h.

Referenced by C4Menu::Default(), and C4Menu::InitSize().


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