MSW-specific: Application Mode Buttons: Added the orange-ish background over the bold font to indicate selection

(see comments for #6860)
This commit is contained in:
YuSanka 2021-09-10 08:01:45 +02:00
parent 0abab45efa
commit ff82c82f52
3 changed files with 27 additions and 2 deletions

View File

@ -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<ModeButton*>& 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);

View File

@ -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__)

View File

@ -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<ModeButton*>& get_btns() { return m_mode_btns; }
private:
std::vector<ModeButton*> m_mode_btns;