From ff82c82f5224fb68e94a8903468162e0ff8160c4 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 10 Sep 2021 08:01:45 +0200 Subject: MSW-specific: Application Mode Buttons: Added the orange-ish background over the bold font to indicate selection (see comments for #6860) --- src/slic3r/GUI/Notebook.cpp | 24 ++++++++++++++++++++++-- src/slic3r/GUI/wxExtensions.cpp | 3 +++ src/slic3r/GUI/wxExtensions.hpp | 2 ++ 3 files changed, 27 insertions(+), 2 deletions(-) (limited to 'src/slic3r') diff --git a/src/slic3r/GUI/Notebook.cpp b/src/slic3r/GUI/Notebook.cpp index b328fc583..9c5ccb834 100644 --- a/src/slic3r/GUI/Notebook.cpp +++ b/src/slic3r/GUI/Notebook.cpp @@ -45,11 +45,12 @@ void ButtonsListCtrl::OnPaint(wxPaintEvent&) if (m_selection < 0 || m_selection >= (int)m_pageButtons.size()) return; - // highlight selected button - const wxColour& selected_btn_bg = Slic3r::GUI::wxGetApp().get_color_selected_btn_bg(); const wxColour& default_btn_bg = Slic3r::GUI::wxGetApp().get_highlight_default_clr(); const wxColour& btn_marker_color = Slic3r::GUI::wxGetApp().get_color_hovered_btn_label(); + + // highlight selected notebook button + for (int idx = 0; idx < int(m_pageButtons.size()); idx++) { wxButton* btn = m_pageButtons[idx]; @@ -63,6 +64,25 @@ void ButtonsListCtrl::OnPaint(wxPaintEvent&) dc.DrawRectangle(pos.x, pos.y + size.y, size.x, sz.y - size.y); } + // highlight selected mode button + + if (m_mode_sizer) { + const std::vector& mode_btns = m_mode_sizer->get_btns(); + for (int idx = 0; idx < int(mode_btns.size()); idx++) { + ModeButton* btn = mode_btns[idx]; + btn->SetBackgroundColour(btn->is_selected() ? selected_btn_bg : default_btn_bg); + + //wxPoint pos = btn->GetPosition(); + //wxSize size = btn->GetSize(); + //const wxColour& clr = btn->is_selected() ? btn_marker_color : default_btn_bg; + //dc.SetPen(clr); + //dc.SetBrush(clr); + //dc.DrawRectangle(pos.x, pos.y + size.y, size.x, sz.y - size.y); + } + } + + // Draw orange bottom line + dc.SetPen(btn_marker_color); dc.SetBrush(btn_marker_color); dc.DrawRectangle(1, sz.y - m_line_margin, sz.x, m_line_margin); diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 8903f3b30..a3d6384e0 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -672,6 +672,9 @@ void ModeButton::focus_button(const bool focus) Slic3r::GUI::wxGetApp().normal_font(); SetFont(new_font); +//#ifdef _WIN32 +// GetParent()->Refresh(); +//#else #ifndef _WIN32 SetForegroundColour(wxSystemSettings::GetColour(focus ? wxSYS_COLOUR_BTNTEXT : #if defined (__linux__) && defined (__WXGTK3__) diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index 1462e8aa0..25876bd23 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -283,6 +283,7 @@ public: void OnLeaveBtn(wxMouseEvent& event) { focus_button(m_is_selected); event.Skip(); } void SetState(const bool state); + bool is_selected() { return m_is_selected; } protected: void focus_button(const bool focus); @@ -312,6 +313,7 @@ public: void set_items_border(int border); void msw_rescale(); + const std::vector& get_btns() { return m_mode_btns; } private: std::vector m_mode_btns; -- cgit v1.2.3