| 496 | } |
| 497 | |
| 498 | bool imguiCheck(const char* text, bool checked, bool enabled) |
| 499 | { |
| 500 | g_state.widgetId++; |
| 501 | unsigned int id = (g_state.areaId<<16) | g_state.widgetId; |
| 502 | |
| 503 | int x = g_state.widgetX; |
| 504 | int y = g_state.widgetY - BUTTON_HEIGHT; |
| 505 | int w = g_state.widgetW; |
| 506 | int h = BUTTON_HEIGHT; |
| 507 | g_state.widgetY -= BUTTON_HEIGHT + DEFAULT_SPACING; |
| 508 | |
| 509 | bool over = enabled && inRect(x, y, w, h); |
| 510 | bool res = buttonLogic(id, over); |
| 511 | |
| 512 | const int cx = x+BUTTON_HEIGHT/2-CHECK_SIZE/2; |
| 513 | const int cy = y+BUTTON_HEIGHT/2-CHECK_SIZE/2; |
| 514 | addGfxCmdRoundedRect((float)cx-3, (float)cy-3, (float)CHECK_SIZE+6, (float)CHECK_SIZE+6, 4, imguiRGBA(128,128,128, isActive(id)?196:96)); |
| 515 | if (checked) |
| 516 | { |
| 517 | if (enabled) |
| 518 | addGfxCmdRoundedRect((float)cx, (float)cy, (float)CHECK_SIZE, (float)CHECK_SIZE, (float)CHECK_SIZE/2-1, imguiRGBA(255,255,255,isActive(id)?255:200)); |
| 519 | else |
| 520 | addGfxCmdRoundedRect((float)cx, (float)cy, (float)CHECK_SIZE, (float)CHECK_SIZE, (float)CHECK_SIZE/2-1, imguiRGBA(128,128,128,200)); |
| 521 | } |
| 522 | |
| 523 | if (enabled) |
| 524 | 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)); |
| 525 | else |
| 526 | addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128,128,128,200)); |
| 527 | |
| 528 | return res; |
| 529 | } |
| 530 | |
| 531 | bool imguiCollapse(const char* text, const char* subtext, bool checked, bool enabled) |
| 532 | { |
no test coverage detected