* 0x004CC807 * * @param x * @param y * @param width * @param height * @param colour * @param count * @param itemHeight * @param flags * Custom Dropdown height if flags & (1<<6) is true */
| 507 | * Custom Dropdown height if flags & (1<<6) is true |
| 508 | */ |
| 509 | void show(int16_t x, int16_t y, int16_t width, int16_t height, AdvancedColour colour, size_t count, uint8_t itemHeight, uint8_t flags) |
| 510 | { |
| 511 | assert(count < std::numeric_limits<uint8_t>::max()); |
| 512 | |
| 513 | common::setColourAndInputFlags(colour, flags); |
| 514 | |
| 515 | WindowManager::close(WindowType::dropdown, 0); |
| 516 | _dropdownFlags = Flags::none; |
| 517 | |
| 518 | _dropdownColumnCount = 1; |
| 519 | _dropdownItemWidth = 0; |
| 520 | _dropdownItemWidth = width; |
| 521 | _dropdownItemHeight = 10; |
| 522 | |
| 523 | if (flags & (1 << 6)) |
| 524 | { |
| 525 | _dropdownItemHeight = itemHeight; |
| 526 | } |
| 527 | |
| 528 | flags &= ~(1 << 6); |
| 529 | |
| 530 | _dropdownItemCount = static_cast<uint16_t>(count); |
| 531 | _dropdownRowCount = 0; |
| 532 | _dropdownRowCount = static_cast<uint32_t>(count); |
| 533 | |
| 534 | int16_t dropdownHeight = (static_cast<int16_t>(count) * _dropdownItemHeight) + 3; |
| 535 | common::widgets[0].bottom = dropdownHeight; |
| 536 | dropdownHeight++; |
| 537 | Ui::Size size = { width, height }; |
| 538 | Ui::Point origin = { x, y }; |
| 539 | origin.y += height; |
| 540 | |
| 541 | size.height = dropdownHeight; |
| 542 | if ((size.height + origin.y) > Ui::height() || origin.y < 0) |
| 543 | { |
| 544 | origin.y -= (height + dropdownHeight); |
| 545 | auto dropdownBottom = origin.y; |
| 546 | |
| 547 | if (origin.y >= 0) |
| 548 | { |
| 549 | dropdownBottom = origin.y + dropdownHeight; |
| 550 | } |
| 551 | |
| 552 | if (origin.y < 0 || dropdownBottom > Ui::height()) |
| 553 | { |
| 554 | origin.x += width + 3; |
| 555 | origin.y = 0; |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | size.width = width + 3; |
| 560 | common::widgets[0].right = size.width; |
| 561 | size.width++; |
| 562 | |
| 563 | if (origin.x < 0) |
| 564 | { |
| 565 | origin.x = 0; |
| 566 | } |
no test coverage detected