MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / Create

Method Create

Descent3/ConfigItem.cpp:152–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152bool ConfigItem::Create(NewUIGameWindow *parentwnd, int type, int flags, int x, int y, int w, int h, char *label,
153 int item_x) {
154 if (m_bAlive)
155 return false;
156 if (!parentwnd)
157 return false;
158 switch (type) {
159 case CIT_HOTSPOTLIST:
160 case CIT_SLIDER:
161 case CIT_ONOFFBUTTON:
162 case CIT_LISTBOX:
163 case CIT_YESNOBUTTON:
164 case CIT_RADIOBUTTON:
165 case CIT_CHECKBOX:
166 m_iType = type;
167 break;
168 default:
169 mprintf(0, "Bad config item type in Create\n");
170 return false;
171 }
172 if (!label)
173 return false;
174
175 m_hWnd = parentwnd;
176 m_iFlags = flags;
177
178 if ((m_iFlags & CIF_USEGROUP) && (type != CIT_RADIOBUTTON)) {
179 // only radiobutton items support the CIF_USEGROUP
180 mprintf(0, "CONFIGITEM: Only CIT_RADIOBUTTON supports CIF_USEGROUP flag\n");
181 m_iFlags &= ~CIF_USEGROUP;
182 Int3();
183 }
184
185 if (type == CIT_SLIDER) { // slider's need to have the label centered vertically
186 UITextItem item{label, UICOL_TEXT_NORMAL};
187 m_tLabel.Create(parentwnd, &item, x, y + 7, UIF_FIT);
188 } else {
189 if (!(m_iFlags & CIF_USEGROUP)) {
190 // create a regular label
191 UITextItem item{label, UICOL_TEXT_NORMAL};
192 m_tLabel.Create(parentwnd, &item, x, y, UIF_FIT);
193 } else {
194 // save the label text
195 m_labeltext = mem_strdup(label);
196 }
197 }
198
199 m_auxX = x;
200 m_auxY = y;
201 m_X = item_x;
202 m_Y = y;
203 m_W = w;
204 m_H = h;
205 return true;
206}
207
208bool ConfigItem::Create(NewUIGameWindow *parentwnd, int type, char *label, int x, int y, int w, int h, int initialvalue,
209 int flags, int item_x) {

Callers 1

AddMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected