34 #include "render/graphics.h"
53 mHighlightColor(getThemeColor(
ThemeColorId::HIGHLIGHT, 255U)),
57 mWrappingEnabled(false),
118 for (
int i = 0; i < columns_nr; i++)
210 for (
int row = 0; row < rows; ++row)
212 for (
int column = 0; column < columns; ++column)
215 if (widget !=
nullptr)
218 this, widget, row, column));
237 const int width = rect.
width;
238 const int height = rect.
height;
239 const int y = rect.
y;
252 int first_row = -(
y / rHeight);
259 unsigned int max_rows_nr;
269 if (max_rows_nr < rows_nr)
270 rows_nr = max_rows_nr;
274 const unsigned first_column = 0;
275 const unsigned last_column1 =
CAST_U32(
278 int y_offset = first_row * rHeight;
280 for (
unsigned int r =
CAST_U32(first_row);
286 for (
unsigned c = first_column; c + 1 <= last_column1; ++c)
292 if (widget !=
nullptr)
294 Rect bounds(x_offset, y_offset, cWidth, rHeight);
321 x_offset, y_offset, cWidth, rHeight));
325 widget->
draw(graphics);
355 const int width = rect.
width;
356 const int height = rect.
height;
357 const int y = rect.
y;
370 int first_row = -(
y / rHeight);
376 1 + height / rHeight);
377 unsigned int max_rows_nr;
387 if (max_rows_nr < rows_nr)
388 rows_nr = max_rows_nr;
392 const unsigned int first_column = 0;
393 const unsigned int last_column1 =
CAST_U32(
396 int y_offset = first_row * rHeight;
398 for (
unsigned int r =
CAST_U32(first_row);
404 for (
unsigned c = first_column; c + 1 <= last_column1; ++c)
410 if (widget !=
nullptr)
412 Rect bounds(x_offset, y_offset, cWidth, rHeight);
439 x_offset, y_offset, cWidth, rHeight));
536 if (row > -1 && column > -1 &&
537 row < mModel->getRows() && column < mModel->getColumns())
574 const int x = std::max(0, event.
getX());
575 const int y = std::max(0, event.
getY());
609 if (row > -1 && column > -1)
637 for (column = 0; column < colnum; column ++)
644 if (column >= colnum)
653 if (focusHandler ==
nullptr)
660 for (
int r = 0; r < rows; ++r)
662 for (
int c = 0; c < cols ; ++c)
virtual void popClipArea()
virtual void fillRectangle(const Rect &rectangle)=0
virtual void setColor(const Color &color)
virtual void pushClipArea(const Rect &area)
void mouseDragged(MouseEvent &event)
void mouseWheelMovedUp(MouseEvent &event)
void installActionListeners()
void mouseWheelMovedDown(MouseEvent &event)
void mousePressed(MouseEvent &event)
const TableModel * getModel() const
Widget * getWidgetAt(int x, int y)
GuiTable(const Widget2 *const widget, TableModel *const initial_model, const Opaque opacity)
void setSelected(const int row, const int column)
void setFocusHandler(FocusHandler *const focusHandler)
void moveToTop(Widget *const widget)
int getSelectedColumn() const
void moveToBottom(Widget *const widget)
void modelUpdated(const bool completed)
void keyPressed(KeyEvent &event)
int getColumnForX(const int x) const
void setModel(TableModel *const m)
std::vector< GuiTableActionListener * > mActionListeners2
int getSelectedRow() const
void safeDraw(Graphics *const graphics)
friend class GuiTableActionListener
void setSelectedRow(const int selected)
void draw(Graphics *const graphics)
int getRowForY(const int y) const
void setSelectedColumn(const int selected)
void recomputeDimensions()
int getColumnWidth(const int i) const
void uninstallActionListeners()
void removeDragged(const Widget *const widget)
MouseButtonT getButton() const
bool isPointInRect(const int x_, const int y_) const
virtual void removeListener(TableModelListener *const listener)
virtual int getRows() const =0
virtual int getColumnWidth(const int index) const =0
virtual Widget * getElementAt(const int row, const int column) const =0
virtual void installListener(TableModelListener *const listener)
virtual int getRowHeight() const =0
virtual int getColumns() const =0
void delete_all(Container &c)
#define BLOCK_START(name)