OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
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

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

Detailed Description

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

Definition at line 1942 of file C4Gui.h.

Member Typedef Documentation

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

Definition at line 1945 of file C4Gui.h.

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

Definition at line 1946 of file C4Gui.h.

Constructor & Destructor Documentation

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

Definition at line 1959 of file C4Gui.h.

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

Member Function Documentation

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

Definition at line 36 of file C4GuiComboBox.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4GUI::ComboBox_FillCB::ClearEntries ( )
inherited

Definition at line 58 of file C4GuiComboBox.cpp.

References C4GUI::Container::Clear().

59  {
60  pDrop->Clear();
61  }

Here is the call graph for this function:

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

Definition at line 1930 of file C4Gui.h.

References C4GUI::ComboBox_FillCB::FillDropDownCB().

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

Here is the call graph for this function:

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

Implements C4GUI::ComboBox_FillCB.

Definition at line 1953 of file C4Gui.h.

1954  { if (pCBClass && FillFunc) (pCBClass->*FillFunc)(this); }
bool C4GUI::ComboBox_FillCB::FindEntry ( const char *  szText)
inherited

Definition at line 45 of file C4GuiComboBox.cpp.

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

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

Here is the call graph for this function:

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

Implements C4GUI::ComboBox_FillCB.

Definition at line 1955 of file C4Gui.h.

1956  { if (pCBClass && SelFunc) return (pCBClass->*SelFunc)(pForCombo, idNewSelection); else return false; }
void C4GUI::ComboBox_FillCB::SelectEntry ( int32_t  iEntry)
inherited

Definition at line 53 of file C4GuiComboBox.cpp.

References C4GUI::ContextMenu::SelectItem().

54  {
55  pDrop->SelectItem(iEntry);
56  }
void SelectItem(int32_t iIndex)
Definition: C4GuiMenu.cpp:551

Here is the call graph for this function:


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