mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-24 03:12:07 +00:00
ENH: add badge for StaticBox and StaticGroup
Change-Id: I8b6e7938de524102809784b078de337da789cde8 Jira: STUDIO-8858 (cherry picked from commit 9733ef0144aebb0c6e711b7d56c36a3d187f628a)
This commit is contained in:
33
src/slic3r/GUI/Widgets/StaticGroup.cpp
Normal file
33
src/slic3r/GUI/Widgets/StaticGroup.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "StaticGroup.hpp"
|
||||
|
||||
StaticGroup::StaticGroup(wxWindow *parent, wxWindowID id, const wxString &label)
|
||||
: wxStaticBox(parent, id, label)
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
Bind(wxEVT_PAINT, &StaticGroup::OnPaint, this);
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
void StaticGroup::ShowBadge(bool show)
|
||||
{
|
||||
if (show)
|
||||
badge = ScalableBitmap(this, "badge", 18);
|
||||
else
|
||||
badge = ScalableBitmap{};
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
||||
void StaticGroup::OnPaint(wxPaintEvent &evt)
|
||||
{
|
||||
wxStaticBox::OnPaint(evt);
|
||||
if (badge.bmp().IsOk()) {
|
||||
auto s = badge.bmp().GetScaledSize();
|
||||
wxPaintDC dc(this);
|
||||
dc.DrawBitmap(badge.bmp(), GetSize().x - s.x, 8);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user