ENH: StaticGroup badge on macOS
Change-Id: Id446e12aec7780f46c341083a7ad8c81ccf4a4f0 Jira: STUDIO-10055
This commit is contained in:
parent
52d6e2f46e
commit
5e6eacccf1
|
@ -7,17 +7,28 @@ StaticGroup::StaticGroup(wxWindow *parent, wxWindowID id, const wxString &label)
|
||||||
SetForegroundColour("#CECECE");
|
SetForegroundColour("#CECECE");
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
Bind(wxEVT_PAINT, &StaticGroup::OnPaint, this);
|
Bind(wxEVT_PAINT, &StaticGroup::OnPaint, this);
|
||||||
#else
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaticGroup::ShowBadge(bool show)
|
void StaticGroup::ShowBadge(bool show)
|
||||||
{
|
{
|
||||||
|
#ifdef __WXMSW__
|
||||||
if (show)
|
if (show)
|
||||||
badge = ScalableBitmap(this, "badge", 18);
|
badge = ScalableBitmap(this, "badge", 18);
|
||||||
else
|
else
|
||||||
badge = ScalableBitmap{};
|
badge = ScalableBitmap{};
|
||||||
Refresh();
|
Refresh();
|
||||||
|
#endif
|
||||||
|
#ifdef __WXOSX__
|
||||||
|
if (show && badge == nullptr) {
|
||||||
|
badge = new ScalableButton(this, wxID_ANY, "badge", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 18);
|
||||||
|
badge->SetSize(badge->GetBestSize());
|
||||||
|
badge->SetBackgroundColour("#F7F7F7");
|
||||||
|
LayoutBadge();
|
||||||
|
}
|
||||||
|
if (badge)
|
||||||
|
badge->Show(show);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
|
@ -59,3 +70,21 @@ void StaticGroup::PaintForeground(wxDC &dc, const struct tagRECT &rc)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __WXOSX__
|
||||||
|
|
||||||
|
void StaticGroup::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
|
{
|
||||||
|
wxStaticBox::DoSetSize(x, y, width, height, sizeFlags);
|
||||||
|
if (badge)
|
||||||
|
LayoutBadge();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StaticGroup::LayoutBadge()
|
||||||
|
{
|
||||||
|
auto size = GetSize();
|
||||||
|
auto size2 = size - badge->GetSize();
|
||||||
|
badge->SetPosition({size2.x - 6, 0});
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -18,9 +18,18 @@ private:
|
||||||
void OnPaint(wxPaintEvent &evt);
|
void OnPaint(wxPaintEvent &evt);
|
||||||
void PaintForeground(wxDC &dc, const struct tagRECT &rc) override;
|
void PaintForeground(wxDC &dc, const struct tagRECT &rc) override;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __WXOSX__
|
||||||
|
void DoSetSize(int x, int y, int width, int height, int sizeFlags) override;
|
||||||
|
void LayoutBadge();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#ifdef __WXMSW__
|
||||||
ScalableBitmap badge;
|
ScalableBitmap badge;
|
||||||
|
#endif
|
||||||
|
#ifdef __WXOSX__
|
||||||
|
ScalableButton * badge { nullptr };
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !slic3r_GUI_StaticGroup_hpp_
|
#endif // !slic3r_GUI_StaticGroup_hpp_
|
||||||
|
|
Loading…
Reference in New Issue