The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
gui2::ttree_view_node Class Reference

#include <tree_view_node.hpp>

Inheritance diagram for gui2::ttree_view_node:
Inheritance graph

Public Types

typedef implementation::ttree_node tnode_definition
 
- 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...
 

Public Member Functions

 ttree_view_node (const std::string &id, const std::vector< tnode_definition > &node_definitions, ttree_view_node *parent_node, ttree_view &parent_tree_view, const std::map< std::string, string_map > &data)
 
 ~ttree_view_node ()
 
ttree_view_nodeadd_child (const std::string &id, const std::map< std::string, string_map > &data, const int index=-1)
 Adds a child item to the list of child nodes. More...
 
ttree_view_nodeadd_sibling (const std::string &id, const std::map< std::string, string_map > &data)
 Adds a sibbling for a node at the end of the list. More...
 
bool is_root_node () const
 Is this node the root node? More...
 
unsigned get_indention_level () const
 The indention level of the node. More...
 
bool empty () const
 Does the node have children? More...
 
bool is_folded () const
 Is the node folded? More...
 
void fold ()
 
void unfold ()
 
virtual iterator::twalker_create_walker () override
 See twidget::create_walker. More...
 
virtual twidgetfind_at (const tpoint &coordinate, const bool must_be_active) override
 See twidget::find_at. More...
 
virtual const twidgetfind_at (const tpoint &coordinate, const bool must_be_active) const override
 See twidget::find_at. More...
 
twidgetfind (const std::string &id, const bool must_be_active) override
 See twidget::find. More...
 
const twidgetfind (const std::string &id, const bool must_be_active) const override
 See twidget::find. More...
 
size_t size () const
 The "size" of the widget. More...
 
void clear ()
 Removes all child items from the widget. More...
 
ttree_view_nodeparent_node ()
 Returns the parent node. More...
 
const ttree_view_nodeparent_node () const
 The const version of parent_node. More...
 
ttree_viewtree_view ()
 
const ttree_viewtree_view () const
 
ttree_view_nodeget_child_at (int index)
 
std::vector< intdescribe_path ()
 calculates the node indicies that we need to get from the root node to this node. More...
 
void set_callback_state_change (const int scope, std::function< void(twidget &)> callback)
 Inherited from tselectable_. More...
 
ttree_view_nodeget_last_visible_parent_node ()
 
ttree_view_nodeget_node_above ()
 
ttree_view_nodeget_node_below ()
 
ttree_view_nodeget_selectable_node_above ()
 
ttree_view_nodeget_selectable_node_below ()
 
void select_node ()
 
tgridget_grid ()
 
void layout_initialise (const bool full_initialisation)
 How the layout engine works. More...
 
- 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::stringid () const
 
twindowget_window ()
 Get the parent window. More...
 
const twindowget_window () const
 The constant version of get_window. More...
 
tdialogdialog ()
 Returns the top-level dialogue. More...
 
void set_parent (twidget *parent)
 
twidgetparent ()
 
virtual void demand_reduce_width (const unsigned maximum_width)
 Tries to reduce the width of a widget. More...
 
virtual void request_reduce_height (const unsigned maximum_height)
 Tries to reduce the height of a widget. More...
 
virtual void demand_reduce_height (const unsigned maximum_height)
 Tries to reduce the height of a widget. More...
 
tpoint get_best_size () const
 Gets the best size for the widget. More...
 
virtual bool can_mouse_focus () const
 Whether the mouse move/click event go 'through' this widget. More...
 
virtual bool can_wrap () const
 Can the widget wrap. 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...
 
virtual void layout_children ()
 Allows a widget to update its children. 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)
 
virtual bool has_widget (const twidget &widget) const
 Does the widget contain the widget. More...
 
- 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_executorset_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...
 

Private Member Functions

int calculate_ypos ()
 
virtual void request_reduce_width (const unsigned maximum_width) override
 See twidget::request_reduce_width. More...
 
void fold_internal ()
 
void unfold_internal ()
 
void impl_populate_dirty_list (twindow &caller, const std::vector< twidget * > &call_stack)
 "Inherited" from twidget. More...
 
virtual tpoint calculate_best_size () const override
 See twidget::calculate_best_size. More...
 
bool disable_click_dismiss () const override
 See twidget::disable_click_dismiss. More...
 
tpoint calculate_best_size (const int indention_level, const unsigned indention_step_size) const
 
tpoint get_current_size (bool assume_visible=false) const
 
tpoint get_folded_size () const
 
tpoint get_unfolded_size () const
 
virtual void set_origin (const tpoint &origin) override
 See twidget::set_origin. More...
 
virtual void place (const tpoint &origin, const tpoint &size) override
 See twidget::place. More...
 
unsigned place (const unsigned indention_step_size, tpoint origin, unsigned width)
 
virtual void set_visible_rectangle (const SDL_Rect &rectangle) override
 See twidget::set_visible_rectangle. More...
 
virtual void impl_draw_children (surface &frame_buffer, int x_offset, int y_offset) override
 See twidget::impl_draw_children. More...
 
void signal_handler_left_button_click (const event::tevent event)
 
void signal_handler_label_left_button_click (const event::tevent event, bool &handled, bool &halt)
 
void init_grid (tgrid *grid, const std::map< std::string, string_map > &data)
 
const std::stringget_control_type () const
 Returns the control_type of the ttree_view_node. More...
 

Private Attributes

ttree_view_nodeparent_node_
 Our parent node. More...
 
ttree_viewtree_view_
 The tree view that owns us. More...
 
tgrid grid_
 Grid holding our contents. More...
 
boost::ptr_vector
< ttree_view_node
children_
 Our children. More...
 
const std::vector
< tnode_definition > & 
node_definitions_
 The node definitions known to use. More...
 
tselectable_toggle_
 The toggle for the folded state. More...
 
tselectable_label_
 The label to show our selected state. More...
 
bool unfolded_
 
std::function< void(twidget &)> callback_state_change_
 See tselectable_::set_callback_state_change. More...
 
std::function< void(twidget &)> callback_state_to_folded_
 See tselectable_::set_callback_state_change. More...
 
std::function< void(twidget &)> callback_state_to_unfolded_
 See tselectable_::set_callback_state_change. More...
 

Friends

struct ttree_view_node_implementation
 
class ttree_view
 

Additional Inherited Members

- Protected Member Functions inherited from gui2::twidget
void set_layout_size (const tpoint &size)
 
const tpointlayout_size () const
 

Detailed Description

Definition at line 33 of file tree_view_node.hpp.

Member Typedef Documentation

Definition at line 39 of file tree_view_node.hpp.

Constructor & Destructor Documentation

gui2::ttree_view_node::ttree_view_node ( const std::string id,
const std::vector< tnode_definition > &  node_definitions,
ttree_view_node parent_node,
ttree_view parent_tree_view,
const std::map< std::string, string_map > &  data 
)
gui2::ttree_view_node::~ttree_view_node ( )

Definition at line 129 of file tree_view_node.cpp.

References gui2::ttree_view::selected_item_, and tree_view().

Member Function Documentation

ttree_view_node & gui2::ttree_view_node::add_child ( const std::string id,
const std::map< std::string, string_map > &  data,
const int  index = -1 
)

Adds a child item to the list of child nodes.

Parameters
idThe id of the node definition to use for the new node.
dataThe data to send to the set_members of the widgets. If the member id is not an empty string it is only send to the widget that has the wanted id (if any). If the member id is an empty string, it is send to all members. Having both empty and non-empty id's gives undefined behavior.
indexThe item before which to add the new item, 0 == begin, -1 == end.

Definition at line 136 of file tree_view_node.cpp.

References children_, gui2::tscrollbar_container::content_grid(), get_indention_level(), gui2::twidget::get_size(), gui2::twidget::get_width(), gui2::ttree_view::indention_step_size_, is_folded(), is_root_node(), itor, node_definitions_, gui2::ttree_view::resize_content(), tree_view(), ttree_view_node(), gui2::tpoint::x, and gui2::tpoint::y.

Referenced by gui2::ttree_view::add_node(), add_sibling(), lua_gui2::intf_add_dialog_tree_node(), gui2::tcampaign_selection::pre_show(), and gui2::tlobby_main::update_playerlist().

ttree_view_node& gui2::ttree_view_node::add_sibling ( const std::string id,
const std::map< std::string, string_map > &  data 
)
inline

Adds a sibbling for a node at the end of the list.

Parameters
idThe id of the node definition to use for the new node.
dataThe data to send to the set_members of the widgets. If the member id is not an empty string it is only send to the widget that has the wanted id (if any). If the member id is an empty string, it is send to all members. Having both empty and non-empty id's gives undefined behavior.

Definition at line 83 of file tree_view_node.hpp.

References add_child(), is_root_node(), and parent_node().

tpoint gui2::ttree_view_node::calculate_best_size ( ) const
overrideprivatevirtual

See twidget::calculate_best_size.

Implements gui2::twidget.

Definition at line 385 of file tree_view_node.cpp.

References tree_view().

Referenced by calculate_best_size().

tpoint gui2::ttree_view_node::calculate_best_size ( const int  indention_level,
const unsigned  indention_step_size 
) const
private
int gui2::ttree_view_node::calculate_ypos ( )
private

Definition at line 708 of file tree_view_node.cpp.

References calculate_ypos(), children_, and parent_node_.

Referenced by calculate_ypos(), clear(), fold_internal(), and unfold_internal().

void gui2::ttree_view_node::clear ( )

Removes all child items from the widget.

Todo:
Also try to find the optimal width.

Definition at line 279 of file tree_view_node.cpp.

References calculate_ypos(), children_, is_folded(), gui2::ttree_view::resize_content(), and tree_view().

Referenced by gui2::tlobby_main::update_playerlist().

virtual iterator::twalker_* gui2::ttree_view_node::create_walker ( )
inlineoverridevirtual

See twidget::create_walker.

Todo:
Implement properly.

Implements gui2::twidget.

Definition at line 138 of file tree_view_node.hpp.

std::vector< int > gui2::ttree_view_node::describe_path ( )

calculates the node indicies that we need to get from the root node to this node.

Definition at line 690 of file tree_view_node.cpp.

References children_, describe_path(), i, is_root_node(), parent_node_, and size().

Referenced by describe_path().

bool gui2::ttree_view_node::disable_click_dismiss ( ) const
overrideprivatevirtual

See twidget::disable_click_dismiss.

Implements gui2::twidget.

Definition at line 390 of file tree_view_node.cpp.

bool gui2::ttree_view_node::empty ( ) const
inline

Does the node have children?

Definition at line 110 of file tree_view_node.hpp.

References children_.

Referenced by gui2::tsub_player_list::auto_hide(), and gui2::ttree_view::empty().

twidget * gui2::ttree_view_node::find ( const std::string id,
const bool  must_be_active 
)
overridevirtual

See twidget::find.

Reimplemented from gui2::twidget.

Definition at line 355 of file tree_view_node.cpp.

References gui2::tgrid::find(), gui2::twidget::find(), and grid_.

Referenced by find_widget(), and gui2::tcampaign_selection::pre_show().

const twidget * gui2::ttree_view_node::find ( const std::string id,
const bool  must_be_active 
) const
overridevirtual

See twidget::find.

Reimplemented from gui2::twidget.

Definition at line 361 of file tree_view_node.cpp.

References gui2::tgrid::find(), gui2::twidget::find(), and grid_.

twidget * gui2::ttree_view_node::find_at ( const tpoint coordinate,
const bool  must_be_active 
)
overridevirtual

See twidget::find_at.

Reimplemented from gui2::twidget.

Definition at line 341 of file tree_view_node.cpp.

const twidget * gui2::ttree_view_node::find_at ( const tpoint coordinate,
const bool  must_be_active 
) const
overridevirtual

See twidget::find_at.

Reimplemented from gui2::twidget.

Definition at line 348 of file tree_view_node.cpp.

void gui2::ttree_view_node::fold ( )
void gui2::ttree_view_node::fold_internal ( )
private
ttree_view_node & gui2::ttree_view_node::get_child_at ( int  index)

Definition at line 684 of file tree_view_node.cpp.

References children_.

Referenced by find_widget(), get_node_above(), and get_node_below().

const std::string & gui2::ttree_view_node::get_control_type ( ) const
private

Returns the control_type of the ttree_view_node.

This class does not derive from tcontrol but the function behaves similar as tcontrol::get_control_type.

Definition at line 678 of file tree_view_node.cpp.

tpoint gui2::ttree_view_node::get_current_size ( bool  assume_visible = false) const
private
Parameters
assume_visibleif false (default) it will return 0 if the parent node is folded

Definition at line 395 of file tree_view_node.cpp.

References children_, get_current_size(), get_folded_size(), gui2::twidget::get_visible(), grid_, gui2::twidget::tvisible::invisible, is_folded(), itor, parent_node_, size(), gui2::tpoint::x, and gui2::tpoint::y.

Referenced by fold_internal(), get_current_size(), get_unfolded_size(), and unfold_internal().

tpoint gui2::ttree_view_node::get_folded_size ( ) const
private
tgrid& gui2::ttree_view_node::get_grid ( )
inline

Definition at line 223 of file tree_view_node.hpp.

References grid_.

unsigned gui2::ttree_view_node::get_indention_level ( ) const

The indention level of the node.

The root node starts at level 0.

Definition at line 180 of file tree_view_node.cpp.

References is_root_node(), and parent_node().

Referenced by add_child(), get_folded_size(), and get_unfolded_size().

ttree_view_node * gui2::ttree_view_node::get_last_visible_parent_node ( )
ttree_view_node * gui2::ttree_view_node::get_node_above ( )
ttree_view_node * gui2::ttree_view_node::get_node_below ( )
ttree_view_node * gui2::ttree_view_node::get_selectable_node_above ( )

Definition at line 776 of file tree_view_node.cpp.

References get_node_above(), and label_.

ttree_view_node * gui2::ttree_view_node::get_selectable_node_below ( )

Definition at line 784 of file tree_view_node.cpp.

References get_node_below(), and label_.

tpoint gui2::ttree_view_node::get_unfolded_size ( ) const
private
void gui2::ttree_view_node::impl_draw_children ( surface frame_buffer,
int  x_offset,
int  y_offset 
)
overrideprivatevirtual

See twidget::impl_draw_children.

Reimplemented from gui2::twidget.

Definition at line 572 of file tree_view_node.cpp.

References children_, gui2::twidget::draw_children(), grid_, and is_folded().

void gui2::ttree_view_node::impl_populate_dirty_list ( twindow caller,
const std::vector< twidget * > &  call_stack 
)
private

"Inherited" from twidget.

This version needs to call its children, which are it's child nodes.

Definition at line 368 of file tree_view_node.cpp.

References children_, grid_, is_folded(), and gui2::twidget::populate_dirty_list().

Referenced by gui2::ttree_view::child_populate_dirty_list().

void gui2::ttree_view_node::init_grid ( tgrid grid,
const std::map< std::string, string_map > &  data 
)
private
bool gui2::ttree_view_node::is_folded ( ) const
bool gui2::ttree_view_node::is_root_node ( ) const
inline

Is this node the root node?

When the parent tree view is created it adds one special node, the root node. This node has no parent node and some other special features so several code paths need to check whether they are the parent node.

Definition at line 97 of file tree_view_node.hpp.

References parent_node_.

Referenced by add_child(), add_sibling(), describe_path(), get_indention_level(), get_node_above(), get_node_below(), parent_node(), and place().

void gui2::ttree_view_node::layout_initialise ( const bool  full_initialisation)
virtual

How the layout engine works.

Every widget has a member layout_size_ which holds the best size in the current layout phase. When the windows starts the layout phase it calls layout_initialise which resets this value.

Every widget has two function to get the best size. get_best_size tests whether layout_size_ is set and if so returns that value otherwise it calls calculate_best_size so the size can be updated.

During the layout phase some functions can modify layout_size_ so the next call to get_best_size returns the currently best size. This means that after the layout phase get_best_size still returns this value. Initialises the layout phase.

Clears the initial best size for the widgets.

See Layout algorithm for more information.

Parameters
full_initialisationFor widgets with scrollbars it hides them unless the mode is tscrollbar_mode::always_visible. For other widgets this flag is a NOP.

Reimplemented from gui2::twidget.

Definition at line 810 of file tree_view_node.cpp.

References gui2::event::tdispatcher::child, children_, grid_, gui2::tgrid::layout_initialise(), and gui2::twidget::layout_initialise().

ttree_view_node & gui2::ttree_view_node::parent_node ( )

Returns the parent node.

Precondition
is_root_node() == false.

Definition at line 193 of file tree_view_node.cpp.

References is_root_node(), and parent_node_.

Referenced by add_sibling(), and get_indention_level().

const ttree_view_node & gui2::ttree_view_node::parent_node ( ) const

The const version of parent_node.

Definition at line 199 of file tree_view_node.cpp.

References is_root_node(), and parent_node_.

void gui2::ttree_view_node::place ( const tpoint origin,
const tpoint size 
)
overrideprivatevirtual
unsigned gui2::ttree_view_node::place ( const unsigned  indention_step_size,
tpoint  origin,
unsigned  width 
)
private
void gui2::ttree_view_node::request_reduce_width ( const unsigned  maximum_width)
overrideprivatevirtual

See twidget::request_reduce_width.

Implements gui2::twidget.

Definition at line 210 of file tree_view_node.cpp.

void gui2::ttree_view_node::select_node ( )
void gui2::ttree_view_node::set_callback_state_change ( const int  scope,
std::function< void(twidget &)>  callback 
)
inline

Inherited from tselectable_.

Parameters
scopeSpecifies the scope of the callback event 0 : on both fold and unfold 1 : on unfolded to folded 2 : on folded to unfolded

Definition at line 202 of file tree_view_node.hpp.

References callback_state_change_, callback_state_to_folded_, and callback_state_to_unfolded_.

void gui2::ttree_view_node::set_origin ( const tpoint origin)
overrideprivatevirtual
void gui2::ttree_view_node::set_visible_rectangle ( const SDL_Rect &  rectangle)
overrideprivatevirtual
void gui2::ttree_view_node::signal_handler_label_left_button_click ( const event::tevent  event,
bool &  handled,
bool &  halt 
)
private
void gui2::ttree_view_node::signal_handler_left_button_click ( const event::tevent  event)
private
Todo:
Rewrite this sizing code for the folding/unfolding.

The code works but feels rather hacky, so better move back to the drawingboard for 1.9.

Definition at line 589 of file tree_view_node.cpp.

References callback_state_change_, DBG_GUI_E, fold_internal(), gui2::tselectable_::get_value_bool(), is_folded(), LOG_HEADER, toggle_, unfold_internal(), and unfolded_.

Referenced by ttree_view_node().

size_t gui2::ttree_view_node::size ( ) const
inline

The "size" of the widget.

Todo:
Rename this function, names to close to the size of the widget.

Definition at line 163 of file tree_view_node.hpp.

References children_.

Referenced by gui2::tsub_player_list::auto_hide(), describe_path(), find_widget(), get_current_size(), get_folded_size(), get_node_above(), get_node_below(), and get_unfolded_size().

ttree_view & gui2::ttree_view_node::tree_view ( )
const ttree_view & gui2::ttree_view_node::tree_view ( ) const

Definition at line 215 of file tree_view_node.cpp.

References tree_view_.

void gui2::ttree_view_node::unfold ( )
void gui2::ttree_view_node::unfold_internal ( )
private

Friends And Related Function Documentation

friend class ttree_view
friend

Definition at line 36 of file tree_view_node.hpp.

friend struct ttree_view_node_implementation
friend

Definition at line 35 of file tree_view_node.hpp.

Member Data Documentation

std::function<void(twidget&)> gui2::ttree_view_node::callback_state_change_
private
std::function<void(twidget&)> gui2::ttree_view_node::callback_state_to_folded_
private
std::function<void(twidget&)> gui2::ttree_view_node::callback_state_to_unfolded_
private
boost::ptr_vector<ttree_view_node> gui2::ttree_view_node::children_
private
tgrid gui2::ttree_view_node::grid_
private
tselectable_* gui2::ttree_view_node::label_
private

The label to show our selected state.

Definition at line 265 of file tree_view_node.hpp.

Referenced by get_selectable_node_above(), get_selectable_node_below(), select_node(), signal_handler_label_left_button_click(), and ttree_view_node().

const std::vector<tnode_definition>& gui2::ttree_view_node::node_definitions_
private

The node definitions known to use.

This list is needed to create new nodes.

Todo:
Maybe store this list in the tree_view to avoid copying the reference.

Definition at line 259 of file tree_view_node.hpp.

Referenced by add_child(), and ttree_view_node().

ttree_view_node* gui2::ttree_view_node::parent_node_
private
tselectable_* gui2::ttree_view_node::toggle_
private

The toggle for the folded state.

Definition at line 262 of file tree_view_node.hpp.

Referenced by fold(), signal_handler_left_button_click(), ttree_view_node(), and unfold().

ttree_view& gui2::ttree_view_node::tree_view_
private

The tree view that owns us.

Definition at line 239 of file tree_view_node.hpp.

Referenced by tree_view().

bool gui2::ttree_view_node::unfolded_
private

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