| 623 | } |
| 624 | |
| 625 | void onMouseDown(WidgetIndex widgetIndex) override |
| 626 | { |
| 627 | auto* widget = &widgets[widgetIndex]; |
| 628 | const auto widgetDesc = _info.GetCustomWidgetDesc(this, widgetIndex); |
| 629 | if (widgetDesc != nullptr) |
| 630 | { |
| 631 | if (widgetDesc->Type == "colourpicker") |
| 632 | { |
| 633 | WindowDropdownShowColour(this, widget, colours[widget->colour], widgetDesc->Colour); |
| 634 | } |
| 635 | else if (widgetDesc->Type == "dropdown") |
| 636 | { |
| 637 | widget--; |
| 638 | auto selectedIndex = widgetDesc->SelectedIndex; |
| 639 | const auto& items = widgetDesc->Items; |
| 640 | const auto numItems = std::min<size_t>(items.size(), Dropdown::kItemsMaxSize); |
| 641 | for (size_t i = 0; i < numItems; i++) |
| 642 | { |
| 643 | gDropdown.items[i] = Dropdown::MenuLabel(items[i].c_str()); |
| 644 | } |
| 645 | WindowDropdownShowTextCustomWidth( |
| 646 | { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[widget->colour], 0, |
| 647 | Dropdown::Flag::StayOpen, numItems, widget->width() - 4); |
| 648 | |
| 649 | if (selectedIndex >= 0 && selectedIndex < static_cast<int32_t>(numItems)) |
| 650 | gDropdown.items[selectedIndex].setChecked(true); |
| 651 | } |
| 652 | else if (widgetDesc->Type == "spinner") |
| 653 | { |
| 654 | if (widget->text == STR_NUMERIC_DOWN) |
| 655 | { |
| 656 | InvokeEventHandler(_info.Owner, widgetDesc->OnDecrement); |
| 657 | } |
| 658 | else if (widget->text == STR_NUMERIC_UP) |
| 659 | { |
| 660 | InvokeEventHandler(_info.Owner, widgetDesc->OnIncrement); |
| 661 | } |
| 662 | } |
| 663 | else if (widgetDesc->Type == "textbox") |
| 664 | { |
| 665 | WindowStartTextbox(*this, widgetIndex, widgetDesc->Text, widgetDesc->MaxLength + 1); |
| 666 | } |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override |
| 671 | { |
nothing calls this directly
no test coverage detected