MCPcopy Create free account
hub / github.com/OpenImageDebugger/OpenImageDebugger / icon_button

Function icon_button

src/host/ui/panels/icon_button.h:39–54  ·  view source on GitHub ↗

Qt-parity icon button: fixed 26px square by default (the legacy Qt frontend's QToolButtons were fixed width 26; see tag legacy-qt), fontello glyph as label. `checked` (when non-null) renders the button in the active color, mirroring a checked QToolButton. `size` lets in-row callers match a neighboring widget's height (e.g. the AC editor's reset buttons beside its input fields).

Source from the content-addressed store, hash-verified

37// QToolButton. `size` lets in-row callers match a neighboring widget's
38// height (e.g. the AC editor's reset buttons beside its input fields).
39inline bool icon_button(const char* glyph,
40 const char* tooltip,
41 const bool* checked = nullptr,
42 const ImVec2& size = ImVec2(26.0f, 26.0f)) {
43 const bool on = checked != nullptr && *checked;
44 if (on) {
45 ImGui::PushStyleColor(ImGuiCol_Button,
46 ImGui::GetStyleColorVec4(ImGuiCol_ButtonActive));
47 }
48 const bool clicked = ImGui::Button(glyph, size);
49 if (on) {
50 ImGui::PopStyleColor();
51 }
52 ImGui::SetItemTooltip("%s", tooltip);
53 return clicked;
54}
55
56} // namespace oid::host
57

Callers 2

draw_contrast_panelFunction · 0.85
draw_toolbarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected