Styling management for buttons and matching all button styles (#8184)

* Add button styling

* Fix dark mode compability

* printable area button

* Connection dialog icons

* Add aligment control

* Fix alignment

* add new styles

* Update BedShapeDialog.cpp

* Use darker text color on dark mode

* update code

* Update

* update

* Update

* Update WipeTowerDialog.cpp

* update

* Update Button.cpp

* update

* Update Button.cpp

* add enums for style and type

* update

* Update Button.cpp

* fix

* update

* Update DialogButtons.cpp

* Update UnsavedChangesDialog.cpp

* update

* update

* update

* Update Button.cpp

* cleanup

---------

Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
yw4z
2025-07-17 15:44:45 +03:00
committed by GitHub
parent 37d8bec3e1
commit e9e069c167
17 changed files with 199 additions and 583 deletions

View File

@@ -136,25 +136,8 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
m_optgroup->append_single_option_line("host_type");
auto create_sizer_with_btn = [](wxWindow* parent, Button** btn, const std::string& icon_name, const wxString& label) {
*btn = new Button(parent, label, ""/*icon_name*/, 0, parent->FromDIP(16));
(*btn)->SetFont(Label::Body_14);
(*btn)->SetMinSize(wxSize(parent->FromDIP(120), parent->FromDIP(26)));
(*btn)->SetSize(wxSize(parent->FromDIP(120), parent->FromDIP(26)));
(*btn)->SetCornerRadius(parent->FromDIP(4));
StateColor clr_bg = StateColor(
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Pressed),
std::pair(wxColour("#D4D4D4"), (int)StateColor::Hovered),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Normal),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Enabled)
);
(*btn)->SetBackgroundColor(clr_bg);
(*btn)->SetBorderColor(clr_bg);
(*btn)->SetTextColor(StateColor(
std::pair(wxColour("#6B6A6A"), (int)StateColor::Disabled),
std::pair(wxColour("#262E30"), (int)StateColor::Hovered),
std::pair(wxColour("#262E30"), (int)StateColor::Normal)
));
*btn = new Button(parent, label);
(*btn)->SetStyle(ButtonStyle::Regular, ButtonType::Parameter);
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(*btn);
@@ -253,6 +236,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
//add_scaled_button(parent, &m_printhost_port_browse_btn, "browse", _(L("Refresh Printers")), wxBU_LEFT | wxBU_EXACTFIT);
auto sizer = create_sizer_with_btn(parent, &m_printhost_port_browse_btn, "monitor_signal_strong", _L("Refresh") + " " + dots);
Button* btn = m_printhost_port_browse_btn;
btn->SetStyle(ButtonStyle::Regular, ButtonType::Parameter);
btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) { update_printers(); });
return sizer;
};