OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
SidePopup Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Widgets/SideMenuPopup.hpp>

Inheritance diagram for SidePopup:
Collaboration diagram for SidePopup:

Public Member Functions

 SidePopup (wxWindow *parent)
 ~SidePopup ()
void Create ()
virtual void Popup (wxWindow *focus=NULL) wxOVERRIDE
virtual void OnDismiss () wxOVERRIDE
virtual bool ProcessLeftDown (wxMouseEvent &event) wxOVERRIDE
virtual bool Show (bool show=true) wxOVERRIDE
void append_button (SideButton *btn)
void paintEvent (wxPaintEvent &evt)
bool Create (wxWindow *parent, int flags=wxBORDER_NONE)

Protected Member Functions

virtual bool ShouldDismissOnTopWindowDeactivate ()

Private Attributes

std::vector< SideButton * > btn_list

Detailed Description

Constructor & Destructor Documentation

◆ SidePopup()

SidePopup::SidePopup ( wxWindow * parent)

References append_button(), paintEvent(), ProcessLeftDown(), and Show().

Here is the call graph for this function:

◆ ~SidePopup()

SidePopup::~SidePopup ( )
32{
33 ;
34}

Member Function Documentation

◆ append_button()

void SidePopup::append_button ( SideButton * btn)
125{
126 btn_list.push_back(btn);
127}
std::vector< SideButton * > btn_list
Definition SideMenuPopup.hpp:20

References btn_list.

Referenced by SidePopup(), and Slic3r::GUI::MainFrame::create_side_tools().

Here is the caller graph for this function:

◆ Create() [1/2]

bool PopupWindow::Create ( wxWindow * parent,
int flags = wxBORDER_NONE )
inherited
22{
23 if (!wxPopupTransientWindow::Create(parent, style))
24 return false;
25#ifdef __WXGTK__
26 GetTopParent(parent)->Bind(wxEVT_ACTIVATE, &PopupWindow::topWindowActiavate, this);
27#endif
28#ifdef __WXOSX__
29 if (style & wxPU_CONTAINS_CONTROLS)
30 for (auto evt : {wxEVT_LEFT_DOWN, wxEVT_LEFT_UP, wxEVT_LEFT_DCLICK, wxEVT_MOTION, wxEVT_MOUSEWHEEL})
31 Bind(evt, &PopupWindow::OnMouseEvent2, this);
32#endif
33 return true;
34}
static wxWindow * GetTopParent(wxWindow *pWindow)
Definition PopupWindow.cpp:10
#define style
Definition WipeTowerDialog.cpp:101

References GetTopParent(), and style.

Referenced by PopupWindow(), and DropDown::Create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Create() [2/2]

void SidePopup::Create ( )
88{
89 wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
90
91 int max_width = 0;
92 int height = 0;
93 for (auto btn : btn_list)
94 {
95 max_width = std::max(btn->GetMinSize().x, max_width);
96 }
97
98 for (auto btn : btn_list)
99 {
100 wxSize size = btn->GetMinSize();
101 height += size.y;
102 size.x = max_width;
103 btn->SetMinSize(size);
104 btn->SetSize(size);
105 sizer->Add(btn, 0, 0, 0);
106 }
107
108 SetSize(wxSize(max_width, height));
109
110 SetSizer(sizer, true);
111
112 Layout();
113 Refresh();
114}
coord_t height(const BoundingBox &box)
Definition Arrange.cpp:1185

References btn_list.

Referenced by Popup().

Here is the caller graph for this function:

◆ OnDismiss()

void SidePopup::OnDismiss ( )
virtual
37{
38 Slic3r::GUI::wxGetApp().set_side_menu_popup_status(false);
39 PopupWindow::OnDismiss();
40}

◆ paintEvent()

void SidePopup::paintEvent ( wxPaintEvent & evt)
117{
118 wxPaintDC dc(this);
119 wxSize size = GetSize();
120 dc.SetBrush(wxTransparentColour);
121 dc.DrawRectangle(0, 0, size.x, size.y);
122}

Referenced by SidePopup(), and wxBEGIN_EVENT_TABLE().

Here is the caller graph for this function:

◆ Popup()

void SidePopup::Popup ( wxWindow * focus = NULL)
virtual
52{
53 Create();
54 auto drect = wxDisplay(GetParent()).GetGeometry();
55 int screenwidth = drect.x + drect.width;
56 //int screenwidth = wxSystemSettings::GetMetric(wxSYS_SCREEN_X,NULL);
57
58 int max_width = 0;
59
60 for (auto btn : btn_list)
61 {
62 max_width = std::max(btn->GetMinSize().x, max_width);
63 }
64 if (focus) {
65 wxPoint pos = focus->ClientToScreen(wxPoint(0, -6));
66 int anchor_h = focus->GetSize().y + 12;
67
68#ifdef __APPLE__
69 pos.x = pos.x - FromDIP(20);
70 // Orca #12936: since the wxWidgets 3.3 upgrade the transient popup is dismissed the
71 // instant the cursor enters the gap between the button and the menu, making
72 // "Print -> Export" unselectable. Anchor the menu flush against the button (slight
73 // overlap) so there is no dead-zone for the cursor to cross.
74 pos.y = focus->ClientToScreen(wxPoint(0, 0)).y;
75 anchor_h = focus->GetSize().y - 2;
76#endif // __APPLE__
77
78 if (pos.x + max_width > screenwidth)
79 Position({pos.x - (pos.x + max_width - screenwidth), pos.y}, {0, anchor_h});
80 else
81 Position(pos, {0, anchor_h});
82 }
83 Slic3r::GUI::wxGetApp().set_side_menu_popup_status(true);
84 PopupWindow::Popup();
85}
void Create()
Definition SideMenuPopup.cpp:87
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16

References btn_list, and Create().

Referenced by Slic3r::GUI::MainFrame::create_side_tools().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessLeftDown()

bool SidePopup::ProcessLeftDown ( wxMouseEvent & event)
virtual
43{
44 return PopupWindow::ProcessLeftDown(event);
45}

Referenced by SidePopup().

Here is the caller graph for this function:

◆ ShouldDismissOnTopWindowDeactivate()

virtual bool PopupWindow::ShouldDismissOnTopWindowDeactivate ( )
inlineprotectedvirtualinherited

Reimplemented in DropDown.

28{ return true; }

◆ Show()

bool SidePopup::Show ( bool show = true)
virtual
47{
48 return PopupWindow::Show(show);
49}

Referenced by SidePopup().

Here is the caller graph for this function:

Member Data Documentation

◆ btn_list

std::vector<SideButton*> SidePopup::btn_list
private

Referenced by append_button(), Create(), and Popup().


The documentation for this class was generated from the following files: