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

#include <C4Gui.h>

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

Public Member Functions

virtual void RemoveElement (Element *pChild)
 
const C4RectGetPreferredDlgRect ()
 
void ShowDialog (Dialog *pDlg, bool fFade)
 
void CloseDialog (Dialog *pDlg, bool fFade)
 
void ActivateDialog (Dialog *pDlg)
 
void RecheckActiveDialog ()
 
DialogGetTopDialog ()
 
 Screen ()
 
 ~Screen ()
 
void Init (int32_t tx, int32_t ty, int32_t twdt, int32_t thgt)
 
void Clear ()
 
void Render (bool fDoBG)
 
void RenderMouse (C4TargetFacet &cgo)
 
virtual ScreenGetScreen ()
 
float GetZoom () const
 
bool IsActive ()
 
bool KeyAny ()
 
virtual bool CharIn (const char *c)
 
bool MouseInput (int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam, Dialog *pDlg, class C4Viewport *pVP)
 
void MouseMove (int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam, class C4Viewport *pVP)
 
void SetMouseInGUI (bool fInGUI, bool fByMouse)
 
bool RecheckMouseInput ()
 
bool ShowMessage (const char *szMessage, const char *szCaption, Icons icoIcon, int32_t *piConfigDontShowAgainSetting=nullptr)
 
bool ShowErrorMessage (const char *szMessage)
 
bool ShowMessageModal (const char *szMessage, const char *szCaption, DWORD dwButtons, Icons icoIcon, int32_t *piConfigDontShowAgainSetting=nullptr)
 
ProgressDialogShowProgressDlg (const char *szMessage, const char *szCaption, int32_t iMaxProgress=100, int32_t iInitialProgress=0, Icons icoIcon=Ico_Wait)
 
bool ShowModalDlg (Dialog *pDlg, bool fDestruct=true)
 
bool ShowRemoveDlg (Dialog *pDlg)
 
void CloseAllDialogs (bool fWithOK)
 
void SetPreferredDlgRect (const C4Rect &rtNewPref)
 
DialogGetDialog (C4Window *pWindow)
 
void DoContext (ContextMenu *pNewCtx, Element *pAtElement, int32_t iX, int32_t iY)
 
void AbortContext (bool fByUser)
 
int32_t GetContextMenuIndex ()
 
int32_t GetLastContextMenuIndex ()
 
bool HasContext ()
 
bool HasFullscreenDialog (bool fIncludeFading)
 
DialogGetFullscreenDialog (bool fIncludeFading)
 
void OnSec1Timer ()
 
void SetExclusive (bool fToState)
 
bool IsExclusive ()
 
bool HasKeyboardFocus ()
 
bool HasMouseFocus ()
 
int32_t GetMouseControlledDialogCount ()
 
void UpdateMouseFocus ()
 
void UpdateGamepadGUIControlEnabled ()
 
virtual void MouseInput (CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
 
void SetPos (int32_t iXPos, int32_t iYPos)
 
virtual void UpdateOwnPos ()
 
virtual C4RectGetClientRect ()
 
virtual void ApplyElementOffset (int32_t &riX, int32_t &riY)
 
virtual void ApplyInvElementOffset (int32_t &riX, int32_t &riY)
 
virtual bool IsComponentOutsideClientArea ()
 
virtual int32_t GetMarginTop ()
 
virtual int32_t GetMarginLeft ()
 
virtual int32_t GetMarginRight ()
 
virtual int32_t GetMarginBottom ()
 
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)
 
virtual ElementGetFirstContained ()
 
virtual ElementGetLastContained ()
 
virtual ElementGetFirstNestedElement (bool fBackwards)
 
Iterator begin ()
 
Iterator end ()
 
ReverseIterator rbegin ()
 
ReverseIterator rend ()
 
ElementGetFirst ()
 
ElementGetLast ()
 
virtual ContainerGetContainer ()
 
ElementGetElementByIndex (int32_t i)
 
int32_t GetElementCount ()
 
virtual void SetVisibility (bool fToValue)
 
virtual bool IsFocused (Control *pCtrl)
 
virtual bool IsSelectedChild (Element *pChild)
 
virtual bool IsParentOf (Element *pEl)
 
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 class DialogGetDlg ()
 
virtual ControlIsFocusElement ()
 
void ScreenPos2ClientPos (int32_t &riX, int32_t &riY)
 
void ClientPos2ScreenPos (int32_t &riX, int32_t &riY)
 
void SetToolTip (const char *szNewTooltip, bool is_immediate=false)
 
const char * GetToolTip ()
 
const char * GetOwnToolTip ()
 
bool IsImmediateToolTip () const
 
int32_t GetWidth ()
 
int32_t GetHeight ()
 
C4RectGetBounds ()
 
void SetBounds (const C4Rect &rcNewBound)
 
C4Rect GetContainedClientRect ()
 
ElementGetNext () const
 
ElementGetPrev () const
 
bool IsInActiveDlg (bool fForKeyboard)
 
C4Rect GetToprightCornerRect (int32_t iWidth=16, int32_t iHeight=16, int32_t iHIndent=4, int32_t iVIndent=4, int32_t iIndexX=0)
 
bool IsVisible ()
 
virtual int32_t GetListItemTopSpacing ()
 
virtual bool GetListItemTopSpacingBar ()
 
void SetDragTarget (Window *pToWindow)
 
void SetContextHandler (ContextHandler *pNewHd)
 
virtual ContextHandlerGetContextHandler ()
 

Static Public Member Functions

static ScreenGetScreenS ()
 
static void DrawToolTip (const char *szTip, C4TargetFacet &cgo, float guix, float guiy)
 

Public Attributes

CMouse Mouse
 
bool fVisible
 

Protected Member Functions

virtual void Draw (C4TargetFacet &cgo, bool fDoBG)
 
virtual void ElementPosChanged (Element *pOfElement)
 
virtual void Draw (C4TargetFacet &cgo)
 
virtual void ElementSizeChanged (Element *pOfElement)
 
virtual void AfterElementRemoval ()
 
virtual bool OnHotkey (uint32_t cHotkey)
 
virtual void DrawElement (C4TargetFacet &cgo)
 
virtual void UpdateSize ()
 
virtual void UpdatePos ()
 
void Draw3DFrame (C4TargetFacet &cgo, bool fUp=false, int32_t iIndent=1, BYTE byAlpha=C4GUI_BorderAlpha, bool fDrawTop=true, int32_t iTopOff=0, bool fDrawLeft=true, int32_t iLeftOff=0)
 
void DrawBar (C4TargetFacet &cgo, DynBarFacet &rFacets)
 
void DrawVBar (C4TargetFacet &cgo, DynBarFacet &rFacets)
 
void DrawHBarByVGfx (C4TargetFacet &cgo, DynBarFacet &rFacets)
 
void DrawHVBar (C4TargetFacet &cgo, DynBarFacet &rFacets, C4DrawTransform &trf, int32_t iMiddleLength)
 
virtual bool IsOwnPtrElement ()
 
virtual bool IsExternalDrawDialog ()
 
virtual bool IsMenu ()
 
virtual class DialogWindowGetDialogWindow ()
 
virtual bool CheckNameHotkey (const char *)
 

Protected Attributes

DialogpActiveDlg
 
ContextMenupContext
 
bool fExclusive
 
C4Rect PreferredDlgRect
 
float fZoom
 
C4Rect rcClientRect
 
ElementpFirst
 
ElementpLast
 
ContainerpParent
 
ElementpPrev
 
ElementpNext
 
WindowpDragTarget
 
int32_t iDragX
 
int32_t iDragY
 
bool fDragging
 
ContextHandlerpContextHandler
 
C4Rect rcBounds
 

Static Protected Attributes

static ScreenpScreen
 

Friends

class Dialog
 
class ContextMenu
 

Detailed Description

Definition at line 2584 of file C4Gui.h.

Constructor & Destructor Documentation

C4GUI::Screen::Screen ( )

Definition at line 573 of file C4Gui.cpp.

References pActiveDlg, and pScreen.

573  : Window(), Mouse(0, 0), pContext(nullptr), fExclusive(true), fZoom(1.0f)
574  {
575  // no dialog active
576  pActiveDlg = nullptr;
577  // set static var
578  pScreen = this;
579  }
float fZoom
Definition: C4Gui.h:2594
ContextMenu * pContext
Definition: C4Gui.h:2591
static Screen * pScreen
Definition: C4Gui.h:2596
CMouse Mouse
Definition: C4Gui.h:2587
Dialog * pActiveDlg
Definition: C4Gui.h:2590
bool fExclusive
Definition: C4Gui.h:2592
C4GUI::Screen::~Screen ( )

Definition at line 601 of file C4Gui.cpp.

References pScreen.

602  {
603  // clear singleton
604  if (this == pScreen) pScreen = nullptr;
605  }
static Screen * pScreen
Definition: C4Gui.h:2596

Member Function Documentation

void C4GUI::Screen::AbortContext ( bool  fByUser)
inline

Definition at line 2654 of file C4Gui.h.

References C4GUI::ContextMenu::Abort().

Referenced by ActivateDialog(), Clear(), CloseDialog(), DoContext(), C4GUI::ContextMenu::DoOK(), and MouseInput().

2654 { if (pContext) pContext->Abort(fByUser); } // close context menu
void Abort(bool fByUser)
Definition: C4GuiMenu.cpp:171
ContextMenu * pContext
Definition: C4Gui.h:2591

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Screen::ActivateDialog ( Dialog pDlg)

Definition at line 650 of file C4Gui.cpp.

References AbortContext(), C4GUI::Element::GetNext(), C4GUI::Dialog::GetZOrdering(), IsExclusive(), C4GUI::Container::MakeLastElement(), Mouse, pActiveDlg, and C4GUI::CMouse::ReleaseElements().

Referenced by C4Game::DoKeyboardInput(), C4GUI::Dialog::Draw(), MouseInput(), and C4ChatDlg::ShowChat().

651  {
652  // no change?
653  if (pActiveDlg == pDlg) return;
654  // in single-mode: release any MouseOver/Drag of previous dlg
655  if (IsExclusive())
657  // close any context menu
658  AbortContext(false);
659  // set as active dlg
660  pActiveDlg = pDlg;
661  // ensure it's last in the list, if it's not a specially ordered dlg
662  if (!pDlg->GetZOrdering() && pDlg->GetNext())
663  MakeLastElement(pDlg);
664  }
void AbortContext(bool fByUser)
Definition: C4Gui.h:2654
bool IsExclusive()
Definition: C4Gui.h:2667
void ReleaseElements()
Definition: C4Gui.cpp:522
void MakeLastElement(Element *pChild)
CMouse Mouse
Definition: C4Gui.h:2587
Dialog * pActiveDlg
Definition: C4Gui.h:2590

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 118 of file C4GuiContainers.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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:

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

Reimplemented from C4GUI::Container.

Reimplemented in C4GUI::Dialog.

Definition at line 866 of file C4Gui.h.

References C4Rect::x, and C4Rect::y.

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

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

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Container.

Reimplemented in C4GUI::Dialog.

Definition at line 868 of file C4Gui.h.

References C4Rect::x, and C4Rect::y.

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

869  { riX += rcClientRect.x; riY += rcClientRect.y; }
C4Rect rcClientRect
Definition: C4Gui.h:851
int32_t y
Definition: C4Rect.h:32
int32_t x
Definition: C4Rect.h:32

Here is the caller graph for this function:

Iterator C4GUI::Container::begin ( )
inlineinherited

Definition at line 824 of file C4Gui.h.

Referenced by C4ScriptGuiWindow::ClearPointers(), and C4ScriptGuiWindow::DrawChildren().

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

Here is the caller graph for this function:

bool C4GUI::Screen::CharIn ( const char *  c)
virtual

Definition at line 782 of file C4Gui.cpp.

References C4GUI::ContextMenu::CharIn(), C4GUI::Dialog::CharIn(), HasKeyboardFocus(), IsExclusive(), C4GUI::Element::IsVisible(), Mouse, pActiveDlg, pContext, and C4GUI::CMouse::ResetActiveInput().

Referenced by C4FullScreen::CharIn(), and FullScreenWinProc().

783  {
784  // Special: Tab chars are ignored, because they are always handled as focus advance
785  if (c[0] == 0x09) return false;
786  // mark in mouse
788  // no processing if focus is not set
789  if (!HasKeyboardFocus()) return false;
790  // always return true in exclusive mode (which means: key processed)
791  bool fResult = IsExclusive();
792  // context menu: forward to context
793  if (pContext) return pContext->CharIn(c) || fResult;
794  // no active dlg?
795  if (!pActiveDlg || !pActiveDlg->IsVisible()) return fResult;
796  // forward to dialog
797  return pActiveDlg->CharIn(c) || fResult;
798  }
bool HasKeyboardFocus()
Definition: C4Gui.h:2668
void ResetActiveInput()
Definition: C4Gui.h:2577
bool IsVisible()
Definition: C4Gui.cpp:202
bool IsExclusive()
Definition: C4Gui.h:2667
virtual bool CharIn(const char *c)
Definition: C4GuiMenu.cpp:455
ContextMenu * pContext
Definition: C4Gui.h:2591
CMouse Mouse
Definition: C4Gui.h:2587
Dialog * pActiveDlg
Definition: C4Gui.h:2590
virtual bool CharIn(const char *c)

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::Screen::Clear ( )

Definition at line 591 of file C4Gui.cpp.

References AbortContext(), C4GUI::Container::Clear(), fExclusive, and fZoom.

Referenced by C4Game::Clear().

592  {
594  // dtor: Close context menu
595  AbortContext(false);
596  // fields reset
597  fExclusive = true;
598  fZoom = 1.0f;
599  }
void AbortContext(bool fByUser)
Definition: C4Gui.h:2654
float fZoom
Definition: C4Gui.h:2594
bool fExclusive
Definition: C4Gui.h:2592

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::Element::ClientPos2ScreenPos ( int32_t &  riX,
int32_t &  riY 
)
inherited

Definition at line 232 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(), DoContext(), and C4Menu::Draw().

233  {
234  // apply all parent offsets
235  Container *pCont = pParent;
236  while (pCont)
237  {
238  pCont->ApplyInvElementOffset(riX, riY);
239  pCont = pCont->GetParent();
240  }
241  // apply own offset
242  riX += rcBounds.x; riY += rcBounds.y;
243  }
int32_t y
Definition: C4Rect.h:32
C4Rect rcBounds
Definition: C4Gui.h:385
Container * pParent
Definition: C4Gui.h:376
int32_t x
Definition: C4Rect.h:32
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::Screen::CloseAllDialogs ( bool  fWithOK)

Definition at line 707 of file C4Gui.cpp.

References C4GUI::Dialog::Close(), and pActiveDlg.

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

708  {
709  while (pActiveDlg) pActiveDlg->Close(fWithOK);
710  }
void Close(bool fOK)
Dialog * pActiveDlg
Definition: C4Gui.h:2590

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Screen::CloseDialog ( Dialog pDlg,
bool  fFade 
)

Definition at line 666 of file C4Gui.cpp.

References AbortContext(), C4GUI::Dialog::fShow, GetTopDialog(), GraphicsSystem, C4GraphicsSystem::InvalidateBg(), C4GUI::Dialog::IsFading(), Mouse, pActiveDlg, C4GUI::CMouse::ReleaseElements(), and UpdateMouseFocus().

Referenced by C4GUI::Dialog::Close(), and C4GUI::Dialog::FadeOut().

667  {
668  // hide dlg
669  if (!fFade) pDlg->fShow = false;
670  // kill from active
671  if (pActiveDlg == pDlg)
672  {
673  // release any MouseOver/Drag of previous dlg
675  // close context menu: probably belonging to closed dlg anyway
676  AbortContext(false);
677  // set new active dlg
679  // do not set yet if it's fading
680  if (pActiveDlg && pActiveDlg->IsFading()) pActiveDlg = nullptr;
681  }
682  // redraw background; clip update
684  }
Dialog * GetTopDialog()
Definition: C4Gui.cpp:695
void AbortContext(bool fByUser)
Definition: C4Gui.h:2654
void UpdateMouseFocus()
Definition: C4Gui.cpp:968
void ReleaseElements()
Definition: C4Gui.cpp:522
bool IsFading()
Definition: C4Gui.h:2151
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51
CMouse Mouse
Definition: C4Gui.h:2587
Dialog * pActiveDlg
Definition: C4Gui.h:2590

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Element::DoContext ( )
inherited

Definition at line 418 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().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Screen::DoContext ( ContextMenu pNewCtx,
Element pAtElement,
int32_t  iX,
int32_t  iY 
)

Definition at line 974 of file C4Gui.cpp.

References AbortContext(), C4GUI::Element::ClientPos2ScreenPos(), C4GUI::Element::GetBounds(), C4Rect::Hgt, pContext, and C4Rect::Wdt.

Referenced by C4GUI::CBContextHandler< CBClass >::OnContext().

975  {
976  assert(pNewCtx); assert(pNewCtx != pContext);
977  // close previous context menu
978  AbortContext(false);
979  // element offset
980  if (pAtElement) pAtElement->ClientPos2ScreenPos(iX, iY);
981  // usually open bottom right
982  // check bottom bounds
983  if (iY + pNewCtx->GetBounds().Hgt >= GetBounds().Hgt)
984  {
985  // bottom too narrow: open to top, if height is sufficient
986  // otherwise, open to top from bottom screen pos
987  if (iY < pNewCtx->GetBounds().Hgt) iY = GetBounds().Hgt;
988  iY -= pNewCtx->GetBounds().Hgt;
989  }
990  // check right bounds likewise
991  if (iX + pNewCtx->GetBounds().Wdt >= GetBounds().Wdt)
992  {
993  // bottom too narrow: open to top, if height is sufficient
994  // otherwise, open to top from bottom screen pos
995  if (iX < pNewCtx->GetBounds().Wdt) iX = GetBounds().Wdt;
996  iX -= pNewCtx->GetBounds().Wdt;
997  }
998  // open new
999  (pContext = pNewCtx)->Open(pAtElement, iX, iY);
1000  }
void AbortContext(bool fByUser)
Definition: C4Gui.h:2654
int32_t Wdt
Definition: C4Rect.h:32
ContextMenu * pContext
Definition: C4Gui.h:2591
C4Rect & GetBounds()
Definition: C4Gui.h:445
int32_t Hgt
Definition: C4Rect.h:32

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 270 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 MouseInput(), and C4GUI::Element::StopDragging().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Window::Draw ( C4TargetFacet cgo)
protectedvirtualinherited

Reimplemented from C4GUI::Container.

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

Definition at line 293 of file C4GuiContainers.cpp.

References C4Draw::ApplyZoom(), C4GUI::Container::Draw(), C4GUI::Element::DrawElement(), C4GUI::Element::GetBounds(), C4GUI::Window::GetClientRect(), C4Draw::GetPrimaryClipper(), C4Rect::Hgt, C4GUI::Window::IsComponentOutsideClientArea(), C4GUI::Element::IsVisible(), pDraw, C4GUI::Window::rcClientRect, C4Draw::SetPrimaryClipper(), C4Draw::SubPrimaryClipper(), C4TargetFacet::TargetX, C4TargetFacet::TargetY, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by C4GUI::ContextMenu::Draw(), C4GUI::Dialog::Draw(), and Draw().

294  {
295  // invisible?
296  if (!IsVisible()) return;
297  // draw window itself
298  DrawElement(cgo);
299  // get target area
302  // clip to window area
303  int clx1, cly1, clx2, cly2;
304  pDraw->GetPrimaryClipper(clx1, cly1, clx2, cly2);
305  float nclx1 = cgo.TargetX+rcClipArea.x, ncly1 = cgo.TargetY+rcClipArea.y, nclx2 = cgo.TargetX+rcClipArea.x+rcClipArea.Wdt-1, ncly2 = cgo.TargetY+rcClipArea.y+rcClipArea.Hgt-1;
306  pDraw->ApplyZoom(nclx1, ncly1);
307  pDraw->ApplyZoom(nclx2, ncly2);
308  pDraw->SubPrimaryClipper(nclx1, ncly1, nclx2, ncly2);
309  // update target area
310  cgo.TargetX += rcClientRect.x; cgo.TargetY += rcClientRect.y;
311  // draw contents
312  Container::Draw(cgo);
313  // reset target area
314  cgo.TargetX -= rcClientRect.x; cgo.TargetY -= rcClientRect.y;
315  // reset clipper
316  pDraw->SetPrimaryClipper(clx1, cly1, clx2, cly2);
317  }
virtual void Draw(C4TargetFacet &cgo)
void ApplyZoom(float &X, float &Y)
Definition: C4Draw.cpp:787
bool GetPrimaryClipper(int &rX1, int &rY1, int &rX2, int &rY2)
Definition: C4Draw.cpp:725
bool IsVisible()
Definition: C4Gui.cpp:202
virtual bool IsComponentOutsideClientArea()
Definition: C4Gui.h:870
Definition: C4Rect.h:29
virtual C4Rect & GetClientRect()
Definition: C4Gui.h:864
C4Rect rcClientRect
Definition: C4Gui.h:851
int32_t Wdt
Definition: C4Rect.h:32
int32_t y
Definition: C4Rect.h:32
C4Draw * pDraw
Definition: C4Draw.cpp:45
bool SetPrimaryClipper(int iX1, int iY1, int iX2, int iY2)
Definition: C4Draw.cpp:220
C4Rect & GetBounds()
Definition: C4Gui.h:445
int32_t x
Definition: C4Rect.h:32
float TargetX
Definition: C4Facet.h:167
virtual void DrawElement(C4TargetFacet &cgo)
Definition: C4Gui.h:388
int32_t Hgt
Definition: C4Rect.h:32
float TargetY
Definition: C4Facet.h:167
bool SubPrimaryClipper(int iX1, int iY1, int iX2, int iY2)
Definition: C4Draw.cpp:199

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Screen::Draw ( C4TargetFacet cgo,
bool  fDoBG 
)
protectedvirtual

Definition at line 749 of file C4Gui.cpp.

References Application, C4GUI::Window::Draw(), C4GUI::ContextMenu::Draw(), C4Draw::DrawBoxDw(), C4Facet::DrawFullScreen(), C4LoaderScreen::fctBackground, GetFullscreenDialog(), GraphicsResource, GraphicsSystem, C4GUI::Dialog::HasBackground(), C4Facet::Hgt, C4Application::isEditor, C4GraphicsResource::IsInitialized(), C4GUI::Element::IsVisible(), pContext, pDraw, C4GraphicsSystem::pLoaderScreen, RenderMouse(), C4Facet::Surface, and C4Facet::Wdt.

Referenced by Render().

750  {
751  // draw bg, if this won't be done by a fullscreen dialog
752  if (fDoBG)
753  {
754  Dialog *pFSDlg = GetFullscreenDialog(false);
755  if (!pFSDlg || !pFSDlg->HasBackground())
756  {
759  else
760  // loader not yet loaded: black BG
761  pDraw->DrawBoxDw(cgo.Surface, 0,0, cgo.Wdt+1, cgo.Hgt+1, 0x00000000);
762  }
763  }
764  // draw contents (if GUI-gfx are loaded, which is assumed in GUI-drawing-functions)
766  {
767  Window::Draw(cgo);
768  if (pContext) pContext->Draw(cgo);
769  }
770  // draw mouse cursor
771  if (!Application.isEditor) RenderMouse(cgo);
772  }
C4FacetSurface fctBackground
bool IsVisible()
Definition: C4Gui.cpp:202
friend class Dialog
Definition: C4Gui.h:2686
C4GraphicsResource GraphicsResource
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51
void DrawBoxDw(C4Surface *sfcDest, int iX1, int iY1, int iX2, int iY2, DWORD dwClr)
Definition: C4Draw.cpp:849
void RenderMouse(C4TargetFacet &cgo)
Definition: C4Gui.cpp:742
C4Draw * pDraw
Definition: C4Draw.cpp:45
C4LoaderScreen * pLoaderScreen
ContextMenu * pContext
Definition: C4Gui.h:2591
void DrawFullScreen(C4Facet &cgo)
Definition: C4Facet.cpp:184
float Hgt
Definition: C4Facet.h:120
Dialog * GetFullscreenDialog(bool fIncludeFading)
Definition: C4Gui.cpp:1040
virtual void Draw(C4TargetFacet &cgo)
C4Surface * Surface
Definition: C4Facet.h:119
float Wdt
Definition: C4Facet.h:120
virtual void Draw(C4TargetFacet &cgo)
Definition: C4GuiMenu.cpp:462
C4Application Application
Definition: C4Globals.cpp:44

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

293  {
294  DWORD dwAlpha = byAlpha<<24;
295  int32_t x0 = cgo.TargetX + rcBounds.x + iLeftOff,
296  y0 = cgo.TargetY + rcBounds.y + iTopOff,
297  x1 = cgo.TargetX + rcBounds.x + rcBounds.Wdt - 1,
298  y1 = cgo.TargetY + rcBounds.y + rcBounds.Hgt - 1;
299  if (fDrawTop) pDraw->DrawLineDw(cgo.Surface, (float)x0,(float)y0,(float)x1,(float)y0, C4GUI_BorderColor1 | dwAlpha);
300  if (fDrawLeft) pDraw->DrawLineDw(cgo.Surface, (float)x0,(float)y0,(float)x0,(float)y1, C4GUI_BorderColor1 | dwAlpha);
301  if (fDrawTop) pDraw->DrawLineDw(cgo.Surface, (float)(x0+1),(float)(y0+1),(float)(x1-1),(float)(y0+1), C4GUI_BorderColor2 | dwAlpha);
302  if (fDrawLeft) pDraw->DrawLineDw(cgo.Surface, (float)(x0+1),(float)(y0+1),(float)(x0+1),(float)(y1-1), C4GUI_BorderColor2 | dwAlpha);
303  pDraw->DrawLineDw(cgo.Surface, (float)x0,(float)y1,(float)x1,(float)y1, C4GUI_BorderColor3 | dwAlpha);
304  pDraw->DrawLineDw(cgo.Surface, (float)x1,(float)y0,(float)x1,(float)y1, C4GUI_BorderColor3 | dwAlpha);
305  pDraw->DrawLineDw(cgo.Surface, (float)(x0+1),(float)(y1-1),(float)(x1-1),(float)(y1-1), C4GUI_BorderColor1 | dwAlpha);
306  pDraw->DrawLineDw(cgo.Surface, (float)(x1-1),(float)(y0+1),(float)(x1-1),(float)(y1-1), C4GUI_BorderColor1 | dwAlpha);
307  }
#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:617
int32_t Wdt
Definition: C4Rect.h:32
#define C4GUI_BorderColor1
Definition: C4Gui.h:85
int32_t y
Definition: C4Rect.h:32
C4Rect rcBounds
Definition: C4Gui.h:385
C4Draw * pDraw
Definition: C4Draw.cpp:45
int32_t x
Definition: C4Rect.h:32
float TargetX
Definition: C4Facet.h:167
#define C4GUI_BorderColor3
Definition: C4Gui.h:87
int32_t Hgt
Definition: C4Rect.h:32
C4Surface * Surface
Definition: C4Facet.h:119
float TargetY
Definition: C4Facet.h:167
uint32_t DWORD

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 309 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().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 366 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().

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Screen::DrawToolTip ( const char *  szTip,
C4TargetFacet cgo,
float  guix,
float  guiy 
)
static

Definition at line 1012 of file C4Gui.cpp.

References ALeft, CStdFont::BreakMessage(), C4GUI_MaxToolTipWdt, C4GUI_ToolTipBGColor, C4GUI_ToolTipColor, C4GUI_ToolTipFrameColor, C4Draw::DrawBoxDw(), C4Draw::DrawFrameDw(), StdStrBuf::getData(), CStdFont::GetTextExtent(), GraphicsResource, GraphicsSystem, C4Facet::Hgt, C4GraphicsSystem::InvalidateBg(), pDraw, C4Facet::Surface, C4TargetFacet::TargetX, C4TargetFacet::TargetY, C4Draw::TextOut(), C4GraphicsResource::TooltipFont, C4Facet::Wdt, C4Facet::X, and C4Facet::Y.

Referenced by C4MouseControl::Draw(), C4Menu::Draw(), and C4GUI::CMouse::Draw().

1013  {
1014  CStdFont *pUseFont = &(::GraphicsResource.TooltipFont);
1015  StdStrBuf sText;
1016  pUseFont->BreakMessage(szTip, std::min<int32_t>(C4GUI_MaxToolTipWdt, std::max<int32_t>(cgo.Wdt, 50)), &sText, true);
1017  // get tooltip rect
1018  int32_t tWdt,tHgt;
1019  if (pUseFont->GetTextExtent(sText.getData(), tWdt, tHgt, true))
1020  {
1021  tWdt+=6; tHgt+=4;
1022  int32_t tX, tY;
1023  if (y < cgo.Y+cgo.TargetY+tHgt+5) tY = std::min<int32_t>(y+5, cgo.TargetY+cgo.Hgt-tHgt); else tY = y-tHgt-5;
1024  tX = Clamp<int32_t>(x-tWdt/2, cgo.TargetX+cgo.X, cgo.TargetX+cgo.Wdt-tWdt);
1025  // draw tooltip box
1026  pDraw->DrawBoxDw(cgo.Surface, tX,tY,tX+tWdt-1,tY+tHgt-2, C4GUI_ToolTipBGColor);
1027  pDraw->DrawFrameDw(cgo.Surface, tX,tY,tX+tWdt-1,tY+tHgt-1, C4GUI_ToolTipFrameColor);
1028  // draw tooltip
1029  pDraw->TextOut(sText.getData(), *pUseFont, 1.0f, cgo.Surface, tX+3,tY+1, C4GUI_ToolTipColor, ALeft);
1030  // while there's a tooltip, redraw the bg, because it might overlap
1032  }
1033  }
const char * getData() const
Definition: StdBuf.h:450
#define C4GUI_ToolTipColor
Definition: C4Gui.h:74
float Y
Definition: C4Facet.h:120
bool TextOut(const char *szText, CStdFont &rFont, float fZoom, C4Surface *sfcDest, float iTx, float iTy, DWORD dwFCol=0xffffffff, BYTE byForm=ALeft, bool fDoMarkup=true)
Definition: C4Draw.cpp:570
#define C4GUI_ToolTipFrameColor
Definition: C4Gui.h:73
bool GetTextExtent(const char *szText, int32_t &rsx, int32_t &rsy, bool fCheckMarkup=true)
#define C4GUI_ToolTipBGColor
Definition: C4Gui.h:72
C4GraphicsResource GraphicsResource
void DrawFrameDw(C4Surface *sfcDest, int x1, int y1, int x2, int y2, DWORD dwClr, float width=1.0f)
Definition: C4Draw.cpp:644
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51
void DrawBoxDw(C4Surface *sfcDest, int iX1, int iY1, int iX2, int iY2, DWORD dwClr)
Definition: C4Draw.cpp:849
C4Draw * pDraw
Definition: C4Draw.cpp:45
#define C4GUI_MaxToolTipWdt
Definition: C4Gui.h:140
std::tuple< std::string, int > BreakMessage(const char *szMsg, int iWdt, bool fCheckMarkup, float fZoom=1.0f)
float TargetX
Definition: C4Facet.h:167
float Hgt
Definition: C4Facet.h:120
const int ALeft
Definition: C4Surface.h:43
C4Surface * Surface
Definition: C4Facet.h:119
float TargetY
Definition: C4Facet.h:167
float Wdt
Definition: C4Facet.h:120
float X
Definition: C4Facet.h:120

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 360 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Screen::ElementPosChanged ( Element pOfElement)
protectedvirtual

Reimplemented from C4GUI::Container.

Definition at line 607 of file C4Gui.cpp.

References GraphicsSystem, C4GraphicsSystem::InvalidateBg(), and IsExclusive().

608  {
609  // redraw fullscreen BG if dlgs are dragged around in shared mode
610  if (!IsExclusive())
612  }
bool IsExclusive()
Definition: C4Gui.h:2667
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51

Here is the call 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(), and C4ScriptGuiWindow::DrawChildren().

825 { return Iterator(nullptr); }

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(), 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(), 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:

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

Reimplemented from C4GUI::Element.

Definition at line 864 of file C4Gui.h.

References C4GUI::Window::rcClientRect.

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

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

Here is the caller graph for this function:

C4Rect C4GUI::Element::GetContainedClientRect ( )
inlineinherited

Definition at line 448 of file C4Gui.h.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Element.

Definition at line 831 of file C4Gui.h.

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

Reimplemented in C4GUI::Dialog.

Definition at line 430 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4GUI::Screen::GetContextMenuIndex ( )
inline

Definition at line 2655 of file C4Gui.h.

References C4GUI::ContextMenu::GetMenuIndex().

Referenced by C4GUI::ContextButton::DrawElement(), and C4GUI::ComboBox::DrawElement().

2655 { return pContext ? pContext->GetMenuIndex() : 0; } // get current context-menu (lowest level)
int32_t GetMenuIndex()
Definition: C4Gui.h:1883
ContextMenu * pContext
Definition: C4Gui.h:2591

Here is the call graph for this function:

Here is the caller graph for this function:

Dialog * C4GUI::Screen::GetDialog ( C4Window pWindow)

Definition at line 723 of file C4Gui.cpp.

References C4GUI::Dialog::GetDlg(), C4GUI::Element::GetPrev(), C4GUI::Container::pLast, and C4GUI::Dialog::pWindow.

Referenced by DialogWinProc().

724  {
725  // get dialog with matching window
726  Dialog *pDlg;
727  for (Element *pEl = pLast; pEl; pEl = pEl->GetPrev())
728  if ( (pDlg = pEl->GetDlg()) != nullptr)
729  if (pDlg->pWindow == pWindow)
730  return pDlg;
731  return nullptr;
732  }
friend class Dialog
Definition: C4Gui.h:2686
Element * pLast
Definition: C4Gui.h:750
Element * GetPrev() const
Definition: C4Gui.h:450

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented in C4GUI::Dialog.

Definition at line 404 of file C4Gui.h.

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

Reimplemented in C4GUI::Dialog.

Definition at line 289 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

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:

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

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)
virtualinherited

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:

Dialog * C4GUI::Screen::GetFullscreenDialog ( bool  fIncludeFading)

Definition at line 1040 of file C4Gui.cpp.

References C4GUI::Dialog::GetDlg(), C4GUI::Container::GetFirst(), C4GUI::Element::GetNext(), C4GUI::Dialog::IsFading(), C4GUI::Dialog::IsFullscreenDialog(), and C4GUI::Element::IsVisible().

Referenced by Draw(), and HasFullscreenDialog().

1041  {
1042  Dialog *pDlg;
1043  for (Element *pEl = GetFirst(); pEl; pEl = pEl->GetNext())
1044  if ((pDlg = pEl->GetDlg()))
1045  if (pDlg->IsVisible())
1046  if (pDlg->IsFullscreenDialog())
1047  if (fIncludeFading || !pDlg->IsFading())
1048  return pDlg;
1049  return nullptr;
1050  }
friend class Dialog
Definition: C4Gui.h:2686
Element * GetFirst()
Definition: C4Gui.h:829
Element * GetNext() const
Definition: C4Gui.h:449

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4GUI::Element::GetHeight ( )
inlineinherited

Definition at line 444 of file C4Gui.h.

References C4Rect::Hgt.

Referenced by ShowDialog().

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

Here is the caller graph for this function:

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
int32_t C4GUI::Screen::GetLastContextMenuIndex ( )
inline

Definition at line 2656 of file C4Gui.h.

References C4GUI::ContextMenu::GetLastMenuIndex().

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

2656 { return ContextMenu::GetLastMenuIndex(); } // get last opened context-menu (lowest level)
static int32_t GetLastMenuIndex()
Definition: C4Gui.h:1884

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented in C4StartupNetListEntry.

Definition at line 461 of file C4Gui.h.

References C4GUI_DefaultListSpacing.

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

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

Here is the caller graph for this function:

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

Definition at line 462 of file C4Gui.h.

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

462 { return false; }

Here is the caller graph for this function:

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

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

Definition at line 876 of file C4Gui.h.

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

876 { return 0; }

Here is the caller graph for this function:

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

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

Definition at line 874 of file C4Gui.h.

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

874 { return 0; }

Here is the caller graph for this function:

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

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

Definition at line 875 of file C4Gui.h.

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

875 { return 0; }

Here is the caller graph for this function:

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

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

Definition at line 873 of file C4Gui.h.

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

873 { return 0; }

Here is the caller graph for this function:

int32_t C4GUI::Screen::GetMouseControlledDialogCount ( )

Definition at line 1002 of file C4Gui.cpp.

References C4GUI::Dialog::GetDlg(), C4GUI::Container::GetFirst(), C4GUI::Element::GetNext(), iResult, C4GUI::Dialog::IsMouseControlled(), and C4GUI::Dialog::IsShown().

Referenced by MouseMove().

1003  {
1004  Dialog *pDlg; int32_t iResult=0;
1005  for (Element *pEl = GetFirst(); pEl; pEl = pEl->GetNext())
1006  if ((pDlg = pEl->GetDlg()))
1007  if (pDlg->IsShown() && pDlg->IsMouseControlled())
1008  ++iResult;
1009  return iResult;
1010  }
friend class Dialog
Definition: C4Gui.h:2686
int iResult
Definition: C4GroupMain.cpp:39
Element * GetFirst()
Definition: C4Gui.h:829
Element * GetNext() const
Definition: C4Gui.h:449

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  }
virtual Element * GetFirstNestedElement(bool fBackwards)

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:450

Here is the call graph for this function:

const C4Rect& C4GUI::Screen::GetPreferredDlgRect ( )
inline

Definition at line 2600 of file C4Gui.h.

References PreferredDlgRect.

Referenced by C4ScoreboardDlg::Update().

2600 { return PreferredDlgRect; }
C4Rect PreferredDlgRect
Definition: C4Gui.h:2593

Here is the caller 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(), GetDialog(), GetTopDialog(), C4GUI::Window::MouseInput(), MouseInput(), and C4GUI::Container::ReverseIterator::operator++().

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

Here is the caller graph for this function:

virtual Screen* C4GUI::Screen::GetScreen ( )
inlinevirtual

Reimplemented from C4GUI::Element.

Definition at line 2625 of file C4Gui.h.

2625 { return this; }; // return contained screen
static Screen* C4GUI::Screen::GetScreenS ( )
inlinestatic

Definition at line 2626 of file C4Gui.h.

References pScreen.

Referenced by C4StartupPlrSelDlg::CheckPlayerName(), C4GUI::Dialog::FadeIn(), C4GUI::FullscreenDialog::FullscreenDialog(), C4GUI::ContextMenu::GetScreen(), C4GUI::GetScreenHgt(), C4GUI::GetScreenWdt(), C4GUI::GetZoom(), C4GUI::IsActive(), C4GUI::IsExclusive(), C4GUI::MouseMove(), C4GUI::Element::RemoveElement(), C4GUI::Dialog::Show(), and C4GUI::Element::~Element().

2626 { return pScreen; } // get global screen
static Screen * pScreen
Definition: C4Gui.h:2596

Here is the caller graph for this function:

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

Definition at line 424 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

Dialog * C4GUI::Screen::GetTopDialog ( )

Definition at line 695 of file C4Gui.cpp.

References C4GUI::Dialog::GetDlg(), C4GUI::Element::GetPrev(), C4GUI::Dialog::IsShown(), and C4GUI::Container::pLast.

Referenced by CloseDialog(), C4GUI::Dialog::Draw(), HasKeyboardFocus(), IsActive(), and RecheckActiveDialog().

696  {
697  // search backwards in component list
698  Dialog *pDlg;
699  for (Element *pEl = pLast; pEl; pEl = pEl->GetPrev())
700  if ((pDlg = pEl->GetDlg()))
701  if (pDlg->IsShown())
702  return pDlg;
703  // no dlg found
704  return nullptr;
705  }
friend class Dialog
Definition: C4Gui.h:2686
Element * pLast
Definition: C4Gui.h:750
Element * GetPrev() const
Definition: C4Gui.h:450

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4GUI::Element::GetWidth ( )
inlineinherited

Definition at line 443 of file C4Gui.h.

References C4Rect::Wdt.

Referenced by ShowDialog().

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

Here is the caller graph for this function:

float C4GUI::Screen::GetZoom ( ) const
inline

Definition at line 2628 of file C4Gui.h.

References fZoom.

Referenced by C4GUI::GetZoom(), and MouseInput().

2628 { return fZoom; }; // get GUI zoom
float fZoom
Definition: C4Gui.h:2594

Here is the caller graph for this function:

bool C4GUI::Screen::HasContext ( )
inline

Definition at line 2657 of file C4Gui.h.

References pContext.

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

2657 { return !!pContext; }
ContextMenu * pContext
Definition: C4Gui.h:2591

Here is the caller graph for this function:

bool C4GUI::Screen::HasFullscreenDialog ( bool  fIncludeFading)

Definition at line 1035 of file C4Gui.cpp.

References GetFullscreenDialog().

Referenced by C4GraphicsSystem::Execute().

1036  {
1037  return !!GetFullscreenDialog(fIncludeFading);
1038  }
Dialog * GetFullscreenDialog(bool fIncludeFading)
Definition: C4Gui.cpp:1040

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Screen::HasKeyboardFocus ( )
inline

Definition at line 2668 of file C4Gui.h.

References GetTopDialog(), IsExclusive(), and C4GUI::Dialog::IsExclusiveDialog().

Referenced by CharIn(), C4Game::DoKeyboardInput(), and HasMouseFocus().

2669  {
2670  // always hook keyboard in exclusive mode; only on exclusive top dialogs in shared mode
2671  if (IsExclusive()) return true;
2672  Dialog *pDlg = GetTopDialog();
2673  return pDlg && pDlg->IsExclusiveDialog();
2674  }
Dialog * GetTopDialog()
Definition: C4Gui.cpp:695
friend class Dialog
Definition: C4Gui.h:2686
bool IsExclusive()
Definition: C4Gui.h:2667

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Screen::HasMouseFocus ( )
inline

Definition at line 2675 of file C4Gui.h.

References HasKeyboardFocus().

Referenced by MouseMove(), and C4MouseControl::UpdateClip().

2676  { return HasKeyboardFocus(); }
bool HasKeyboardFocus()
Definition: C4Gui.h:2668

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Screen::Init ( int32_t  tx,
int32_t  ty,
int32_t  twdt,
int32_t  thgt 
)

Definition at line 581 of file C4Gui.cpp.

References fZoom, Mouse, C4GUI::Element::SetBounds(), SetPreferredDlgRect(), C4GUI::CMouse::x, and C4GUI::CMouse::y.

Referenced by C4Game::PreInit().

582  {
583  Mouse.x = tx+twdt/2;
584  Mouse.y = ty+thgt/2;
585  fZoom = 1.0f;
586  // set size - calcs client area as well
587  SetBounds(C4Rect(tx,ty,twdt,thgt));
588  SetPreferredDlgRect(C4Rect(0,0,twdt,thgt));
589  }
float fZoom
Definition: C4Gui.h:2594
int32_t y
Definition: C4Gui.h:2532
Definition: C4Rect.h:29
void SetPreferredDlgRect(const C4Rect &rtNewPref)
Definition: C4Gui.h:2648
void SetBounds(const C4Rect &rcNewBound)
Definition: C4Gui.h:446
int32_t x
Definition: C4Gui.h:2532
CMouse Mouse
Definition: C4Gui.h:2587

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 150 of file C4GuiContainers.cpp.

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

Referenced by C4GUI::ListBox::InsertElement(), and 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::Screen::IsActive ( )
inline

Definition at line 2630 of file C4Gui.h.

References GetTopDialog().

Referenced by C4GUI::IsActive(), C4MessageBoard::LogNotify(), and MouseMove().

2630 { return !!GetTopDialog(); } // return whether GUI is active
Dialog * GetTopDialog()
Definition: C4Gui.cpp:695

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool C4GUI::Window::IsComponentOutsideClientArea ( )
inlinevirtualinherited

Reimplemented in C4GUI::FullscreenDialog, C4GUI::Dialog, C4GUI::ScrollWindow, and C4StartupPlrPropertiesDlg.

Definition at line 870 of file C4Gui.h.

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

870 { return false; } // if set, drawing routine of subcomponents will clip to Bounds rather than to ClientRect

Here is the caller graph for this function:

bool C4GUI::Screen::IsExclusive ( )
inline

Definition at line 2667 of file C4Gui.h.

References fExclusive.

Referenced by ActivateDialog(), CharIn(), C4Scoreboard::DoDlgShow(), ElementPosChanged(), HasKeyboardFocus(), C4Scoreboard::HideDlg(), C4GUI::Dialog::IsActive(), C4GUI::IsExclusive(), MouseInput(), and ShowDialog().

2667 { return fExclusive; }
bool fExclusive
Definition: C4Gui.h:2592

Here is the caller graph for this function:

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

Reimplemented in C4GUI::Dialog, and C4Menu.

Definition at line 402 of file C4Gui.h.

402 { return false; }
virtual bool C4GUI::Container::IsFocused ( Control pCtrl)
inlinevirtualinherited

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

Definition at line 836 of file C4Gui.h.

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

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

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

Here is the call graph for this function:

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:

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Definition at line 403 of file C4Gui.h.

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

403 { return false; }

Here is the caller graph for this function:

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

Reimplemented in C4Menu.

Definition at line 401 of file C4Gui.h.

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

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

Here is the caller graph for this function:

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

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::Element::IsVisible ( )
inherited

Definition at line 202 of file C4Gui.cpp.

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

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

203  {
204  // self and parent must be visible
205  return fVisible && (!pParent || pParent->IsVisible());
206  }
bool IsVisible()
Definition: C4Gui.cpp:202
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::Screen::KeyAny ( )

Definition at line 774 of file C4Gui.cpp.

References Mouse, and C4GUI::CMouse::ResetActiveInput().

Referenced by C4Game::DoKeyboardInput().

775  {
776  // mark keystroke in mouse
778  // key not yet processed
779  return false;
780  }
void ResetActiveInput()
Definition: C4Gui.h:2577
CMouse Mouse
Definition: C4Gui.h:2587

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

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

Here is the caller graph for this function:

void C4GUI::Window::MouseInput ( CMouse rMouse,
int32_t  iButton,
int32_t  iX,
int32_t  iY,
DWORD  dwKeyParam 
)
virtualinherited

Reimplemented from C4GUI::Element.

Reimplemented in C4GUI::Dialog, C4GUI::ComboBox, C4GUI::ContextButton, C4GUI::ContextMenu, C4GUI::Tabular, C4GUI::ListBox, C4GUI::CheckBox, C4GUI::Edit, C4GUI::Button, C4GUI::Control, C4GUI::PaintBox, C4GUI::ScrollWindow, and C4StartupScenSelDlg::ScenListItem.

Definition at line 273 of file C4GuiContainers.cpp.

References C4GUI::Element::GetBounds(), C4GUI::Window::GetClientRect(), C4GUI::Element::GetPrev(), C4GUI::Element::IsVisible(), C4GUI::Element::MouseInput(), C4GUI::Container::pLast, C4GUI::Element::rcBounds, C4GUI::Window::rcClientRect, C4Rect::x, C4GUI::CMouse::x, and C4Rect::y.

Referenced by C4GUI::ScrollWindow::MouseInput(), C4GUI::Control::MouseInput(), C4GUI::ContextMenu::MouseInput(), C4GUI::Dialog::MouseInput(), and MouseInput().

274  {
275  // invisible?
276  if (!IsVisible()) return;
277  // inherited
278  Container::MouseInput(rMouse, iButton, iX, iY, dwKeyParam);
279  // get client pos
281  iX -= rcClientRect.x - rcBounds.x; iY -= rcClientRect.y - rcBounds.y;
282  // forward to topmost child element
283  for (Element *pChild = pLast; pChild; pChild = pChild->GetPrev())
284  if (pChild->fVisible && pChild->GetBounds().Contains(iX, iY))
285  {
286  // forward
287  pChild->MouseInput(rMouse, iButton, iX - pChild->GetBounds().x, iY - pChild->GetBounds().y, dwKeyParam);
288  // forward to one control only
289  break;
290  }
291  }
bool IsVisible()
Definition: C4Gui.cpp:202
Element * pLast
Definition: C4Gui.h:750
Definition: C4Rect.h:29
virtual C4Rect & GetClientRect()
Definition: C4Gui.h:864
C4Rect rcClientRect
Definition: C4Gui.h:851
int32_t y
Definition: C4Rect.h:32
C4Rect rcBounds
Definition: C4Gui.h:385
virtual void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
Definition: C4Gui.cpp:245
C4Rect & GetBounds()
Definition: C4Gui.h:445
int32_t x
Definition: C4Rect.h:32
Element * GetPrev() const
Definition: C4Gui.h:450

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Screen::MouseInput ( int32_t  iButton,
int32_t  iX,
int32_t  iY,
DWORD  dwKeyParam,
Dialog pDlg,
class C4Viewport pVP 
)

Definition at line 840 of file C4Gui.cpp.

References AbortContext(), ActivateDialog(), C4MC_Button_LeftDown, C4MC_Button_RightDown, C4Rect::Contains(), C4GUI::ContextMenu::CtxMouseInput(), C4GUI::Element::DoDragging(), fZoom, C4GUI::Element::GetBounds(), C4GUI::Window::GetClientRect(), C4GUI::Element::GetDlg(), C4GUI::Dialog::GetDlg(), C4Viewport::GetOutputRect(), C4GUI::Element::GetPrev(), C4GUI::Dialog::GetViewport(), GetZoom(), C4GUI::CMouse::Input(), IsExclusive(), C4GUI::Dialog::IsExternalDrawDialog(), C4GUI::Dialog::IsFading(), C4GUI::CMouse::IsLDown(), C4GUI::Dialog::IsShown(), C4GUI::Element::IsVisible(), Mouse, C4GUI::Element::MouseEnter(), C4GUI::Window::MouseInput(), C4GUI::Dialog::MouseInput(), C4GUI::Element::MouseLeave(), pActiveDlg, pContext, C4GUI::CMouse::pDragElement, C4GUI::Container::pLast, C4GUI::CMouse::pMouseOverElement, C4GUI::CMouse::pPrevMouseOverElement, C4GUI::Element::rcBounds, C4GUI::Element::ScreenPos2ClientPos(), C4GUI::Element::StopDragging(), C4Rect::x, and C4Rect::y.

Referenced by DialogWinProc(), MouseMove(), and RecheckMouseInput().

841  {
842  // convert from screen pixel coordinates to GUI coordinates
843  float fZoom = pForDlg ? 1.0f : GetZoom(); // Developer mode dialogs are currently drawn unzoomed
844  float fX = float(iPxX) / fZoom;
845  float fY = float(iPxY) / fZoom;
846  // forward to mouse
847  Mouse.Input(iButton, fX, fY, dwKeyParam);
848 
849  // dragging
850  if (Mouse.pDragElement)
851  {
852  int32_t iX2=fX, iY2=fY;
854  if (!Mouse.IsLDown())
855  {
856  // stop dragging
857  Mouse.pDragElement->StopDragging(Mouse, iX2, iY2, dwKeyParam);
858  Mouse.pDragElement = nullptr;
859  }
860  else
861  {
862  // continue dragging
863  Mouse.pDragElement->DoDragging(Mouse, iX2, iY2, dwKeyParam);
864  }
865  }
866  // backup previous MouseOver-element
868  Mouse.pMouseOverElement = nullptr;
869  bool fProcessed = false;
870  // active context menu?
871  if (!pForVP && pContext && pContext->CtxMouseInput(Mouse, iButton, fX, fY, dwKeyParam))
872  {
873  // processed by context menu: OK!
874  }
875  // otherwise: active dlg and inside screen? (or direct forward to specific dlg/viewport dlg)
876  else if (rcBounds.Contains(fX, fY) || pForDlg || pForVP)
877  {
878  // context menu open but mouse down command issued? close context then
879  if (pContext && (iButton == C4MC_Button_LeftDown || iButton == C4MC_Button_RightDown))
880  AbortContext(true);
881  // get client pos
882  if (!pForDlg && !pForVP)
883  {
884  C4Rect &rcClientArea = GetClientRect();
885  fX -= rcClientArea.x; fY -= rcClientArea.y;
886  }
887  // exclusive mode: process active dialog only
888  if (IsExclusive() && !pForDlg && !pForVP)
889  {
891  {
892  // bounds check to dlg: only if not dragging
893  C4Rect &rcDlgBounds = pActiveDlg->GetBounds();
894  if (Mouse.IsLDown() || rcDlgBounds.Contains(fX, fY))
895  // forward to active dialog
896  pActiveDlg->MouseInput(Mouse, iButton, fX - rcDlgBounds.x, fY - rcDlgBounds.y, dwKeyParam);
897  else
898  Mouse.pMouseOverElement = nullptr;
899  }
900  else
901  // outside dialog: own handling (for screen context menu)
902  Window::MouseInput(Mouse, iButton, fX, fY, dwKeyParam);
903  }
904  else
905  {
906  // non-exclusive mode: process all dialogs; make them active on left-click
907  Dialog *pDlg;
908  for (Element *pEl = pLast; pEl; pEl = pEl->GetPrev())
909  if ((pDlg = pEl->GetDlg()))
910  if (pDlg->IsShown())
911  {
912  // if specified: process specified dlg only
913  if (pForDlg && pDlg != pForDlg) continue;
914  // if specified: process specified viewport only
915  bool fIsExternalDrawDialog = pDlg->IsExternalDrawDialog();
916  C4Viewport *pVP = fIsExternalDrawDialog ? pDlg->GetViewport() : nullptr;
917  if (pForVP && pForVP != pVP) continue;
918  // calc offset
919  C4Rect &rcDlgBounds = pDlg->GetBounds();
920  int32_t iOffX=0, iOffY=0;
921  // special handling for viewport dialogs
922  if (fIsExternalDrawDialog)
923  {
924  // ignore external drawing dialogs without a viepwort assigned
925  if (!pVP) continue;
926  // always clip to viewport bounds
927  C4Rect rcOut(pVP->GetOutputRect());
928  if (!rcOut.Contains(fX + rcBounds.x, fY + rcBounds.y)) continue;
929  // viewport dialogs: Offset determined by viewport position
930  iOffX = rcOut.x; iOffY = rcOut.y;
931  }
932  // hit test; or special: dragging possible outside active dialog
933  if (rcDlgBounds.Contains(fX-iOffX, fY-iOffY) || (pDlg == pActiveDlg && Mouse.pDragElement && Mouse.pDragElement->GetDlg() == pDlg))
934  {
935  // Okay; do input
936  pDlg->MouseInput(Mouse, iButton, fX - rcDlgBounds.x - iOffX, fY - rcDlgBounds.y - iOffY, dwKeyParam);
937  // CAUTION: pDlg may be invalid now!
938  // set processed-flag manually
939  fProcessed = true;
940  // inactive dialogs get activated by clicks
941  if (Mouse.IsLDown() && pDlg != pActiveDlg)
942  // but not viewport dialogs!
943  if (!pDlg->IsExternalDrawDialog())
944  ActivateDialog(pDlg);
945  // one dlg only; break loop here
946  break;
947  }
948  }
949  }
950  }
951 
952  // check if MouseOver has changed
954  {
955  // send events
958  }
959  // return whether anything processed it
960  return fProcessed || Mouse.pDragElement || (Mouse.pMouseOverElement && Mouse.pMouseOverElement!=this) || pContext;
961  }
virtual void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
bool Contains(int32_t iX, int32_t iY) const
Definition: C4Rect.h:42
const int32_t C4MC_Button_LeftDown
void AbortContext(bool fByUser)
Definition: C4Gui.h:2654
Element * pDragElement
Definition: C4Gui.h:2553
float fZoom
Definition: C4Gui.h:2594
bool IsVisible()
Definition: C4Gui.cpp:202
friend class Dialog
Definition: C4Gui.h:2686
Element * pLast
Definition: C4Gui.h:750
Definition: C4Rect.h:29
virtual C4Rect & GetClientRect()
Definition: C4Gui.h:864
virtual void StopDragging(CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam)
Definition: C4Gui.cpp:283
bool IsExclusive()
Definition: C4Gui.h:2667
bool IsLDown()
Definition: C4Gui.h:2562
bool IsFading()
Definition: C4Gui.h:2151
int32_t y
Definition: C4Rect.h:32
Element * pPrevMouseOverElement
Definition: C4Gui.h:2552
C4Rect rcBounds
Definition: C4Gui.h:385
C4Rect GetOutputRect()
Definition: C4Viewport.h:64
float GetZoom() const
Definition: C4Gui.h:2628
ContextMenu * pContext
Definition: C4Gui.h:2591
C4Rect & GetBounds()
Definition: C4Gui.h:445
const int32_t C4MC_Button_RightDown
virtual class Dialog * GetDlg()
Definition: C4Gui.cpp:289
int32_t x
Definition: C4Rect.h:32
void Input(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
Definition: C4Gui.cpp:466
void ScreenPos2ClientPos(int32_t &riX, int32_t &riY)
Definition: C4Gui.cpp:219
virtual void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
Element * GetPrev() const
Definition: C4Gui.h:450
virtual void DoDragging(CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam)
Definition: C4Gui.cpp:270
CMouse Mouse
Definition: C4Gui.h:2587
Dialog * pActiveDlg
Definition: C4Gui.h:2590
Element * pMouseOverElement
Definition: C4Gui.h:2552
bool CtxMouseInput(CMouse &rMouse, int32_t iButton, int32_t iScreenX, int32_t iScreenY, DWORD dwKeyParam)
Definition: C4GuiMenu.cpp:443
virtual void MouseEnter(CMouse &rMouse)
Definition: C4Gui.h:413
virtual void MouseLeave(CMouse &rMouse)
Definition: C4Gui.h:414
void ActivateDialog(Dialog *pDlg)
Definition: C4Gui.cpp:650

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 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 C4GUI::Screen::MouseMove ( int32_t  iButton,
int32_t  iX,
int32_t  iY,
DWORD  dwKeyParam,
class C4Viewport pVP 
)

Definition at line 800 of file C4Gui.cpp.

References GetMouseControlledDialogCount(), HasMouseFocus(), C4MouseControl::IsActive(), IsActive(), C4MouseControl::IsDragging(), MouseControl, MouseInput(), C4ViewportList::MouseMoveToViewport(), SetMouseInGUI(), and Viewports.

Referenced by C4GUI::MouseMove().

801  {
802  // Special: Pass to MouseControl if dragging and button is not upped
803  if (IsActive() && !::MouseControl.IsDragging())
804  {
805  bool fResult = MouseInput(iButton, iX, iY, dwKeyParam, nullptr, pVP);
806  if (HasMouseFocus()) { SetMouseInGUI(true, true); return; }
807  // non-exclusive GUI: inform mouse-control about GUI-result
808  SetMouseInGUI(fResult, true);
809  // abort if GUI processed it
810  if (fResult) return;
811  }
812  else
813  // no GUI: mouse is not in GUI
814  SetMouseInGUI(false, true);
815  // mouse control enabled?
816  if (!::MouseControl.IsActive())
817  {
818  // enable mouse in GUI, if a mouse-only-dlg is displayed
820  SetMouseInGUI(true, true);
821  return;
822  }
823  // Pass on to mouse controlled viewport
824  ::Viewports.MouseMoveToViewport(iButton, iX, iY, dwKeyParam);
825  }
void MouseMoveToViewport(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
bool IsActive()
Definition: C4Gui.h:2630
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
bool MouseInput(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam, Dialog *pDlg, class C4Viewport *pVP)
Definition: C4Gui.cpp:840
int32_t GetMouseControlledDialogCount()
Definition: C4Gui.cpp:1002
C4ViewportList Viewports
Definition: C4Viewport.cpp:841
bool HasMouseFocus()
Definition: C4Gui.h:2675
void SetMouseInGUI(bool fInGUI, bool fByMouse)
Definition: C4Gui.cpp:827

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Here is the call graph for this function:

void C4GUI::Screen::OnSec1Timer ( )
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::Screen::RecheckActiveDialog ( )

Definition at line 686 of file C4Gui.cpp.

References GetTopDialog(), C4GUI::Dialog::IsFading(), Mouse, pActiveDlg, and C4GUI::CMouse::ReleaseElements().

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

687  {
688  Dialog *pNewTop = GetTopDialog();
689  if (pActiveDlg == pNewTop) return;
691  // do not set yet if it's fading
692  if (pActiveDlg && pActiveDlg->IsFading()) pActiveDlg = nullptr;
693  }
Dialog * GetTopDialog()
Definition: C4Gui.cpp:695
friend class Dialog
Definition: C4Gui.h:2686
void ReleaseElements()
Definition: C4Gui.cpp:522
bool IsFading()
Definition: C4Gui.h:2151
CMouse Mouse
Definition: C4Gui.h:2587
Dialog * pActiveDlg
Definition: C4Gui.h:2590

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Screen::RecheckMouseInput ( )

Definition at line 963 of file C4Gui.cpp.

References C4MC_Button_None, C4GUI::CMouse::dwKeys, Mouse, MouseInput(), C4GUI::CMouse::x, and C4GUI::CMouse::y.

964  {
965  return MouseInput(C4MC_Button_None, Mouse.x, Mouse.y, Mouse.dwKeys, nullptr, nullptr);
966  }
int32_t y
Definition: C4Gui.h:2532
bool MouseInput(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam, Dialog *pDlg, class C4Viewport *pVP)
Definition: C4Gui.cpp:840
DWORD dwKeys
Definition: C4Gui.h:2535
const int32_t C4MC_Button_None
int32_t x
Definition: C4Gui.h:2532
CMouse Mouse
Definition: C4Gui.h:2587

Here is the call graph for this function:

void C4GUI::Screen::RemoveElement ( Element pChild)
virtual

Reimplemented from C4GUI::Container.

Definition at line 559 of file C4Gui.cpp.

References Mouse, pActiveDlg, pContext, C4GUI::Container::RemoveElement(), C4GUI::ContextMenu::RemoveElement(), C4GUI::CMouse::RemoveElement(), and C4GUI::CMouse::ResetElements().

Referenced by C4GUI::Element::RemoveElement(), C4Menu::TryClose(), C4GUI::ContextMenu::~ContextMenu(), and C4GUI::Element::~Element().

560  {
561  // inherited
562  Window::RemoveElement(pChild);
563  // clear ptrs
564  if (pActiveDlg == pChild) { pActiveDlg = nullptr; Mouse.ResetElements(); }
565  Mouse.RemoveElement(pChild);
566  if (pContext)
567  {
568  if (pContext == pChild) pContext=nullptr;
569  else pContext->RemoveElement(pChild);
570  }
571  }
virtual void RemoveElement(Element *pChild)
Definition: C4GuiMenu.cpp:366
virtual void RemoveElement(Element *pChild)
ContextMenu * pContext
Definition: C4Gui.h:2591
void ResetElements()
Definition: C4Gui.h:2566
void RemoveElement(Element *pChild)
Definition: C4Gui.cpp:537
CMouse Mouse
Definition: C4Gui.h:2587
Dialog * pActiveDlg
Definition: C4Gui.h:2590

Here is the call graph for this function:

Here is the caller 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::Screen::Render ( bool  fDoBG)

Definition at line 733 of file C4Gui.cpp.

References Draw(), FullScreen, C4Window::pSurface, C4GUI::Element::rcBounds, and C4TargetFacet::Set().

Referenced by C4GraphicsSystem::Execute().

734  {
735  // get output cgo
736  C4TargetFacet cgo;
738  // draw to it
739  Draw(cgo, fDoBG);
740  }
C4Surface * pSurface
Definition: C4Window.h:279
C4FullScreen FullScreen
Definition: C4Globals.cpp:46
C4Rect rcBounds
Definition: C4Gui.h:385
void Set(const C4Facet &cpy)
Definition: C4Facet.h:184
virtual void Draw(C4TargetFacet &cgo, bool fDoBG)
Definition: C4Gui.cpp:749

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Screen::RenderMouse ( C4TargetFacet cgo)

Definition at line 742 of file C4Gui.cpp.

References C4GUI::CMouse::Draw(), C4GUI::CMouse::IsActiveInput(), C4GUI::CMouse::IsMouseStill(), Mouse, C4GUI::CMouse::TTST_All, C4GUI::CMouse::TTST_Immediate, and C4GUI::CMouse::TTST_None.

Referenced by Draw(), and C4Viewport::DrawOverlay().

743  {
744  // draw mouse cursor
745  // All tool tips hidden during keyboard input. Immediate tooltips hidden if mouse was moving recently.
747  }
void Draw(C4TargetFacet &cgo, TooltipShowState draw_tool_tips)
Definition: C4Gui.cpp:488
bool IsMouseStill()
Definition: C4Gui.h:2576
CMouse Mouse
Definition: C4Gui.h:2587
bool IsActiveInput()
Definition: C4Gui.h:2578

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 219 of file C4Gui.cpp.

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

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

220  {
221  // apply all parent offsets
222  Container *pCont = pParent;
223  while (pCont)
224  {
225  pCont->ApplyElementOffset(riX, riY);
226  pCont = pCont->GetParent();
227  }
228  // apply own offset
229  riX -= rcBounds.x; riY -= rcBounds.y;
230  }
int32_t y
Definition: C4Rect.h:32
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:32
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(), 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:186
C4Rect rcBounds
Definition: C4Gui.h:385
virtual void UpdatePos()
Definition: C4Gui.cpp:194

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(), 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::Element::SetDragTarget ( Window pToWindow)
inlineinherited

Definition at line 464 of file C4Gui.h.

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

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

Here is the caller graph for this function:

void C4GUI::Screen::SetExclusive ( bool  fToState)
inline

Definition at line 2666 of file C4Gui.h.

References C4GUI::CMouse::SetOwnedMouse(), and UpdateMouseFocus().

Referenced by C4Game::Init().

void UpdateMouseFocus()
Definition: C4Gui.cpp:968
void SetOwnedMouse(bool fToVal)
Definition: C4Gui.h:2573
CMouse Mouse
Definition: C4Gui.h:2587
bool fExclusive
Definition: C4Gui.h:2592

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Screen::SetMouseInGUI ( bool  fInGUI,
bool  fByMouse 
)

Definition at line 827 of file C4Gui.cpp.

References C4MC_Button_None, C4GUI::CMouse::dwKeys, C4GUI::GetZoom(), C4MouseControl::IsMouseOwned(), Mouse, MouseControl, C4ViewportList::MouseMoveToViewport(), pGUI, C4MouseControl::SetOwnedMouse(), C4GUI::CMouse::SetOwnedMouse(), Viewports, C4GUI::CMouse::x, and C4GUI::CMouse::y.

Referenced by C4GraphicsSystem::Execute(), and MouseMove().

828  {
829  // inform mouse control and GUI
830  Mouse.SetOwnedMouse(fInGUI);
831  // initial movement to ensure mouse control pos is correct
832  if (!::MouseControl.IsMouseOwned() && !fInGUI && !fByMouse)
833  {
836  }
837  ::MouseControl.SetOwnedMouse(!fInGUI);
838  }
int32_t y
Definition: C4Gui.h:2532
void MouseMoveToViewport(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
void SetOwnedMouse(bool fToVal)
float GetZoom()
Definition: C4Gui.h:2828
C4GUIScreen * pGUI
Definition: C4Gui.cpp:1194
DWORD dwKeys
Definition: C4Gui.h:2535
void SetOwnedMouse(bool fToVal)
Definition: C4Gui.h:2573
C4ViewportList Viewports
Definition: C4Viewport.cpp:841
const int32_t C4MC_Button_None
int32_t x
Definition: C4Gui.h:2532
CMouse Mouse
Definition: C4Gui.h:2587

Here is the call graph for this function:

Here is the caller 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 ShowDialog().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Screen::SetPreferredDlgRect ( const C4Rect rtNewPref)
inline

Definition at line 2648 of file C4Gui.h.

Referenced by Init(), C4ViewportList::RecalculateViewports(), C4Viewport::SetOutputSize(), and C4MouseControl::UpdateClip().

2648 { PreferredDlgRect = rtNewPref; }
C4Rect PreferredDlgRect
Definition: C4Gui.h:2593

Here is the caller graph for this function:

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

Definition at line 410 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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  }
virtual void SetVisibility(bool fToValue)
Definition: C4Gui.cpp:208
C4GameControl Control
virtual class Dialog * GetDlg()
Definition: C4Gui.cpp:289
virtual bool IsParentOf(Element *pEl)

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Screen::ShowDialog ( Dialog pDlg,
bool  fFade 
)

Definition at line 614 of file C4Gui.cpp.

References Application, C4GUI::Dialog::DoPlacement(), C4GUI::Dialog::fOK, C4GUI::Dialog::fShow, C4GUI::Element::GetDlg(), C4GUI::Container::GetFirst(), C4GUI::Element::GetHeight(), C4GUI::Element::GetNext(), C4GUI::Element::GetWidth(), C4GUI::Dialog::GetZOrdering(), C4GUI::Container::InsertElement(), C4GUI::Dialog::IsBottomPlacementDialog(), C4Application::isEditor, IsExclusive(), C4GUI::Dialog::IsExternalDrawDialog(), C4GUI::Dialog::IsFreePlaceDialog(), C4GUI::Dialog::IsViewportDialog(), pActiveDlg, PreferredDlgRect, C4GUI::Window::SetPos(), UpdateMouseFocus(), C4Rect::x, and C4Rect::y.

Referenced by C4GUI::Dialog::FadeIn(), and C4GUI::Dialog::Show().

615  {
616  assert(pDlg);
617  // do place console mode dialogs
618  if (!Application.isEditor || pDlg->IsViewportDialog())
619  // exclusive or free dlg: center pos
620  // evaluate own placement proc first
621  if (!pDlg->DoPlacement(this, PreferredDlgRect))
622  {
623  if (pDlg->IsFreePlaceDialog())
624  pDlg->SetPos((GetWidth() - pDlg->GetWidth()) / 2, (GetHeight() - pDlg->GetHeight()) / 2 + pDlg->IsBottomPlacementDialog()*GetHeight()/3);
625  else if (IsExclusive())
626  pDlg->SetPos((GetWidth() - pDlg->GetWidth()) / 2, (GetHeight() - pDlg->GetHeight()) / 2);
627  else
628  // non-exclusive mode at preferred viewport pos
629  pDlg->SetPos(PreferredDlgRect.x+30, PreferredDlgRect.y+30);
630  }
631  // add to local component list at correct ordering
632  int32_t iNewZ = pDlg->GetZOrdering(); Element *pEl; Dialog *pOtherDlg;
633  for (pEl = GetFirst(); pEl; pEl = pEl->GetNext())
634  if ((pOtherDlg = pEl->GetDlg()))
635  if (pOtherDlg->GetZOrdering() > iNewZ)
636  break;
637  InsertElement(pDlg, pEl);
638  // set as active, if not fading and on top
639  if (!fFade && !pEl)
640  // but not viewport dialogs!
641  if (!pDlg->IsExternalDrawDialog())
642  pActiveDlg = pDlg;
643  // show it
644  pDlg->fOK = false;
645  pDlg->fShow = true;
646  // mouse focus might have changed
648  }
void UpdateMouseFocus()
Definition: C4Gui.cpp:968
friend class Dialog
Definition: C4Gui.h:2686
bool fOK
Definition: C4Gui.h:2082
bool IsExclusive()
Definition: C4Gui.h:2667
int32_t GetHeight()
Definition: C4Gui.h:444
int32_t y
Definition: C4Rect.h:32
Element * GetFirst()
Definition: C4Gui.h:829
void InsertElement(Element *pChild, Element *pInsertBefore)
int32_t GetWidth()
Definition: C4Gui.h:443
int32_t x
Definition: C4Rect.h:32
Element * GetNext() const
Definition: C4Gui.h:449
C4Rect PreferredDlgRect
Definition: C4Gui.h:2593
Dialog * pActiveDlg
Definition: C4Gui.h:2590
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Screen::ShowErrorMessage ( const char *  szMessage)

Definition at line 1041 of file C4GuiDialogs.cpp.

References C4GUI::Ico_Error, LoadResStr(), and ShowMessage().

Referenced by C4StartupNetDlg::DoOK(), C4Network2::LeagueShowError(), C4StartupPlrPropertiesDlg::OnClosed(), C4ChatControl::OnConnectBtn(), C4StartupMainDlg::OnEditorBtn(), and C4FileSelDlg::UserClose().

1042  {
1043  return ShowMessage(szMessage, LoadResStr("IDS_DLG_ERROR"), Ico_Error);
1044  }
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
bool ShowMessage(const char *szMessage, const char *szCaption, Icons icoIcon, int32_t *piConfigDontShowAgainSetting=nullptr)

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Screen::ShowMessage ( const char *  szMessage,
const char *  szCaption,
Icons  icoIcon,
int32_t *  piConfigDontShowAgainSetting = nullptr 
)

Definition at line 1029 of file C4GuiDialogs.cpp.

References C4GUI::MessageDialog::btnOK, C4GUI::MessageDialog::dsRegular, LogSilentF(), and ShowRemoveDlg().

Referenced by C4StartupPlrSelDlg::CheckPlayerName(), C4StartupScenSelDlg::DoOK(), C4Startup::DoStartup(), C4Network2IRCClient::Join(), C4StartupPlrPropertiesDlg::OnClosed(), C4StartupPlrSelDlg::OnDelBtnConfirm(), C4StartupMainDlg::OnTODO(), C4StartupOptionsDlg::SaveConfig(), ShowErrorMessage(), and C4StartupPlrSelDlg::PlayerListItem::UpdateCore().

1030  {
1031  // always log messages
1032  LogSilentF("[Msg] %s: %s", szCaption, szMessage);
1033  if (piConfigDontShowAgainSetting && *piConfigDontShowAgainSetting) return true;
1034 #ifdef USE_CONSOLE
1035  // skip in console mode
1036  return true;
1037 #endif
1038  return ShowRemoveDlg(new MessageDialog(szMessage, szCaption, MessageDialog::btnOK, icoIcon, MessageDialog::dsRegular, piConfigDontShowAgainSetting));
1039  }
bool ShowRemoveDlg(Dialog *pDlg)
bool LogSilentF(const char *strMessage,...)
Definition: C4Log.cpp:263

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Screen::ShowMessageModal ( const char *  szMessage,
const char *  szCaption,
DWORD  dwButtons,
Icons  icoIcon,
int32_t *  piConfigDontShowAgainSetting = nullptr 
)

Definition at line 1046 of file C4GuiDialogs.cpp.

References C4GUI::MessageDialog::dsRegular, LogSilentF(), and ShowModalDlg().

Referenced by C4StartupScenSelDlg::DeleteConfirm(), C4StartupNetDlg::DoOK(), C4StartupScenSelDlg::DoOK(), C4StartupNetDlg::DoRefresh(), C4DownloadDlg::DownloadFile(), C4Network2::InitLeague(), C4Network2::LeagueEnd(), C4Network2::LeaguePlrAuth(), C4Network2::LeagueStart(), C4ChatControl::OnConnectBtn(), C4ScenarioListLoader::Entry::RenameTo(), C4PlayerInfoList::RestoreSavegameInfos(), C4ScenarioListLoader::Entry::SetTitleInGroup(), C4LeagueSignupDialog::UserClose(), and C4ChatControl::UserQueryQuit().

1047  {
1048  // always log messages
1049  LogSilentF("[Modal] %s: %s", szCaption, szMessage);
1050  // skip if user doesn't want to see it
1051  if (piConfigDontShowAgainSetting && *piConfigDontShowAgainSetting) return true;
1052  // create message dlg and show modal
1053  return ShowModalDlg(new MessageDialog(szMessage, szCaption, dwButtons, icoIcon, MessageDialog::dsRegular, piConfigDontShowAgainSetting));
1054  }
bool LogSilentF(const char *strMessage,...)
Definition: C4Log.cpp:263
bool ShowModalDlg(Dialog *pDlg, bool fDestruct=true)

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Screen::ShowModalDlg ( Dialog pDlg,
bool  fDestruct = true 
)

Definition at line 1066 of file C4GuiDialogs.cpp.

References C4GUI::Dialog::DoModal(), and C4GUI::Dialog::Show().

Referenced by C4StartupPlrPropertiesDlg::OnClrChangeCustom(), C4StartupMainDlg::OnShown(), C4Network2::QueryClientPassword(), C4DefinitionSelDlg::SelectDefinitions(), C4PortraitSelDlg::SelectPortrait(), ShowMessageModal(), and C4LeagueSignupDialog::ShowModal().

1067  {
1068 #ifdef USE_CONSOLE
1069  // no modal dialogs in console build
1070  // (there's most likely no way to close them!)
1071  if (fDestruct) delete pDlg;
1072  return true;
1073 #endif
1074  // safety
1075  if (!pDlg) return false;
1076  // show it
1077  if (!pDlg->Show(this, true)) { delete pDlg; return false; }
1078  // wait until it is closed
1079  bool fResult = pDlg->DoModal();
1080  if (fDestruct) delete pDlg;
1081  // return result
1082  return fResult;
1083  }

Here is the call graph for this function:

Here is the caller graph for this function:

ProgressDialog * C4GUI::Screen::ShowProgressDlg ( const char *  szMessage,
const char *  szCaption,
int32_t  iMaxProgress = 100,
int32_t  iInitialProgress = 0,
Icons  icoIcon = Ico_Wait 
)

Definition at line 1056 of file C4GuiDialogs.cpp.

References C4GUI::Dialog::Show().

1057  {
1058  // create progress dlg
1059  ProgressDialog *pDlg = new ProgressDialog(szMessage, szCaption, iMaxProgress, iInitialProgress, icoIcon);
1060  // show it
1061  if (!pDlg->Show(this, true)) { delete pDlg; return nullptr; }
1062  // return dlg pointer
1063  return pDlg;
1064  }

Here is the call graph for this function:

bool C4GUI::Screen::ShowRemoveDlg ( Dialog pDlg)

Definition at line 1085 of file C4GuiDialogs.cpp.

References C4GUI::Dialog::SetDelOnClose(), and C4GUI::Dialog::Show().

Referenced by C4Scoreboard::DoDlgShow(), C4Startup::DoStartup(), C4StartupScenSelDlg::KeyCheat(), C4StartupScenSelDlg::KeyDelete(), C4GameOptionButtons::OnBtnComment(), C4GameOptionButtons::OnBtnPassword(), C4StartupPlrSelDlg::OnDelBtn(), C4StartupPlrSelDlg::OnNewBtn(), C4StartupPlrSelDlg::OnPropertyBtn(), C4FullScreen::ShowAbortDlg(), ShowMessage(), C4MessageInput::StartTypeIn(), C4Network2ClientListDlg::Toggle(), and C4ChartDialog::Toggle().

1086  {
1087  // safety
1088  if (!pDlg) return false;
1089  // mark removal when done
1090  pDlg->SetDelOnClose();
1091  // show it
1092  if (!pDlg->Show(this, true)) { delete pDlg; return false; }
1093  // done, success
1094  return true;
1095  }

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

261  {
262  // set flag
263  fDragging = true;
264  // set drag start pos
265  iDragX = iX; iDragY = iY;
266  // mark drag in mouse
267  rMouse.pDragElement = this;
268  }
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 283 of file C4Gui.cpp.

References C4GUI::Element::DoDragging().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Screen::UpdateGamepadGUIControlEnabled ( )

Definition at line 1052 of file C4Gui.cpp.

1053  {
1054  // Gamepad is always kept open now.
1055  }
void C4GUI::Screen::UpdateMouseFocus ( )

Definition at line 968 of file C4Gui.cpp.

References MouseControl, and C4MouseControl::UpdateClip().

Referenced by CloseDialog(), SetExclusive(), and ShowDialog().

969  {
970  // when exclusive mode has changed: Make sure mouse clip is correct
972  }
C4MouseControl MouseControl
Definition: C4Globals.cpp:47

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Window::UpdateOwnPos ( )
virtualinherited

Reimplemented from C4GUI::Element.

Reimplemented in C4GUI::FullscreenDialog, C4GUI::CheckBox, C4GUI::ScrollWindow, C4StartupScenSelDlg::ScenListItem, C4Menu, C4FileSelDlg::DefaultListItem, and C4ChatControl::ChatSheet::NickItem.

Definition at line 324 of file C4GuiContainers.cpp.

References C4GUI::Window::GetMarginBottom(), C4GUI::Window::GetMarginLeft(), C4GUI::Window::GetMarginRight(), C4GUI::Window::GetMarginTop(), C4Rect::Hgt, C4GUI::Element::rcBounds, C4GUI::Window::rcClientRect, C4Rect::Set(), C4GUI::Element::UpdateOwnPos(), C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by C4GameOverDlg::C4GameOverDlg(), C4GUI::Edit::Edit(), C4GUI::ListBox::ListBox(), C4GUI::Dialog::SetFrameDeco(), C4GUI::GroupBox::SetMargin(), C4GUI::Tabular::SetSheetMargin(), C4GUI::GroupBox::SetTitle(), C4GUI::Tabular::Tabular(), C4GUI::TextWindow::TextWindow(), C4FileSelDlg::DefaultListItem::UpdateOwnPos(), C4GUI::FullscreenDialog::UpdateOwnPos(), and C4GUI::Window::Window().

325  {
327  // set client rect
328  int32_t iMarginL=GetMarginLeft(), iMarginT=GetMarginTop();
329  rcClientRect.Set(rcBounds.x + iMarginL, rcBounds.y + iMarginT, std::max<int32_t>(rcBounds.Wdt - iMarginL - GetMarginRight(), 0), std::max<int32_t>(rcBounds.Hgt - iMarginT - GetMarginBottom(), 0));
330  }
C4Rect rcClientRect
Definition: C4Gui.h:851
virtual int32_t GetMarginTop()
Definition: C4Gui.h:873
int32_t Wdt
Definition: C4Rect.h:32
int32_t y
Definition: C4Rect.h:32
C4Rect rcBounds
Definition: C4Gui.h:385
virtual int32_t GetMarginRight()
Definition: C4Gui.h:875
virtual int32_t GetMarginLeft()
Definition: C4Gui.h:874
int32_t x
Definition: C4Rect.h:32
void Set(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt)
Definition: C4Rect.cpp:86
virtual void UpdateOwnPos()
Definition: C4Gui.h:434
int32_t Hgt
Definition: C4Rect.h:32
virtual int32_t GetMarginBottom()
Definition: C4Gui.h:876

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Element::UpdatePos ( )
protectedvirtualinherited

Reimplemented in C4GUI::Dialog.

Definition at line 194 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Element::UpdateSize ( )
protectedvirtualinherited

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

Definition at line 186 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class ContextMenu
friend

Definition at line 2686 of file C4Gui.h.

friend class Dialog
friend

Definition at line 2686 of file C4Gui.h.

Member Data Documentation

bool C4GUI::Element::fDragging
protectedinherited

Definition at line 380 of file C4Gui.h.

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

bool C4GUI::Screen::fExclusive
protected

Definition at line 2592 of file C4Gui.h.

Referenced by Clear(), and IsExclusive().

float C4GUI::Screen::fZoom
protected

Definition at line 2594 of file C4Gui.h.

Referenced by Clear(), GetZoom(), Init(), and MouseInput().

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

ContextMenu* C4GUI::Screen::pContext
protected
ContextHandler* C4GUI::Element::pContextHandler
protectedinherited
Window* C4GUI::Element::pDragTarget
protectedinherited

Definition at line 378 of file C4Gui.h.

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

C4Rect C4GUI::Screen::PreferredDlgRect
protected

Definition at line 2593 of file C4Gui.h.

Referenced by GetPreferredDlgRect(), and ShowDialog().

Screen * C4GUI::Screen::pScreen
staticprotected

Definition at line 2596 of file C4Gui.h.

Referenced by GetScreenS(), Screen(), and ~Screen().

C4Rect C4GUI::Element::rcBounds
protectedinherited

Definition at line 385 of file C4Gui.h.

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


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