| 241 | int GuiType::sMemberCount = _countof(sMembers); |
| 242 | |
| 243 | ResultType GuiType::AddControl(ResultToken &aResultToken, int aID, int aFlags, ExprTokenType *aParam[], int aParamCount) |
| 244 | { |
| 245 | auto ctrl_type = GuiControls(aID); |
| 246 | if (ctrl_type == GUI_CONTROL_INVALID) // Gui.Add(CtrlType) |
| 247 | { |
| 248 | LPTSTR ctrl_type_name = ParamIndexToString(0, _f_number_buf); // Pass buf for error-reporting purposes. |
| 249 | --aParamCount; // Exclude control type from param count. |
| 250 | ++aParam; // As above, but for the param array. |
| 251 | ctrl_type = GuiControlType::ConvertTypeName(ctrl_type_name); |
| 252 | if (ctrl_type == GUI_CONTROL_INVALID) |
| 253 | _o_throw(_T("Invalid control type."), ctrl_type_name); |
| 254 | } |
| 255 | _f_param_string_opt(options, 0); |
| 256 | _f_param_string_opt(text, 1); |
| 257 | Array *text_obj = nullptr; |
| 258 | if ( !ParamIndexIsOmitted(1) |
| 259 | && GuiControlType::TypeHasAttrib(ctrl_type, GuiControlType::TYPE_HAS_ITEMS) |
| 260 | && !(text_obj = TokenToArray(*aParam[1])) ) |
| 261 | { |
| 262 | return aResultToken.ParamError(aID ? 1 : 2, aParam[1], _T("Array")); |
| 263 | } |
| 264 | if (!mHwnd) |
| 265 | _o_throw(ERR_GUI_NO_WINDOW); |
| 266 | GuiControlType* pcontrol; |
| 267 | ResultType result = AddControl(ctrl_type, options, text, pcontrol, text_obj); |
| 268 | if (pcontrol) |
| 269 | { |
| 270 | pcontrol->AddRef(); |
| 271 | _o_return(pcontrol); |
| 272 | } // else: above already displayed an error message. |
| 273 | if (!result) |
| 274 | aResultToken.SetExitResult(result); |
| 275 | return result; |
| 276 | } |
| 277 | |
| 278 | ResultType GuiType::Invoke(ResultToken &aResultToken, int aID, int aFlags, ExprTokenType *aParam[], int aParamCount) |
| 279 | { |
nothing calls this directly
no test coverage detected