mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
GCode Preview - New Layout
This commit is contained in:
parent
c550ad2268
commit
787a5f1715
7 changed files with 202 additions and 31 deletions
74
xs/src/slic3r/GUI/wxExtensions.cpp
Normal file
74
xs/src/slic3r/GUI/wxExtensions.cpp
Normal file
|
@ -0,0 +1,74 @@
|
|||
#include "wxExtensions.hpp"
|
||||
|
||||
const unsigned int wxCheckListBoxComboPopup::Height = 200;
|
||||
|
||||
wxCheckListBoxComboPopup::wxCheckListBoxComboPopup(wxWindowID id)
|
||||
: m_id(id)
|
||||
, m_text(wxEmptyString)
|
||||
{
|
||||
}
|
||||
|
||||
bool wxCheckListBoxComboPopup::Create(wxWindow* parent)
|
||||
{
|
||||
return wxCheckListBox::Create(parent, m_id, wxPoint(0, 0));
|
||||
}
|
||||
|
||||
wxWindow* wxCheckListBoxComboPopup::GetControl()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
void wxCheckListBoxComboPopup::SetStringValue(const wxString& value)
|
||||
{
|
||||
m_text = value;
|
||||
}
|
||||
|
||||
wxString wxCheckListBoxComboPopup::GetStringValue() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
wxSize wxCheckListBoxComboPopup::GetAdjustedSize(int minWidth, int prefHeight, int maxHeight)
|
||||
{
|
||||
// matches owner wxComboCtrl's width
|
||||
|
||||
wxComboCtrl* cmb = GetComboCtrl();
|
||||
if (cmb != nullptr)
|
||||
{
|
||||
wxSize size = GetComboCtrl()->GetSize();
|
||||
size.SetHeight(Height);
|
||||
return size;
|
||||
}
|
||||
else
|
||||
return wxSize(200, Height);
|
||||
}
|
||||
|
||||
void wxCheckListBoxComboPopup::OnCheckListBox(wxCommandEvent& evt)
|
||||
{
|
||||
// forwards the checklistbox event to the owner wxComboCtrl
|
||||
|
||||
wxComboCtrl* cmb = GetComboCtrl();
|
||||
if (cmb != nullptr)
|
||||
{
|
||||
wxCommandEvent event(wxEVT_CHECKLISTBOX, cmb->GetId());
|
||||
cmb->ProcessWindowEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void wxCheckListBoxComboPopup::OnListBoxSelection(wxCommandEvent& evt)
|
||||
{
|
||||
// transforms list box item selection event into checklistbox item toggle event
|
||||
|
||||
int selId = GetSelection();
|
||||
if (selId != wxNOT_FOUND)
|
||||
{
|
||||
Toggle((unsigned int)selId);
|
||||
SetSelection(wxNOT_FOUND);
|
||||
|
||||
wxCommandEvent event(wxEVT_CHECKLISTBOX, GetId());
|
||||
event.SetInt(selId);
|
||||
event.SetEventObject(this);
|
||||
event.SetString(GetString(selId));
|
||||
ProcessEvent(event);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue