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

#include <C4GameLobby.h>

Inheritance diagram for C4GameLobby::MainDlg:
[legend]
Collaboration diagram for C4GameLobby::MainDlg:
[legend]

Public Member Functions

 MainDlg (bool fHost)
 
 ~MainDlg () override
 
void OnClientJoin (C4Client *pNewClient)
 
void OnClientConnect (C4Client *pClient, C4Network2IOConnection *pConn)
 
void OnClientPart (C4Client *pPartClient)
 
bool OnMessage (C4Client *pOfClient, const char *szMessage)
 
void OnClientSound (C4Client *pOfClient)
 
void OnLog (const char *szLogMsg, DWORD dwClr=C4GUI_LogFontClr)
 
void OnError (const char *szErrMsg)
 
void OnPlayersChange ()
 
void OnClientReadyStateChange ()
 
void OnClientAddPlayer (const char *szFilename, int32_t idClient)
 
void HandlePacket (char cStatus, const C4PacketBase *pBasePkt, C4Network2Client *pClient)
 
void OnCountdownPacket (const C4PacketCountdown &Pkt)
 
bool IsCountdown ()
 
void Start (int32_t iCountdownTime)
 
void UpdatePassword ()
 
void ClearLog ()
 
void SetTitle (const char *szToTitle)
 
void SetTitle (const char *szToTitle, bool fShowCloseButton=true)
 
void RemoveElement (Element *pChild) override
 
void Draw (C4TargetFacet &cgo) 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
 
bool KeyEnter ()
 
virtual bool OnEscape ()
 
bool KeyEscape ()
 
void AdvanceFocus (bool fBackwards)
 
bool KeyAdvanceFocus (bool fBackwards)
 
bool IsShown ()
 
bool IsOK ()
 
bool IsAborted ()
 
bool IsActive (bool fForKeyboard)
 
bool IsFading ()
 
virtual bool HasBackground ()
 
virtual bool IsFreePlaceDialog ()
 
virtual bool IsBottomPlacementDialog ()
 
virtual bool IsExclusiveDialog ()
 
virtual bool IsMouseControlled ()
 
virtual C4ViewportGetViewport ()
 
bool IsViewportDialog ()
 
bool IsExternalDrawDialog () override
 
virtual int32_t GetZOrdering ()
 
bool Show (Screen *pOnScreen, bool fCB)
 
void Close (bool fOK)
 
bool FadeIn (Screen *pOnScreen)
 
void FadeOut (bool fCloseWithOK)
 
bool DoModal ()
 
bool Execute ()
 
bool Execute2 ()
 
void SetDelOnClose (bool fToVal=true)
 
void SetFrameDeco (FrameDecoration *pNewDeco)
 
void ClearFrameDeco ()
 
FrameDecoration * GetFrameDecoration () const
 
void SetClientSize (int32_t iToWdt, int32_t iToHgt)
 
void OnUserClose (C4GUI::Control *btn)
 
virtual void UserClose (bool fOK)
 
virtual void OnShown ()
 
virtual void OnIdle ()
 
ContextHandler * GetContextHandler () override
 
void SetPos (int32_t iXPos, int32_t iYPos)
 
C4RectGetClientRect () override
 
void Clear ()
 
void ClearChildren ()
 
void MakeLastElement (Element *pChild)
 
void AddElement (Element *pChild)
 
void ReaddElement (Element *pChild)
 
void InsertElement (Element *pChild, Element *pInsertBefore)
 
ElementGetNextNestedElement (Element *pPrevElement, bool fBackwards)
 
ElementGetFirstContained () override
 
virtual ElementGetLastContained ()
 
ElementGetFirstNestedElement (bool fBackwards) override
 
Iterator begin ()
 
Iterator end ()
 
ReverseIterator rbegin ()
 
ReverseIterator rend ()
 
ElementGetFirst ()
 
ElementGetLast ()
 
ContainerGetContainer () override
 
ElementGetElementByIndex (int32_t i)
 
int32_t GetElementCount ()
 
void SetVisibility (bool fToValue) override
 
virtual bool IsSelectedChild (Element *pChild)
 
bool IsParentOf (Element *pEl) override
 
virtual void MouseEnter (CMouse &rMouse)
 
virtual void MouseLeave (CMouse &rMouse)
 
virtual void StartDragging (CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam)
 
virtual void DoDragging (CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam)
 
virtual void StopDragging (CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam)
 
bool DoContext ()
 
ContainerGetParent ()
 
virtual ScreenGetScreen ()
 
virtual ControlIsFocusElement ()
 
void ScreenPos2ClientPos (int32_t &riX, int32_t &riY)
 
void ClientPos2ScreenPos (int32_t &riX, int32_t &riY)
 
void SetToolTip (const char *szNewTooltip, bool is_immediate=false)
 
const char * GetToolTip ()
 
const char * GetOwnToolTip ()
 
bool IsImmediateToolTip () const
 
int32_t GetWidth ()
 
int32_t GetHeight ()
 
C4RectGetBounds ()
 
void SetBounds (const C4Rect &rcNewBound)
 
C4Rect GetContainedClientRect ()
 
ElementGetNext () const
 
ElementGetPrev () const
 
bool IsInActiveDlg (bool fForKeyboard)
 
C4Rect GetToprightCornerRect (int32_t iWidth=16, int32_t iHeight=16, int32_t iHIndent=4, int32_t iVIndent=4, int32_t iIndexX=0)
 
bool IsVisible ()
 
virtual int32_t GetListItemTopSpacing ()
 
virtual bool GetListItemTopSpacingBar ()
 
void SetDragTarget (Window *pToWindow)
 
void SetContextHandler (ContextHandler *pNewHd)
 

Static Public Member Functions

static int32_t GetDefaultTitleHeight ()
 

Public Attributes

bool fVisible {true}
 

Protected Member Functions

void OnReadyCheck (C4GUI::Element *pCheckBox)
 
void OnRunBtn (C4GUI::Control *btn)
 
void OnExitBtn (C4GUI::Control *btn)
 
bool KeyHistoryUpDown (bool fUp)
 
C4GUI::Edit::InputResult OnChatInput (C4GUI::Edit *edt, bool fPasting, bool fPastingMore)
 
void OnClosed (bool fOK) override
 
void OnSec1Timer () override
 
C4GUI::ContextMenuOnRightTabContext (C4GUI::Element *pLabel, int32_t iX, int32_t iY)
 
void OnCtxTabPlayers (C4GUI::Element *pListItem)
 
void OnTabPlayers (C4GUI::Control *btn)
 
void OnCtxTabTeams (C4GUI::Element *pListItem)
 
void OnTabTeams (C4GUI::Control *btn)
 
void OnCtxTabRes (C4GUI::Element *pListItem)
 
void OnTabRes (C4GUI::Control *btn)
 
void OnCtxTabOptions (C4GUI::Element *pListItem)
 
void OnTabOptions (C4GUI::Control *btn)
 
void OnCtxTabScenario (C4GUI::Element *pListItem)
 
void OnTabScenario (C4GUI::Control *btn)
 
void UpdateRightTab ()
 
void OnBtnChat (C4GUI::Control *btn)
 
class C4GUI::ControlGetDefaultControl () override
 
const char * GetID () override
 
void DrawElement (C4TargetFacet &cgo) override
 
bool OnEnter () override
 
bool IsComponentOutsideClientArea () override
 
virtual bool HasUpperBoard ()
 
bool IsFullscreenDialog () override
 
bool DoPlacement (Screen *pOnScreen, const C4Rect &rPreferredDlgRect) override
 
int32_t GetMarginTop () override
 
int32_t GetMarginLeft () override
 
int32_t GetMarginRight () override
 
int32_t GetMarginBottom () override
 
void UpdateOwnPos () override
 
void DrawBackground (C4TargetFacet &cgo, C4Facet &rFromFct)
 
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 IsOwnPtrElement ()
 
virtual bool IsMenu ()
 
virtual bool CheckNameHotkey (const char *)
 

Protected Attributes

Label * pFullscreenTitle
 
Label * pSubTitle
 
int32_t iDlgMarginX
 
int32_t iDlgMarginY
 
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
 

Private Member Functions

bool Execute (int, pollfd *) override
 
void Set ()
 
void SetDelay (uint32_t inDelay)
 
bool CheckAndReset ()
 
C4TimeMilliseconds GetNextTick (C4TimeMilliseconds tNow) override
 
uint32_t TimerInterval () override
 
void Changed ()
 
bool ExecuteUntil (int iTimeout=-1)
 
virtual void GetFDs (std::vector< struct pollfd > &)
 
bool IsSignaled ()
 
virtual bool IsLowPriority ()
 
virtual bool IsNotify ()
 

Detailed Description

Definition at line 85 of file C4GameLobby.h.

Constructor & Destructor Documentation

C4GameLobby::MainDlg::MainDlg ( bool  fHost)

Definition at line 129 of file C4GameLobby.cpp.

References StdScheduler::Add(), C4GUI::Container::AddElement(), C4GUI::ListBox::AddElement(), C4GUI::Tabular::AddSheet(), ALeft, Application, C4GUI_CaptionFontClr, C4GUI_IconExHgt, fHost, Game, C4GUI::ComponentAligner::GetAll(), C4GUI::Window::GetClientRect(), C4GUI::Element::GetContainedClientRect(), C4GUI::Edit::GetDefaultEditHeight(), C4GUI::WoodenLabel::GetDefaultHeight(), C4GUI::ComponentAligner::GetFromBottom(), C4GUI::ComponentAligner::GetFromRight(), C4GameOptionsList::GOLS_Lobby, GraphicsResource, C4GUI::Ico_Ex_Chat, C4GUI::Ico_Gfx, C4GUI::Ico_Options, C4GUI::Ico_Player, C4GUI::Ico_Resource, C4GUI::Ico_Team, C4ChatDlg::IsChatActive(), C4TeamList::IsMultiTeams(), KeyHistoryUpDown(), KEYSCOPE_Gui, LoadResStr(), OnBtnChat(), OnChatInput(), OnExitBtn(), OnReadyCheck(), OnRightTabContext(), OnRunBtn(), OnTabOptions(), OnTabPlayers(), OnTabRes(), OnTabScenario(), OnTabTeams(), C4PlayerInfoListBox::PILBM_LobbyClientSort, C4CustomKey::PRIO_CtrlOverride, C4GUI::FullscreenDialog::pSubTitle, C4GUI::Dialog::SetFocus(), C4GUI::CheckBox::SetOnChecked(), C4GUI::Element::SetToolTip(), C4GUI::Tabular::tbNone, C4Game::Teams, C4GraphicsResource::TextFont, UpdateRightTab(), and C4Rect::Wdt.

131  (const char *) LoadResStr("IDS_DLG_LOBBY"):
132  FormatString("%s - %s", Game.ScenarioTitle.getData(), LoadResStr("IDS_DLG_LOBBY")).getData(),
134  pPlayerList(nullptr), pResList(nullptr), pChatBox(nullptr), pRightTabLbl(nullptr), pRightTab(nullptr),
135  pEdt(nullptr), btnRun(nullptr), btnPlayers(nullptr), btnResources(nullptr), btnTeams(nullptr), btnChat(nullptr)
136  {
137  // key bindings
138  pKeyHistoryUp = new C4KeyBinding(C4KeyCodeEx(K_UP ), "LobbyChatHistoryUp" , KEYSCOPE_Gui, new C4GUI::DlgKeyCBEx<MainDlg, bool>(*this, true , &MainDlg::KeyHistoryUpDown), C4CustomKey::PRIO_CtrlOverride);
139  pKeyHistoryDown= new C4KeyBinding(C4KeyCodeEx(K_DOWN), "LobbyChatHistoryDown", KEYSCOPE_Gui, new C4GUI::DlgKeyCBEx<MainDlg, bool>(*this, false, &MainDlg::KeyHistoryUpDown), C4CustomKey::PRIO_CtrlOverride);
140  // timer
141  Application.Add(this);
142  // indents / sizes
143  int32_t iDefBtnHeight = 32;
144  int32_t iIndentX1, iIndentX2, iIndentX3;
145  int32_t iIndentY1, iIndentY2, iIndentY3, iIndentY4;
146  int32_t iClientListWdt;
147  if (GetClientRect().Wdt > 500)
148  {
149  // normal dlg
150  iIndentX1 = 10; // lower button area
151  iIndentX2 = 20; // center area (chat)
152  iIndentX3 = 5; // client/player list
153  iClientListWdt = GetClientRect().Wdt / 3;
154  }
155  else
156  {
157  // small dlg
158  iIndentX1 = 2; // lower button area
159  iIndentX2 = 2; // center area (chat)
160  iIndentX3 = 1; // client/player list
161  iClientListWdt = GetClientRect().Wdt / 2;
162  }
163  if (GetClientRect().Hgt > 320)
164  {
165  // normal dlg
166  iIndentY1 = 16; // lower button area
167  iIndentY2 = 20; // status bar offset
168  iIndentY3 = 8; // center area (chat)
169  iIndentY4 = 8; // client/player list
170  }
171  else
172  {
173  // small dlg
174  iIndentY1 = 2; // lower button area
175  iIndentY2 = 2; // status bar offset
176  iIndentY3 = 1; // center area (chat)
177  iIndentY4 = 1; // client/player list
178  }
179  // set subtitle ToolTip
180  if (pSubTitle)
181  pSubTitle->SetToolTip(LoadResStr("IDS_DLG_SCENARIOTITLE"));
182  C4GUI::Label *pLbl;
183  // main screen components
184  C4GUI::ComponentAligner caMain(GetClientRect(), 0,0,true);
185  caMain.GetFromBottom(iIndentY2);
186  // lower button-area
187  C4GUI::ComponentAligner caBottom(caMain.GetFromBottom(iDefBtnHeight+iIndentY1*2), iIndentX1,iIndentY1);
188  // add buttons
190  btnExit = new C4GUI::CallbackButton<MainDlg>(LoadResStr("IDS_DLG_EXIT"), caBottom.GetFromLeft(100), &MainDlg::OnExitBtn);
191  if (fHost)
192  {
193  btnRun = new C4GUI::CallbackButton<MainDlg>(LoadResStr("IDS_DLG_GAMEGO"), caBottom.GetFromRight(100), &MainDlg::OnRunBtn);
194  checkReady = nullptr;
195  }
196  else
197  {
198  checkReady = new C4GUI::CheckBox(caBottom.GetFromRight(90), LoadResStr("IDS_DLG_READY"), false);
200  caBottom.GetFromRight(90);
201  }
202  pGameOptionButtons = new C4GameOptionButtons(caBottom.GetCentered(caBottom.GetInnerWidth(), std::min<int32_t>(C4GUI_IconExHgt, caBottom.GetHeight())), true, fHost, true);
203 
204  // players / resources sidebar
205  C4GUI::ComponentAligner caRight(caMain.GetFromRight(iClientListWdt), iIndentX3,iIndentY4);
207  caRight.ExpandTop(iIndentY4*2 + 1); // undo margin, so client list is located directly under label
208  pRightTab = new C4GUI::Tabular(caRight.GetAll(), C4GUI::Tabular::tbNone);
209  C4GUI::Tabular::Sheet *pPlayerSheet = pRightTab->AddSheet(LoadResStr("IDS_DLG_PLAYERS"));
210  C4GUI::Tabular::Sheet *pResSheet = pRightTab->AddSheet(LoadResStr("IDS_DLG_RESOURCES"));
211  C4GUI::Tabular::Sheet *pOptionsSheet = pRightTab->AddSheet(LoadResStr("IDS_DLG_OPTIONS"));
212  C4GUI::Tabular::Sheet *pScenarioSheet = pRightTab->AddSheet(LoadResStr("IDS_DLG_SCENARIO"));
213  pPlayerList = new C4PlayerInfoListBox(pPlayerSheet->GetContainedClientRect(), C4PlayerInfoListBox::PILBM_LobbyClientSort);
214  pPlayerSheet->AddElement(pPlayerList);
215  pResList = new C4Network2ResDlg(pResSheet->GetContainedClientRect(), false);
216  pResSheet->AddElement(pResList);
217  pOptionsList = new C4GameOptionsList(pResSheet->GetContainedClientRect(), false, C4GameOptionsList::GOLS_Lobby);
218  pOptionsSheet->AddElement(pOptionsList);
219  pScenarioInfo = new ScenDesc(pResSheet->GetContainedClientRect(), false);
220  pScenarioSheet->AddElement(pScenarioInfo);
221  pRightTabLbl->SetContextHandler(new C4GUI::CBContextHandler<C4GameLobby::MainDlg>(this, &MainDlg::OnRightTabContext));
222  pRightTabLbl->SetClickFocusControl(pPlayerList);
223 
224  bool fHasTeams = Game.Teams.IsMultiTeams();
225  bool fHasChat = C4ChatDlg::IsChatActive();
226  int32_t iBtnNum = 4+fHasTeams+fHasChat;
227  if (fHasTeams)
228  {
229  btnTeams = new C4GUI::CallbackButton<MainDlg, C4GUI::IconButton>(C4GUI::Ico_Team, pRightTabLbl->GetToprightCornerRect(16, 16, 4, 4, --iBtnNum), LoadResStr("IDS_DLG_PLAYERSBYTEAM"), &MainDlg::OnTabTeams);
230  }
231  btnPlayers = new C4GUI::CallbackButton<MainDlg, C4GUI::IconButton>(C4GUI::Ico_Player, pRightTabLbl->GetToprightCornerRect(16,16,4,4,--iBtnNum), LoadResStr("IDS_DLG_PLAYERS"), &MainDlg::OnTabPlayers);
232  btnResources = new C4GUI::CallbackButton<MainDlg, C4GUI::IconButton>(C4GUI::Ico_Resource, pRightTabLbl->GetToprightCornerRect(16,16,4,4,--iBtnNum), LoadResStr("IDS_DLG_RESOURCES"), &MainDlg::OnTabRes);
233  btnOptions = new C4GUI::CallbackButton<MainDlg, C4GUI::IconButton>(C4GUI::Ico_Options, pRightTabLbl->GetToprightCornerRect(16,16,4,4,--iBtnNum), LoadResStr("IDS_DLG_OPTIONS"), &MainDlg::OnTabOptions);
234  btnScenario = new C4GUI::CallbackButton<MainDlg, C4GUI::IconButton>(C4GUI::Ico_Gfx, pRightTabLbl->GetToprightCornerRect(16,16,4,4,--iBtnNum), LoadResStr("IDS_DLG_SCENARIO"), &MainDlg::OnTabScenario);
235  if (fHasChat)
236  btnChat = new C4GUI::CallbackButton<MainDlg, C4GUI::IconButton>(C4GUI::Ico_Ex_Chat, pRightTabLbl->GetToprightCornerRect(16,16,4,4,--iBtnNum), LoadResStr("IDS_CTL_CHAT"), &MainDlg::OnBtnChat);
237 
238  // update labels and tooltips for player list
239  UpdateRightTab();
240 
241  // chat area
242  C4GUI::ComponentAligner caCenter(caMain.GetAll(), iIndentX2, iIndentY3);
243  // chat input box
244  C4GUI::ComponentAligner caChat(caCenter.GetFromBottom(C4GUI::Edit::GetDefaultEditHeight()), 0,0);
245  pLbl = new C4GUI::WoodenLabel(LoadResStr("IDS_CTL_CHAT"), caChat.GetFromLeft(40), C4GUI_CaptionFontClr, &::GraphicsResource.TextFont);
246  pEdt = new C4GUI::CallbackEdit<MainDlg>(caChat.GetAll(), this, &MainDlg::OnChatInput);
247  pEdt->SetToolTip(LoadResStr("IDS_DLGTIP_CHAT")); pLbl->SetToolTip(LoadResStr("IDS_DLGTIP_CHAT"));
248  pLbl->SetClickFocusControl(pEdt);
249  // log box
250  pChatBox = new C4GUI::TextWindow(caCenter.GetAll());
251  // add components in tab-order
252  AddElement(pChatBox);
253  AddElement(pLbl); AddElement(pEdt); // chat
254 
255  AddElement(pRightTabLbl);
256  if (btnTeams) AddElement(btnTeams);
257  AddElement(btnPlayers);
258  AddElement(btnResources);
259  AddElement(btnOptions);
260  AddElement(btnScenario);
261  if (btnChat) AddElement(btnChat);
262 
263  AddElement(pRightTab);
264  AddElement(btnExit); btnExit->SetToolTip(LoadResStr("IDS_DLGTIP_EXIT"));
265  AddElement(pGameOptionButtons);
266  if (fHost)
267  {
268  AddElement(btnRun);
269  btnRun->SetToolTip(LoadResStr("IDS_DLGTIP_GAMEGO"));
270  }
271  else
272  {
273  AddElement(checkReady);
274  checkReady->SetToolTip(LoadResStr("IDS_DLGTIP_READY"));
275  }
276  // set initial focus
277  SetFocus(pEdt, false);
278 
279  // stuff
280  eCountdownState = CDS_None;
281  iBackBufferIndex = -1;
282 
283  // initial player list update
284  UpdatePlayerList();
285  }
const char * getData() const
Definition: StdBuf.h:442
bool fHost
Definition: TstC4NetIO.cpp:31
#define C4GUI_CaptionFontClr
Definition: C4Gui.h:37
C4Game Game
Definition: C4Globals.cpp:52
C4GUI::Edit::InputResult OnChatInput(C4GUI::Edit *edt, bool fPasting, bool fPastingMore)
bool KeyHistoryUpDown(bool fUp)
StdCopyStrBuf ScenarioTitle
Definition: C4Game.h:103
#define C4GUI_IconExHgt
Definition: C4Gui.h:96
bool AddElement(Element *pChild, int32_t iIndent=0)
void SetToolTip(const char *szNewTooltip, bool is_immediate=false)
Definition: C4Gui.cpp:409
void AddElement(Element *pChild)
bool IsMultiTeams() const
Definition: C4Teams.h:162
C4Rect GetContainedClientRect()
Definition: C4Gui.h:448
C4GraphicsResource GraphicsResource
void Add(StdSchedulerProc *pProc)
C4TeamList & Teams
Definition: C4Game.h:70
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
int32_t Wdt
Definition: C4Rect.h:30
static int32_t GetDefaultHeight(CStdFont *pUseFont=nullptr)
void OnRunBtn(C4GUI::Control *btn)
C4Rect & GetClientRect() override
Definition: C4Gui.h:864
void OnTabRes(C4GUI::Control *btn)
void OnTabScenario(C4GUI::Control *btn)
void OnReadyCheck(C4GUI::Element *pCheckBox)
static int32_t GetDefaultEditHeight()
Definition: C4GuiEdit.cpp:113
C4GUI::ContextMenu * OnRightTabContext(C4GUI::Element *pLabel, int32_t iX, int32_t iY)
void SetOnChecked(BaseCallbackHandler *pCB)
void OnTabTeams(C4GUI::Control *btn)
void SetFocus(Control *pCtrl, bool fByMouse)
static bool IsChatActive()
Definition: C4ChatDlg.cpp:996
void OnTabOptions(C4GUI::Control *btn)
const int ALeft
Definition: C4Surface.h:41
void OnTabPlayers(C4GUI::Control *btn)
Sheet * AddSheet(const char *szTitle, int32_t icoTitle=Ico_None)
void OnBtnChat(C4GUI::Control *btn)
void OnExitBtn(C4GUI::Control *btn)
C4Application Application
Definition: C4Globals.cpp:44
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270

Here is the call graph for this function:

C4GameLobby::MainDlg::~MainDlg ( )
override

Definition at line 287 of file C4GameLobby.cpp.

References Application, and StdScheduler::Remove().

288  {
289  Application.Remove(this);
290  delete pKeyHistoryUp;
291  delete pKeyHistoryDown;
292  }
void Remove(StdSchedulerProc *pProc)
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

Member Function Documentation

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

Definition at line 118 of file C4GuiContainers.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 580 of file C4GuiDialogs.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented in C4GUI::ListBox.

Definition at line 756 of file C4Gui.h.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Window.

Definition at line 743 of file C4GuiDialogs.cpp.

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

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

Here is the call graph for this function:

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

Reimplemented from C4GUI::Window.

Definition at line 756 of file C4GuiDialogs.cpp.

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

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

Here is the call graph for this function:

Iterator C4GUI::Container::begin ( )
inlineinherited

Definition at line 824 of file C4Gui.h.

Referenced by C4ScriptGuiWindow::ClearPointers().

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

Here is the caller graph for this function:

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

Definition at line 519 of file C4GuiDialogs.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented in C4StartupScenSelDlg::ScenListItem.

Definition at line 407 of file C4Gui.h.

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

407 { return false; }

Here is the caller graph for this function:

void C4GUI::Container::Clear ( )
inherited

Definition at line 63 of file C4GuiContainers.cpp.

References C4GUI::Container::ClearChildren().

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

64  {
65  ClearChildren();
66  }

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Container::ClearChildren ( )
inherited

Definition at line 68 of file C4GuiContainers.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Dialog::ClearFrameDeco ( )
inlineinherited

Definition at line 2199 of file C4Gui.h.

References C4GUI::FrameDecoration::Deref().

Referenced by C4Menu::Clear().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::ClearLog ( )

Definition at line 698 of file C4GameLobby.cpp.

References C4GUI::TextWindow::ClearText().

Referenced by C4MessageInput::ProcessCommand().

699  {
700  pChatBox->ClearText(true);
701  }
void ClearText(bool fDoUpdate)
Definition: C4Gui.h:1744

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 231 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 631 of file C4GuiDialogs.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::CreateConsoleWindow ( )
protectedinherited

Definition at line 239 of file C4GuiDialogs.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Dialog::DestroyConsoleWindow ( )
protectedinherited

Definition at line 262 of file C4GuiDialogs.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Element::DoContext ( )
inherited

Definition at line 417 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Definition at line 269 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::DoModal ( )
inherited

Definition at line 658 of file C4GuiDialogs.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::FullscreenDialog::DoPlacement ( Screen pOnScreen,
const C4Rect rPreferredDlgRect 
)
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 2244 of file C4Gui.h.

2244 { return true; } // fullscreen dlg already placed
void C4GUI::Dialog::Draw ( C4TargetFacet cgo)
overridevirtualinherited

Reimplemented from C4GUI::Window.

Reimplemented in C4Menu, and C4ScoreboardDlg.

Definition at line 435 of file C4GuiDialogs.cpp.

References C4Draw::ActivateBlitModulation(), C4GUI::Screen::ActivateDialog(), C4GUI_StandardBGColor, C4Draw::DeactivateBlitModulation(), C4GUI::Window::Draw(), C4GUI::ContextMenu::Draw(), C4Draw::DrawBoxDw(), C4GUI::Dialog::eFade, C4GUI::Dialog::fShow, C4GUI::Element::fVisible, C4GUI::Element::GetScreen(), C4GUI::ContextMenu::GetTargetDialog(), C4GUI::Screen::GetTopDialog(), C4Rect::Hgt, C4Facet::Hgt, C4GUI::Dialog::iFade, C4Surface::PageFlip(), pDraw, C4Window::pSurface, C4GUI::Dialog::pWindow, C4GUI::Screen::RecheckActiveDialog(), C4TargetFacet::Set(), C4Facet::Surface, C4Rect::Wdt, C4Facet::Wdt, C4Rect::x, C4Facet::X, C4Rect::y, and C4Facet::Y.

Referenced by C4GUI::DialogWindow::PerformUpdate().

436  {
437  C4TargetFacet cgo; cgo.Set(cgo0);
438  // Dialogs with a window just ignore the cgo.
439  if (pWindow)
440  {
441  cgo.Surface = pWindow->pSurface;
442  cgo.X = 0; cgo.Y = 0; cgo.Wdt = rcBounds.Wdt; cgo.Hgt = rcBounds.Hgt;
443  }
444  Screen *pScreen;
445  // evaluate fading
446  switch (eFade)
447  {
448  case eFadeNone: break; // no fading
449  case eFadeIn:
450  // fade in
451  if ((iFade+=10) >= 100)
452  {
453  if ((pScreen = GetScreen()))
454  {
455  if (pScreen->GetTopDialog() == this)
456  pScreen->ActivateDialog(this);
457  }
458  eFade = eFadeNone;
459  }
460  break;
461  case eFadeOut:
462  // fade out
463  if ((iFade-=10) <= 0)
464  {
465  fVisible = fShow = false;
466  if ((pScreen = GetScreen()))
467  pScreen->RecheckActiveDialog();
468  eFade = eFadeNone;
469  }
470  }
471  // set fade
472  if (iFade < 100)
473  {
474  if (iFade <= 0) return;
475  pDraw->ActivateBlitModulation((iFade*255/100)<<24 | 0xffffff);
476  }
477  // separate window: Clear background
478  if (pWindow)
479  pDraw->DrawBoxDw(cgo.Surface, rcBounds.x, rcBounds.y, rcBounds.Wdt-1, rcBounds.Hgt-1, (0xff << 24) | (C4GUI_StandardBGColor & 0xffffff) );
480  // draw window + contents (evaluates IsVisible)
481  Window::Draw(cgo);
482  // reset blit modulation
484  // blit output to own window
485  if (pWindow)
486  {
487  // Draw context menu on editor window
488  ContextMenu *menu;
489  if ((menu = GetScreen()->pContext))
490  {
491  if (menu->GetTargetDialog() == this)
492  {
493  menu->Draw(cgo);
494  }
495  }
496  // Editor window: Blit to output
497  C4Rect rtSrc,rtDst;
498  rtSrc.x=rcBounds.x; rtSrc.y=rcBounds.y; rtSrc.Wdt=rcBounds.Wdt; rtSrc.Hgt=rcBounds.Hgt;
499  rtDst.x=0; rtDst.y=0; rtDst.Wdt=rcBounds.Wdt; rtDst.Hgt=rcBounds.Hgt;
500  pWindow->pSurface->PageFlip(&rtSrc, &rtDst);
501  }
502  }
#define C4GUI_StandardBGColor
Definition: C4Gui.h:66
Fade eFade
Definition: C4Gui.h:2084
float Y
Definition: C4Facet.h:118
bool fShow
Definition: C4Gui.h:2081
C4Surface * pSurface
Definition: C4Window.h:274
Definition: C4Rect.h:27
DialogWindow * pWindow
Definition: C4Gui.h:2088
int32_t Wdt
Definition: C4Rect.h:30
int32_t y
Definition: C4Rect.h:30
bool PageFlip(C4Rect *pSrcRt=nullptr, C4Rect *pDstRt=nullptr)
Definition: C4Surface.cpp:310
void DrawBoxDw(C4Surface *sfcDest, int iX1, int iY1, int iX2, int iY2, DWORD dwClr)
Definition: C4Draw.cpp:846
C4Rect rcBounds
Definition: C4Gui.h:385
void Set(const C4Facet &cpy)
Definition: C4Facet.h:182
C4Draw * pDraw
Definition: C4Draw.cpp:42
void Draw(C4TargetFacet &cgo) override
int32_t x
Definition: C4Rect.h:30
float Hgt
Definition: C4Facet.h:118
bool fVisible
Definition: C4Gui.h:383
void DeactivateBlitModulation()
Definition: C4Draw.h:189
friend class Screen
Definition: C4Gui.h:2216
virtual Screen * GetScreen()
Definition: C4Gui.cpp:289
void ActivateBlitModulation(DWORD dwWithClr)
Definition: C4Draw.h:188
int32_t Hgt
Definition: C4Rect.h:30
C4Surface * Surface
Definition: C4Facet.h:117
float Wdt
Definition: C4Facet.h:118
float X
Definition: C4Facet.h:118
int32_t iFade
Definition: C4Gui.h:2083

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 291 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::FullscreenDialog::DrawBackground ( C4TargetFacet cgo,
C4Facet rFromFct 
)
protectedinherited

Definition at line 836 of file C4GuiDialogs.cpp.

References C4Facet::DrawFullScreen().

Referenced by C4StartupScenSelDlg::DrawElement().

837  {
838  // draw across fullscreen bounds - zoom 1px border to prevent flashing borders by blit offsets
839  rFromFct.DrawFullScreen(cgo);
840  }
void DrawFullScreen(C4Facet &cgo)
Definition: C4Facet.cpp:184

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 308 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::FullscreenDialog::DrawElement ( C4TargetFacet cgo)
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Reimplemented in C4StartupScenSelDlg, C4StartupPlrSelDlg, C4StartupNetDlg, C4StartupMainDlg, and C4StartupAboutDlg.

Definition at line 823 of file C4GuiDialogs.cpp.

References C4Draw::BlitSurfaceTile(), C4GraphicsResource::fctUpperBoard, GraphicsResource, C4GUI::FullscreenDialog::HasUpperBoard(), C4Facet::Hgt, C4GUI::Dialog::iFade, pDraw, C4Facet::Surface, and C4Facet::Wdt.

824  {
825  // draw upper board
826  if (HasUpperBoard())
828  }
C4GraphicsResource GraphicsResource
virtual bool HasUpperBoard()
Definition: C4Gui.h:2241
bool BlitSurfaceTile(C4Surface *sfcSurface, C4Surface *sfcTarget, float iToX, float iToY, float iToWdt, float iToHgt, float iOffsetX, float iOffsetY, C4ShaderCall *shader_call)
Definition: C4Draw.cpp:535
C4Draw * pDraw
Definition: C4Draw.cpp:42
float Hgt
Definition: C4Facet.h:118
C4Surface * Surface
Definition: C4Facet.h:117
float Wdt
Definition: C4Facet.h:118
int32_t iFade
Definition: C4Gui.h:2083

Here is the call graph for this function:

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

Definition at line 365 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 375 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 359 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Definition at line 754 of file C4Gui.h.

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

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

Here is the caller graph for this function:

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

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

Definition at line 753 of file C4Gui.h.

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

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

Here is the caller graph for this function:

Iterator C4GUI::Container::end ( )
inlineinherited

Definition at line 825 of file C4Gui.h.

Referenced by C4ScriptGuiWindow::ClearPointers().

825 { return Iterator(nullptr); }

Here is the caller graph for this function:

bool C4GUI::Dialog::Execute ( )
inherited

Definition at line 680 of file C4GuiDialogs.cpp.

References Application, C4GUI::Dialog::fShow, and StdScheduler::ScheduleProcs().

Referenced by C4GUI::Dialog::Execute2(), C4Network2::FinalInit(), and C4Network2::RetrieveRes().

681  {
682  // process messages
683  if (!Application.ScheduleProcs(0))
684  return false;
685  // check status
686  if (!fShow) return false;
687  return true;
688  }
bool fShow
Definition: C4Gui.h:2081
bool ScheduleProcs(int iTimeout=1000/36)
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::Execute2 ( )
inherited

Definition at line 690 of file C4GuiDialogs.cpp.

References C4GUI::Dialog::Execute().

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

Here is the call graph for this function:

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

Definition at line 714 of file C4GuiDialogs.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 728 of file C4GuiDialogs.cpp.

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

Referenced by C4Startup::SwitchDialog().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 445 of file C4Gui.h.

References C4GUI::Element::rcBounds.

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

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

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Element.

Definition at line 864 of file C4Gui.h.

References C4GUI::Window::rcClientRect.

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

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

Here is the caller graph for this function:

C4Rect C4GUI::Element::GetContainedClientRect ( )
inlineinherited
Container* C4GUI::Container::GetContainer ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 831 of file C4Gui.h.

831 { return this; } // returns parent for elements; this for containers
ContextHandler* C4GUI::Dialog::GetContextHandler ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 2211 of file C4Gui.h.

References C4GUI::Element::pContextHandler.

2212  { return pContextHandler; }
ContextHandler * pContextHandler
Definition: C4Gui.h:381
class C4GUI::Control* C4GameLobby::MainDlg::GetDefaultControl ( )
inlineoverrideprotectedvirtual

Reimplemented from C4GUI::Dialog.

Definition at line 131 of file C4GameLobby.h.

131 { return pEdt; } // def focus chat input
int32_t C4GUI::Dialog::GetDefaultTitleHeight ( )
staticinherited

Definition at line 330 of file C4GuiDialogs.cpp.

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

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

Here is the call graph for this function:

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

Reimplemented from C4GUI::Element.

Definition at line 2117 of file C4Gui.h.

References C4GUI::Dialog::pWindow.

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

Reimplemented from C4GUI::Element.

Definition at line 2116 of file C4Gui.h.

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

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

Here is the caller graph for this function:

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

Definition at line 223 of file C4GuiContainers.cpp.

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

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

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

Here is the caller graph for this function:

int32_t C4GUI::Container::GetElementCount ( )
inherited

Definition at line 232 of file C4GuiContainers.cpp.

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

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

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

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Element.

Definition at line 773 of file C4Gui.h.

References C4GUI::Container::pFirst.

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

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

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Element.

Definition at line 204 of file C4GuiContainers.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2115 of file C4Gui.h.

References C4GUI::Dialog::pActiveCtrl.

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

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

Here is the caller graph for this function:

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

Definition at line 2201 of file C4Gui.h.

References C4GUI::Dialog::pFrameDeco.

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

Definition at line 444 of file C4Gui.h.

References C4Rect::Hgt.

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

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

Here is the caller graph for this function:

const char* C4GUI::FullscreenDialog::GetID ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 2226 of file C4Gui.h.

2226 { return nullptr; } // no ID needed, because it's never created as a window
Element* C4GUI::Container::GetLast ( )
inlineinherited

Definition at line 830 of file C4Gui.h.

References C4GUI::Container::pLast.

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

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

Here is the caller graph for this function:

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

Definition at line 774 of file C4Gui.h.

References C4GUI::Container::pLast.

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

Reimplemented in C4StartupNetListEntry.

Definition at line 461 of file C4Gui.h.

References C4GUI_DefaultListSpacing.

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

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

Here is the caller graph for this function:

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

Definition at line 462 of file C4Gui.h.

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

462 { return false; }

Here is the caller graph for this function:

int32_t C4GUI::FullscreenDialog::GetMarginBottom ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 2249 of file C4Gui.h.

References C4GUI::FullscreenDialog::iDlgMarginY.

2249 { return iDlgMarginY; }
int32_t C4GUI::FullscreenDialog::GetMarginLeft ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 2247 of file C4Gui.h.

References C4GUI::FullscreenDialog::iDlgMarginX.

2247 { return iDlgMarginX; }
int32_t C4GUI::FullscreenDialog::GetMarginRight ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 2248 of file C4Gui.h.

References C4GUI::FullscreenDialog::iDlgMarginX.

2248 { return iDlgMarginX; }
int32_t C4GUI::FullscreenDialog::GetMarginTop ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Reimplemented in C4StartupScenSelDlg, and C4StartupPlrSelDlg.

Definition at line 2246 of file C4Gui.h.

References C4GUI_FullscreenDlg_TitleHeight, C4UpperBoardHeight, C4GUI::FullscreenDialog::HasUpperBoard(), and C4GUI::FullscreenDialog::iDlgMarginY.

Referenced by C4GUI::FullscreenDialog::FullscreenDialog(), and C4GUI::FullscreenDialog::SetTitle().

const int C4UpperBoardHeight
Definition: C4Constants.h:59
virtual bool HasUpperBoard()
Definition: C4Gui.h:2241
#define C4GUI_FullscreenDlg_TitleHeight
Definition: C4Gui.h:160

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 171 of file C4GuiContainers.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 440 of file C4Gui.h.

References StdStrBuf::getData().

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

Here is the call graph for this function:

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

Definition at line 450 of file C4Gui.h.

References C4GUI::Element::pPrev.

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

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

Here is the caller graph for this function:

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

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

Definition at line 289 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 423 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 399 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

virtual C4Viewport* C4GUI::Dialog::GetViewport ( )
inlinevirtualinherited

Reimplemented in C4Menu.

Definition at line 2171 of file C4Gui.h.

Referenced by C4GUI::Dialog::ApplyElementOffset(), C4GUI::Dialog::ApplyInvElementOffset(), and C4GUI::Screen::MouseInput().

2171 { return nullptr; }

Here is the caller graph for this function:

int32_t C4GUI::Element::GetWidth ( )
inlineinherited

Definition at line 443 of file C4Gui.h.

References C4Rect::Wdt.

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

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

Here is the caller graph for this function:

virtual int32_t C4GUI::Dialog::GetZOrdering ( )
inlinevirtualinherited

Reimplemented in C4GUI::MessageDialog, C4Menu, and C4ChatInputDialog.

Definition at line 2181 of file C4Gui.h.

References C4GUI_Z_DEFAULT.

Referenced by C4GUI::Screen::ActivateDialog(), and C4GUI::Screen::ShowDialog().

2181 { return C4GUI_Z_DEFAULT; }
#define C4GUI_Z_DEFAULT
Definition: C4Gui.h:154

Here is the caller graph for this function:

void C4GameLobby::MainDlg::HandlePacket ( char  cStatus,
const C4PacketBase pBasePkt,
C4Network2Client pClient 
)

Definition at line 468 of file C4GameLobby.cpp.

References Game, C4GUI::Tabular::GetActiveSheetIndex(), GETPKT, OnCountdownPacket(), C4Game::Parameters, PID_LobbyCountdown, PID_SetScenarioParameter, C4GameParameters::ScenarioParameters, C4ScenarioParameters::SetValue(), and C4GameOptionsList::Update().

Referenced by C4Network2::HandleLobbyPacket().

469  {
470  // note that player info update packets are not handled by this function,
471  // but by player info list and then forwarded to MainDlg::OnPlayerUpdate
472  // this is necessary because there might be changes (e.g. duplicate colors)
473  // done by player info list
474  // besides, this releases the lobby from doing any host/client-specializations
475 #define GETPKT(type, name) \
476  assert(pPacket); const type &name = \
477  static_cast<const type &>(*pPacket);
478  switch (cStatus)
479  {
480  case PID_LobbyCountdown: // initiate or abort countdown
481  {
482  GETPKT(C4PacketCountdown, Pkt);
483  // do countdown
484  OnCountdownPacket(Pkt);
485  }
486  break;
487  case PID_SetScenarioParameter: // set a scenario parameter value
488  {
489  GETPKT(C4PacketSetScenarioParameter, Pkt);
490  ::Game.Parameters.ScenarioParameters.SetValue(Pkt.GetID(), Pkt.GetValue(), false);
491  // reflect updated value immediately on clients
492  if (pRightTab->GetActiveSheetIndex() == SheetIdx_Options) if (pOptionsList) pOptionsList->Update();
493  }
494  };
495 #undef GETPKT
496  }
#define GETPKT(type, name)
C4Game Game
Definition: C4Globals.cpp:52
void OnCountdownPacket(const C4PacketCountdown &Pkt)
C4GameParameters & Parameters
Definition: C4Game.h:67
C4ScenarioParameters ScenarioParameters
int32_t GetActiveSheetIndex()
void SetValue(const char *id, int32_t value, bool only_if_larger)

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented in C4StartupScenSelDlg, C4StartupPlrSelDlg, and C4StartupNetDlg.

Definition at line 2154 of file C4Gui.h.

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

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

Here is the caller graph for this function:

virtual bool C4GUI::FullscreenDialog::HasUpperBoard ( )
inlineprotectedvirtualinherited

Definition at line 2241 of file C4Gui.h.

Referenced by C4GUI::FullscreenDialog::DrawElement(), C4GUI::FullscreenDialog::FullscreenDialog(), C4GUI::FullscreenDialog::GetMarginTop(), and C4GUI::FullscreenDialog::SetTitle().

2241 { return false; } // standard fullscreen dialog: UpperBoard no longer present

Here is the caller graph for this function:

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

Definition at line 150 of file C4GuiContainers.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::IsAborted ( )
inlineinherited

Definition at line 2149 of file C4Gui.h.

References C4GUI::Dialog::fOK.

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

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

Here is the caller graph for this function:

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

Definition at line 699 of file C4GuiDialogs.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented in C4ChatInputDialog.

Definition at line 2161 of file C4Gui.h.

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

2161 { return false; }

Here is the caller graph for this function:

bool C4GUI::FullscreenDialog::IsComponentOutsideClientArea ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 2239 of file C4Gui.h.

2239 { return true; }
bool C4GameLobby::MainDlg::IsCountdown ( )

Definition at line 379 of file C4GameLobby.cpp.

380  {
381  // flag as countdown if countdown running or game is about to start
382  // so team choice, etc. will not become available in the last split-second
383  return eCountdownState >= CDS_Countdown;
384  }
virtual bool C4GUI::Dialog::IsExclusiveDialog ( )
inlinevirtualinherited

Reimplemented in C4ChatDlg, C4GameOverDlg, C4ChatInputDialog, and C4AbortGameDialog.

Definition at line 2164 of file C4Gui.h.

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

2164 { return false; }

Here is the caller graph for this function:

bool C4GUI::Dialog::IsExternalDrawDialog ( )
inlineoverridevirtualinherited

Reimplemented from C4GUI::Element.

Reimplemented in C4Menu.

Definition at line 2178 of file C4Gui.h.

Referenced by C4GUI::Screen::MouseInput(), and C4GUI::Screen::ShowDialog().

2178 { return false; }

Here is the caller graph for this function:

bool C4GUI::Dialog::IsFading ( )
inlineinherited

Definition at line 2151 of file C4Gui.h.

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

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

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Container.

Definition at line 2113 of file C4Gui.h.

References C4GUI::Dialog::pActiveCtrl.

Referenced by KeyHistoryUpDown().

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

Here is the caller graph for this function:

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

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

Definition at line 432 of file C4Gui.h.

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

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

Here is the caller graph for this function:

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

Reimplemented in C4ChatDlg, C4GameOverDlg, C4ChatInputDialog, and C4AbortGameDialog.

Definition at line 2158 of file C4Gui.h.

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

2158 { return false; }

Here is the caller graph for this function:

bool C4GUI::FullscreenDialog::IsFullscreenDialog ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

Definition at line 2243 of file C4Gui.h.

2243 { return true; }
bool C4GUI::Element::IsImmediateToolTip ( ) const
inlineinherited

Definition at line 441 of file C4Gui.h.

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

441 { return is_immediate_tooltip; }

Here is the caller graph for this function:

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

Definition at line 435 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Definition at line 403 of file C4Gui.h.

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

403 { return false; }

Here is the caller graph for this function:

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

Reimplemented in C4Menu, C4ChatInputDialog, and C4ScoreboardDlg.

Definition at line 2168 of file C4Gui.h.

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

2168 { return true; }

Here is the caller graph for this function:

bool C4GUI::Dialog::IsOK ( )
inlineinherited

Definition at line 2148 of file C4Gui.h.

References C4GUI::Dialog::fOK.

2148 { return fOK; } // returns whether user pressed OK
bool fOK
Definition: C4Gui.h:2082
virtual bool C4GUI::Element::IsOwnPtrElement ( )
inlineprotectedvirtualinherited

Reimplemented in C4Menu.

Definition at line 401 of file C4Gui.h.

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

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

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Element.

Definition at line 239 of file C4GuiContainers.cpp.

References C4GUI::Element::GetParent().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Definition at line 837 of file C4Gui.h.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::IsShown ( )
inlineinherited

Definition at line 2147 of file C4Gui.h.

References C4GUI::Dialog::fShow.

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

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

Here is the caller graph for this function:

bool C4GUI::Dialog::IsViewportDialog ( )
inlineinherited

Definition at line 2172 of file C4Gui.h.

References C4GUI::Dialog::fViewportDlg.

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

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

Here is the caller graph for this function:

bool C4GUI::Element::IsVisible ( )
inherited

Definition at line 201 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2138 of file C4Gui.h.

References C4GUI::Dialog::AdvanceFocus().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::KeyEnter ( )
inlineinherited

Definition at line 2133 of file C4Gui.h.

References C4GUI::Dialog::OnEnter().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Dialog::KeyEscape ( )
inlineinherited

Definition at line 2135 of file C4Gui.h.

References C4GUI::Dialog::OnEscape().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GameLobby::MainDlg::KeyHistoryUpDown ( bool  fUp)
protected

Definition at line 667 of file C4GameLobby.cpp.

References C4GUI::Edit::DeleteSelection(), C4MessageInput::GetBackBuffer(), C4GUI::Edit::InsertText(), C4GUI::Dialog::IsFocused(), MessageInput, and C4GUI::Edit::SelectAll().

Referenced by MainDlg().

668  {
669  // chat input only
670  if (!IsFocused(pEdt)) return false;
671  pEdt->SelectAll(); pEdt->DeleteSelection();
672  const char *szPrevInput = ::MessageInput.GetBackBuffer(fUp ? (++iBackBufferIndex) : (--iBackBufferIndex));
673  if (!szPrevInput || !*szPrevInput)
674  iBackBufferIndex = -1;
675  else
676  {
677  pEdt->InsertText(szPrevInput, true);
678  pEdt->SelectAll();
679  }
680  return true;
681  }
bool IsFocused(Control *pCtrl) override
Definition: C4Gui.h:2113
const char * GetBackBuffer(int32_t iIndex)
void DeleteSelection()
Definition: C4GuiEdit.cpp:149
void SelectAll()
Definition: C4GuiEdit.cpp:641
C4MessageInput MessageInput
bool InsertText(const char *szText, bool fUser)
Definition: C4GuiEdit.cpp:163

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 106 of file C4GuiContainers.cpp.

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

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

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

Here is the caller graph for this function:

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

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

Definition at line 413 of file C4Gui.h.

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

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

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Window.

Definition at line 557 of file C4GuiDialogs.cpp.

References C4GUI::Window::MouseInput().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Definition at line 414 of file C4Gui.h.

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

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

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnBtnChat ( C4GUI::Control btn)
protected

Definition at line 661 of file C4GameLobby.cpp.

References C4ChatDlg::ShowChat().

Referenced by MainDlg().

662  {
663  // open chat dialog
665  }
static C4ChatDlg * ShowChat()
Definition: C4ChatDlg.cpp:966

Here is the call graph for this function:

Here is the caller graph for this function:

C4GUI::Edit::InputResult C4GameLobby::MainDlg::OnChatInput ( C4GUI::Edit edt,
bool  fPasting,
bool  fPastingMore 
)
protected

Definition at line 426 of file C4GameLobby.cpp.

References C4GUI::Edit::DeleteSelection(), C4GUI::Edit::GetText(), C4GUI::GUISound(), C4GUI::Edit::IR_None, MessageInput, C4MessageInput::ProcessInput(), C4GUI::Edit::SelectAll(), and C4MessageInput::StoreBackBuffer().

Referenced by MainDlg().

427  {
428  // get edit text
429  C4GUI::Edit *pEdt = reinterpret_cast<C4GUI::Edit *>(edt);
430  const char *szInputText = pEdt->GetText();
431  // no input?
432  if (!szInputText || !*szInputText)
433  {
434  // do some error sound then
435  C4GUI::GUISound("UI::Error");
436  }
437  else
438  {
439  // store input in backbuffer before processing commands
440  // because those might kill the edit field
441  ::MessageInput.StoreBackBuffer(szInputText);
442  ::MessageInput.ProcessInput(szInputText);
443  }
444  // clear edit field after text has been processed
445  pEdt->SelectAll(); pEdt->DeleteSelection();
446  // reset backbuffer-index of chat history
447  iBackBufferIndex = -1;
448  // OK, on we go. Leave edit intact
449  return C4GUI::Edit::IR_None;
450  }
void GUISound(const char *szSound)
Definition: C4Gui.cpp:1175
void DeleteSelection()
Definition: C4GuiEdit.cpp:149
void SelectAll()
Definition: C4GuiEdit.cpp:641
const char * GetText()
Definition: C4Gui.h:1338
C4MessageInput MessageInput
void StoreBackBuffer(const char *szMessage)
bool ProcessInput(const char *szText)

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnClientAddPlayer ( const char *  szFilename,
int32_t  idClient 
)

Definition at line 577 of file C4GameLobby.cpp.

References C4Config::AtRelativePath(), C4Game::Clients, Config, FormatString(), Game, C4ClientList::getLocalID(), ItemExists(), C4Network2Players::JoinLocalPlayer(), LoadResStr(), C4GameLobby::LobbyError(), Network, and C4Network2::Players.

578  {
579  // check client number
580  if (idClient != Game.Clients.getLocalID())
581  {
582  LobbyError(FormatString(LoadResStr("IDS_ERR_JOINPLR_NOLOCALCLIENT"), szFilename, idClient).getData());
583  return;
584  }
585  // player join - check filename
586  if (!ItemExists(szFilename))
587  {
588  LobbyError(FormatString(LoadResStr("IDS_ERR_JOINPLR_NOFILE"), szFilename).getData());
589  return;
590  }
591  // join!
593  }
C4Config Config
Definition: C4Config.cpp:833
C4Game Game
Definition: C4Globals.cpp:52
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
void LobbyError(const char *szErrorMsg)
C4Network2 Network
Definition: C4Globals.cpp:53
int32_t getLocalID() const
Definition: C4Client.h:171
C4Network2Players Players
Definition: C4Network2.h:119
C4ClientList & Clients
Definition: C4Game.h:69
const char * AtRelativePath(const char *szFilename)
Definition: C4Config.cpp:656
bool JoinLocalPlayer(const char *szLocalPlayerFilename, bool initial=false)
bool ItemExists(const char *szItemName)
Definition: StdFile.h:75
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270

Here is the call graph for this function:

void C4GameLobby::MainDlg::OnClientConnect ( C4Client pClient,
C4Network2IOConnection pConn 
)

Definition at line 458 of file C4GameLobby.cpp.

Referenced by C4Network2::OnClientConnect().

459  {
460  }

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnClientJoin ( C4Client pNewClient)

Definition at line 452 of file C4GameLobby.cpp.

453  {
454  // update list
455  UpdatePlayerList();
456  }
void C4GameLobby::MainDlg::OnClientPart ( C4Client pPartClient)

Definition at line 462 of file C4GameLobby.cpp.

463  {
464  // update list
465  UpdatePlayerList();
466  }
void C4GameLobby::MainDlg::OnClientReadyStateChange ( )
inline

Definition at line 152 of file C4GameLobby.h.

152 { UpdatePlayerList(); }
void C4GameLobby::MainDlg::OnClientSound ( C4Client pOfClient)

Definition at line 514 of file C4GameLobby.cpp.

References C4Client::getID(), and C4PlayerInfoListBox::SetClientSoundIcon().

515  {
516  // show that someone played a sound
517  if (pOfClient && pPlayerList)
518  {
519  pPlayerList->SetClientSoundIcon(pOfClient->getID());
520  }
521  }
int32_t getID() const
Definition: C4Client.h:105
void SetClientSoundIcon(int32_t iForClientID)

Here is the call graph for this function:

void C4GameLobby::MainDlg::OnClosed ( bool  fOK)
overrideprotectedvirtual

Reimplemented from C4GUI::Dialog.

Definition at line 386 of file C4GameLobby.cpp.

References C4GameLobby::UserAbort.

387  {
388  // lobby aborted by user: remember not to display error log
389  if (!fOK)
390  C4GameLobby::UserAbort = true;
391  // finish countdown if running
392  // (may not be finished if status change packet from host is faster than the countdown-initiate)
393  if (eCountdownState) SetCountdownState(fOK ? CDS_Start : CDS_None, 0);
394  }
bool fOK
Definition: C4Gui.h:2082
void C4GameLobby::MainDlg::OnCountdownPacket ( const C4PacketCountdown Pkt)

Definition at line 351 of file C4GameLobby.cpp.

References C4GameLobby::AlmostStartCountdownTime, C4GUI_LogFontClr2, C4GameLobby::C4PacketCountdown::GetCountdown(), C4GameLobby::C4PacketCountdown::GetCountdownMsg(), StdStrBuf::getData(), C4GameLobby::C4PacketCountdown::IsAbort(), OnLog(), and StartSoundEffect().

Referenced by C4GameLobby::Countdown::Abort(), C4GameLobby::Countdown::Countdown(), HandlePacket(), and C4GameLobby::Countdown::OnSec1Timer().

352  {
353  // determine new countdown state
354  int32_t iTimer = 0;
355  CountdownState eNewState;
356  if (Pkt.IsAbort())
357  eNewState = CDS_None;
358  else
359  {
360  iTimer = Pkt.GetCountdown();
361  if (!iTimer)
362  eNewState = CDS_Start; // game is about to be started (boom)
363  else if (iTimer <= AlmostStartCountdownTime)
364  eNewState = CDS_Countdown; // eToState
365  else
366  eNewState = CDS_LongCountdown;
367  }
368  bool fWasCountdown = !!eCountdownState;
369  SetCountdownState(eNewState, iTimer);
370  // display countdown (except last, which ends the lobby anyway)
371  if (iTimer)
372  {
373  // first countdown message
374  OnLog(Pkt.GetCountdownMsg(!fWasCountdown).getData(), C4GUI_LogFontClr2);
375  StartSoundEffect("UI::Tick");
376  }
377  }
void OnLog(const char *szLogMsg, DWORD dwClr=C4GUI_LogFontClr)
C4SoundInstance * StartSoundEffect(const char *szSndName, bool fLoop, int32_t iVolume, C4Object *pObj, int32_t iCustomFalloffDistance, int32_t iPitch, C4SoundModifier *modifier)
#define C4GUI_LogFontClr2
Definition: C4Gui.h:52
const int32_t AlmostStartCountdownTime
Definition: C4GameLobby.h:27

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnCtxTabOptions ( C4GUI::Element pListItem)
inlineprotected

Definition at line 124 of file C4GameLobby.h.

References OnTabOptions().

Referenced by OnRightTabContext().

124 { OnTabOptions(nullptr); }
void OnTabOptions(C4GUI::Control *btn)

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnCtxTabPlayers ( C4GUI::Element pListItem)
inlineprotected

Definition at line 118 of file C4GameLobby.h.

References OnTabPlayers().

Referenced by OnRightTabContext().

118 { OnTabPlayers(nullptr); }
void OnTabPlayers(C4GUI::Control *btn)

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnCtxTabRes ( C4GUI::Element pListItem)
inlineprotected

Definition at line 122 of file C4GameLobby.h.

References OnTabRes().

Referenced by OnRightTabContext().

122 { OnTabRes(nullptr); }
void OnTabRes(C4GUI::Control *btn)

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnCtxTabScenario ( C4GUI::Element pListItem)
inlineprotected

Definition at line 126 of file C4GameLobby.h.

References OnTabScenario().

126 { OnTabScenario(nullptr); }
void OnTabScenario(C4GUI::Control *btn)

Here is the call graph for this function:

void C4GameLobby::MainDlg::OnCtxTabTeams ( C4GUI::Element pListItem)
inlineprotected

Definition at line 120 of file C4GameLobby.h.

References OnTabTeams().

Referenced by OnRightTabContext().

120 { OnTabTeams(nullptr); }
void OnTabTeams(C4GUI::Control *btn)

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::FullscreenDialog::OnEnter ( )
inlineoverrideprotectedvirtualinherited

Reimplemented from C4GUI::Dialog.

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

Definition at line 2237 of file C4Gui.h.

2237 { return false; }
void C4GameLobby::MainDlg::OnError ( const char *  szErrMsg)

Definition at line 532 of file C4GameLobby.cpp.

References C4GUI::TextWindow::AddTextLine(), C4GUI_ErrorFontClr, GraphicsResource, C4GUI::TextWindow::ScrollToBottom(), StartSoundEffect(), and C4GraphicsResource::TextFont.

Referenced by C4GameLobby::LobbyError(), and C4MessageInput::ProcessCommand().

533  {
534  if (pChatBox)
535  {
536  StartSoundEffect("UI::Error");
537  pChatBox->AddTextLine(szErrMsg, &::GraphicsResource.TextFont, C4GUI_ErrorFontClr, true, true);
538  pChatBox->ScrollToBottom();
539  }
540  }
C4GraphicsResource GraphicsResource
C4SoundInstance * StartSoundEffect(const char *szSndName, bool fLoop, int32_t iVolume, C4Object *pObj, int32_t iCustomFalloffDistance, int32_t iPitch, C4SoundModifier *modifier)
void ScrollToBottom()
Definition: C4Gui.h:1742
void AddTextLine(const char *szText, CStdFont *pFont, DWORD dwClr, bool fDoUpdate, bool fMakeReadableOnBlack, CStdFont *pCaptionFont=nullptr)
Definition: C4Gui.h:1740
#define C4GUI_ErrorFontClr
Definition: C4Gui.h:53

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Definition at line 2134 of file C4Gui.h.

References C4GUI::Dialog::UserClose().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnExitBtn ( C4GUI::Control btn)
protected

Definition at line 294 of file C4GameLobby.cpp.

References C4GUI::Dialog::Close().

Referenced by MainDlg().

295  {
296  // abort dlg
297  Close(false);
298  }
void Close(bool fOK)

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Element.

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

Definition at line 212 of file C4GuiContainers.cpp.

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

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

Here is the call graph for this function:

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

Reimplemented in C4PortraitSelDlg, and C4DownloadDlg.

Definition at line 2209 of file C4Gui.h.

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

2209 {} // idle proc in DoModal

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnLog ( const char *  szLogMsg,
DWORD  dwClr = C4GUI_LogFontClr 
)

Definition at line 523 of file C4GameLobby.cpp.

References C4GUI::TextWindow::AddTextLine(), GraphicsResource, C4GUI::TextWindow::ScrollToBottom(), and C4GraphicsResource::TextFont.

Referenced by Log(), and OnCountdownPacket().

524  {
525  if (pChatBox)
526  {
527  pChatBox->AddTextLine(szLogMsg, &::GraphicsResource.TextFont, dwClr, true, true);
528  pChatBox->ScrollToBottom();
529  }
530  }
C4GraphicsResource GraphicsResource
void ScrollToBottom()
Definition: C4Gui.h:1742
void AddTextLine(const char *szText, CStdFont *pFont, DWORD dwClr, bool fDoUpdate, bool fMakeReadableOnBlack, CStdFont *pCaptionFont=nullptr)
Definition: C4Gui.h:1740

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GameLobby::MainDlg::OnMessage ( C4Client pOfClient,
const char *  szMessage 
)

Definition at line 498 of file C4GameLobby.cpp.

References C4GUI::TextWindow::AddTextLine(), C4GUI_MessageFontAlpha, C4Game::Clients, Game, C4Network2Players::GetClientChatColor(), C4Client::getID(), C4ClientList::getLocalID(), GraphicsResource, C4Client::IsIgnored(), LogSilent(), Network, C4Network2::Players, C4GUI::TextWindow::ScrollToBottom(), and C4GraphicsResource::TextFont.

499  {
500  // output message should be prefixed with client already
501  const char *szMsgBuf = szMessage;
502  // 2do: log with player colors?
503  if (pChatBox && !pOfClient->IsIgnored())
504  {
505  pChatBox->AddTextLine(szMsgBuf, &::GraphicsResource.TextFont, ::Network.Players.GetClientChatColor(pOfClient ? pOfClient->getID() : Game.Clients.getLocalID(), true) | C4GUI_MessageFontAlpha, true, true);
506  pChatBox->ScrollToBottom();
507  }
508  // log it
509  LogSilent(szMsgBuf);
510  // done, success
511  return true;
512  }
bool LogSilent(const char *szMessage, bool fConsole)
Definition: C4Log.cpp:124
C4Game Game
Definition: C4Globals.cpp:52
C4GraphicsResource GraphicsResource
int32_t getID() const
Definition: C4Client.h:105
C4Network2 Network
Definition: C4Globals.cpp:53
DWORD GetClientChatColor(int idForClient, bool fLobby) const
int32_t getLocalID() const
Definition: C4Client.h:171
#define C4GUI_MessageFontAlpha
Definition: C4Gui.h:44
void ScrollToBottom()
Definition: C4Gui.h:1742
bool IsIgnored() const
Definition: C4Client.h:114
C4Network2Players Players
Definition: C4Network2.h:119
C4ClientList & Clients
Definition: C4Game.h:69
void AddTextLine(const char *szText, CStdFont *pFont, DWORD dwClr, bool fDoUpdate, bool fMakeReadableOnBlack, CStdFont *pCaptionFont=nullptr)
Definition: C4Gui.h:1740

Here is the call graph for this function:

void C4GameLobby::MainDlg::OnPlayersChange ( )
inline

Definition at line 151 of file C4GameLobby.h.

Referenced by C4Network2Players::HandlePlayerInfo(), C4Network2Players::HandlePlayerInfoUpdRequest(), and C4Network2::LeagueUpdateProcessReply().

151 { UpdatePlayerList(); }

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnReadyCheck ( C4GUI::Element pCheckBox)
protected

Definition at line 300 of file C4GameLobby.cpp.

References CDT_Direct, CID_ClientUpdate, C4Game::Clients, Control, CUT_SetReady, C4GameControl::DoInput(), Game, and C4ClientList::getLocalID().

Referenced by MainDlg().

301  {
302  bool rIsOn = static_cast<C4GUI::CheckBox *>(pCheckBox)->GetChecked();
304  }
C4Game Game
Definition: C4Globals.cpp:52
int32_t getLocalID() const
Definition: C4Client.h:171
C4GameControl Control
void DoInput(C4PacketType eCtrlType, C4ControlPacket *pPkt, C4ControlDeliveryType eDelivery)
C4ClientList & Clients
Definition: C4Game.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

C4GUI::ContextMenu * C4GameLobby::MainDlg::OnRightTabContext ( C4GUI::Element pLabel,
int32_t  iX,
int32_t  iY 
)
protected

Definition at line 553 of file C4GameLobby.cpp.

References C4GUI::ContextMenu::AddItem(), Game, StdStrBuf::getData(), C4GUI::Tabular::GetSheet(), C4GUI::Tabular::Sheet::GetTitle(), C4GUI::Element::GetToolTip(), C4GUI::Ico_Options, C4GUI::Ico_Player, C4GUI::Ico_Resource, C4GUI::Ico_Team, C4TeamList::IsMultiTeams(), LoadResStr(), OnCtxTabOptions(), OnCtxTabPlayers(), OnCtxTabRes(), OnCtxTabTeams(), and C4Game::Teams.

Referenced by MainDlg().

554  {
555  // create context menu
556  C4GUI::ContextMenu *pMenu = new C4GUI::ContextMenu();
557  // players/resources
558  C4GUI::Tabular::Sheet *pPlayerSheet = pRightTab->GetSheet(0);
559  C4GUI::Tabular::Sheet *pResSheet = pRightTab->GetSheet(1);
560  C4GUI::Tabular::Sheet *pOptionsSheet = pRightTab->GetSheet(2);
561  pMenu->AddItem(pPlayerSheet->GetTitle(), pPlayerSheet->GetToolTip(), C4GUI::Ico_Player,
563  if (Game.Teams.IsMultiTeams())
564  {
565  StdCopyStrBuf strShowTeamsDesc(LoadResStr("IDS_MSG_SHOWTEAMS_DESC"));
566  pMenu->AddItem(LoadResStr("IDS_MSG_SHOWTEAMS"), strShowTeamsDesc.getData(), C4GUI::Ico_Team,
567  new C4GUI::CBMenuHandler<MainDlg>(this, &MainDlg::OnCtxTabTeams));
568  }
569  pMenu->AddItem(pResSheet->GetTitle(), pResSheet->GetToolTip(), C4GUI::Ico_Resource,
570  new C4GUI::CBMenuHandler<MainDlg>(this, &MainDlg::OnCtxTabRes));
571  pMenu->AddItem(pOptionsSheet->GetTitle(), pOptionsSheet->GetToolTip(), C4GUI::Ico_Options,
572  new C4GUI::CBMenuHandler<MainDlg>(this, &MainDlg::OnCtxTabOptions));
573  // open it
574  return pMenu;
575  }
const char * GetTitle()
Definition: C4Gui.h:1624
void AddItem(const char *szText, const char *szToolTip=nullptr, Icons icoIcon=Ico_None, MenuHandler *pMenuHandler=nullptr, ContextHandler *pSubmenuHandler=nullptr)
Definition: C4Gui.h:1873
C4Game Game
Definition: C4Globals.cpp:52
bool IsMultiTeams() const
Definition: C4Teams.h:162
C4TeamList & Teams
Definition: C4Game.h:70
const char * GetToolTip()
Definition: C4Gui.cpp:423
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
void OnCtxTabPlayers(C4GUI::Element *pListItem)
Definition: C4GameLobby.h:118
void OnCtxTabRes(C4GUI::Element *pListItem)
Definition: C4GameLobby.h:122
Sheet * GetSheet(int32_t iIndex)
Definition: C4Gui.h:1706
void OnCtxTabOptions(C4GUI::Element *pListItem)
Definition: C4GameLobby.h:124
void OnCtxTabTeams(C4GUI::Element *pListItem)
Definition: C4GameLobby.h:120

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnRunBtn ( C4GUI::Control btn)
protected

Definition at line 396 of file C4GameLobby.cpp.

References C4Network2::AbortLobbyCountdown(), Config, C4ConfigLobby::CountdownTime, C4Network2::isHost(), C4Config::Lobby, Network, and Start().

Referenced by MainDlg().

397  {
398  // only for host
399  if (!::Network.isHost()) return;
400  // already started? then abort
401  if (eCountdownState) { ::Network.AbortLobbyCountdown(); return; }
402  // otherwise start, utilizing correct countdown time
404  }
C4Config Config
Definition: C4Config.cpp:833
bool isHost() const
Definition: C4Network2.h:209
void AbortLobbyCountdown()
C4Network2 Network
Definition: C4Globals.cpp:53
C4ConfigLobby Lobby
Definition: C4Config.h:256
void Start(int32_t iCountdownTime)
int32_t CountdownTime
Definition: C4Config.h:197

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnSec1Timer ( )
overrideprotectedvirtual

Implements C4ApplicationSec1Timer.

Definition at line 542 of file C4GameLobby.cpp.

543  {
544  UpdatePlayerList();
545  }
virtual void C4GUI::Dialog::OnShown ( )
inlinevirtualinherited

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

Definition at line 2208 of file C4Gui.h.

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

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

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnTabOptions ( C4GUI::Control btn)
protected

Definition at line 624 of file C4GameLobby.cpp.

References C4GUI::Tabular::SelectSheet(), and UpdateRightTab().

Referenced by MainDlg(), and OnCtxTabOptions().

625  {
626  if (pRightTab)
627  {
628  pRightTab->SelectSheet(SheetIdx_Options, true);
629  UpdateRightTab();
630  }
631  }
void SelectSheet(int32_t iIndex, bool fByUser)

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnTabPlayers ( C4GUI::Control btn)
protected

Definition at line 595 of file C4GameLobby.cpp.

References C4PlayerInfoListBox::PILBM_LobbyClientSort, C4GUI::Tabular::SelectSheet(), C4PlayerInfoListBox::SetMode(), and UpdateRightTab().

Referenced by MainDlg(), and OnCtxTabPlayers().

596  {
597  if (pPlayerList) pPlayerList->SetMode(C4PlayerInfoListBox::PILBM_LobbyClientSort);
598  if (pRightTab)
599  {
600  pRightTab->SelectSheet(SheetIdx_PlayerList, true);
601  UpdateRightTab();
602  }
603  }
void SelectSheet(int32_t iIndex, bool fByUser)
void SetMode(Mode eNewMode)

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnTabRes ( C4GUI::Control btn)
protected

Definition at line 615 of file C4GameLobby.cpp.

References C4GUI::Tabular::SelectSheet(), and UpdateRightTab().

Referenced by MainDlg(), and OnCtxTabRes().

616  {
617  if (pRightTab)
618  {
619  pRightTab->SelectSheet(SheetIdx_Res, true);
620  UpdateRightTab();
621  }
622  }
void SelectSheet(int32_t iIndex, bool fByUser)

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnTabScenario ( C4GUI::Control btn)
protected

Definition at line 633 of file C4GameLobby.cpp.

References C4GUI::Tabular::SelectSheet(), and UpdateRightTab().

Referenced by MainDlg(), and OnCtxTabScenario().

634  {
635  if (pRightTab)
636  {
637  pRightTab->SelectSheet(SheetIdx_Scenario, true);
638  UpdateRightTab();
639  }
640  }
void SelectSheet(int32_t iIndex, bool fByUser)

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::OnTabTeams ( C4GUI::Control btn)
protected

Definition at line 605 of file C4GameLobby.cpp.

References C4PlayerInfoListBox::PILBM_LobbyTeamSort, C4GUI::Tabular::SelectSheet(), C4PlayerInfoListBox::SetMode(), and UpdateRightTab().

Referenced by MainDlg(), and OnCtxTabTeams().

606  {
607  if (pPlayerList) pPlayerList->SetMode(C4PlayerInfoListBox::PILBM_LobbyTeamSort);
608  if (pRightTab)
609  {
610  pRightTab->SelectSheet(SheetIdx_PlayerList, true);
611  UpdateRightTab();
612  }
613  }
void SelectSheet(int32_t iIndex, bool fByUser)
void SetMode(Mode eNewMode)

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2204 of file C4Gui.h.

References C4GUI::Dialog::UserClose().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

ReverseIterator C4GUI::Container::rbegin ( )
inlineinherited

Definition at line 826 of file C4Gui.h.

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

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

Here is the caller graph for this function:

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

Definition at line 134 of file C4GuiContainers.cpp.

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

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

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

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Container.

Definition at line 427 of file C4GuiDialogs.cpp.

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

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

Here is the call graph for this function:

ReverseIterator C4GUI::Container::rend ( )
inlineinherited

Definition at line 827 of file C4Gui.h.

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

827 { return ReverseIterator(nullptr); }

Here is the caller graph for this function:

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

Definition at line 218 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 446 of file C4Gui.h.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 769 of file C4GuiDialogs.cpp.

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

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

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  }
int32_t Wdt
Definition: C4Rect.h:30
int32_t GetMarginTop() override
Definition: C4Gui.h:2140
int32_t y
Definition: C4Rect.h:30
int32_t GetMarginBottom() override
Definition: C4Gui.h:2143
int32_t GetMarginLeft() override
Definition: C4Gui.h:2141
C4Rect rcBounds
Definition: C4Gui.h:385
int32_t x
Definition: C4Rect.h:30
void UpdatePos() override
int32_t Hgt
Definition: C4Rect.h:30
int32_t GetMarginRight() override
Definition: C4Gui.h:2142

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 465 of file C4Gui.h.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2190 of file C4Gui.h.

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

2190 { fDelOnClose=fToVal; } // dialog will delete itself when closed
bool fDelOnClose
Definition: C4Gui.h:2085

Here is the caller graph for this function:

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

Definition at line 464 of file C4Gui.h.

References C4GUI::Element::pDragTarget.

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

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

Here is the caller graph for this function:

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

Definition at line 563 of file C4GuiDialogs.cpp.

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

Referenced by C4GUI::Dialog::AdvanceFocus(), C4ChatDlg::C4ChatDlg(), C4GameOverDlg::C4GameOverDlg(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4StartupPlrPropertiesDlg::C4StartupPlrPropertiesDlg(), C4StartupPlrSelDlg::C4StartupPlrSelDlg(), C4StartupScenSelDlg::C4StartupScenSelDlg(), C4GUI::Dialog::CharIn(), C4StartupScenSelDlg::DeselectAll(), C4StartupNetDlg::DoOK(), C4FileSelDlg::InitElements(), 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().

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  }
Control * pActiveCtrl
Definition: C4Gui.h:2080
virtual void OnLooseFocus()
Definition: C4Gui.h:1057
C4GameControl Control

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2193 of file C4Gui.h.

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

2194  {
2195  if (pFrameDeco) pFrameDeco->Deref();
2196  if ((pFrameDeco = pNewDeco)) pNewDeco->Ref();
2197  UpdateOwnPos(); // margin may have changed; might need to reposition stuff
2198  }
FrameDecoration * pFrameDeco
Definition: C4Gui.h:2089
void UpdateOwnPos() override

Here is the call graph for this function:

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

Definition at line 860 of file C4Gui.h.

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

861  { rcBounds.x=iXPos; rcBounds.y=iYPos; UpdatePos(); }
int32_t y
Definition: C4Rect.h:30
C4Rect rcBounds
Definition: C4Gui.h:385
int32_t x
Definition: C4Rect.h:30
virtual void UpdatePos()
Definition: C4Gui.cpp:193

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 336 of file C4GuiDialogs.cpp.

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, 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(), C4Menu::SetSelection(), C4ScoreboardDlg::Update(), and C4Menu::UpdateElementPositions().

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_CaptionFontClr
Definition: C4Gui.h:37
#define C4GUI_TitleAutoScrollTime
Definition: C4Gui.h:146
void SetToolTip(const char *szNewTooltip, bool is_immediate=false)
Definition: C4Gui.cpp:409
void SetTitle(const char *Title)
Definition: C4AppT.cpp:111
Definition: C4Rect.h:27
DialogWindow * pWindow
Definition: C4Gui.h:2088
void AddElement(Element *pChild)
bool IsViewportDialog()
Definition: C4Gui.h:2172
CallbackButton< Dialog, C4GUI::IconButton > * pCloseBtn
Definition: C4Gui.h:2079
C4GraphicsResource GraphicsResource
bool SEqual(const char *szStr1, const char *szStr2)
Definition: Standard.h:93
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
int32_t Wdt
Definition: C4Rect.h:30
StdStrBuf TitleString
Definition: C4Gui.h:2086
static int32_t GetDefaultHeight(CStdFont *pUseFont=nullptr)
int32_t GetMarginLeft() override
Definition: C4Gui.h:2141
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
C4Rect rcBounds
Definition: C4Gui.h:385
void OnUserClose(C4GUI::Control *btn)
Definition: C4Gui.h:2204
C4Rect & GetBounds()
Definition: C4Gui.h:445
void SetDragTarget(Window *pToWindow)
Definition: C4Gui.h:464
const char * GetText()
Definition: C4Gui.h:503
WoodenLabel * pTitle
Definition: C4Gui.h:2078
void SetAutoScrollTime(uint32_t tDelay)
Definition: C4Gui.h:537
const int ALeft
Definition: C4Surface.h:41
void SetRightIndent(int32_t iNewIndent)
Definition: C4Gui.h:540
void Copy()
Definition: StdBuf.h:467
C4Application Application
Definition: C4Globals.cpp:44
void SetText(const char *szToText, bool fAllowHotkey=true)
Definition: C4GuiLabels.cpp:74

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::FullscreenDialog::SetTitle ( const char *  szToTitle)
inherited

Definition at line 806 of file C4GuiDialogs.cpp.

References ACenter, C4GUI::Container::AddElement(), ALeft, C4GUI_CaptionFontClr, C4GUI_FullscreenCaptionFontClr, C4UpperBoardHeight, C4GUI::Window::GetClientRect(), CStdFont::GetLineHeight(), C4GUI::FullscreenDialog::GetMarginTop(), GraphicsResource, C4GUI::FullscreenDialog::HasUpperBoard(), C4GUI::FullscreenDialog::pFullscreenTitle, C4GUI::Element::SetToolTip(), and C4GraphicsResource::TitleFont.

Referenced by C4GUI::FullscreenDialog::FullscreenDialog().

807  {
808  if (pFullscreenTitle) { delete pFullscreenTitle; pFullscreenTitle=nullptr; }
809  // change title text; creates or removes title bar if necessary
810  if (szTitle && *szTitle)
811  {
812  // not using dlg label, which is a wooden label
813  if (HasUpperBoard())
815  else
816  // non-woodbar: Title is centered and in big font
818  AddElement(pFullscreenTitle);
819  pFullscreenTitle->SetToolTip(szTitle);
820  }
821  }
#define C4GUI_CaptionFontClr
Definition: C4Gui.h:37
int GetLineHeight() const
Definition: C4FontLoader.h:125
#define C4GUI_FullscreenCaptionFontClr
Definition: C4Gui.h:161
Label * pFullscreenTitle
Definition: C4Gui.h:2223
void AddElement(Element *pChild)
const int C4UpperBoardHeight
Definition: C4Constants.h:59
C4GraphicsResource GraphicsResource
virtual bool HasUpperBoard()
Definition: C4Gui.h:2241
const int ACenter
Definition: C4Surface.h:41
int32_t GetMarginTop() override
Definition: C4Gui.h:2246
C4Rect & GetClientRect() override
Definition: C4Gui.h:864
const int ALeft
Definition: C4Surface.h:41

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 409 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Element.

Reimplemented in C4StartupNetListEntry.

Definition at line 247 of file C4GuiContainers.cpp.

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(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupScenSelDlg::C4StartupScenSelDlg(), C4Menu::Draw(), C4Menu::InitLocation(), and C4StartupNetListEntry::SetVisibility().

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
C4GameControl Control
virtual class Dialog * GetDlg()
Definition: C4Gui.cpp:288

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 614 of file C4GuiDialogs.cpp.

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(), C4Network2::OpenSurrenderDialog(), C4Network2::OpenVoteDialog(), C4Network2::RetrieveRes(), C4ChatDlg::ShowChat(), C4Game::ShowGameOverDlg(), C4DownloadDlg::ShowModal(), C4GUI::Screen::ShowModalDlg(), C4GUI::Screen::ShowProgressDlg(), C4GUI::Screen::ShowRemoveDlg(), and C4Startup::SwitchDialog().

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 fShow
Definition: C4Gui.h:2081
virtual void OnShown()
Definition: C4Gui.h:2208
static Screen * GetScreenS()
Definition: C4Gui.h:2626
bool IsViewportDialog()
Definition: C4Gui.h:2172
bool CreateConsoleWindow()
bool fVisible
Definition: C4Gui.h:383
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::Start ( int32_t  iCountdownTime)

Definition at line 406 of file C4GameLobby.cpp.

References C4GUI::MessageDialog::btnYesNo, C4Game::C4S, Config, C4PlayerInfoList::FindUnassociatedRestoreInfo(), Game, StdStrBuf::getData(), C4GUI::Element::GetScreen(), C4Scenario::Head, C4ConfigStartup::HideMsgPlrNoTakeOver, C4GUI::Ico_SavegamePlayer, LoadResStr(), Network, C4Game::PlayerInfos, StdStrBuf::Ref(), C4Game::RestorePlayerInfos, C4SHead::SaveGame, C4Network2::Start(), C4Network2::StartLobbyCountdown(), and C4Config::Startup.

Referenced by OnRunBtn(), and C4MessageInput::ProcessCommand().

407  {
408  // network savegame resumes: Warn if not all players have been associated
409  if (Game.C4S.Head.SaveGame)
411  {
412  StdStrBuf sMsg; sMsg.Ref(LoadResStr("IDS_MSG_NOTALLSAVEGAMEPLAYERSHAVE"));
413  if (!GetScreen()->ShowMessageModal(sMsg.getData(), LoadResStr("IDS_MSG_FREESAVEGAMEPLRS"), C4GUI::MessageDialog::btnYesNo, C4GUI::Ico_SavegamePlayer, &Config.Startup.HideMsgPlrNoTakeOver))
414  return;
415  }
416  // validate countdown time
417  iCountdownTime = ValidatedCountdownTime(iCountdownTime);
418  // either direct start...
419  if (!iCountdownTime)
420  ::Network.Start();
421  else
422  // ...or countdown
423  ::Network.StartLobbyCountdown(iCountdownTime);
424  }
const char * getData() const
Definition: StdBuf.h:442
C4PlayerInfoList & RestorePlayerInfos
Definition: C4Game.h:72
bool Start()
Definition: C4Network2.cpp:505
C4Config Config
Definition: C4Config.cpp:833
C4ConfigStartup Startup
Definition: C4Config.h:260
C4Game Game
Definition: C4Globals.cpp:52
C4Scenario C4S
Definition: C4Game.h:74
int32_t HideMsgPlrNoTakeOver
Definition: C4Config.h:186
void StartLobbyCountdown(int32_t iCountdownTime)
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
bool SaveGame
Definition: C4Scenario.h:71
C4Network2 Network
Definition: C4Globals.cpp:53
C4PlayerInfo * FindUnassociatedRestoreInfo(const C4PlayerInfoList &rRestoreInfoList)
void Ref(const char *pnData)
Definition: StdBuf.h:455
C4PlayerInfoList & PlayerInfos
Definition: C4Game.h:71
virtual Screen * GetScreen()
Definition: C4Gui.cpp:289
C4SHead Head
Definition: C4Scenario.h:230

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 259 of file C4Gui.cpp.

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

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

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

Here is the caller graph for this function:

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

Definition at line 282 of file C4Gui.cpp.

References C4GUI::Element::DoDragging().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::FullscreenDialog::UpdateOwnPos ( )
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Window.

Definition at line 830 of file C4GuiDialogs.cpp.

References C4GUI::Window::UpdateOwnPos().

831  {
832  // inherited to update client rect
834  }
void UpdateOwnPos() override

Here is the call graph for this function:

void C4GameLobby::MainDlg::UpdatePassword ( )

Definition at line 683 of file C4GameLobby.cpp.

References C4GameOptionButtons::UpdatePasswordBtn().

Referenced by C4MessageInput::ProcessCommand().

684  {
685  // if the password setting has changed, make sure the buttons reflect this change
686  pGameOptionButtons->UpdatePasswordBtn();
687  }

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Dialog::UpdatePos ( )
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 416 of file C4GuiDialogs.cpp.

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

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

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  }
DialogWindow * pWindow
Definition: C4Gui.h:2088
int32_t y
Definition: C4Rect.h:30
C4Rect rcBounds
Definition: C4Gui.h:385
int32_t x
Definition: C4Rect.h:30
virtual void UpdatePos()
Definition: C4Gui.cpp:193

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GameLobby::MainDlg::UpdateRightTab ( )
protected

Definition at line 642 of file C4GameLobby.cpp.

References C4GameLobby::ScenDesc::Activate(), C4Network2ResDlg::Activate(), C4GameOptionsList::Activate(), C4GameLobby::ScenDesc::Deactivate(), C4Network2ResDlg::Deactivate(), C4GameOptionsList::Deactivate(), C4GUI::Tabular::GetActiveSheet(), C4GUI::Tabular::GetActiveSheetIndex(), C4PlayerInfoListBox::GetMode(), C4GUI::Tabular::Sheet::GetTitle(), C4GUI::Element::GetToolTip(), C4PlayerInfoListBox::PILBM_LobbyClientSort, C4PlayerInfoListBox::PILBM_LobbyTeamSort, C4GUI::Label::SetText(), and C4GUI::Element::SetToolTip().

Referenced by MainDlg(), OnTabOptions(), OnTabPlayers(), OnTabRes(), OnTabScenario(), and OnTabTeams().

643  {
644  if (!pRightTabLbl || !pRightTab || !pRightTab->GetActiveSheet() || !pPlayerList) return;
645  // copy active sheet data to label
646  pRightTabLbl->SetText(pRightTab->GetActiveSheet()->GetTitle());
647  pRightTabLbl->SetToolTip(pRightTab->GetActiveSheet()->GetToolTip());
648  // update
649  if (pRightTab->GetActiveSheetIndex() == SheetIdx_PlayerList) UpdatePlayerList();
650  if (pRightTab->GetActiveSheetIndex() == SheetIdx_Res) pResList->Activate(); else pResList->Deactivate();
651  if (pRightTab->GetActiveSheetIndex() == SheetIdx_Options) pOptionsList->Activate(); else pOptionsList->Deactivate();
652  if (pRightTab->GetActiveSheetIndex() == SheetIdx_Scenario) pScenarioInfo->Activate(); else pScenarioInfo->Deactivate();
653  // update selection buttons
654  if (btnPlayers) btnPlayers->SetHighlight(pRightTab->GetActiveSheetIndex() == SheetIdx_PlayerList && pPlayerList->GetMode() == C4PlayerInfoListBox::PILBM_LobbyClientSort);
655  if (btnResources) btnResources->SetHighlight(pRightTab->GetActiveSheetIndex() == SheetIdx_Res);
656  if (btnTeams) btnTeams->SetHighlight(pRightTab->GetActiveSheetIndex() == SheetIdx_PlayerList && pPlayerList->GetMode() == C4PlayerInfoListBox::PILBM_LobbyTeamSort);
657  if (btnOptions) btnOptions->SetHighlight(pRightTab->GetActiveSheetIndex() == SheetIdx_Options);
658  if (btnScenario) btnScenario->SetHighlight(pRightTab->GetActiveSheetIndex() == SheetIdx_Scenario);
659  }
const char * GetTitle()
Definition: C4Gui.h:1624
void SetToolTip(const char *szNewTooltip, bool is_immediate=false)
Definition: C4Gui.cpp:409
const char * GetToolTip()
Definition: C4Gui.cpp:423
Sheet * GetActiveSheet()
Definition: C4Gui.h:1707
void SetText(const char *szToText, bool fAllowHotkey=true)
Definition: C4GuiLabels.cpp:74
int32_t GetActiveSheetIndex()

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Dialog::UpdateSize ( )
overrideprotectedvirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 398 of file C4GuiDialogs.cpp.

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

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

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  }
Definition: C4Rect.h:27
DialogWindow * pWindow
Definition: C4Gui.h:2088
virtual void UpdateSize()
Definition: C4Gui.cpp:185
CallbackButton< Dialog, C4GUI::IconButton > * pCloseBtn
Definition: C4Gui.h:2079
C4GraphicsResource GraphicsResource
int32_t Wdt
Definition: C4Rect.h:30
void SetSize(unsigned int cx, unsigned int cy)
Definition: C4AppT.cpp:110
static int32_t GetDefaultHeight(CStdFont *pUseFont=nullptr)
int32_t GetMarginLeft() override
Definition: C4Gui.h:2141
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
C4Rect rcBounds
Definition: C4Gui.h:385
WoodenLabel * pTitle
Definition: C4Gui.h:2078
void SetBounds(const C4Rect &rcNewBound)
Definition: C4Gui.h:446
int32_t Hgt
Definition: C4Rect.h:30

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void C4GUI::Dialog::UserClose ( bool  fOK)
inlinevirtualinherited

Reimplemented in C4LeagueSignupDialog, C4StartupPlrPropertiesDlg, C4Menu, C4FileSelDlg, C4DownloadDlg, and C4StartupOptionsDlg.

Definition at line 2206 of file C4Gui.h.

References C4GUI::Dialog::Close().

Referenced by C4GUI::Dialog::OnEnter(), C4GameOverDlg::OnEscape(), C4GUI::Dialog::OnEscape(), C4ChatDlg::OnExitBtn(), C4GUI::CloseButton::OnPress(), C4GUI::CloseIconButton::OnPress(), and C4GUI::Dialog::OnUserClose().

2206 { Close(fOK); }
void Close(bool fOK)
bool fOK
Definition: C4Gui.h:2082

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Fade C4GUI::Dialog::eFade
protectedinherited
bool C4GUI::Dialog::fDelOnClose
protectedinherited

Definition at line 2085 of file C4Gui.h.

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

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

Definition at line 380 of file C4Gui.h.

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

bool C4GUI::Dialog::fViewportDlg
protectedinherited

Definition at line 2087 of file C4Gui.h.

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

int32_t C4GUI::FullscreenDialog::iDlgMarginX
protectedinherited
int32_t C4GUI::FullscreenDialog::iDlgMarginY
protectedinherited
int32_t C4GUI::Element::iDragX
protectedinherited

Definition at line 379 of file C4Gui.h.

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

int32_t C4GUI::Element::iDragY
protectedinherited

Definition at line 379 of file C4Gui.h.

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

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

Definition at line 2079 of file C4Gui.h.

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

ContextHandler* C4GUI::Element::pContextHandler {nullptr}
protectedinherited
Window* C4GUI::Element::pDragTarget {nullptr}
protectedinherited
FrameDecoration* C4GUI::Dialog::pFrameDeco
protectedinherited
Label* C4GUI::FullscreenDialog::pFullscreenTitle
protectedinherited

Definition at line 2223 of file C4Gui.h.

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