15 #ifndef GUI_WIDGETS_GRID_HPP_INCLUDED
16 #define GUI_WIDGETS_GRID_HPP_INCLUDED
35 explicit tgrid(
const unsigned rows = 0,
const unsigned cols = 0);
59 static const unsigned BORDER_ALL = BORDER_TOP | BORDER_BOTTOM | BORDER_LEFT
123 const unsigned flags,
124 const unsigned border_size);
144 twidget* new_parent =
nullptr);
239 virtual bool can_wrap()
const override;
259 const std::vector<twidget*>& call_stack)
override;
263 const bool must_be_active)
override;
267 const bool must_be_active)
const override;
274 const bool must_be_active)
const override;
305 void set_rows_cols(
const unsigned rows,
const unsigned cols);
419 return itor_->widget();
423 return itor_->widget();
479 return children_[rows_ * col +
row];
483 return children_[rows_ * col +
row];
492 int y_offset)
override;
void set_single_child(tgrid &grid, twidget *widget)
Sets the single child in a grid.
static const unsigned HORIZONTAL_SHIFT
void remove_child(const unsigned row, const unsigned col)
Removes and frees a widget in a cell.
unsigned cols_
The number of grid columns.
void reduce_height(const unsigned maximum_height)
Tries to reduce the height of a container.
static const unsigned BORDER_BOTTOM
static const unsigned BORDER_ALL
bool operator==(const iterator &i) const
void set_row_grow_factor(const unsigned row, const unsigned factor)
Sets the grow factor for a row.
virtual void demand_reduce_height(const unsigned maximum_height) override
See twidget::demand_reduce_height.
bool operator!=(const iterator &i) const
virtual void layout_children() override
See twidget::layout_children.
static const unsigned HORIZONTAL_MASK
tgrid(const unsigned rows=0, const unsigned cols=0)
virtual bool can_mouse_focus() const override
Whether the mouse move/click event go 'through' this widget.
static const unsigned HORIZONTAL_ALIGN_RIGHT
virtual void impl_draw_children(surface &frame_buffer, int x_offset, int y_offset) override
See twidget::impl_draw_children.
static const unsigned VERTICAL_GROW_SEND_TO_CLIENT
unsigned int get_rows() const
virtual void place(const tpoint &origin, const tpoint &size) override
See twidget::place.
static const unsigned HORIZONTAL_GROW_SEND_TO_CLIENT
tpoint recalculate_best_size()
Recalculates the best size.
bool disable_click_dismiss() const override
See twidget::disable_click_dismiss.
static const unsigned BORDER_RIGHT
twidget * widget(const unsigned row, const unsigned col)
Returns the widget in the selected cell.
virtual void set_origin(const tpoint &origin) override
See twidget::set_origin.
static const unsigned BORDER_TOP
static const unsigned VERTICAL_SHIFT
base class of top level items, the only item which needs to store the final canvases to draw on ...
std::vector< unsigned > row_height_
The row heights in the grid.
A class inherited from ttext_box that displays its input as stars.
void place(tpoint origin, tpoint size)
Places the widget in the cell.
static const unsigned HORIZONTAL_ALIGN_LEFT
void layout_initialise(const bool full_initialisation)
Forwards tgrid::layout_initialise to the cell.
virtual iterator::twalker_ * create_walker() override
See twidget::create_walker.
virtual void request_reduce_height(const unsigned maximum_height) override
See twidget::request_reduce_height.
const tchild & child(const unsigned row, const unsigned col) const
const twidget * widget() const
unsigned rows_
The number of grid rows.
unsigned get_border_size() const
void set_column_grow_factor(const unsigned column, const unsigned factor)
Sets the grow factor for a column.
std::vector< unsigned > row_grow_factor_
The grow factor for all rows.
void layout(const tpoint &origin)
Layouts the children in the grid.
void set_rows(const unsigned rows)
friend class tdebug_layout_graph
Iterator for the tchild items.
void set_active(const bool active)
Activates all children.
virtual void request_reduce_width(const unsigned maximum_width) override
See twidget::request_reduce_width.
static const unsigned VERTICAL_ALIGN_TOP
std::vector< unsigned > col_grow_factor_
The grow factor for all columns.
GLuint GLuint GLsizei count
cl_event GLbitfield flags
virtual bool has_widget(const twidget &widget) const override
See twidget::has_widget.
virtual void set_visible_rectangle(const SDL_Rect &rectangle) override
See twidget::set_visible_rectangle.
GLenum GLenum GLvoid GLvoid * column
void set_border_size(const unsigned border_size)
std::vector< tchild >::iterator itor_
iterator(std::vector< tchild >::iterator itor)
std::map< std::string, tfilter >::iterator itor
unsigned get_flags() const
virtual bool can_wrap() const override
See twidget::can_wrap.
twidget * swap_child(const std::string &id, twidget *widget, const bool recurse, twidget *new_parent=nullptr)
Exchanges a child in the grid.
tpoint border_space() const
Returns the space needed for the border.
virtual tpoint calculate_best_size() const override
See twidget::calculate_best_size.
virtual void demand_reduce_width(const unsigned maximum_width) override
See twidget::demand_reduce_width.
unsigned add_row(const unsigned count=1)
Adds a row to end of the grid.
static const unsigned VERTICAL_ALIGN_CENTER
bool can_wrap() const
Returns the can_wrap for the cell.
std::vector< tchild > children_
The child items.
tchild & child(const unsigned row, const unsigned col)
void set_widget(twidget *widget)
void set_rows_cols(const unsigned rows, const unsigned cols)
Wrapper to set_rows and set_cols.
unsigned border_size_
The size of the border, the actual configuration of the border is determined by the flags...
GLenum GLenum GLvoid * row
void set_cols(const unsigned cols)
const std::string & id() const
Returns the id of the widget/.
twidget * widget_
Pointer to the widget.
static const unsigned HORIZONTAL_ALIGN_CENTER
void set_flags(const unsigned flags)
unsigned flags_
The flags for the border and cell setup.
Helper to implement private functions without modifying the header.
virtual void layout_initialise(const bool full_initialisation) override
See twidget::layout_initialise.
twidget * find(const std::string &id, const bool must_be_active) override
See twidget::find.
static const unsigned VERTICAL_MASK
void set_child(twidget *widget, const unsigned row, const unsigned col, const unsigned flags, const unsigned border_size)
Sets a child in the grid.
const twidget * widget(const unsigned row, const unsigned col) const
Returns the widget in the selected cell.
The walker abstract base class.
void reduce_width(const unsigned maximum_width)
Tries to reduce the width of a container.
tpoint get_best_size() const
Returns the best size for the cell.
static const unsigned VERTICAL_ALIGN_BOTTOM
virtual void child_populate_dirty_list(twindow &caller, const std::vector< twidget * > &call_stack) override
See twidget::child_populate_dirty_list.
unsigned int get_cols() const
GLsizei const GLcharARB ** string
virtual twidget * find_at(const tpoint &coordinate, const bool must_be_active) override
See twidget::find_at.
std::vector< unsigned > col_width_
The column widths in the grid.
static const unsigned BORDER_LEFT