Base container class. More...
#include <grid.hpp>
Classes | |
class | iterator |
Iterator for the tchild items. More... | |
class | tchild |
Child item of the grid. More... | |
Public Member Functions | |
tgrid (const unsigned rows=0, const unsigned cols=0) | |
virtual | ~tgrid () |
unsigned | add_row (const unsigned count=1) |
Adds a row to end of the grid. More... | |
void | set_row_grow_factor (const unsigned row, const unsigned factor) |
Sets the grow factor for a row. More... | |
void | set_column_grow_factor (const unsigned column, const unsigned factor) |
Sets the grow factor for a column. More... | |
void | set_child (twidget *widget, const unsigned row, const unsigned col, const unsigned flags, const unsigned border_size) |
Sets a child in the grid. More... | |
twidget * | swap_child (const std::string &id, twidget *widget, const bool recurse, twidget *new_parent=nullptr) |
Exchanges a child in the grid. More... | |
void | remove_child (const unsigned row, const unsigned col) |
Removes and frees a widget in a cell. More... | |
void | remove_child (const std::string &id, const bool find_all=false) |
Removes and frees a widget in a cell by it's id. More... | |
void | set_active (const bool active) |
Activates all children. More... | |
const twidget * | widget (const unsigned row, const unsigned col) const |
Returns the widget in the selected cell. More... | |
twidget * | widget (const unsigned row, const unsigned col) |
Returns the widget in the selected cell. More... | |
virtual bool | can_mouse_focus () const override |
Whether the mouse move/click event go 'through' this widget. More... | |
virtual void | layout_initialise (const bool full_initialisation) override |
See twidget::layout_initialise. More... | |
void | reduce_width (const unsigned maximum_width) |
Tries to reduce the width of a container. More... | |
virtual void | request_reduce_width (const unsigned maximum_width) override |
See twidget::request_reduce_width. More... | |
virtual void | demand_reduce_width (const unsigned maximum_width) override |
See twidget::demand_reduce_width. More... | |
void | reduce_height (const unsigned maximum_height) |
Tries to reduce the height of a container. More... | |
virtual void | request_reduce_height (const unsigned maximum_height) override |
See twidget::request_reduce_height. More... | |
virtual void | demand_reduce_height (const unsigned maximum_height) override |
See twidget::demand_reduce_height. More... | |
tpoint | recalculate_best_size () |
Recalculates the best size. More... | |
virtual bool | can_wrap () const override |
See twidget::can_wrap. More... | |
virtual void | place (const tpoint &origin, const tpoint &size) override |
See twidget::place. More... | |
virtual void | set_origin (const tpoint &origin) override |
See twidget::set_origin. More... | |
virtual void | set_visible_rectangle (const SDL_Rect &rectangle) override |
See twidget::set_visible_rectangle. More... | |
virtual void | layout_children () override |
See twidget::layout_children. More... | |
virtual void | child_populate_dirty_list (twindow &caller, const std::vector< twidget * > &call_stack) override |
See twidget::child_populate_dirty_list. More... | |
virtual twidget * | find_at (const tpoint &coordinate, const bool must_be_active) override |
See twidget::find_at. More... | |
virtual const twidget * | find_at (const tpoint &coordinate, const bool must_be_active) const override |
See twidget::find_at. More... | |
twidget * | find (const std::string &id, const bool must_be_active) override |
See twidget::find. More... | |
const twidget * | find (const std::string &id, const bool must_be_active) const override |
See twidget::find. More... | |
virtual bool | has_widget (const twidget &widget) const override |
See twidget::has_widget. More... | |
bool | disable_click_dismiss () const override |
See twidget::disable_click_dismiss. More... | |
virtual iterator::twalker_ * | create_walker () override |
See twidget::create_walker. More... | |
void | set_rows (const unsigned rows) |
unsigned int | get_rows () const |
void | set_cols (const unsigned cols) |
unsigned int | get_cols () const |
void | set_rows_cols (const unsigned rows, const unsigned cols) |
Wrapper to set_rows and set_cols. More... | |
iterator | begin () |
iterator | end () |
Public Member Functions inherited from gui2::twidget | |
twidget () | |
twidget (const tbuilder_widget &builder) | |
Constructor. More... | |
virtual | ~twidget () override |
void | set_id (const std::string &id) |
const std::string & | id () const |
twindow * | get_window () |
Get the parent window. More... | |
const twindow * | get_window () const |
The constant version of get_window. More... | |
tdialog * | dialog () |
Returns the top-level dialogue. More... | |
void | set_parent (twidget *parent) |
twidget * | parent () |
tpoint | get_best_size () const |
Gets the best size for the widget. More... | |
virtual void | set_size (const tpoint &size) |
Sets the size of the widget. More... | |
virtual void | move (const int x_offset, const int y_offset) |
Moves a widget. More... | |
tpoint | get_origin () const |
Returns the screen origin of the widget. More... | |
tpoint | get_size () const |
Returns the size of the widget. More... | |
SDL_Rect | get_rectangle () const |
Gets the bounding rectangle of the widget on the screen. More... | |
int | get_x () const |
int | get_y () const |
unsigned | get_width () const |
unsigned | get_height () const |
void | set_linked_group (const std::string &linked_group) |
SDL_Rect | calculate_blitting_rectangle (const int x_offset, const int y_offset) |
Calculates the blitting rectangle of the widget. More... | |
SDL_Rect | calculate_clipping_rectangle (const int x_offset, const int y_offset) |
Calculates the clipping rectangle of the widget. More... | |
void | draw_background (surface &frame_buffer, int x_offset, int y_offset) |
Draws the background of a widget. More... | |
void | draw_children (surface &frame_buffer, int x_offset, int y_offset) |
Draws the children of a widget. More... | |
void | draw_foreground (surface &frame_buffer, int x_offset, int y_offset) |
Draws the foreground of the widget. More... | |
void | populate_dirty_list (twindow &caller, std::vector< twidget * > &call_stack) |
Adds a widget to the dirty list if it is dirty. More... | |
SDL_Rect | get_dirty_rectangle () const |
Gets the dirty rectangle of the widget. More... | |
void | set_is_dirty (const bool is_dirty) |
bool | get_is_dirty () const |
void | set_visible (const tvisible::scoped_enum visible) |
tvisible::scoped_enum | get_visible () const |
tredraw_action::scoped_enum | get_drawing_action () const |
void | set_debug_border_mode (const unsigned debug_border_mode) |
void | set_debug_border_colour (const unsigned debug_border_colour) |
Public Member Functions inherited from gui2::tevent_executor | |
tevent_executor () | |
virtual | ~tevent_executor () |
void | set_wants_mouse_hover (const bool hover=true) |
bool | wants_mouse_hover () const |
void | set_wants_mouse_left_double_click (const bool click=true) |
bool | wants_mouse_left_double_click () const |
void | set_wants_mouse_middle_double_click (const bool click=true) |
bool | wants_mouse_middle_double_click () const |
tevent_executor & | set_wants_mouse_right_double_click (const bool click=true) |
bool | wants_mouse_right_double_click () const |
Public Member Functions inherited from gui2::event::tdispatcher | |
tdispatcher () | |
virtual | ~tdispatcher () |
void | connect () |
Connects the dispatcher to the event handler. More... | |
bool | has_event (const tevent event, const tevent_type event_type) |
bool | fire (const tevent event, twidget &target) |
Fires an event which has no extra parameters. More... | |
bool | fire (const tevent event, twidget &target, const tpoint &coordinate) |
Fires an event which takes a coordinate parameter. More... | |
bool | fire (const tevent event, twidget &target, const SDLKey key, const SDLMod modifier, const utf8::string &unicode) |
Fires an event which takes keyboard parameters. More... | |
bool | fire (const tevent event, twidget &target, void *) |
Fires an event which takes notification parameters. More... | |
bool | fire (const tevent event, twidget &target, tmessage &message) |
Fires an event which takes message parameters. More... | |
template<tevent E> | |
boost::enable_if < boost::mpl::has_key < tset_event, boost::mpl::int_ < E > > >::type | connect_signal (const tsignal_function &signal, const tposition position=back_child) |
Connect a signal for callback in tset_event. More... | |
template<tevent E> | |
boost::enable_if < boost::mpl::has_key < tset_event, boost::mpl::int_ < E > > >::type | disconnect_signal (const tsignal_function &signal, const tposition position=back_child) |
Disconnect a signal for callback in tset_event. More... | |
template<tevent E> | |
boost::enable_if < boost::mpl::has_key < tset_event_mouse, boost::mpl::int_< E > > >::type | connect_signal (const tsignal_mouse_function &signal, const tposition position=back_child) |
Connect a signal for callback in tset_event_mouse. More... | |
template<tevent E> | |
boost::enable_if < boost::mpl::has_key < tset_event_mouse, boost::mpl::int_< E > > >::type | disconnect_signal (const tsignal_mouse_function &signal, const tposition position=back_child) |
Disconnect a signal for callback in tset_event_mouse. More... | |
template<tevent E> | |
boost::enable_if < boost::mpl::has_key < tset_event_keyboard, boost::mpl::int_< E > > >::type | connect_signal (const tsignal_keyboard_function &signal, const tposition position=back_child) |
Connect a signal for callback in tset_event_keyboard. More... | |
template<tevent E> | |
boost::enable_if < boost::mpl::has_key < tset_event_keyboard, boost::mpl::int_< E > > >::type | disconnect_signal (const tsignal_keyboard_function &signal, const tposition position=back_child) |
Disconnect a signal for callback in tset_event_keyboard. More... | |
template<tevent E> | |
boost::enable_if < boost::mpl::has_key < tset_event_notification, boost::mpl::int_< E > > >::type | connect_signal (const tsignal_notification_function &signal, const tposition position=back_child) |
Connect a signal for callback in tset_event_notification. More... | |
template<tevent E> | |
boost::enable_if < boost::mpl::has_key < tset_event_notification, boost::mpl::int_< E > > >::type | disconnect_signal (const tsignal_notification_function &signal, const tposition position=back_child) |
Disconnect a signal for callback in tset_event_notification. More... | |
template<tevent E> | |
boost::enable_if < boost::mpl::has_key < tset_event_message, boost::mpl::int_< E > > >::type | connect_signal (const tsignal_message_function &signal, const tposition position=back_child) |
Connect a signal for callback in tset_event_message. More... | |
template<tevent E> | |
boost::enable_if < boost::mpl::has_key < tset_event_message, boost::mpl::int_< E > > >::type | disconnect_signal (const tsignal_message_function &signal, const tposition position=back_child) |
Disconnect a signal for callback in tset_event_message. More... | |
void | capture_mouse () |
Captures the mouse. More... | |
void | release_mouse () |
Releases the mouse capture. More... | |
void | set_mouse_behavior (const tmouse_behavior mouse_behavior) |
tmouse_behavior | get_mouse_behavior () const |
void | set_want_keyboard_input (const bool want_keyboard_input) |
bool | get_want_keyboard_input () const |
void | register_hotkey (const hotkey::HOTKEY_COMMAND id, const thotkey_function &function) |
Registers a hotkey. More... | |
bool | execute_hotkey (const hotkey::HOTKEY_COMMAND id) |
Executes a hotkey. More... | |
Static Public Attributes | |
static const unsigned | VERTICAL_SHIFT = 0 |
static const unsigned | VERTICAL_GROW_SEND_TO_CLIENT = 1 << VERTICAL_SHIFT |
static const unsigned | VERTICAL_ALIGN_TOP = 2 << VERTICAL_SHIFT |
static const unsigned | VERTICAL_ALIGN_CENTER = 3 << VERTICAL_SHIFT |
static const unsigned | VERTICAL_ALIGN_BOTTOM = 4 << VERTICAL_SHIFT |
static const unsigned | VERTICAL_MASK = 7 << VERTICAL_SHIFT |
static const unsigned | HORIZONTAL_SHIFT = 3 |
static const unsigned | HORIZONTAL_GROW_SEND_TO_CLIENT |
static const unsigned | HORIZONTAL_ALIGN_LEFT = 2 << HORIZONTAL_SHIFT |
static const unsigned | HORIZONTAL_ALIGN_CENTER = 3 << HORIZONTAL_SHIFT |
static const unsigned | HORIZONTAL_ALIGN_RIGHT = 4 << HORIZONTAL_SHIFT |
static const unsigned | HORIZONTAL_MASK = 7 << HORIZONTAL_SHIFT |
static const unsigned | BORDER_TOP = 1 << 6 |
static const unsigned | BORDER_BOTTOM = 1 << 7 |
static const unsigned | BORDER_LEFT = 1 << 8 |
static const unsigned | BORDER_RIGHT = 1 << 9 |
static const unsigned | BORDER_ALL |
Private Member Functions | |
virtual tpoint | calculate_best_size () const override |
See twidget::calculate_best_size. More... | |
const tchild & | child (const unsigned row, const unsigned col) const |
tchild & | child (const unsigned row, const unsigned col) |
void | layout (const tpoint &origin) |
Layouts the children in the grid. More... | |
virtual void | impl_draw_children (surface &frame_buffer, int x_offset, int y_offset) override |
See twidget::impl_draw_children. More... | |
Private Attributes | |
unsigned | rows_ |
The number of grid rows. More... | |
unsigned | cols_ |
The number of grid columns. More... | |
std::vector< unsigned > | row_height_ |
The row heights in the grid. More... | |
std::vector< unsigned > | col_width_ |
The column widths in the grid. More... | |
std::vector< unsigned > | row_grow_factor_ |
The grow factor for all rows. More... | |
std::vector< unsigned > | col_grow_factor_ |
The grow factor for all columns. More... | |
std::vector< tchild > | children_ |
The child items. More... | |
Friends | |
class | tdebug_layout_graph |
struct | tgrid_implementation |
Additional Inherited Members | |
Public Types inherited from gui2::event::tdispatcher | |
enum | tevent_type { pre = 1, child = 2, post = 4 } |
enum | tposition { front_pre_child, back_pre_child, front_child, back_child, front_post_child, back_post_child } |
The position where to add a new callback in the signal handler. More... | |
enum | tmouse_behavior { all, hit, none } |
The behavior of the mouse events. More... | |
Protected Member Functions inherited from gui2::twidget | |
void | set_layout_size (const tpoint &size) |
const tpoint & | layout_size () const |
Base container class.
This class holds a number of widgets and their wanted layout parameters. It also layouts the items in the grid and handles their drawing.
|
explicit |
|
virtual |
Definition at line 48 of file grid.cpp.
References child(), children_, and gui2::tgrid::tchild::widget().
unsigned gui2::tgrid::add_row | ( | const unsigned | count = 1 | ) |
Adds a row to end of the grid.
count | Number of rows to add, should be > 0. |
Definition at line 58 of file grid.cpp.
References cols_, rows_, and set_rows_cols().
Referenced by gui2::tcontainer_::add_row().
|
inline |
Definition at line 440 of file grid.hpp.
References children_.
Referenced by gui2::tcontainer_::begin(), gui2::tgame_load::filter_text_changed(), and gui2::tunit_create::filter_text_changed().
|
overrideprivatevirtual |
See twidget::calculate_best_size.
Implements gui2::twidget.
Definition at line 378 of file grid.cpp.
References child(), col_width_, cols_, DBG_GUI_L, gui2::tgrid::tchild::get_best_size(), gui2::log_gui_layout, LOG_HEADER, log_scope2, LOG_SCOPE_HEADER, row_height_, rows_, gui2::tpoint::x, and gui2::tpoint::y.
Referenced by place(), recalculate_best_size(), request_reduce_height(), and request_reduce_width().
|
inlineoverridevirtual |
Whether the mouse move/click event go 'through' this widget.
Reimplemented from gui2::twidget.
|
overridevirtual |
See twidget::can_wrap.
Reimplemented from gui2::twidget.
Definition at line 422 of file grid.cpp.
References gui2::tgrid::tchild::can_wrap(), gui2::twidget::can_wrap(), child(), and children_.
Referenced by gui2::tcontainer_::can_wrap(), and gui2::tscrollbar_container::can_wrap().
|
inlineprivate |
Definition at line 477 of file grid.hpp.
Referenced by calculate_best_size(), can_wrap(), child_populate_dirty_list(), gui2::tgrid_implementation::column_request_reduce_width(), disable_click_dismiss(), has_widget(), impl_draw_children(), layout(), layout_children(), layout_initialise(), remove_child(), gui2::tgrid_implementation::row_request_reduce_height(), set_active(), set_child(), set_origin(), set_visible_rectangle(), swap_child(), widget(), and ~tgrid().
|
inlineprivate |
|
overridevirtual |
See twidget::child_populate_dirty_list.
Reimplemented from gui2::twidget.
Definition at line 584 of file grid.cpp.
References child(), children_, gui2::twidget::populate_dirty_list(), and gui2::tgrid::tchild::widget().
|
overridevirtual |
Implements gui2::twidget.
Definition at line 656 of file grid.cpp.
Referenced by gui2::tselect_orb_colors::setup_orb_group().
|
overridevirtual |
See twidget::demand_reduce_height.
Reimplemented from gui2::twidget.
Definition at line 366 of file grid.cpp.
Referenced by gui2::tcontainer_::demand_reduce_height().
|
overridevirtual |
See twidget::demand_reduce_width.
Reimplemented from gui2::twidget.
Definition at line 275 of file grid.cpp.
Referenced by gui2::tcontainer_::demand_reduce_width().
|
overridevirtual |
See twidget::disable_click_dismiss.
Implements gui2::twidget.
Definition at line 638 of file grid.cpp.
References child(), children_, gui2::twidget::disable_click_dismiss(), gui2::twidget::get_visible(), gui2::twidget::tvisible::visible, widget(), and gui2::tgrid::tchild::widget().
Referenced by gui2::tcontainer_::disable_click_dismiss(), gui2::tscrollbar_container::disable_click_dismiss(), and gui2::tgenerator< minimum_selection, maximum_selection, placement, select_action >::disable_click_dismiss().
|
inline |
Definition at line 444 of file grid.hpp.
References children_.
Referenced by gui2::iterator::tgrid::at_end(), gui2::tcontainer_::end(), gui2::iterator::tgrid::get(), and gui2::iterator::tgrid::next().
|
overridevirtual |
See twidget::find.
Reimplemented from gui2::twidget.
Definition at line 612 of file grid.cpp.
References gui2::twidget::id().
Referenced by gui2::tscroll_label::finalize_subclass(), gui2::tcontainer_::find(), gui2::tmatrix::find(), gui2::ttree_view_node::find(), gui2::policy::placement::tindependent::find(), gui2::get_advanced_row_grid(), gui2::policy::select_action::tshow::init(), gui2::tcampaign_difficulty::pre_show(), gui2::tlogging::pre_show(), gui2::tcampaign_selection::pre_show(), gui2::tscroll_label::set_can_wrap(), and gui2::ttree_view_node::ttree_view_node().
|
overridevirtual |
See twidget::find.
Reimplemented from gui2::twidget.
Definition at line 617 of file grid.cpp.
References gui2::twidget::id().
|
overridevirtual |
See twidget::find_at.
Reimplemented from gui2::twidget.
Definition at line 599 of file grid.cpp.
Referenced by gui2::tcontainer_::find_at(), gui2::tmatrix::find_at(), gui2::policy::placement::thorizontal_list::find_at(), gui2::policy::placement::tvertical_list::find_at(), and gui2::policy::placement::tindependent::find_at().
|
inline |
Definition at line 294 of file grid.hpp.
References cols_.
Referenced by gui2::tlistbox::finalize(), gui2::tcontainer_::get_cols(), gui2::policy::select_action::tselect::init(), gui2::policy::select_action::tshow::init(), gui2::ttree_view_node::init_grid(), and gui2::twindow::~twindow().
|
inline |
Definition at line 288 of file grid.hpp.
References rows_.
Referenced by gui2::tlistbox::finalize(), gui2::tcontainer_::get_rows(), gui2::policy::select_action::tselect::init(), gui2::policy::select_action::tshow::init(), gui2::ttree_view_node::init_grid(), and gui2::twindow::~twindow().
|
overridevirtual |
See twidget::has_widget.
Reimplemented from gui2::twidget.
Definition at line 623 of file grid.cpp.
References child(), children_, gui2::twidget::has_widget(), and gui2::tgrid::tchild::widget().
Referenced by gui2::tcontainer_::has_widget(), and gui2::tlistbox::list_item_clicked().
|
overrideprivatevirtual |
See twidget::impl_draw_children.
Reimplemented from gui2::twidget.
Definition at line 908 of file grid.cpp.
References child(), children_, gui2::twidget::draw_background(), gui2::twidget::draw_children(), gui2::twidget::draw_foreground(), gui2::twidget::get_drawing_action(), gui2::twidget::get_visible(), gui2::twidget::tredraw_action::none, gui2::twidget::set_is_dirty(), gui2::twidget::tvisible::visible, widget(), and gui2::tgrid::tchild::widget().
Layouts the children in the grid.
Definition at line 886 of file grid.cpp.
References child(), col_width_, cols_, DBG_GUI_L, LOG_HEADER, gui2::tgrid::tchild::place(), row_height_, rows_, widget(), gui2::tpoint::x, and gui2::tpoint::y.
Referenced by place().
|
overridevirtual |
Reimplemented from gui2::twidget.
Definition at line 575 of file grid.cpp.
References child(), children_, gui2::twidget::layout_children(), and gui2::tgrid::tchild::widget().
Referenced by gui2::tstacked_widget::layout_children(), gui2::tcontainer_::layout_children(), gui2::tmatrix::layout_children(), and gui2::tscrollbar_container::layout_children().
|
overridevirtual |
See twidget::layout_initialise.
Reimplemented from gui2::twidget.
Definition at line 191 of file grid.cpp.
References child(), children_, gui2::twidget::layout_initialise(), and gui2::tgrid::tchild::layout_initialise().
Referenced by gui2::tcontainer_::layout_initialise(), gui2::tscrollbar_container::layout_initialise(), gui2::tmatrix::layout_initialise(), gui2::ttree_view_node::layout_initialise(), and gui2::tgenerator< minimum_selection, maximum_selection, placement, select_action >::layout_initialise().
See twidget::place.
Reimplemented from gui2::twidget.
Definition at line 435 of file grid.cpp.
References calculate_best_size(), col_grow_factor_, col_width_, cols_, DBG_GUI_L, ERR_GUI_L, i, gui2::twidget::id(), layout(), gui2::log_gui_layout, LOG_HEADER, log_scope2, LOG_SCOPE_HEADER, gui2::twidget::parent(), gui2::twidget::place(), row_grow_factor_, row_height_, rows_, gui2::tpoint::x, and gui2::tpoint::y.
Referenced by gui2::tlistbox::layout_children(), gui2::tcontainer_::place(), gui2::tmatrix::place(), gui2::policy::placement::thorizontal_list::place(), gui2::policy::placement::tvertical_list::place(), gui2::ttree_view_node::place(), gui2::policy::placement::tindependent::place(), gui2::tlistbox::set_content_size(), and gui2::tscrollbar_container::set_content_size().
tpoint gui2::tgrid::recalculate_best_size | ( | ) |
Recalculates the best size.
This is used for scrollbar containers when they try to update their contents size before falling back to the 'global' invalidate_layout.
Definition at line 371 of file grid.cpp.
References calculate_best_size(), and gui2::twidget::set_layout_size().
Referenced by gui2::tscrollbar_container::content_resize_request().
void gui2::tgrid::reduce_height | ( | const unsigned | maximum_height | ) |
Tries to reduce the height of a container.
See Layout algorithm for more information.
maximum_height | The wanted maximum height. |
Definition at line 280 of file grid.cpp.
References DBG_GUI_L, gui2::twidget::get_best_size(), gui2::log_gui_layout, LOG_HEADER, log_scope2, LOG_SCOPE_HEADER, request_reduce_height(), and gui2::tpoint::y.
Referenced by gui2::tcontainer_::reduce_height().
void gui2::tgrid::reduce_width | ( | const unsigned | maximum_width | ) |
Tries to reduce the width of a container.
See Layout algorithm for more information.
maximum_width | The wanted maximum width. |
Definition at line 204 of file grid.cpp.
References DBG_GUI_L, gui2::twidget::get_best_size(), gui2::log_gui_layout, LOG_HEADER, log_scope2, LOG_SCOPE_HEADER, request_reduce_width(), and gui2::tpoint::x.
Referenced by gui2::tcontainer_::reduce_width().
void gui2::tgrid::remove_child | ( | const unsigned | row, |
const unsigned | col | ||
) |
Removes and frees a widget in a cell.
row | The row of the cell. |
col | The columnof the cell. |
Definition at line 140 of file grid.cpp.
References child(), cols_, rows_, gui2::tgrid::tchild::set_widget(), and gui2::tgrid::tchild::widget().
Referenced by gui2::twindow::~twindow().
void gui2::tgrid::remove_child | ( | const std::string & | id, |
const bool | find_all = false |
||
) |
Removes and frees a widget in a cell by it's id.
id | The id of the widget to free. |
find_all | If true if removes all items with the id, otherwise it stops after removing the first item (or once all children have been tested). |
Definition at line 152 of file grid.cpp.
References child(), children_, gui2::twidget::id(), gui2::tgrid::tchild::id(), gui2::tgrid::tchild::set_widget(), and gui2::tgrid::tchild::widget().
|
overridevirtual |
See twidget::request_reduce_height.
Now we try every item to be reduced, maybe items need a flag whether or not to try to reduce and also evaluate whether the force reduction is still needed.
Reimplemented from gui2::twidget.
Definition at line 313 of file grid.cpp.
References calculate_best_size(), DBG_GUI_L, gui2::twidget::get_best_size(), LOG_HEADER, row_height_, gui2::tgrid_implementation::row_request_reduce_height(), rows_, gui2::twidget::set_layout_size(), and gui2::tpoint::y.
Referenced by reduce_height(), gui2::tcontainer_::request_reduce_height(), gui2::tscrollbar_container::request_reduce_height(), and gui2::policy::placement::tindependent::request_reduce_height().
|
overridevirtual |
See twidget::request_reduce_width.
Implements gui2::twidget.
Definition at line 237 of file grid.cpp.
References calculate_best_size(), col_width_, cols_, gui2::tgrid_implementation::column_request_reduce_width(), DBG_GUI_L, gui2::twidget::get_best_size(), LOG_HEADER, gui2::twidget::set_layout_size(), and gui2::tpoint::x.
Referenced by reduce_width(), gui2::tcontainer_::request_reduce_width(), gui2::tscrollbar_container::request_reduce_width(), and gui2::policy::placement::tindependent::request_reduce_width().
void gui2::tgrid::set_active | ( | const bool | active | ) |
Activates all children.
If a child inherits from tcontrol or is a tgrid it will call set_active() for the child otherwise it ignores the widget.
active | Parameter for set_active. |
Definition at line 168 of file grid.cpp.
References child(), children_, preferences::grid(), gui2::tcontrol::set_active(), set_active(), widget(), and gui2::tgrid::tchild::widget().
Referenced by gui2::tcontainer_::set_active(), set_active(), and gui2::tlistbox::set_row_active().
void gui2::tgrid::set_child | ( | twidget * | widget, |
const unsigned | row, | ||
const unsigned | col, | ||
const unsigned | flags, | ||
const unsigned | border_size | ||
) |
Sets a child in the grid.
When the child is added to the grid the grid 'owns' the widget. The widget is put in a cell, and every cell can only contain 1 widget if the wanted cell already contains a widget, that widget is freed and removed.
widget | The widget to put in the grid. |
row | The row of the cell. |
col | The columnof the cell. |
flags | The flags for the widget in the cell. |
border_size | The size of the border for the cell, how the border is applied depends on the flags. |
Definition at line 69 of file grid.cpp.
References child(), cols_, HORIZONTAL_MASK, gui2::tgrid::tchild::id(), LOG_HEADER, rows_, gui2::tgrid::tchild::set_border_size(), gui2::tgrid::tchild::set_flags(), gui2::twidget::set_parent(), gui2::tgrid::tchild::set_widget(), VERTICAL_MASK, gui2::tgrid::tchild::widget(), and WRN_GUI_G.
Referenced by add_widget(), gui2::implementation::tbuilder_scrollbar_panel::build(), gui2::tbuilder_grid::build(), gui2::implementation::tbuilder_listbox::build(), gui2::ttree_view::finalize_setup(), gui2::tcontainer_::set_child(), and gui2::set_single_child().
void gui2::tgrid::set_cols | ( | const unsigned | cols | ) |
Definition at line 670 of file grid.cpp.
References cols_, rows_, and set_rows_cols().
Referenced by gui2::tcontainer_::set_cols().
|
inline |
Sets the grow factor for a column.
column | The column to modify. |
factor | The grow factor. |
Definition at line 96 of file grid.hpp.
References col_grow_factor_, and gui2::twidget::set_is_dirty().
Referenced by gui2::implementation::tbuilder_scrollbar_panel::build(), gui2::tbuilder_grid::build(), and gui2::tcontainer_::set_column_grow_factor().
See twidget::set_origin.
Reimplemented from gui2::twidget.
Definition at line 542 of file grid.cpp.
References child(), children_, gui2::twidget::get_x(), gui2::twidget::get_y(), gui2::twidget::set_origin(), widget(), gui2::tgrid::tchild::widget(), gui2::tpoint::x, and gui2::tpoint::y.
Referenced by gui2::tscrollbar_container::scrollbar_moved(), gui2::tcontainer_::set_origin(), gui2::tscrollbar_container::set_origin(), gui2::policy::placement::thorizontal_list::set_origin(), gui2::policy::placement::tvertical_list::set_origin(), and gui2::policy::placement::tindependent::set_origin().
|
inline |
Sets the grow factor for a row.
row | The row to modify. |
factor | The grow factor. |
Definition at line 81 of file grid.hpp.
References row_grow_factor_, and gui2::twidget::set_is_dirty().
Referenced by gui2::implementation::tbuilder_scrollbar_panel::build(), gui2::tbuilder_grid::build(), and gui2::tcontainer_::set_row_grow_factor().
void gui2::tgrid::set_rows | ( | const unsigned | rows | ) |
Definition at line 661 of file grid.cpp.
References cols_, rows_, and set_rows_cols().
Referenced by gui2::tcontainer_::set_rows().
void gui2::tgrid::set_rows_cols | ( | const unsigned | rows, |
const unsigned | cols | ||
) |
Wrapper to set_rows and set_cols.
rows | Parameter to call set_rows with. |
cols | Parameter to call set_cols with. |
Definition at line 679 of file grid.cpp.
References children_, col_grow_factor_, cols_, LOG_HEADER, row_grow_factor_, rows_, and WRN_GUI_G.
Referenced by add_row(), gui2::implementation::tbuilder_scrollbar_panel::build(), gui2::tbuilder_grid::build(), gui2::implementation::tbuilder_listbox::build(), gui2::ttree_view::finalize_setup(), set_cols(), set_rows(), gui2::tcontainer_::set_rows_cols(), and gui2::set_single_child().
|
overridevirtual |
See twidget::set_visible_rectangle.
Reimplemented from gui2::twidget.
Definition at line 560 of file grid.cpp.
References child(), children_, gui2::twidget::set_visible_rectangle(), widget(), and gui2::tgrid::tchild::widget().
Referenced by gui2::tlistbox::layout_children(), gui2::tscrollbar_container::place(), gui2::tscrollbar_container::scrollbar_moved(), gui2::tscrollbar_container::set_origin(), gui2::tlistbox::set_row_shown(), gui2::tcontainer_::set_visible_rectangle(), gui2::tscrollbar_container::set_visible_rectangle(), gui2::policy::placement::thorizontal_list::set_visible_rectangle(), gui2::policy::placement::tvertical_list::set_visible_rectangle(), gui2::ttree_view_node::set_visible_rectangle(), gui2::policy::placement::tindependent::set_visible_rectangle(), and gui2::tlistbox::update_content_size().
twidget * gui2::tgrid::swap_child | ( | const std::string & | id, |
twidget * | widget, | ||
const bool | recurse, | ||
twidget * | new_parent = nullptr |
||
) |
Exchanges a child in the grid.
It replaced the child with a certain id with the new widget but doesn't touch the other settings of the child.
id | The id of the widget to free. |
widget | The widget to put in the grid. |
recurse | Do we want to decent into the child grids. |
new_parent | The new parent for the swapped out widget. |
returns The widget which got removed (the parent of the widget is cleared). If no widget found and thus not replace nullptr will returned.
Definition at line 99 of file grid.cpp.
References child(), children_, gui2::twidget::get_visible(), preferences::grid(), gui2::twidget::id(), gui2::tgrid::tchild::id(), gui2::twidget::set_parent(), gui2::twidget::set_visible(), gui2::tgrid::tchild::set_widget(), swap_child(), and gui2::tgrid::tchild::widget().
Referenced by gui2::tscrollbar_container::finalize_setup(), gui2::tpreferences::initialize_members(), and swap_child().
|
inline |
Returns the widget in the selected cell.
Definition at line 176 of file grid.hpp.
References child(), and gui2::tgrid::tchild::widget().
Referenced by disable_click_dismiss(), gui2::policy::placement::tvertical_list::handle_key_down_arrow(), gui2::policy::placement::thorizontal_list::handle_key_left_arrow(), gui2::policy::placement::thorizontal_list::handle_key_right_arrow(), gui2::policy::placement::tvertical_list::handle_key_up_arrow(), impl_draw_children(), gui2::policy::select_action::tselect::init(), gui2::policy::select_action::tshow::init(), gui2::ttree_view_node::init_grid(), layout(), gui2::tgrid::tchild::place(), gui2::policy::select_action::tselect::select(), set_active(), set_origin(), and set_visible_rectangle().
|
inline |
Returns the widget in the selected cell.
Definition at line 182 of file grid.hpp.
References child(), and gui2::tgrid::tchild::widget().
|
friend |
|
static |
Definition at line 59 of file grid.hpp.
Referenced by gui2::implementation::tbuilder_listbox::build(), and gui2::implementation::get_border().
|
static |
Definition at line 56 of file grid.hpp.
Referenced by gui2::tgrid::tchild::border_space(), gui2::implementation::get_border(), and gui2::tgrid::tchild::place().
|
static |
Definition at line 57 of file grid.hpp.
Referenced by gui2::tgrid::tchild::border_space(), gui2::implementation::get_border(), and gui2::tgrid::tchild::place().
|
static |
Definition at line 58 of file grid.hpp.
Referenced by gui2::tgrid::tchild::border_space(), gui2::implementation::get_border(), and gui2::tgrid::tchild::place().
|
static |
Definition at line 55 of file grid.hpp.
Referenced by gui2::tgrid::tchild::border_space(), gui2::implementation::get_border(), and gui2::tgrid::tchild::place().
|
private |
The child items.
All children are stored in a 1D vector and the formula to access a cell is: rows_ * col + row. All other vectors use the same access formula.
Definition at line 476 of file grid.hpp.
Referenced by begin(), can_wrap(), child_populate_dirty_list(), disable_click_dismiss(), end(), has_widget(), impl_draw_children(), layout_children(), layout_initialise(), remove_child(), set_active(), set_origin(), set_rows_cols(), set_visible_rectangle(), swap_child(), and ~tgrid().
|
private |
The grow factor for all columns.
Definition at line 468 of file grid.hpp.
Referenced by place(), set_column_grow_factor(), and set_rows_cols().
|
mutableprivate |
The column widths in the grid.
Definition at line 462 of file grid.hpp.
Referenced by calculate_best_size(), layout(), place(), and request_reduce_width().
|
private |
The number of grid columns.
Definition at line 454 of file grid.hpp.
Referenced by add_row(), calculate_best_size(), get_cols(), layout(), place(), remove_child(), request_reduce_width(), gui2::tgrid_implementation::row_request_reduce_height(), set_child(), set_cols(), set_rows(), and set_rows_cols().
|
static |
Definition at line 51 of file grid.hpp.
Referenced by gui2::implementation::get_h_align(), gui2::twindow::layout(), and gui2::tgrid::tchild::place().
|
static |
Definition at line 50 of file grid.hpp.
Referenced by gui2::implementation::get_h_align(), gui2::twindow::layout(), and gui2::tgrid::tchild::place().
|
static |
Definition at line 52 of file grid.hpp.
Referenced by gui2::implementation::get_h_align(), gui2::twindow::layout(), and gui2::tgrid::tchild::place().
|
static |
Definition at line 48 of file grid.hpp.
Referenced by add_widget(), gui2::implementation::tbuilder_listbox::build(), gui2::ttree_view::finalize_setup(), gui2::tgrid::tchild::place(), gui2::implementation::read_flags(), and gui2::set_single_child().
|
static |
Definition at line 53 of file grid.hpp.
Referenced by gui2::tgrid::tchild::place(), and set_child().
|
private |
The grow factor for all rows.
Definition at line 465 of file grid.hpp.
Referenced by place(), set_row_grow_factor(), and set_rows_cols().
|
mutableprivate |
The row heights in the grid.
Definition at line 459 of file grid.hpp.
Referenced by calculate_best_size(), layout(), place(), and request_reduce_height().
|
private |
The number of grid rows.
Definition at line 451 of file grid.hpp.
Referenced by add_row(), calculate_best_size(), gui2::tgrid_implementation::column_request_reduce_width(), get_rows(), layout(), place(), remove_child(), request_reduce_height(), set_child(), set_cols(), set_rows(), and set_rows_cols().
|
static |
Definition at line 44 of file grid.hpp.
Referenced by gui2::implementation::get_v_align(), gui2::twindow::layout(), and gui2::tgrid::tchild::place().
|
static |
Definition at line 43 of file grid.hpp.
Referenced by gui2::implementation::get_v_align(), gui2::twindow::layout(), and gui2::tgrid::tchild::place().
|
static |
Definition at line 42 of file grid.hpp.
Referenced by gui2::implementation::get_v_align(), gui2::twindow::layout(), and gui2::tgrid::tchild::place().
|
static |
Definition at line 41 of file grid.hpp.
Referenced by add_widget(), gui2::implementation::tbuilder_listbox::build(), gui2::ttree_view::finalize_setup(), gui2::tgrid::tchild::place(), gui2::implementation::read_flags(), and gui2::set_single_child().
|
static |
Definition at line 45 of file grid.hpp.
Referenced by gui2::tgrid::tchild::place(), and set_child().