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

#include <C4PlayerInfoListBox.h>

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

Public Types

enum  Spacings {
  IconLabelSpacing = 2, ClientListBoxSpacing = 8, PlayerListBoxIndent = 3, NoneLabelSpacing = 20,
  SoundIconShowTime = 1
}
 
enum  Mode { PILBM_LobbyClientSort, PILBM_LobbyTeamSort, PILBM_Evaluation, PILBM_EvaluationNoWinners }
 
typedef int32_t(* SortFunction )(const Element *pEl1, const Element *pEl2, void *par)
 

Public Member Functions

 C4PlayerInfoListBox (const C4Rect &rcBounds, Mode eMode, int32_t iTeamFilter=0)
 
virtual ~C4PlayerInfoListBox ()
 
void Update ()
 
void SetClientSoundIcon (int32_t iForClientID)
 
void SetMode (Mode eNewMode)
 
void SetTeamFilter (int32_t idNewTeamFilter)
 
void SetCustomFont (CStdFont *pNewFont, uint32_t dwTextColor)
 
Mode GetMode () const
 
virtual void MouseInput (CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
 
virtual void RemoveElement (Element *pChild)
 
bool AddElement (Element *pChild, int32_t iIndent=0)
 
void AddElement (Element *pChild)
 
bool InsertElement (Element *pChild, Element *pInsertBefore, int32_t iIndent=0)
 
void InsertElement (Element *pChild, Element *pInsertBefore)
 
virtual void ElementSizeChanged (Element *pOfElement)
 
virtual void ElementPosChanged (Element *pOfElement)
 
int32_t GetItemWidth ()
 
void SelectionChanged (bool fByUser)
 
void SetSelectionChangeCallbackFn (BaseCallbackHandler *pToHandler)
 
void SetSelectionDblClickFn (BaseCallbackHandler *pToHandler)
 
void ScrollToBottom ()
 
void ScrollItemInView (Element *pItem)
 
void FreezeScrolling ()
 
void UnFreezeScrolling ()
 
void SetDecoration (bool fDrawBG, ScrollBarFacets *pToGfx, bool fAutoScroll, bool fDrawBorder=false)
 
void SetSelectionDiabled (bool fToVal=true)
 
ElementGetFirst ()
 
ElementGetLast ()
 
virtual int32_t GetMarginTop ()
 
virtual int32_t GetMarginLeft ()
 
virtual int32_t GetMarginRight ()
 
virtual int32_t GetMarginBottom ()
 
ElementGetSelectedItem ()
 
bool IsScrollingActive ()
 
bool IsScrollingNecessary ()
 
void SelectEntry (Element *pNewSel, bool fByUser)
 
void SelectFirstEntry (bool fByUser)
 
void SelectNone (bool fByUser)
 
bool IsMultiColumn () const
 
int32_t ContractToElementHeight ()
 
void UpdateElementPositions ()
 
void UpdateElementPosition (Element *pOfElement, int32_t iIndent)
 
virtual void UpdateSize ()
 
virtual bool IsSelectedChild (Element *pChild)
 
void SortElements (SortFunction SortFunc, void *par)
 
bool HasFocus ()
 
bool HasDrawFocus ()
 
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 ()
 
void Clear ()
 
void ClearChildren ()
 
void MakeLastElement (Element *pChild)
 
void ReaddElement (Element *pChild)
 
ElementGetNextNestedElement (Element *pPrevElement, bool fBackwards)
 
virtual ElementGetFirstContained ()
 
virtual ElementGetLastContained ()
 
virtual ElementGetFirstNestedElement (bool fBackwards)
 
Iterator begin ()
 
Iterator end ()
 
ReverseIterator rbegin ()
 
ReverseIterator rend ()
 
virtual ContainerGetContainer ()
 
ElementGetElementByIndex (int32_t i)
 
int32_t GetElementCount ()
 
virtual void SetVisibility (bool fToValue)
 
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 Screen * GetScreen ()
 
void ScreenPos2ClientPos (int32_t &riX, int32_t &riY)
 
void ClientPos2ScreenPos (int32_t &riX, int32_t &riY)
 
void SetToolTip (const char *szNewTooltip, bool is_immediate=false)
 
const char * GetToolTip ()
 
const char * GetOwnToolTip ()
 
bool IsImmediateToolTip () const
 
int32_t GetWidth ()
 
int32_t GetHeight ()
 
C4RectGetBounds ()
 
void SetBounds (const C4Rect &rcNewBound)
 
C4Rect GetContainedClientRect ()
 
ElementGetNext () const
 
ElementGetPrev () const
 
bool IsInActiveDlg (bool fForKeyboard)
 
C4Rect GetToprightCornerRect (int32_t iWidth=16, int32_t iHeight=16, int32_t iHIndent=4, int32_t iVIndent=4, int32_t iIndexX=0)
 
bool IsVisible ()
 
virtual int32_t GetListItemTopSpacing ()
 
virtual bool GetListItemTopSpacingBar ()
 
void SetDragTarget (Window *pToWindow)
 
void SetContextHandler (ContextHandler *pNewHd)
 
virtual ContextHandler * GetContextHandler ()
 

Public Attributes

bool fVisible
 

Protected Member Functions

bool IsPlayerItemCollapsed (PlayerListItem *pItem)
 
void OnPlrListSelChange (class C4GUI::Element *pEl)
 
uint32_t GetTextColor () const
 
CStdFontGetCustomFont () const
 
virtual void DrawElement (C4TargetFacet &cgo)
 
virtual bool IsFocused (Control *pCtrl)
 
virtual bool IsFocusOnClick ()
 
virtual ControlIsFocusElement ()
 
virtual void OnGetFocus (bool fByMouse)
 
virtual bool CharIn (const char *c)
 
virtual void AfterElementRemoval ()
 
void UpdateColumnCount ()
 
void DisableFocus ()
 
virtual void OnLooseFocus ()
 
virtual void Draw (C4TargetFacet &cgo)
 
virtual bool OnHotkey (uint32_t cHotkey)
 
virtual void UpdatePos ()
 
void Draw3DFrame (C4TargetFacet &cgo, bool fUp=false, int32_t iIndent=1, BYTE byAlpha=C4GUI_BorderAlpha, bool fDrawTop=true, int32_t iTopOff=0, bool fDrawLeft=true, int32_t iLeftOff=0)
 
void DrawBar (C4TargetFacet &cgo, DynBarFacet &rFacets)
 
void DrawVBar (C4TargetFacet &cgo, DynBarFacet &rFacets)
 
void DrawHBarByVGfx (C4TargetFacet &cgo, DynBarFacet &rFacets)
 
void DrawHVBar (C4TargetFacet &cgo, DynBarFacet &rFacets, C4DrawTransform &trf, int32_t iMiddleLength)
 
virtual bool IsOwnPtrElement ()
 
virtual bool IsExternalDrawDialog ()
 
virtual bool IsMenu ()
 
virtual class DialogWindow * GetDialogWindow ()
 
virtual bool CheckNameHotkey (const char *)
 

Protected Attributes

int32_t iMultiColItemWidth
 
int32_t iColCount
 
ScrollWindowpClientWindow
 
ElementpSelectedItem
 
BaseCallbackHandler * pSelectionChangeHandler
 
BaseCallbackHandler * pSelectionDblClickHandler
 
bool fDrawBackground
 
bool fDrawBorder
 
bool fSelectionDisabled
 
C4Rect rcClientRect
 
ElementpFirst
 
ElementpLast
 
ContainerpParent
 
ElementpPrev
 
ElementpNext
 
WindowpDragTarget
 
int32_t iDragX
 
int32_t iDragY
 
bool fDragging
 
ContextHandler * pContextHandler
 
C4Rect rcBounds
 

Friends

class PlayerListItem
 
class TeamListItem
 

Detailed Description

Definition at line 23 of file C4PlayerInfoListBox.h.

Member Typedef Documentation

typedef int32_t(* C4GUI::ListBox::SortFunction)(const Element *pEl1, const Element *pEl2, void *par)
inherited

Definition at line 1595 of file C4Gui.h.

Member Enumeration Documentation

Enumerator
IconLabelSpacing 
ClientListBoxSpacing 
PlayerListBoxIndent 
NoneLabelSpacing 
SoundIconShowTime 

Definition at line 26 of file C4PlayerInfoListBox.h.

27  {
28  // some spacings
29  IconLabelSpacing = 2, // space between an icon and its text
30  ClientListBoxSpacing = 8, // space between two clients in the list
31  PlayerListBoxIndent = 3, // indent of player list box items
32  NoneLabelSpacing = 20, // indent of "- none -"-label in list box
33 
34  SoundIconShowTime = 1 // seconds. min time a sound icon is shown
35  };

Constructor & Destructor Documentation

C4PlayerInfoListBox::C4PlayerInfoListBox ( const C4Rect rcBounds,
Mode  eMode,
int32_t  iTeamFilter = 0 
)

Definition at line 1226 of file C4PlayerInfoListBox.cpp.

References OnPlrListSelChange(), C4GUI::ListBox::SetSelectionChangeCallbackFn(), and Update().

1227  : C4GUI::ListBox(rcBounds), eMode(eMode), iMaxUncollapsedPlayers(10), fIsCollapsed(false), iTeamFilter(iTeamFilter), dwTextColor(C4GUI_MessageFontClr), pCustomFont(nullptr)
1228 {
1229  // update if client listbox selection changes
1231  // initial update
1232  Update();
1233 }
#define C4GUI_MessageFontClr
Definition: C4Gui.h:43
void OnPlrListSelChange(class C4GUI::Element *pEl)
void SetSelectionChangeCallbackFn(BaseCallbackHandler *pToHandler)
Definition: C4Gui.h:1548

Here is the call graph for this function:

virtual C4PlayerInfoListBox::~C4PlayerInfoListBox ( )
inlinevirtual

Definition at line 334 of file C4PlayerInfoListBox.h.

334 {}

Member Function Documentation

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

Definition at line 118 of file C4GuiContainers.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::ListBox::AddElement ( Element pChild,
int32_t  iIndent = 0 
)
inherited

Definition at line 489 of file C4GuiListBox.cpp.

References C4GUI::Container::AddElement(), C4GUI::Element::GetBounds(), C4GUI::ListBox::GetItemWidth(), C4GUI::Element::GetListItemTopSpacing(), C4GUI::Element::GetPrev(), C4Rect::Hgt, C4GUI::ListBox::iColCount, C4GUI::ListBox::iMultiColItemWidth, C4GUI::ListBox::pClientWindow, C4GUI::ScrollWindow::SetClientHeight(), C4GUI::Element::UpdateOwnPos(), C4Rect::Wdt, C4Rect::x, and C4Rect::y.

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

490  {
491  // fail if no client window is present
492  if (!pClientWindow) return false;
493  // add to scroll window
494  pClientWindow->AddElement(pChild);
495  // resize to horizontal list extents
496  C4Rect &rcChildBounds = pChild->GetBounds();
497  rcChildBounds.x = iIndent;
498  rcChildBounds.Wdt = GetItemWidth() - iIndent ;
499  // reposition to end of list
500  if (pChild->GetPrev())
501  {
502  if (iMultiColItemWidth)
503  {
504  rcChildBounds.y = pChild->GetPrev()->GetBounds().y;
505  int32_t col = pChild->GetPrev()->GetBounds().x / iMultiColItemWidth + 1;
506  if (col >= iColCount)
507  {
508  col = 0;
509  int32_t cnt = iColCount;
510  int32_t iPrevLineHgt = 0;
511  Element *pPrevChild = pChild->GetPrev();
512  while (cnt-- && pPrevChild)
513  {
514  iPrevLineHgt = std::max<int32_t>(iPrevLineHgt, pPrevChild->GetBounds().Hgt);
515  pPrevChild = pPrevChild->GetPrev();
516  }
517  rcChildBounds.y += iPrevLineHgt;
518  }
519  rcChildBounds.x = col * iMultiColItemWidth;
520  }
521  else
522  {
523  rcChildBounds.y = pChild->GetPrev()->GetBounds().y + pChild->GetPrev()->GetBounds().Hgt + pChild->GetListItemTopSpacing();
524  }
525  }
526  else
527  rcChildBounds.y = 0;
528  pChild->UpdateOwnPos();
529  // update scrolling
530  pClientWindow->SetClientHeight(rcChildBounds.y+rcChildBounds.Hgt);
531  // success
532  return true;
533  }
Definition: C4Rect.h:29
void AddElement(Element *pChild)
int32_t iMultiColItemWidth
Definition: C4Gui.h:1507
int32_t Wdt
Definition: C4Rect.h:32
int32_t y
Definition: C4Rect.h:32
int32_t x
Definition: C4Rect.h:32
int32_t iColCount
Definition: C4Gui.h:1508
int32_t GetItemWidth()
Definition: C4Gui.h:1545
void SetClientHeight(int32_t iToHgt)
Definition: C4Gui.h:973
int32_t Hgt
Definition: C4Rect.h:32
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Container.

Definition at line 1528 of file C4Gui.h.

References C4GUI::Container::AfterElementRemoval(), and C4GUI::ListBox::UpdateElementPositions().

1529  { Container::AfterElementRemoval(); UpdateElementPositions(); } // called by ScrollWindow to parent after an element has been removed
void UpdateElementPositions()
virtual void AfterElementRemoval()
Definition: C4Gui.h:756

Here is the call 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::ListBox::CharIn ( const char *  c)
protectedvirtualinherited

Reimplemented from C4GUI::Control.

Definition at line 599 of file C4GuiListBox.cpp.

References C4GUI::Control::CharIn(), C4GUI::Element::CheckNameHotkey(), C4GUI::ListBox::GetFirst(), C4GUI::Element::GetNext(), C4GUI::ListBox::GetSelectedItem(), and C4GUI::ListBox::SelectEntry().

600  {
601  // Jump to first/next entry beginning with typed letter
602  Element *pSel = GetSelectedItem();
603  Element *pStartCheck = pSel;
604  if (pSel) pSel = pSel->GetNext();
605  if (!pSel)
606  {
607  pSel = GetFirst();
608  if (!pSel) return false;
609  }
610  while (pSel != pStartCheck && !pSel->CheckNameHotkey(c))
611  if (!(pSel = pSel->GetNext()))
612  if (pStartCheck)
613  // list end reached while another entry had been selected before: Re-check start of list
614  pSel = GetFirst();
615  // ok, change selection - might do nothing if list was cycled, which is OK
616  if (pSel)
617  {
618  SelectEntry(pSel, true);
619  return true;
620  }
621  return Control::CharIn(c);
622  }
Element * GetFirst()
Definition: C4Gui.h:1571
Element * GetSelectedItem()
Definition: C4Gui.h:1580
virtual bool CharIn(const char *)
Definition: C4Gui.h:1051
void SelectEntry(Element *pNewSel, bool fByUser)

Here is the call graph for this function:

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

Reimplemented in C4StartupScenSelDlg::ScenListItem.

Definition at line 407 of file C4Gui.h.

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

407 { return false; }

Here is the caller graph for this function:

void C4GUI::Container::Clear ( )
inherited

Definition at line 63 of file C4GuiContainers.cpp.

References C4GUI::Container::ClearChildren().

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

64  {
65  ClearChildren();
66  }

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Container::ClearChildren ( )
inherited

Definition at line 68 of file C4GuiContainers.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

int32_t C4GUI::ListBox::ContractToElementHeight ( )
inherited

Definition at line 187 of file C4GuiListBox.cpp.

References C4GUI::Element::GetBounds(), C4GUI::Window::GetClientRect(), C4Rect::Hgt, C4GUI::ListBox::pClientWindow, and C4GUI::Element::SetBounds().

Referenced by C4Network2ClientListDlg::C4Network2ClientListDlg().

188  {
189  if (!pClientWindow) return 0;
190  // calc superfluous bottom space
191  int32_t iExtraSpace = pClientWindow->GetBounds().Hgt - pClientWindow->GetClientRect().Hgt;
192  if (iExtraSpace <= 0) return 0;
193  // contract by it
194  C4Rect rcNewBounds = GetBounds();
195  rcNewBounds.Hgt -= iExtraSpace;
196  SetBounds(rcNewBounds);
197  return iExtraSpace;
198  }
Definition: C4Rect.h:29
virtual C4Rect & GetClientRect()
Definition: C4Gui.h:864
C4Rect & GetBounds()
Definition: C4Gui.h:445
void SetBounds(const C4Rect &rcNewBound)
Definition: C4Gui.h:446
int32_t Hgt
Definition: C4Rect.h:32
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::Control::DisableFocus ( )
protectedinherited

Definition at line 765 of file C4GuiContainers.cpp.

References C4GUI::Dialog::AdvanceFocus(), C4GUI::Element::GetDlg(), and C4GUI::Control::HasFocus().

Referenced by C4GUI::CheckBox::SetEnabled().

766  {
767  // has it any focus at all?
768  if (!HasFocus()) return;
769  // then de-focus it
770  Dialog *pDlg=GetDlg();
771  if (!pDlg) return;
772  pDlg->AdvanceFocus(true);
773  }
friend class Dialog
Definition: C4Gui.h:1070
bool HasFocus()
Definition: C4Gui.h:1067
virtual class Dialog * GetDlg()
Definition: C4Gui.cpp:289

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::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 C4GUI::Screen::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 C4GUI::Screen::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::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::ListBox::DrawElement ( C4TargetFacet cgo)
protectedvirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 101 of file C4GuiListBox.cpp.

References C4GUI_ListBoxBarColor, C4GUI_ListBoxBarIndent, C4GUI_ListBoxInactSelColor, C4GUI_ListBoxSelColor, C4GUI::Element::Draw3DFrame(), C4Draw::DrawBoxDw(), C4Draw::DrawLineDw(), C4GUI::ListBox::fDrawBackground, C4GUI::ListBox::fDrawBorder, C4GUI::Element::GetBounds(), C4GUI::Window::GetClientRect(), C4GUI::Container::GetFirst(), C4GUI::Element::GetListItemTopSpacing(), C4GUI::Element::GetListItemTopSpacingBar(), C4GUI::Element::GetNext(), C4GUI::Control::HasDrawFocus(), C4Rect::Hgt, C4GUI::ListBox::pClientWindow, pDraw, C4GUI::ListBox::pSelectedItem, C4GUI::Element::rcBounds, C4Facet::Surface, C4TargetFacet::TargetX, C4TargetFacet::TargetY, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

102  {
103  if (fDrawBackground)
105  if (fDrawBorder) Draw3DFrame(cgo);
106  // listbox bg: mark selected item
107  if (!pClientWindow) return;
108  if (pSelectedItem)
109  {
110  C4Rect rcSelArea = pSelectedItem->GetBounds();
111  rcSelArea.x += GetClientRect().x;
112  rcSelArea.y += GetClientRect().y + pClientWindow->GetClientRect().y;
113  // clip
114  if (rcSelArea.y < GetClientRect().y)
115  {
116  rcSelArea.Hgt -= GetClientRect().y - rcSelArea.y;
117  rcSelArea.y = GetClientRect().y;
118  }
119  rcSelArea.Hgt = std::min(rcSelArea.Hgt, GetClientRect().y + GetClientRect().Hgt - rcSelArea.y);
120  // draw
121  if (rcSelArea.Hgt>=0)
122  pDraw->DrawBoxDw(cgo.Surface, rcSelArea.x+cgo.TargetX, rcSelArea.y+cgo.TargetY,
123  rcSelArea.x+rcSelArea.Wdt+cgo.TargetX-1, rcSelArea.y+rcSelArea.Hgt+cgo.TargetY-1,
125  }
126  // draw delimeter bars
127  Element *pCurr = pClientWindow->GetFirst();
128  if (!pCurr) return;
129  while ((pCurr = pCurr->GetNext()))
130  if (pCurr->GetListItemTopSpacingBar())
131  {
132  int32_t iYSpace = pCurr->GetListItemTopSpacing();
133  int32_t iY = pCurr->GetBounds().y + GetClientRect().y + pClientWindow->GetClientRect().y - iYSpace/2;
134  int32_t iX0 = pCurr->GetBounds().x + GetClientRect().x + C4GUI_ListBoxBarIndent;
135  int32_t iX1 = iX0 + pClientWindow->GetClientRect().Wdt - 2*C4GUI_ListBoxBarIndent;
136  // clip
137  if (iY < GetClientRect().y || iY >= GetClientRect().y+GetClientRect().Hgt) continue;
138  // draw
139  pDraw->DrawLineDw(cgo.Surface, (float)(iX0+cgo.TargetX), (float)(iY+cgo.TargetY), (float)(iX1+cgo.TargetX), (float)(iY+cgo.TargetY), C4GUI_ListBoxBarColor);
140  }
141  }
#define C4GUI_ListBoxBarColor
Definition: C4Gui.h:68
#define C4GUI_ListBoxInactSelColor
Definition: C4Gui.h:63
#define C4GUI_ListBoxSelColor
Definition: C4Gui.h:62
Definition: C4Rect.h:29
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)
Definition: C4Gui.cpp:292
virtual C4Rect & GetClientRect()
Definition: C4Gui.h:864
virtual int32_t GetListItemTopSpacing()
Definition: C4Gui.h:461
void DrawLineDw(C4Surface *sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width=1.0f)
Definition: C4Draw.cpp:617
bool fDrawBorder
Definition: C4Gui.h:1513
int32_t Wdt
Definition: C4Rect.h:32
int32_t y
Definition: C4Rect.h:32
Element * GetFirst()
Definition: C4Gui.h:829
void DrawBoxDw(C4Surface *sfcDest, int iX1, int iY1, int iX2, int iY2, DWORD dwClr)
Definition: C4Draw.cpp:849
C4Rect rcBounds
Definition: C4Gui.h:385
C4Draw * pDraw
Definition: C4Draw.cpp:45
#define C4GUI_ListBoxBarIndent
Definition: C4Gui.h:124
C4Rect & GetBounds()
Definition: C4Gui.h:445
bool fDrawBackground
Definition: C4Gui.h:1512
int32_t x
Definition: C4Rect.h:32
Element * pSelectedItem
Definition: C4Gui.h:1510
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
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call 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::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::ListBox::ElementPosChanged ( Element pOfElement)
virtualinherited

Reimplemented from C4GUI::Container.

Definition at line 565 of file C4GuiListBox.cpp.

References C4GUI::Container::ElementSizeChanged(), C4GUI::Element::GetParent(), and C4GUI::ListBox::UpdateElementPositions().

566  {
567  // inherited
568  if (pOfElement->GetParent() == this)
569  Control::ElementSizeChanged(pOfElement);
570  // update positions of all list items
572  }
void UpdateElementPositions()
virtual void ElementSizeChanged(Element *pOfElement)
Definition: C4Gui.h:753

Here is the call graph for this function:

void C4GUI::ListBox::ElementSizeChanged ( Element pOfElement)
virtualinherited

Reimplemented from C4GUI::Container.

Definition at line 552 of file C4GuiListBox.cpp.

References C4GUI::Container::ElementSizeChanged(), C4GUI::Element::GetParent(), C4GUI::ListBox::UpdateColumnCount(), and C4GUI::ListBox::UpdateElementPositions().

553  {
554  // inherited
555  if (pOfElement->GetParent() == this)
556  {
557  Control::ElementSizeChanged(pOfElement);
558  // update col count if list element container was resized
560  }
561  // update positions of all list items
563  }
void UpdateElementPositions()
virtual void ElementSizeChanged(Element *pOfElement)
Definition: C4Gui.h:753
void UpdateColumnCount()

Here is the call 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:

void C4GUI::ListBox::FreezeScrolling ( )
inlineinherited

Definition at line 1562 of file C4Gui.h.

References C4GUI::ScrollWindow::Freeze().

1562 { pClientWindow->Freeze(); }
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

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

Definition at line 445 of file C4Gui.h.

References C4GUI::Element::rcBounds.

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

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

Here is the caller graph for this function:

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(), C4GUI::Screen::MouseInput(), C4GUI::ScrollBar::OnPosChanged(), C4GUI::ProgressDialog::ProgressDialog(), C4GameLobby::ScenDesc::ScenDesc(), C4StartupScenSelDlg::ScenListItem::ScenListItem(), C4GUI::ScrollWindow::ScrollBy(), C4GUI::ScrollWindow::ScrollRangeInView(), C4GUI::ScrollWindow::ScrollToBottom(), C4GUI::ScrollWindow::ScrollWindow(), C4GoalDisplay::SetGoals(), C4GUI::FullscreenDialog::SetTitle(), C4GUI::TextWindow::TextWindow(), C4GUI::ScrollBar::Update(), C4GUI::ListBox::UpdateColumnCount(), and C4GUI::TextWindow::UpdateSize().

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

Here is the caller graph for this function:

C4Rect C4GUI::Element::GetContainedClientRect ( )
inlineinherited

Definition at line 448 of file C4Gui.h.

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

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

448 { C4Rect rc=GetClientRect(); rc.x=rc.y=0; return rc; }
Definition: C4Rect.h: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:

CStdFont* C4PlayerInfoListBox::GetCustomFont ( ) const
inlineprotected

Definition at line 330 of file C4PlayerInfoListBox.h.

330 { return pCustomFont; }
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(), C4GUI::Screen::MouseInput(), C4ChatControl::OnConnectBtn(), C4GUI::RenameEdit::OnFinishInput(), C4GUI::Label::OnHotkey(), C4ChatControl::OnLoginDataEnter(), C4GUI::CloseButton::OnPress(), C4GUI::CloseIconButton::OnPress(), C4GUI::RenameEdit::RenameEdit(), C4GUI::Container::SetVisibility(), and C4GUI::Screen::ShowDialog().

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:

Element* C4GUI::ListBox::GetFirst ( )
inlineinherited

Definition at line 1571 of file C4Gui.h.

References C4GUI::Container::GetFirst().

Referenced by C4StartupPlrSelDlg::C4StartupPlrSelDlg(), C4GUI::ListBox::CharIn(), C4StartupNetDlg::DoRefresh(), C4StartupNetListEntry::GetNextLower(), C4FileSelDlg::GetSelection(), C4StartupPlrSelDlg::OnItemCheckChange(), C4GUI::ListBox::SelectFirstEntry(), C4FileSelDlg::SetSelection(), and Update().

1571 { return pClientWindow ? pClientWindow->GetFirst() : nullptr; }
Element * GetFirst()
Definition: C4Gui.h:829
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

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:

int32_t C4GUI::Element::GetHeight ( )
inlineinherited

Definition at line 444 of file C4Gui.h.

References C4Rect::Hgt.

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

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

Here is the caller graph for this function:

int32_t C4GUI::ListBox::GetItemWidth ( )
inlineinherited

Definition at line 1545 of file C4Gui.h.

References C4GUI::Window::GetClientRect(), and C4Rect::Wdt.

Referenced by C4GUI::ListBox::AddElement(), C4GUI::ListBox::InsertElement(), and C4GUI::ListBox::UpdateElementPosition().

virtual C4Rect & GetClientRect()
Definition: C4Gui.h:864
int32_t iMultiColItemWidth
Definition: C4Gui.h:1507
int32_t Wdt
Definition: C4Rect.h:32
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 1572 of file C4Gui.h.

References C4GUI::Container::GetLast().

1572 { return pClientWindow ? pClientWindow->GetLast() : nullptr; }
Element * GetLast()
Definition: C4Gui.h:830
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

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

Definition at line 774 of file C4Gui.h.

References C4GUI::Container::pLast.

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

Reimplemented in C4StartupNetListEntry.

Definition at line 461 of file C4Gui.h.

References C4GUI_DefaultListSpacing.

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

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

Here is the caller graph for this function:

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

Definition at line 462 of file C4Gui.h.

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

462 { return false; }

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Window.

Definition at line 1578 of file C4Gui.h.

1578 { return 3; }
virtual int32_t C4GUI::ListBox::GetMarginLeft ( )
inlinevirtualinherited

Reimplemented from C4GUI::Window.

Definition at line 1576 of file C4Gui.h.

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

1576 { return 3; }

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Window.

Definition at line 1577 of file C4Gui.h.

1577 { return 3; }
virtual int32_t C4GUI::ListBox::GetMarginTop ( )
inlinevirtualinherited

Reimplemented from C4GUI::Window.

Definition at line 1575 of file C4Gui.h.

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

1575 { return 3; }

Here is the caller graph for this function:

Mode C4PlayerInfoListBox::GetMode ( ) const
inline

Definition at line 342 of file C4PlayerInfoListBox.h.

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

342 { return eMode; }

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:

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

Definition at line 450 of file C4Gui.h.

References C4GUI::Element::pPrev.

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

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

Here is the caller graph for this function:

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

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

Definition at line 290 of file C4Gui.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

Element* C4GUI::ListBox::GetSelectedItem ( )
inlineinherited

Definition at line 1580 of file C4Gui.h.

References C4GUI::ListBox::pSelectedItem.

Referenced by C4GUI::ListBox::CharIn(), C4StartupNetDlg::DoOK(), C4StartupPlrSelDlg::GetSelection(), IsPlayerItemCollapsed(), C4StartupNetDlg::OnReferenceEntryAdd(), and C4FileSelDlg::UpdateSelection().

1580 { return pSelectedItem; } // get focused listbox item
Element * pSelectedItem
Definition: C4Gui.h:1510

Here is the caller graph for this function:

uint32_t C4PlayerInfoListBox::GetTextColor ( ) const
inlineprotected

Definition at line 329 of file C4PlayerInfoListBox.h.

329 { return dwTextColor; }
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:

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 C4GUI::Screen::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:

bool C4GUI::Control::HasDrawFocus ( )
inherited

Definition at line 751 of file C4GuiContainers.cpp.

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

Referenced by 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::ContextButton::DrawElement(), and C4GUI::ComboBox::DrawElement().

752  {
753  // has focus at all?
754  if (!HasFocus()) return false;
755  // is screen ready and not in context?
756  if (GetScreen() && GetScreen()->HasContext()) return false;
757  // get dlg
758  Dialog *pDlg=GetDlg();
759  // dlg-less control has focus, OK (shouldn't happen)
760  if (!pDlg) return true;
761  // check if dlg is active
762  return pDlg->IsActive(true);
763  }
friend class Dialog
Definition: C4Gui.h:1070
bool HasFocus()
Definition: C4Gui.h:1067
virtual class Dialog * GetDlg()
Definition: C4Gui.cpp:289
virtual Screen * GetScreen()
Definition: C4Gui.cpp:290

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::Control::HasFocus ( )
inlineinherited

Definition at line 1067 of file C4Gui.h.

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

Referenced by C4GUI::Control::DisableFocus(), C4GUI::Control::HasDrawFocus(), C4GUI::ListBox::IsFocused(), and C4GUI::Control::MouseInput().

1067 { return pParent && pParent->IsFocused(this); }
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:

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

Definition at line 150 of file C4GuiContainers.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::ListBox::InsertElement ( Element pChild,
Element pInsertBefore,
int32_t  iIndent = 0 
)
inherited

Definition at line 535 of file C4GuiListBox.cpp.

References C4GUI::Element::GetBounds(), C4GUI::ListBox::GetItemWidth(), C4GUI::Container::InsertElement(), C4GUI::ListBox::pClientWindow, C4GUI::ListBox::UpdateElementPositions(), C4GUI::Element::UpdateOwnPos(), C4Rect::Wdt, and C4Rect::x.

Referenced by C4StartupNetListEntry::C4StartupNetListEntry(), C4StartupScenSelDlg::ScenListItem::ScenListItem(), C4Network2ResDlg::Update(), and C4Network2ClientListBox::Update().

536  {
537  // fail if no client window is present
538  if (!pClientWindow) return false;
539  // add to scroll window
540  pClientWindow->InsertElement(pChild, pInsertBefore);
541  // resize to horizontal list extents
542  C4Rect &rcChildBounds = pChild->GetBounds();
543  rcChildBounds.x = iIndent;
544  rcChildBounds.Wdt = GetItemWidth() - iIndent ;
545  pChild->UpdateOwnPos();
546  // update all element positions (and scrolling)
548  // done, success
549  return true;
550  }
void UpdateElementPositions()
Definition: C4Rect.h:29
int32_t Wdt
Definition: C4Rect.h:32
void InsertElement(Element *pChild, Element *pInsertBefore)
int32_t x
Definition: C4Rect.h:32
int32_t GetItemWidth()
Definition: C4Gui.h:1545
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

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:

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::ListBox::IsFocused ( Control pCtrl)
inlineprotectedvirtualinherited

Reimplemented from C4GUI::Container.

Definition at line 1518 of file C4Gui.h.

References C4GUI::Control::HasFocus(), and C4GUI::Container::IsFocused().

1519  {
1520  // subcontrol also counts as focused if the list has focus and the subcontrol is selected
1521  return Control::IsFocused(pCtrl) || (HasFocus() && pSelectedItem == pCtrl);
1522  }
bool HasFocus()
Definition: C4Gui.h:1067
Element * pSelectedItem
Definition: C4Gui.h:1510
virtual bool IsFocused(Control *pCtrl)
Definition: C4Gui.h:836

Here is the call graph for this function:

virtual Control* C4GUI::ListBox::IsFocusElement ( )
inlineprotectedvirtualinherited

Reimplemented from C4GUI::Control.

Definition at line 1524 of file C4Gui.h.

1524 { return this; }; // this control can gain focus
virtual bool C4GUI::ListBox::IsFocusOnClick ( )
inlineprotectedvirtualinherited

Reimplemented from C4GUI::Control.

Definition at line 1523 of file C4Gui.h.

1523 { return true; } // list boxes do get focus on click
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:

bool C4GUI::ListBox::IsMultiColumn ( ) const
inlineinherited

Definition at line 1586 of file C4Gui.h.

1586 { return iColCount > 1; }
int32_t iColCount
Definition: C4Gui.h:1508
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:

bool C4PlayerInfoListBox::IsPlayerItemCollapsed ( PlayerListItem pItem)
protected

Definition at line 1573 of file C4PlayerInfoListBox.cpp.

References C4GUI::ListBox::GetSelectedItem().

1574 {
1575  // never if view is not collapsed
1576  if (!fIsCollapsed) return false;
1577  // collapsed if not selected
1578  return GetSelectedItem() != pItem;
1579 }
Element * GetSelectedItem()
Definition: C4Gui.h:1580

Here is the call graph for this function:

bool C4GUI::ListBox::IsScrollingActive ( )
inlineinherited

Definition at line 1581 of file C4Gui.h.

References C4GUI::ScrollWindow::IsScrollingActive().

Referenced by Update().

bool IsScrollingActive()
Definition: C4Gui.h:992
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4GUI::ListBox::IsScrollingNecessary ( )
inlineinherited

Definition at line 1582 of file C4Gui.h.

References C4GUI::ScrollWindow::IsScrollingNecessary().

bool IsScrollingNecessary()
Definition: C4Gui.h:993
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

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

Reimplemented from C4GUI::Container.

Definition at line 1593 of file C4Gui.h.

References C4GUI::Element::IsParentOf().

1593 { return pChild == pSelectedItem || (pSelectedItem && pSelectedItem->IsParentOf(pChild)); }
virtual bool IsParentOf(Element *pEl)
Definition: C4Gui.h:454
Element * pSelectedItem
Definition: C4Gui.h:1510

Here is the call 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(), C4GUI::Screen::CharIn(), C4GUI::ControlKeyDlgCB< TargetClass >::CheckCondition(), C4ScriptGuiWindow::Draw(), C4GUI::Container::Draw(), C4GUI::Window::Draw(), C4GUI::Screen::Draw(), C4ScriptGuiWindow::DrawAll(), C4ScriptGuiWindow::DrawChildren(), C4ChatControl::GetDefaultControl(), C4GUI::Screen::GetFullscreenDialog(), C4GUI::Element::IsVisible(), C4ScriptGuiWindow::IsVisibleTo(), C4GUI::Window::MouseInput(), C4GUI::Control::MouseInput(), C4GUI::Screen::MouseInput(), C4GUI::Container::OnHotkey(), C4ScriptGuiWindow::ProcessMouseInput(), C4Menu::SetPosition(), C4Menu::UpdateElementPositions(), and C4GUI::TextWindow::UpdateSize().

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:

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

Definition at line 106 of file C4GuiContainers.cpp.

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

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

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

Here is the caller graph for this function:

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

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

Definition at line 413 of file C4Gui.h.

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

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

Here is the caller graph for this function:

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

Reimplemented from C4GUI::Control.

Definition at line 143 of file C4GuiListBox.cpp.

References C4MC_Button_LeftDouble, C4MC_Button_LeftDown, C4Rect::Contains(), C4GUI::BaseCallbackHandler::DoCall(), C4GUI::Element::GetBounds(), C4GUI::Container::GetFirst(), C4GUI::ListBox::GetMarginLeft(), C4GUI::ListBox::GetMarginTop(), C4GUI::Element::GetNext(), C4GUI::ScrollWindow::GetScrollY(), C4GUI::Control::MouseInput(), C4GUI::ListBox::pClientWindow, C4GUI::ListBox::pSelectedItem, C4GUI::ListBox::pSelectionDblClickHandler, and C4GUI::ListBox::SelectionChanged().

144  {
145  // inherited
146  Control::MouseInput(rMouse, iButton, iX, iY, dwKeyParam);
147  // safety
148  if (pClientWindow)
149  {
150  // check list area bounds
151  if (pClientWindow->GetBounds().Contains(iX, iY))
152  // left btn down: select item (regardless of key states)
153  if (iButton == C4MC_Button_LeftDown || iButton == C4MC_Button_LeftDouble)
154  {
155  // reset selection
156  Element *pPrevSelectedItem = pSelectedItem;
157  pSelectedItem = nullptr;
158  // get client component the mouse is over
159  iX -= GetMarginLeft(); iY -= GetMarginTop();
160  iY += pClientWindow->GetScrollY();
161  for (Element *pCurr = pClientWindow->GetFirst(); pCurr; pCurr = pCurr->GetNext())
162  if (pCurr->GetBounds().Contains(iX, iY))
163  pSelectedItem = pCurr;
164  // selection change sound
165  if (pSelectedItem != pPrevSelectedItem) SelectionChanged(true);
166  // item double-clicked? Callback
167  if (iButton == C4MC_Button_LeftDouble && pSelectedItem)
169  }
170  }
171  }
int32_t GetScrollY()
Definition: C4Gui.h:987
virtual void DoCall(class Element *pElement)=0
bool Contains(int32_t iX, int32_t iY) const
Definition: C4Rect.h:42
const int32_t C4MC_Button_LeftDown
virtual int32_t GetMarginTop()
Definition: C4Gui.h:1575
BaseCallbackHandler * pSelectionDblClickHandler
Definition: C4Gui.h:1511
void SelectionChanged(bool fByUser)
const int32_t C4MC_Button_LeftDouble
Element * GetFirst()
Definition: C4Gui.h:829
virtual void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
C4Rect & GetBounds()
Definition: C4Gui.h:445
Element * pSelectedItem
Definition: C4Gui.h:1510
Element * GetNext() const
Definition: C4Gui.h:449
virtual int32_t GetMarginLeft()
Definition: C4Gui.h:1576
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

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

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

Definition at line 414 of file C4Gui.h.

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

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

Here is the caller graph for this function:

void C4GUI::ListBox::OnGetFocus ( bool  fByMouse)
protectedvirtualinherited

Reimplemented from C4GUI::Control.

Definition at line 200 of file C4GuiListBox.cpp.

References C4GUI::Container::GetFirstContained(), C4GUI::Control::OnGetFocus(), C4GUI::ListBox::pClientWindow, C4GUI::ListBox::pSelectedItem, and C4GUI::ListBox::SelectionChanged().

201  {
202  // inherited (tooltip)
203  Control::OnGetFocus(fByMouse);
204  // select list item if none is selected (only for keyboard; mouse will select with left-click anyway)
205  if (!pSelectedItem && pClientWindow && !fByMouse)
206  {
208  SelectionChanged(false);
209  }
210  }
virtual Element * GetFirstContained()
Definition: C4Gui.h:773
void SelectionChanged(bool fByUser)
virtual void OnGetFocus(bool fByMouse)
Definition: C4Gui.h:1056
Element * pSelectedItem
Definition: C4Gui.h:1510
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call 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:

virtual void C4GUI::Control::OnLooseFocus ( )
inlineprotectedvirtualinherited

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

Definition at line 1057 of file C4Gui.h.

Referenced by C4GUI::Edit::OnLooseFocus(), and C4GUI::Dialog::SetFocus().

1057 {}; // callback when control looses focus

Here is the caller graph for this function:

void C4PlayerInfoListBox::OnPlrListSelChange ( class C4GUI::Element pEl)
inlineprotected

Definition at line 327 of file C4PlayerInfoListBox.h.

References Update().

Referenced by C4PlayerInfoListBox().

Here is the call graph for this function:

Here is the caller graph for this function:

ReverseIterator C4GUI::Container::rbegin ( )
inlineinherited

Definition at line 826 of file C4Gui.h.

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

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

Here is the caller graph for this function:

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

Definition at line 134 of file C4GuiContainers.cpp.

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

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

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

Here is the caller graph for this function:

void C4GUI::ListBox::RemoveElement ( Element pChild)
virtualinherited

Reimplemented from C4GUI::Container.

Definition at line 476 of file C4GuiListBox.cpp.

References C4GUI::ListBox::pSelectedItem, C4GUI::Container::RemoveElement(), and C4GUI::ListBox::SelectionChanged().

477  {
478  // inherited
479  Control::RemoveElement(pChild);
480  // clear selection var
481  if (pChild == pSelectedItem)
482  {
483  pSelectedItem = nullptr;
484  SelectionChanged(false);
485  }
486  // position update in AfterElementRemoval
487  }
void SelectionChanged(bool fByUser)
virtual void RemoveElement(Element *pChild)
Element * pSelectedItem
Definition: C4Gui.h:1510

Here is the call graph for this function:

ReverseIterator C4GUI::Container::rend ( )
inlineinherited

Definition at line 827 of file C4Gui.h.

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

827 { return ReverseIterator(nullptr); }

Here is the caller graph for this function:

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

Definition at line 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 C4GUI::Screen::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::ListBox::ScrollItemInView ( Element pItem)
inherited

Definition at line 398 of file C4GuiListBox.cpp.

References C4GUI::Element::GetBounds(), C4Rect::Hgt, C4GUI::ListBox::pClientWindow, C4GUI::ScrollWindow::ScrollRangeInView(), and C4Rect::y.

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

399  {
400  // safety
401  if (!pItem) return;
402  // scroll covered range into view
403  pClientWindow->ScrollRangeInView(pItem->GetBounds().y, pItem->GetBounds().Hgt);
404  }
void ScrollRangeInView(int32_t iY, int32_t iHgt)
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::ListBox::ScrollToBottom ( )
inlineinherited

Definition at line 1559 of file C4Gui.h.

References C4GUI::ScrollWindow::ScrollToBottom().

ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

void C4GUI::ListBox::SelectEntry ( Element pNewSel,
bool  fByUser 
)
inherited

Definition at line 591 of file C4GuiListBox.cpp.

References C4GUI::Element::GetParent(), C4GUI::ListBox::pClientWindow, C4GUI::ListBox::pSelectedItem, and C4GUI::ListBox::SelectionChanged().

Referenced by C4GUI::ListBox::CharIn(), C4StartupScenSelDlg::DeleteConfirm(), C4GUI::ListBox::SelectFirstEntry(), C4GUI::ListBox::SelectNone(), and C4StartupPlrSelDlg::SetSelection().

592  {
593  assert(!pNewSel || pNewSel->GetParent() == pClientWindow);
594  if (pSelectedItem == pNewSel) return;
595  pSelectedItem = pNewSel;
596  SelectionChanged(fByUser);
597  }
void SelectionChanged(bool fByUser)
Element * pSelectedItem
Definition: C4Gui.h:1510
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::ListBox::SelectFirstEntry ( bool  fByUser)
inlineinherited

Definition at line 1584 of file C4Gui.h.

References C4GUI::ListBox::GetFirst(), and C4GUI::ListBox::SelectEntry().

1584 { SelectEntry(GetFirst(), fByUser); }
Element * GetFirst()
Definition: C4Gui.h:1571
void SelectEntry(Element *pNewSel, bool fByUser)

Here is the call graph for this function:

void C4GUI::ListBox::SelectionChanged ( bool  fByUser)
inherited

Definition at line 574 of file C4GuiListBox.cpp.

References C4GUI::BaseCallbackHandler::DoCall(), C4GUI::ListBox::fSelectionDisabled, C4GUI::GUISound(), C4GUI::ListBox::pSelectedItem, C4GUI::ListBox::pSelectionChangeHandler, and C4GUI::ListBox::ScrollItemInView().

Referenced by C4GUI::ListBox::MouseInput(), C4GUI::ListBox::OnGetFocus(), C4GUI::ListBox::RemoveElement(), and C4GUI::ListBox::SelectEntry().

575  {
576  // selections disabled?
577  if (fSelectionDisabled) { pSelectedItem = nullptr; return; }
578  // any selection?
579  if (pSelectedItem)
580  {
581  // effect
582  if (fByUser) GUISound("UI::Select");
583  }
584  // callback (caution: May do periluous things...)
586  // let's hope it wasn't perilous enough to delete this,
587  // because scrolling the item into view must be done AFTER the callback, as the callback might resize
589  }
virtual void DoCall(class Element *pElement)=0
void GUISound(const char *szSound)
Definition: C4Gui.cpp:1178
BaseCallbackHandler * pSelectionChangeHandler
Definition: C4Gui.h:1511
Element * pSelectedItem
Definition: C4Gui.h:1510
void ScrollItemInView(Element *pItem)
bool fSelectionDisabled
Definition: C4Gui.h:1514

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::ListBox::SelectNone ( bool  fByUser)
inlineinherited

Definition at line 1585 of file C4Gui.h.

References C4GUI::ListBox::SelectEntry().

Referenced by C4StartupScenSelDlg::DoRefresh().

1585 { SelectEntry(nullptr, fByUser); }
void SelectEntry(Element *pNewSel, bool fByUser)

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 446 of file C4Gui.h.

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

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

446 { rcBounds=rcNewBound; UpdatePos(); UpdateSize(); }
virtual void UpdateSize()
Definition: C4Gui.cpp: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 C4PlayerInfoListBox::SetClientSoundIcon ( int32_t  iForClientID)

Definition at line 1235 of file C4PlayerInfoListBox.cpp.

References C4PlayerInfoListBox::ListItem::ID::PLI_CLIENT.

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

1236 {
1237  // get client element
1238  ListItem *pItem = GetPlayerListItem(ListItem::ID::PLI_CLIENT, iForClientID);
1239  if (pItem)
1240  {
1241  ClientListItem *pClientItem = static_cast<ClientListItem *>(pItem);
1242  pClientItem->SetSoundIcon();
1243  }
1244 }

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 C4PlayerInfoListBox::SetCustomFont ( CStdFont pNewFont,
uint32_t  dwTextColor 
)

Definition at line 1590 of file C4PlayerInfoListBox.cpp.

1591 {
1592  pCustomFont = pNewFont;
1593  this->dwTextColor = dwTextColor;
1594  // update done later by caller anyway
1595 }
void C4GUI::ListBox::SetDecoration ( bool  fDrawBG,
ScrollBarFacets pToGfx,
bool  fAutoScroll,
bool  fDrawBorder = false 
)
inlineinherited

Definition at line 1566 of file C4Gui.h.

References C4GUI::ListBox::fDrawBorder, and C4GUI::ScrollWindow::SetDecoration().

Referenced by C4GameOverDlg::C4GameOverDlg(), C4Network2ClientListDlg::C4Network2ClientListDlg(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupPlrSelDlg::C4StartupPlrSelDlg(), and C4StartupScenSelDlg::C4StartupScenSelDlg().

1567  { fDrawBackground=fDrawBG; this->fDrawBorder=fDrawBorder; if (pClientWindow) pClientWindow->SetDecoration(pToGfx, fAutoScroll); }
void SetDecoration(ScrollBarFacets *pToGfx, bool fAutoScroll)
Definition: C4Gui.h:977
bool fDrawBorder
Definition: C4Gui.h:1513
bool fDrawBackground
Definition: C4Gui.h:1512
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

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 C4PlayerInfoListBox::SetMode ( Mode  eNewMode)

Definition at line 1581 of file C4PlayerInfoListBox.cpp.

References Update().

Referenced by C4GameLobby::MainDlg::OnTabPlayers(), and C4GameLobby::MainDlg::OnTabTeams().

1582 {
1583  if (eMode != eNewMode)
1584  {
1585  eMode = eNewMode;
1586  Update();
1587  }
1588 }

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 C4GUI::Screen::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::ListBox::SetSelectionChangeCallbackFn ( BaseCallbackHandler pToHandler)
inlineinherited

Definition at line 1548 of file C4Gui.h.

References C4GUI::BaseCallbackHandler::DeRef(), and C4GUI::BaseCallbackHandler::Ref().

Referenced by C4PlayerInfoListBox(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupPlrSelDlg::C4StartupPlrSelDlg(), C4StartupScenSelDlg::C4StartupScenSelDlg(), and C4FileSelDlg::InitElements().

1549  {
1551  if ((pSelectionChangeHandler = pToHandler)) pToHandler->Ref();
1552  }
BaseCallbackHandler * pSelectionChangeHandler
Definition: C4Gui.h:1511

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::ListBox::SetSelectionDblClickFn ( BaseCallbackHandler pToHandler)
inlineinherited

Definition at line 1553 of file C4Gui.h.

References C4GUI::BaseCallbackHandler::DeRef(), and C4GUI::BaseCallbackHandler::Ref().

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

1554  {
1557  }
BaseCallbackHandler * pSelectionDblClickHandler
Definition: C4Gui.h:1511

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::ListBox::SetSelectionDiabled ( bool  fToVal = true)
inlineinherited

Definition at line 1568 of file C4Gui.h.

Referenced by C4GameOverDlg::C4GameOverDlg(), and C4Network2ClientListDlg::C4Network2ClientListDlg().

1568 { fSelectionDisabled = fToVal; }
bool fSelectionDisabled
Definition: C4Gui.h:1514

Here is the caller graph for this function:

void C4PlayerInfoListBox::SetTeamFilter ( int32_t  idNewTeamFilter)
inline

Definition at line 339 of file C4PlayerInfoListBox.h.

339 { iTeamFilter = idNewTeamFilter; }
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::ListBox::SortElements ( SortFunction  SortFunc,
void *  par 
)
inherited

Definition at line 636 of file C4GuiListBox.cpp.

References C4GUI::Container::GetElementCount(), C4GUI::Container::GetFirst(), C4GUI::Element::GetNext(), C4GUI::ListBox::pClientWindow, C4GUI::Container::ReaddElement(), and C4GUI::ListBox::UpdateElementPositions().

637  {
638  // sort list items:
639  // create an array of all list items, sort it, and reorder them afterwards
640  if (!pClientWindow) return;
641  int32_t iElemCount = pClientWindow->GetElementCount();
642  if (iElemCount <= 1) return;
643  Element **ppElements = new Element *[iElemCount];
644  try
645  {
646  int32_t i=0;
647  for (Element *pEl = pClientWindow->GetFirst(); pEl; pEl = pEl->GetNext())
648  ppElements[i++] = pEl;
649  std::sort(ppElements, ppElements+iElemCount, SortCompareElements(SortFunc, par));
650  for (i=0; i<iElemCount; ++i)
651  pClientWindow->ReaddElement(ppElements[i]);
652  }
653  catch (...)
654  {
655  delete [] ppElements;
656  throw;
657  }
658  delete [] ppElements;
660  }
void ReaddElement(Element *pChild)
void UpdateElementPositions()
Element * GetFirst()
Definition: C4Gui.h:829
Element * GetNext() const
Definition: C4Gui.h:449
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call 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 C4GUI::Screen::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::ListBox::UnFreezeScrolling ( )
inlineinherited

Definition at line 1563 of file C4Gui.h.

References C4GUI::ScrollWindow::UnFreeze().

1563 { pClientWindow->UnFreeze(); }
void UnFreeze()
Definition: C4Gui.h:970
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

void C4PlayerInfoListBox::Update ( )

Definition at line 1286 of file C4PlayerInfoListBox.cpp.

References C4Game::C4S, C4TeamList::CanLocalSeeTeam(), Game, C4GUI::ListBox::GetFirst(), C4PlayerInfoList::GetPlayerCount(), C4Scenario::Head, C4GUI::ListBox::IsScrollingActive(), PILBM_Evaluation, PILBM_EvaluationNoWinners, PILBM_LobbyClientSort, PILBM_LobbyTeamSort, C4Game::PlayerInfos, C4SHead::Replay, and C4Game::Teams.

Referenced by C4PlayerInfoListBox(), OnPlrListSelChange(), C4GameOverDlg::OnSec1Timer(), and SetMode().

1287 {
1288  if (fPlayerListUpdating) return;
1289  fPlayerListUpdating = true;
1290 
1291  // synchronize current list with what it should be
1292  // call update on all other list items
1293  ListItem *pCurrInList = static_cast<ListItem *>(GetFirst()); // list item being compared with the searched item
1294 
1295  // free savegame players first
1296  UpdateSavegamePlayers(&pCurrInList);
1297 
1298  // next comes the regular players, sorted either by clients or teams, or special sort for evaluation mode
1299  switch (eMode)
1300  {
1301  case PILBM_LobbyTeamSort:
1302  // sort by team
1303  if (Game.Teams.CanLocalSeeTeam())
1304  UpdatePlayersByTeam(&pCurrInList);
1305  else
1306  UpdatePlayersByRandomTeam(&pCurrInList);
1307  break;
1308 
1309  case PILBM_LobbyClientSort:
1310  // sort by client
1311  // replay players first?
1312  if (Game.C4S.Head.Replay) UpdateReplayPlayers(&pCurrInList);
1313  // script controlled players from the main list
1314  UpdateScriptPlayers(&pCurrInList);
1315  // regular players
1316  UpdatePlayersByClient(&pCurrInList);
1317  break;
1318 
1319  case PILBM_Evaluation:
1321  UpdatePlayersByEvaluation(&pCurrInList, eMode == PILBM_Evaluation);
1322  break;
1323  }
1324 
1325  // finally: remove any remaining list items at the end
1326  while (pCurrInList)
1327  {
1328  ListItem *pDel = pCurrInList;
1329  pCurrInList = static_cast<ListItem *>(pCurrInList->GetNext());
1330  delete pDel;
1331  }
1332 
1333  // update done
1334  fPlayerListUpdating = false;
1335 
1336  // check whether view needs to be collapsed
1337  if (!fIsCollapsed && IsScrollingActive() && !IsEvaluation())
1338  {
1339  // then collapse it, and update window
1340  iMaxUncollapsedPlayers = Game.PlayerInfos.GetPlayerCount()-1;
1341  fIsCollapsed = true;
1342  Update(); // recursive call!
1343  }
1344  else if (fIsCollapsed && Game.PlayerInfos.GetPlayerCount() <= iMaxUncollapsedPlayers)
1345  {
1346  // player count dropped below collapse-limit: uncollapse
1347  // note that this may again cause a collapse after that update, if scrolling was still necessary
1348  // however, it will then not recurse any further, because iMaxUncollapsedPlayers will have been updated
1349  fIsCollapsed = false;
1350  Update();
1351  }
1352 }
int32_t GetPlayerCount() const
C4Game Game
Definition: C4Globals.cpp:52
C4Scenario C4S
Definition: C4Game.h:76
bool Replay
Definition: C4Scenario.h:72
Element * GetFirst()
Definition: C4Gui.h:1571
C4TeamList & Teams
Definition: C4Game.h:72
bool CanLocalSeeTeam() const
Definition: C4Teams.cpp:328
C4PlayerInfoList & PlayerInfos
Definition: C4Game.h:73
C4SHead Head
Definition: C4Scenario.h:230
bool IsScrollingActive()
Definition: C4Gui.h:1581

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::ListBox::UpdateColumnCount ( )
protectedinherited

Definition at line 173 of file C4GuiListBox.cpp.

References C4GUI::Window::GetClientRect(), C4GUI::ListBox::iColCount, C4GUI::ListBox::iMultiColItemWidth, C4GUI::ListBox::pClientWindow, and C4Rect::Wdt.

Referenced by C4GUI::ListBox::ElementSizeChanged(), and C4GUI::ListBox::ListBox().

174  {
176  {
177  // multicoloumn-listbox
178  iColCount = std::max<int32_t>(pClientWindow->GetClientRect().Wdt / iMultiColItemWidth, 1);
179  }
180  else
181  {
182  // regular 1-col-listbox
183  iColCount = 1;
184  }
185  }
virtual C4Rect & GetClientRect()
Definition: C4Gui.h:864
int32_t iMultiColItemWidth
Definition: C4Gui.h:1507
int32_t Wdt
Definition: C4Rect.h:32
int32_t iColCount
Definition: C4Gui.h:1508
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::ListBox::UpdateElementPosition ( Element pOfElement,
int32_t  iIndent 
)
inherited

Definition at line 465 of file C4GuiListBox.cpp.

References C4GUI::Element::GetBounds(), C4GUI::ListBox::GetItemWidth(), C4GUI::ListBox::UpdateElementPositions(), C4GUI::Element::UpdateOwnPos(), C4Rect::Wdt, and C4Rect::x.

466  {
467  // resize it
468  C4Rect &rcChildBounds = pOfElement->GetBounds();
469  rcChildBounds.x = iIndent;
470  rcChildBounds.Wdt = GetItemWidth() - iIndent ;
471  pOfElement->UpdateOwnPos();
472  // re-stack elements
474  }
void UpdateElementPositions()
Definition: C4Rect.h:29
int32_t Wdt
Definition: C4Rect.h:32
int32_t x
Definition: C4Rect.h:32
int32_t GetItemWidth()
Definition: C4Gui.h:1545

Here is the call graph for this function:

void C4GUI::ListBox::UpdateElementPositions ( )
inherited

Definition at line 406 of file C4GuiListBox.cpp.

References C4GUI::Element::fVisible, C4GUI::Element::GetBounds(), C4GUI::Container::GetFirst(), C4GUI::Element::GetListItemTopSpacing(), C4GUI::Element::GetNext(), C4Rect::Hgt, C4GUI::ListBox::iColCount, C4GUI::ListBox::iMultiColItemWidth, C4GUI::ListBox::pClientWindow, C4GUI::Element::SetBounds(), C4GUI::ScrollWindow::SetClientHeight(), C4GUI::Element::UpdateOwnPos(), C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by C4GUI::ListBox::AfterElementRemoval(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupPlrSelDlg::C4StartupPlrSelDlg(), C4GUI::ListBox::ElementPosChanged(), C4GUI::ListBox::ElementSizeChanged(), C4GUI::ListBox::InsertElement(), C4GUI::ListBox::SortElements(), C4GUI::ListBox::UpdateElementPosition(), and C4GUI::ListBox::UpdateSize().

407  {
408  // safety
409  if (!pClientWindow) return;
410  // first item at zero offset
411  Element *pCurr = pClientWindow->GetFirst();
412  int iOverallHgt;
413  if (pCurr)
414  {
415  if (!iMultiColItemWidth)
416  {
417  // Single column box: All stacked vertically
418  if (pCurr->GetBounds().y)
419  {
420  pCurr->GetBounds().y = 0;
421  pCurr->UpdateOwnPos();
422  }
423  if(pCurr->fVisible) iOverallHgt = pCurr->GetBounds().Hgt;
424  else iOverallHgt = 0;
425  // others stacked under it
426  while ((pCurr = pCurr->GetNext()))
427  {
428  if(!pCurr->fVisible) continue; //Do not reserve space for hidden elements
429  int32_t iYSpace = pCurr->GetListItemTopSpacing();
430  int32_t iNewY = iOverallHgt + iYSpace;
431  iOverallHgt += pCurr->GetBounds().Hgt + iYSpace;
432  if (iNewY != pCurr->GetBounds().y)
433  {
434  pCurr->GetBounds().y = iNewY;
435  pCurr->UpdateOwnPos();
436  }
437  }
438  }
439  else
440  {
441  // Multi column box: Keep element size; reposition horizontally+vertically
442  int32_t y=0, iLineHgt=0, col=0;
443  for (; pCurr; pCurr=pCurr->GetNext())
444  {
445  const C4Rect &rcCurrBounds = pCurr->GetBounds();
446  iLineHgt = std::max<int32_t>(rcCurrBounds.Hgt, iLineHgt);
447  int32_t x = col * iMultiColItemWidth;
448  if (rcCurrBounds.x != x || rcCurrBounds.y != y || rcCurrBounds.Wdt != iMultiColItemWidth)
449  pCurr->SetBounds(C4Rect(x,y,iMultiColItemWidth,rcCurrBounds.Hgt));
450  if (++col >= iColCount)
451  {
452  col = 0;
453  y += iLineHgt;
454  }
455  }
456  iOverallHgt = y + iLineHgt;
457  }
458  }
459  else
460  iOverallHgt = 0;
461  // update scrolling
462  pClientWindow->SetClientHeight(iOverallHgt);
463  }
Definition: C4Rect.h:29
int32_t iMultiColItemWidth
Definition: C4Gui.h:1507
int32_t Wdt
Definition: C4Rect.h:32
int32_t y
Definition: C4Rect.h:32
Element * GetFirst()
Definition: C4Gui.h:829
C4Rect & GetBounds()
Definition: C4Gui.h:445
int32_t x
Definition: C4Rect.h:32
int32_t iColCount
Definition: C4Gui.h:1508
void SetClientHeight(int32_t iToHgt)
Definition: C4Gui.h:973
int32_t Hgt
Definition: C4Rect.h:32
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

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:

virtual void C4GUI::ListBox::UpdateSize ( )
inlinevirtualinherited

Reimplemented from C4GUI::Element.

Definition at line 1591 of file C4Gui.h.

References C4GUI::ListBox::UpdateElementPositions(), and C4GUI::Element::UpdateSize().

void UpdateElementPositions()
virtual void UpdateSize()
Definition: C4Gui.cpp:186
ScrollWindow * pClientWindow
Definition: C4Gui.h:1509

Here is the call graph for this function:

Friends And Related Function Documentation

friend class PlayerListItem
friend

Definition at line 344 of file C4PlayerInfoListBox.h.

friend class TeamListItem
friend

Definition at line 345 of file C4PlayerInfoListBox.h.

Member Data Documentation

bool C4GUI::Element::fDragging
protectedinherited

Definition at line 380 of file C4Gui.h.

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

bool C4GUI::ListBox::fDrawBackground
protectedinherited

Definition at line 1512 of file C4Gui.h.

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

bool C4GUI::ListBox::fDrawBorder
protectedinherited

Definition at line 1513 of file C4Gui.h.

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

bool C4GUI::ListBox::fSelectionDisabled
protectedinherited

Definition at line 1514 of file C4Gui.h.

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

int32_t C4GUI::ListBox::iColCount
protectedinherited
int32_t C4GUI::Element::iDragX
protectedinherited

Definition at line 379 of file C4Gui.h.

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

int32_t C4GUI::Element::iDragY
protectedinherited

Definition at line 379 of file C4Gui.h.

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

int32_t C4GUI::ListBox::iMultiColItemWidth
protectedinherited
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().

BaseCallbackHandler* C4GUI::ListBox::pSelectionChangeHandler
protectedinherited

Definition at line 1511 of file C4Gui.h.

Referenced by C4GUI::ListBox::SelectionChanged(), and C4GUI::ListBox::~ListBox().

BaseCallbackHandler * C4GUI::ListBox::pSelectionDblClickHandler
protectedinherited

Definition at line 1511 of file C4Gui.h.

Referenced by C4GUI::ListBox::MouseInput(), and C4GUI::ListBox::~ListBox().

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(), C4GUI::Screen::MouseInput(), C4GUI::MultilineLabel::MultilineLabel(), C4ChatControl::ChatSheet::NickItem::NickItem(), C4ScriptGuiWindow::OnMouseIn(), C4GUI::ContextMenu::Open(), C4GUI::Picture::Picture(), C4ScriptGuiWindow::ProcessMouseInput(), C4GUI::ProgressBar::ProgressBar(), C4GUI::Screen::Render(), 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: