OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::Search::SearchListModel Class Reference

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

Inheritance diagram for Slic3r::Search::SearchListModel:
Collaboration diagram for Slic3r::Search::SearchListModel:

Public Types

enum  { colIcon , colMarkedText , colMax }

Public Member Functions

 SearchListModel (wxWindow *parent)
void Clear ()
void Prepend (const std::string &text)
void msw_rescale ()
unsigned int GetColumnCount () const override
wxString GetColumnType (unsigned int col) const override
void GetValueByRow (wxVariant &variant, unsigned int row, unsigned int col) const override
bool GetAttrByRow (unsigned int row, unsigned int col, wxDataViewItemAttr &attr) const override
bool SetValueByRow (const wxVariant &variant, unsigned int row, unsigned int col) override

Private Attributes

std::vector< std::pair< wxString, int > > m_values
ScalableBitmap m_icon [5]

Detailed Description

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
colIcon 
colMarkedText 
colMax 
@ colMarkedText
Definition Search.hpp:209
@ colMax
Definition Search.hpp:209
@ colIcon
Definition Search.hpp:209

Constructor & Destructor Documentation

◆ SearchListModel()

Slic3r::Search::SearchListModel::SearchListModel ( wxWindow * parent)
657 : wxDataViewVirtualListModel(0)
658{
659 int icon_id = 0;
660 for (const std::string icon : {"cog", "printer", "printer", "spool", "blank_16"}) m_icon[icon_id++] = ScalableBitmap(parent, icon);
661}
ScalableBitmap m_icon[5]
Definition Search.hpp:206

References m_icon.

Member Function Documentation

◆ Clear()

void Slic3r::Search::SearchListModel::Clear ( )
664{
665 m_values.clear();
666 Reset(0);
667}
std::vector< std::pair< wxString, int > > m_values
Definition Search.hpp:205

References m_values.

◆ GetAttrByRow()

bool Slic3r::Search::SearchListModel::GetAttrByRow ( unsigned int row,
unsigned int col,
wxDataViewItemAttr & attr ) const
inlineoverride
224{ return true; }

◆ GetColumnCount()

unsigned int Slic3r::Search::SearchListModel::GetColumnCount ( ) const
inlineoverride
221{ return colMax; }

References colMax.

◆ GetColumnType()

wxString Slic3r::Search::SearchListModel::GetColumnType ( unsigned int col) const
override
686{
687 if (col == colIcon) return "wxBitmap";
688 return "string";
689}

References colIcon.

◆ GetValueByRow()

void Slic3r::Search::SearchListModel::GetValueByRow ( wxVariant & variant,
unsigned int row,
unsigned int col ) const
override
692{
693 switch (col) {
694 case colIcon: variant << m_icon[m_values[row].second].bmp(); break;
695 case colMarkedText: variant = m_values[row].first; break;
696 case colMax: wxFAIL_MSG("invalid column");
697 default: break;
698 }
699}

References colIcon, colMarkedText, colMax, m_icon, and m_values.

◆ msw_rescale()

void Slic3r::Search::SearchListModel::msw_rescale ( )
681{
682 for (ScalableBitmap &bmp : m_icon) bmp.msw_rescale();
683}

References m_icon.

◆ Prepend()

void Slic3r::Search::SearchListModel::Prepend ( const std::string & text)
670{
671 const char icon_c = label.at(0);
672 int icon_idx = icon_idxs.at(icon_c);
673 wxString str = from_u8(label).Remove(0, 1);
674
675 m_values.emplace_back(str, icon_idx);
676
677 RowPrepended();
678}
static const std::map< const char, int > icon_idxs
Definition Search.cpp:438
wxString from_u8(const std::string &str)
Definition GUI.cpp:544

References Slic3r::from_u8(), Slic3r::Search::icon_idxs, and m_values.

Here is the call graph for this function:

◆ SetValueByRow()

bool Slic3r::Search::SearchListModel::SetValueByRow ( const wxVariant & variant,
unsigned int row,
unsigned int col )
inlineoverride
225{ return false; }

Member Data Documentation

◆ m_icon

ScalableBitmap Slic3r::Search::SearchListModel::m_icon[5]
private

◆ m_values

std::vector<std::pair<wxString, int> > Slic3r::Search::SearchListModel::m_values
private

Referenced by Clear(), GetValueByRow(), and Prepend().


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