| 529 | } |
| 530 | |
| 531 | bool imguiCollapse(const char* text, const char* subtext, bool checked, bool enabled) |
| 532 | { |
| 533 | g_state.widgetId++; |
| 534 | unsigned int id = (g_state.areaId<<16) | g_state.widgetId; |
| 535 | |
| 536 | int x = g_state.widgetX; |
| 537 | int y = g_state.widgetY - BUTTON_HEIGHT; |
| 538 | int w = g_state.widgetW; |
| 539 | int h = BUTTON_HEIGHT; |
| 540 | g_state.widgetY -= BUTTON_HEIGHT; // + DEFAULT_SPACING; |
| 541 | |
| 542 | const int cx = x+BUTTON_HEIGHT/2-CHECK_SIZE/2; |
| 543 | const int cy = y+BUTTON_HEIGHT/2-CHECK_SIZE/2; |
| 544 | |
| 545 | bool over = enabled && inRect(x, y, w, h); |
| 546 | bool res = buttonLogic(id, over); |
| 547 | |
| 548 | if (checked) |
| 549 | addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 2, imguiRGBA(255,255,255,isActive(id)?255:200)); |
| 550 | else |
| 551 | addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 1, imguiRGBA(255,255,255,isActive(id)?255:200)); |
| 552 | |
| 553 | if (enabled) |
| 554 | addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200)); |
| 555 | else |
| 556 | addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128,128,128,200)); |
| 557 | |
| 558 | if (subtext) |
| 559 | addGfxCmdText(x+w-BUTTON_HEIGHT/2, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_RIGHT, subtext, imguiRGBA(255,255,255,128)); |
| 560 | |
| 561 | return res; |
| 562 | } |
| 563 | |
| 564 | void imguiLabel(const char* text) |
| 565 | { |
nothing calls this directly
no test coverage detected