OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::SwitcherImage Class Reference

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

Inheritance diagram for Slic3r::GUI::SwitcherImage:
Collaboration diagram for Slic3r::GUI::SwitcherImage:

Public Member Functions

void setShowState (bool show_state)
void paintEvent (wxPaintEvent &evt)
void render (wxDC &dc)
void doRender (wxDC &dc)
 SwitcherImage (wxWindow *parent, wxWindowID id, std::string file_name, const wxSize &size, const wxPoint &pos=wxDefaultPosition)
 ~SwitcherImage ()

Public Attributes

bool m_show_state = {false}
wxColour m_colour
ScalableBitmap m_switcher
std::string m_file_name

Detailed Description

Constructor & Destructor Documentation

◆ SwitcherImage()

Slic3r::GUI::SwitcherImage::SwitcherImage ( wxWindow * parent,
wxWindowID id,
std::string file_name,
const wxSize & size,
const wxPoint & pos = wxDefaultPosition )
829{
830 wxWindow::Create(parent, id, pos, size);
831 SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE));
832 m_show_state = true;
833 m_switcher = ScalableBitmap(this, file_name, 16);
834 m_file_name = file_name;
835 SetSize(size);
836 SetMinSize(size);
837 SetMaxSize(size);
838
839
840 Bind(wxEVT_PAINT, &SwitcherImage::paintEvent, this);
841}
bool m_show_state
Definition AMSItem.hpp:444
ScalableBitmap m_switcher
Definition AMSItem.hpp:446
void paintEvent(wxPaintEvent &evt)
Definition AMSItem.cpp:790
std::string m_file_name
Definition AMSItem.hpp:447
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219

References StateColor::darkModeColorFor(), m_file_name, m_show_state, m_switcher, and paintEvent().

Here is the call graph for this function:

◆ ~SwitcherImage()

Slic3r::GUI::SwitcherImage::~SwitcherImage ( )
843{}

Member Function Documentation

◆ doRender()

void Slic3r::GUI::SwitcherImage::doRender ( wxDC & dc)
818{
819 auto size = GetSize();
820 if (m_show_state){
821 dc.SetPen(*wxTRANSPARENT_PEN);
822 dc.SetBrush(*wxWHITE);
823 dc.DrawBitmap(m_switcher.bmp(), wxPoint((size.x - m_switcher.GetBmpSize().x) / 2, 0));
824 }
825 Layout();
826}

References m_show_state, and m_switcher.

Referenced by render().

Here is the caller graph for this function:

◆ paintEvent()

void Slic3r::GUI::SwitcherImage::paintEvent ( wxPaintEvent & evt)
791{
792 wxPaintDC dc(this);
793 render(dc);
794}
void render(wxDC &dc)
Definition AMSItem.cpp:796

References render().

Referenced by SwitcherImage().

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

◆ render()

void Slic3r::GUI::SwitcherImage::render ( wxDC & dc)
797{
798#ifdef __WXMSW__
799 wxSize size = GetSize();
800 wxMemoryDC memdc;
801 wxBitmap bmp(size.x, size.y);
802 memdc.SelectObject(bmp);
803 memdc.Blit({0, 0}, size, &dc, {0, 0});
804
805 {
806 wxGCDC dc2(memdc);
807 doRender(dc2);
808 }
809
810 memdc.SelectObject(wxNullBitmap);
811 dc.DrawBitmap(bmp, 0, 0);
812#else
813 doRender(dc);
814#endif
815}
void doRender(wxDC &dc)
Definition AMSItem.cpp:817

References doRender().

Referenced by paintEvent().

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

◆ setShowState()

void Slic3r::GUI::SwitcherImage::setShowState ( bool show_state)
inline
439{ m_show_state = show_state; };

References m_show_state.

Member Data Documentation

◆ m_colour

wxColour Slic3r::GUI::SwitcherImage::m_colour

◆ m_file_name

std::string Slic3r::GUI::SwitcherImage::m_file_name

Referenced by SwitcherImage().

◆ m_show_state

bool Slic3r::GUI::SwitcherImage::m_show_state = {false}
444{false};

Referenced by SwitcherImage(), doRender(), and setShowState().

◆ m_switcher

ScalableBitmap Slic3r::GUI::SwitcherImage::m_switcher

Referenced by SwitcherImage(), and doRender().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Widgets/AMSItem.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Widgets/AMSItem.cpp