93{
94 ObjectGridTable *table =
dynamic_cast<ObjectGridTable *
>(
grid.GetTable());
95
96 wxGridCellRenderer::Draw(
grid, attr, dc, rect, row, col, isSelected);
97 if (table) {
98 ObjectGridTable::ObjectGridCol* grid_col = table->get_grid_col(col);
99 if (!grid_col || !grid_col->b_icon) {
100 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": cell (%1%, %2%) not icon type") %row %col;
101 return;
102 }
103 ObjectGridTable::ObjectGridRow* grid_row = table->get_grid_row(row - 1);
106 if (cur_option == orig_option) {
107
108 return;
109 }
110
111 table->m_icon_row_height =
grid.GetRowSize(row);
112 table->m_icon_col_width =
grid.GetColSize(col);
113
114 wxBitmap& bitmap = table->get_undo_bitmap();
115 int bitmap_width = bitmap.GetWidth();
116 int bitmap_height = bitmap.GetHeight();
117 int offset_x = (table->m_icon_col_width - bitmap_width)/2;
118 int offset_y = (table->m_icon_row_height - bitmap_height)/2;
119
120 #ifdef __WXOSX_COCOA__
121 auto lock_pos = wxPoint(rect.x + offset_x, rect.y + offset_y);
122 auto left = (28 - 12) / 2;
123 auto top = (32 - 12) / 2;
125 lock_pos.y += top;
126 dc.DrawBitmap(bitmap, lock_pos);
127 #else
128 dc.DrawBitmap(bitmap, wxPoint(rect.x + offset_x, rect.y + offset_y));
129 #endif
130
131
132
133
134 }
135 else {
136
137 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": no table found, should not happen" << std::endl;
138 }
139}
GridColType
Definition GUI_ObjectTable.hpp:294
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
@ left
Definition MarchingSquares.hpp:188