MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / OnCreateCtrl

Method OnCreateCtrl

engine/Poseidon/UI/DisplayUIMenus.cpp:82–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80
81// Login display
82
83Control* DisplayLogin::OnCreateCtrl(int type, int idc, const ParamEntry& cls)
84{
85 if (idc == IDC_LOGIN_USER)
86 {
87 // CCombo *combo = new CCombo(this, idc, cls);
88 C3DListBox* ctrl = new C3DListBox(this, idc, cls);
89
90 auto profiles = ProfileManager::EnumerateProfiles(GamePaths::Instance().UserDir());
91 for (const auto& profile : profiles)
92 {
93 ctrl->AddString(profile.name.c_str());
94 }
95 ctrl->SortItems();
96 ctrl->SetCurSel(0);
97 for (int i = 0; i < ctrl->GetSize(); i++)
98 {
99 if (Glob.header.playerName == ctrl->GetText(i))
100 {
101 ctrl->SetCurSel(i);
102 }
103 }
104 return ctrl;
105 }
106 return Display::OnCreateCtrl(type, idc, cls);
107}
108
109void DisplayLogin::OnButtonClicked(int idc)

Callers

nothing calls this directly

Calls 15

EnumerateProfilesFunction · 0.85
LocalizeStringFunction · 0.85
GetPublicKeyFunction · 0.85
AddStringMethod · 0.80
SortItemsMethod · 0.80
SetMaxCharsMethod · 0.80
SetThumbPosMethod · 0.80
EnableCtrlMethod · 0.80
RStringClass · 0.50
SetCurSelMethod · 0.45
GetSizeMethod · 0.45
GetTextMethod · 0.45

Tested by

no test coverage detected