| 665 | Object *GuiControlType::sPrototypes[GUI_CONTROL_TYPE_COUNT]; |
| 666 | |
| 667 | void GuiControlType::DefineControlClasses() |
| 668 | { |
| 669 | auto gui_class = (Object *)g_script.FindGlobalVar(_T("Gui"), 3)->Object(); |
| 670 | |
| 671 | sPrototype = CreatePrototype(_T("Gui.Control"), Object::sPrototype, sMembers, _countof(sMembers)); |
| 672 | sPrototypeList = CreatePrototype(_T("Gui.List"), sPrototype, sMembersList, _countof(sMembersList)); |
| 673 | auto ctrl_class = CreateClass(sPrototype); |
| 674 | auto list_class = CreateClass(sPrototypeList); |
| 675 | ctrl_class->SetBase(Object::sClass); |
| 676 | list_class->SetBase(ctrl_class); |
| 677 | gui_class->DefineClass(_T("Control"), ctrl_class); |
| 678 | gui_class->DefineClass(_T("List"), list_class); |
| 679 | |
| 680 | for (int i = GUI_CONTROL_INVALID + 1; i < GUI_CONTROL_TYPE_COUNT; ++i) |
| 681 | { |
| 682 | if (i == GUI_CONTROL_TAB2 || i == GUI_CONTROL_TAB3) |
| 683 | continue; |
| 684 | |
| 685 | // Determine base prototype and control-type-specific members. |
| 686 | Object *base_proto = sPrototype, *base_class = ctrl_class; |
| 687 | ObjectMember *more_items = nullptr; |
| 688 | int how_many = 0; |
| 689 | switch (i) |
| 690 | { |
| 691 | case GUI_CONTROL_TAB: more_items = sMembersTab; how_many = _countof(sMembersTab); // Fall through: |
| 692 | case GUI_CONTROL_DROPDOWNLIST: |
| 693 | case GUI_CONTROL_COMBOBOX: |
| 694 | case GUI_CONTROL_LISTBOX: base_proto = sPrototypeList; base_class = list_class; break; |
| 695 | case GUI_CONTROL_DATETIME: more_items = sMembersDate; how_many = _countof(sMembersDate); break; |
| 696 | case GUI_CONTROL_LISTVIEW: more_items = sMembersLV; how_many = _countof(sMembersLV); break; |
| 697 | case GUI_CONTROL_TREEVIEW: more_items = sMembersTV; how_many = _countof(sMembersTV); break; |
| 698 | case GUI_CONTROL_STATUSBAR: more_items = sMembersSB; how_many = _countof(sMembersSB); break; |
| 699 | } |
| 700 | TCHAR buf[32]; |
| 701 | _sntprintf(buf, 32, _T("Gui.%s"), sTypeNames[i]); |
| 702 | sPrototypes[i] = CreatePrototype(buf, base_proto, more_items, how_many); |
| 703 | auto cls = CreateClass(sPrototypes[i]); |
| 704 | cls->SetBase(base_class); |
| 705 | gui_class->DefineClass(sTypeNames[i], cls); |
| 706 | } |
| 707 | } |
| 708 | |
| 709 | Object *GuiControlType::GetPrototype(GuiControls aType) |
| 710 | { |
nothing calls this directly
no test coverage detected