OpenClonk
C4GUI::ComboBox_FillCallback< CB > Class Template Reference

#include <C4Gui.h>

Inheritance diagram for C4GUI::ComboBox_FillCallback< CB >:
[legend]
Collaboration diagram for C4GUI::ComboBox_FillCallback< CB >:
[legend]

Public Types

typedef void(CB::* ComboFillFunc) (ComboBox_FillCB *pFiller)
 
typedef bool(CB::* ComboSelFunc) (ComboBox *pForCombo, int32_t idNewSelection)
 

Public Member Functions

 ComboBox_FillCallback (CB *pCBClass, ComboFillFunc FillFunc, ComboSelFunc SelFunc)
 
void FillDropDown (ComboBox *pComboBox, ContextMenu *pDropdownList)
 
void AddEntry (const char *szText, int32_t id)
 
bool FindEntry (const char *szText)
 
void ClearEntries ()
 
void SelectEntry (int32_t iEntry)
 

Protected Member Functions

void FillDropDownCB () override
 
bool OnComboSelChange (ComboBox *pForCombo, int32_t idNewSelection) override
 

Detailed Description

template<class CB>
class C4GUI::ComboBox_FillCallback< CB >

Definition at line 1943 of file C4Gui.h.

Member Typedef Documentation

◆ ComboFillFunc

template<class CB >
typedef void(CB::* C4GUI::ComboBox_FillCallback< CB >::ComboFillFunc) (ComboBox_FillCB *pFiller)

Definition at line 1946 of file C4Gui.h.

◆ ComboSelFunc

template<class CB >
typedef bool(CB::* C4GUI::ComboBox_FillCallback< CB >::ComboSelFunc) (ComboBox *pForCombo, int32_t idNewSelection)

Definition at line 1947 of file C4Gui.h.

Constructor & Destructor Documentation

◆ ComboBox_FillCallback()

template<class CB >
C4GUI::ComboBox_FillCallback< CB >::ComboBox_FillCallback ( CB *  pCBClass,
ComboFillFunc  FillFunc,
ComboSelFunc  SelFunc 
)
inline

Definition at line 1960 of file C4Gui.h.

1960  :
1961  pCBClass(pCBClass), FillFunc(FillFunc), SelFunc(SelFunc) { }

Member Function Documentation

◆ AddEntry()

void C4GUI::ComboBox_FillCB::AddEntry ( const char *  szText,
int32_t  id 
)
inherited

Definition at line 34 of file C4GuiComboBox.cpp.

35  {
36  if (!szText) szText = "";
38  Handler *pHandler = new Handler(pCombo, &ComboBox::OnCtxComboSelect);
39  pHandler->SetExtra(ComboBox::ComboMenuCBStruct(szText, id));
40  pDrop->AddItem(szText, FormatString(LoadResStr("IDS_MSG_SELECT"), szText).getData(), Ico_Empty, pHandler);
41  }
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270
void OnCtxComboSelect(C4GUI::Element *pListItem, const ComboMenuCBStruct &rNewSel)
void AddItem(const char *szText, const char *szToolTip=nullptr, Icons icoIcon=Ico_None, MenuHandler *pMenuHandler=nullptr, ContextHandler *pSubmenuHandler=nullptr)
Definition: C4Gui.h:1874
@ Ico_Empty
Definition: C4Gui.h:639

References C4GUI::ContextMenu::AddItem(), FormatString(), C4GUI::Ico_Empty, LoadResStr(), and C4GUI::ComboBox::OnCtxComboSelect().

Referenced by C4TeamList::FillTeamDistOptions(), C4FileSelDlg::OnLocationComboFill(), and C4StartupModsDlg::OnSortComboFill().

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

◆ ClearEntries()

void C4GUI::ComboBox_FillCB::ClearEntries ( )
inherited

Definition at line 56 of file C4GuiComboBox.cpp.

57  {
58  pDrop->Clear();
59  }

References C4GUI::Container::Clear().

Here is the call graph for this function:

◆ FillDropDown()

void C4GUI::ComboBox_FillCB::FillDropDown ( ComboBox pComboBox,
ContextMenu pDropdownList 
)
inlineinherited

Definition at line 1931 of file C4Gui.h.

1932  { pCombo = pComboBox; pDrop = pDropdownList; FillDropDownCB(); }
virtual void FillDropDownCB()=0

References C4GUI::ComboBox_FillCB::FillDropDownCB().

Here is the call graph for this function:

◆ FillDropDownCB()

template<class CB >
void C4GUI::ComboBox_FillCallback< CB >::FillDropDownCB ( )
inlineoverrideprotectedvirtual

Implements C4GUI::ComboBox_FillCB.

Definition at line 1954 of file C4Gui.h.

1955  { if (pCBClass && FillFunc) (pCBClass->*FillFunc)(this); }

◆ FindEntry()

bool C4GUI::ComboBox_FillCB::FindEntry ( const char *  szText)
inherited

Definition at line 43 of file C4GuiComboBox.cpp.

44  {
45  // check for entry with same name
46  ContextMenu::Entry *pEntry; int32_t idx=0;
47  while ((pEntry = pDrop->GetIndexedEntry(idx++))) if (SEqual(pEntry->GetText(), szText)) return true;
48  return false;
49  }
bool SEqual(const char *szStr1, const char *szStr2)
Definition: Standard.h:93
friend class Entry
Definition: C4Gui.h:1889
Entry * GetIndexedEntry(int32_t iIndex)
Definition: C4Gui.h:1880

References C4GUI::ContextMenu::GetIndexedEntry(), C4GUI::ContextMenu::Entry::GetText(), and SEqual().

Here is the call graph for this function:

◆ OnComboSelChange()

template<class CB >
bool C4GUI::ComboBox_FillCallback< CB >::OnComboSelChange ( ComboBox pForCombo,
int32_t  idNewSelection 
)
inlineoverrideprotectedvirtual

Implements C4GUI::ComboBox_FillCB.

Definition at line 1956 of file C4Gui.h.

1957  { if (pCBClass && SelFunc) return (pCBClass->*SelFunc)(pForCombo, idNewSelection); else return false; }

◆ SelectEntry()

void C4GUI::ComboBox_FillCB::SelectEntry ( int32_t  iEntry)
inherited

Definition at line 51 of file C4GuiComboBox.cpp.

52  {
53  pDrop->SelectItem(iEntry);
54  }
void SelectItem(int32_t iIndex)
Definition: C4GuiMenu.cpp:549

References C4GUI::ContextMenu::SelectItem().

Here is the call graph for this function:

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