mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-31 20:00:37 -07:00
FIX: StaticGroup constriant layout badge on macOS
Change-Id: Ia93c91b990ec3f5fef3eae57d48ca71b4a0841e6 Jira: STUDIO-10383 (cherry picked from commit 88521a06d12cd4ebbcb8e98d8c929e9815aa71de)
This commit is contained in:
parent
09df1248c0
commit
e746ef0451
4 changed files with 13 additions and 24 deletions
|
|
@ -10,6 +10,8 @@ StaticGroup::StaticGroup(wxWindow *parent, wxWindowID id, const wxString &label)
|
|||
#endif
|
||||
}
|
||||
|
||||
void StaticGroup_layoutBadge(void * group, void * badge);
|
||||
|
||||
void StaticGroup::ShowBadge(bool show)
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
|
|
@ -24,7 +26,7 @@ void StaticGroup::ShowBadge(bool show)
|
|||
badge = new ScalableButton(this, wxID_ANY, "badge", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 18);
|
||||
badge->SetSize(badge->GetBestSize());
|
||||
badge->SetBackgroundColour("#F7F7F7");
|
||||
LayoutBadge();
|
||||
StaticGroup_layoutBadge(GetHandle(), badge->GetHandle());
|
||||
}
|
||||
if (badge && badge->IsShown() != show)
|
||||
badge->Show(show);
|
||||
|
|
@ -69,22 +71,3 @@ void StaticGroup::PaintForeground(wxDC &dc, const struct tagRECT &rc)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __WXOSX__
|
||||
|
||||
void StaticGroup::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
auto size = GetSize();
|
||||
wxStaticBox::DoSetSize(x, y, width, height, sizeFlags);
|
||||
if (badge && size != GetSize())
|
||||
LayoutBadge();
|
||||
}
|
||||
|
||||
void StaticGroup::LayoutBadge()
|
||||
{
|
||||
auto size = GetSize();
|
||||
auto size2 = size - badge->GetSize();
|
||||
badge->SetPosition({size2.x - 6, 0});
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@ private:
|
|||
void OnPaint(wxPaintEvent &evt);
|
||||
void PaintForeground(wxDC &dc, const struct tagRECT &rc) override;
|
||||
#endif
|
||||
#ifdef __WXOSX__
|
||||
void DoSetSize(int x, int y, int width, int height, int sizeFlags) override;
|
||||
void LayoutBadge();
|
||||
#endif
|
||||
|
||||
private:
|
||||
#ifdef __WXMSW__
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ void set_tag_when_enter_full_screen(bool isfullscreen);
|
|||
void set_title_colour_after_set_title(void * window);
|
||||
void initGestures(void * view, wxEvtHandler * handler);
|
||||
void openFolderForFile(wxString const & file);
|
||||
void StaticGroup_layoutBadge(void * group, void * badge);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -417,3 +417,12 @@ void initGestures(void * view, wxEvtHandler * handler)
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
void StaticGroup_layoutBadge(void * group, void * badge)
|
||||
{
|
||||
NSView * vg = (NSView *)group;
|
||||
NSView * vb = (NSView *)badge;
|
||||
vb.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[vg addConstraint: [NSLayoutConstraint constraintWithItem:vb attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:vg attribute:NSLayoutAttributeTop multiplier:1.0 constant:15]];
|
||||
[vg addConstraint: [NSLayoutConstraint constraintWithItem:vb attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:vg attribute:NSLayoutAttributeRight multiplier:1.0 constant:-1]];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue