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

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

Inheritance diagram for Slic3r::GUI::GridCellComboBoxRenderer:
Collaboration diagram for Slic3r::GUI::GridCellComboBoxRenderer:

Public Member Functions

virtual void Draw (wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, const wxRect &rect, int row, int col, bool isSelected) wxOVERRIDE
virtual wxSize GetBestSize (wxGrid &WXUNUSED(grid), wxGridCellAttr &attr, wxDC &dc, int WXUNUSED(row), int WXUNUSED(col)) wxOVERRIDE
virtual GridCellComboBoxRenderer * Clone () const wxOVERRIDE

Detailed Description

Member Function Documentation

◆ Clone()

GridCellComboBoxRenderer * Slic3r::GUI::GridCellComboBoxRenderer::Clone ( ) const
virtual
585{ return new GridCellComboBoxRenderer(); }

◆ Draw()

void Slic3r::GUI::GridCellComboBoxRenderer::Draw ( wxGrid & grid,
wxGridCellAttr & attr,
wxDC & dc,
const wxRect & rect,
int row,
int col,
bool isSelected )
virtual
553{
554 ObjectGridTable *table = dynamic_cast<ObjectGridTable *>(grid.GetTable());
555 wxRect text_rect = rect;
556
557 if (table) {
558 ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
559 ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
560 ConfigOptionInt & cur_option = dynamic_cast<ConfigOptionInt &>((*grid_row)[(ObjectGridTable::GridColType) col]);
561
562 wxBitmap *bitmap = table->get_color_bitmap((cur_option.value >= 1) ? cur_option.value - 1 : cur_option.value);
563 int bitmap_width = bitmap->GetWidth();
564 int bitmap_height = bitmap->GetHeight();
565 int offset_x = grid_cell_border_width;
566 int offset_y = (rect.height > bitmap_height) ? (rect.height - bitmap_height) / 2 : grid_cell_border_height;
567
568 dc.SetPen(*wxTRANSPARENT_PEN);
569 dc.SetBrush(wxBrush(attr.GetBackgroundColour()));
570 dc.DrawRectangle(rect);
571 dc.DrawBitmap(*bitmap, wxPoint(rect.x + offset_x, rect.y + offset_y));
572 text_rect.x += bitmap_width + grid_cell_border_width * 2;
573 text_rect.width -= (bitmap_width + grid_cell_border_width * 2);
574 }
575
576 wxGridCellChoiceRenderer::Draw(grid, attr, dc, text_rect, row, col, isSelected);
577}
GridColType
Definition GUI_ObjectTable.hpp:294
static const int grid_cell_border_width
Definition GUI_ObjectTable.cpp:61
static const int grid_cell_border_height
Definition GUI_ObjectTable.cpp:62
std::vector< ArithmeticOnly< T > > grid(const T &start, const T &stop, const T &stride)
A set of equidistant values starting from 'start' (inclusive), ending in the closest multiple of 'str...
Definition MTUtils.hpp:127

References Slic3r::GUI::ObjectGridTable::get_color_bitmap(), Slic3r::GUI::ObjectGridTable::get_grid_col(), Slic3r::GUI::ObjectGridTable::get_grid_row(), Slic3r::grid(), Slic3r::GUI::grid_cell_border_height, Slic3r::GUI::grid_cell_border_width, and Slic3r::ConfigOptionSingle< T >::value.

Here is the call graph for this function:

◆ GetBestSize()

wxSize Slic3r::GUI::GridCellComboBoxRenderer::GetBestSize ( wxGrid & WXUNUSEDgrid,
wxGridCellAttr & attr,
wxDC & dc,
int WXUNUSEDrow,
int WXUNUSEDcol )
virtual
580{
581 wxSize size{48, -1};
582 return size;
583}

References Slic3r::grid().

Here is the call graph for this function:

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