mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-20 23:31:13 -06:00
Add the full source of BambuStudio
using version 1.0.10
This commit is contained in:
parent
30bcadab3e
commit
1555904bef
3771 changed files with 1251328 additions and 0 deletions
92
src/slic3r/GUI/Widgets/SideMenuPopup.cpp
Normal file
92
src/slic3r/GUI/Widgets/SideMenuPopup.cpp
Normal file
|
@ -0,0 +1,92 @@
|
|||
#include "SideMenuPopup.hpp"
|
||||
#include "Label.hpp"
|
||||
|
||||
#include <wx/dcgraph.h>
|
||||
|
||||
|
||||
|
||||
wxBEGIN_EVENT_TABLE(SidePopup,wxPopupTransientWindow)
|
||||
EVT_PAINT(SidePopup::paintEvent)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
SidePopup::SidePopup(wxWindow* parent)
|
||||
:wxPopupTransientWindow(parent,
|
||||
wxBORDER_NONE |
|
||||
wxPU_CONTAINS_CONTROLS)
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
SetDoubleBuffered(true);
|
||||
#endif //__WINDOWS__
|
||||
|
||||
}
|
||||
|
||||
SidePopup::~SidePopup()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void SidePopup::OnDismiss()
|
||||
{
|
||||
wxPopupTransientWindow::OnDismiss();
|
||||
}
|
||||
|
||||
bool SidePopup::ProcessLeftDown(wxMouseEvent& event)
|
||||
{
|
||||
return wxPopupTransientWindow::ProcessLeftDown(event);
|
||||
}
|
||||
bool SidePopup::Show( bool show )
|
||||
{
|
||||
return wxPopupTransientWindow::Show(show);
|
||||
}
|
||||
|
||||
void SidePopup::Popup(wxWindow* focus)
|
||||
{
|
||||
Create();
|
||||
if (focus) {
|
||||
wxPoint pos = focus->ClientToScreen(wxPoint(0, -6));
|
||||
Position(pos, {0, focus->GetSize().y + 12});
|
||||
}
|
||||
wxPopupTransientWindow::Popup();
|
||||
}
|
||||
|
||||
void SidePopup::Create()
|
||||
{
|
||||
wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
int max_width = 0;
|
||||
int height = 0;
|
||||
for (auto btn : btn_list)
|
||||
{
|
||||
max_width = std::max(btn->GetMinSize().x, max_width);
|
||||
}
|
||||
|
||||
for (auto btn : btn_list)
|
||||
{
|
||||
wxSize size = btn->GetMinSize();
|
||||
height += size.y;
|
||||
size.x = max_width;
|
||||
btn->SetMinSize(size);
|
||||
btn->SetSize(size);
|
||||
sizer->Add(btn, 0, 0, 0);
|
||||
}
|
||||
|
||||
SetSize(wxSize(max_width, height));
|
||||
|
||||
SetSizer(sizer, true);
|
||||
|
||||
Layout();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void SidePopup::paintEvent(wxPaintEvent& evt)
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
wxSize size = GetSize();
|
||||
dc.SetBrush(wxTransparentColour);
|
||||
dc.DrawRectangle(0, 0, size.x, size.y);
|
||||
}
|
||||
|
||||
void SidePopup::append_button(SideButton* btn)
|
||||
{
|
||||
btn_list.push_back(btn);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue