diff --git a/src/ui/elements/ui_button.cpp b/src/ui/elements/ui_button.cpp index 83b5f99..3d0a867 100644 --- a/src/ui/elements/ui_button.cpp +++ b/src/ui/elements/ui_button.cpp @@ -21,6 +21,8 @@ namespace recompui { set_color(Color{ 204, 204, 204, 255 }); set_tab_index(TabIndex::Auto); hover_style.set_color(Color{ 242, 242, 242, 255 }); + disabled_style.set_color(Color{ 204, 204, 204, 128 }); + hover_disabled_style.set_color(Color{ 242, 242, 242, 128 }); const uint8_t border_opacity = 204; const uint8_t background_opacity = 13; @@ -32,6 +34,10 @@ namespace recompui { set_background_color({ 185, 125, 242, background_opacity }); hover_style.set_border_color({ 185, 125, 242, border_hover_opacity }); hover_style.set_background_color({ 185, 125, 242, background_hover_opacity }); + disabled_style.set_border_color({ 185, 125, 242, border_opacity / 4 }); + disabled_style.set_background_color({ 185, 125, 242, background_opacity / 4 }); + hover_disabled_style.set_border_color({ 185, 125, 242, border_hover_opacity / 4 }); + hover_disabled_style.set_background_color({ 185, 125, 242, background_hover_opacity / 4 }); break; } case ButtonStyle::Secondary: { @@ -39,6 +45,10 @@ namespace recompui { set_background_color({ 23, 214, 232, background_opacity }); hover_style.set_border_color({ 23, 214, 232, border_hover_opacity }); hover_style.set_background_color({ 23, 214, 232, background_hover_opacity }); + disabled_style.set_border_color({ 23, 214, 232, border_opacity / 4 }); + disabled_style.set_background_color({ 23, 214, 232, background_opacity / 4 }); + hover_disabled_style.set_border_color({ 23, 214, 232, border_hover_opacity / 4 }); + hover_disabled_style.set_background_color({ 23, 214, 232, background_hover_opacity / 4 }); break; } default: @@ -46,11 +56,6 @@ namespace recompui { break; } - disabled_style.set_border_color({ 128, 128, 128, border_hover_opacity }); - disabled_style.set_background_color({ 128, 128, 128, background_hover_opacity }); - hover_disabled_style.set_border_color({ 196, 196, 196, border_hover_opacity }); - hover_disabled_style.set_background_color({ 196, 196, 196, background_hover_opacity }); - add_style(&hover_style, hover_state); add_style(&disabled_style, disabled_state); add_style(&hover_disabled_style, { hover_state, disabled_state }); @@ -61,8 +66,10 @@ namespace recompui { void Button::process_event(const Event &e) { switch (e.type) { case EventType::Click: - for (const auto &function : pressed_callbacks) { - function(); + if (is_enabled()) { + for (const auto &function : pressed_callbacks) { + function(); + } } break; case EventType::Hover: diff --git a/src/ui/ui_mod_details_panel.cpp b/src/ui/ui_mod_details_panel.cpp index dc851df..df847a9 100644 --- a/src/ui/ui_mod_details_panel.cpp +++ b/src/ui/ui_mod_details_panel.cpp @@ -60,14 +60,13 @@ ModDetailsPanel::ModDetailsPanel(Element *parent) : Element(parent) { enable_toggle->add_checked_callback(std::bind(&ModDetailsPanel::enable_toggle_checked, this, std::placeholders::_1)); configure_button = context.create_element