Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends

gui2::tscrollbar_container Class Reference

Base class for creating containers with one or two scrollbar(s). More...

#include <scrollbar_container.hpp>

Inheritance diagram for gui2::tscrollbar_container:
Inheritance graph
[legend]
Collaboration diagram for gui2::tscrollbar_container:
Collaboration graph
[legend]

List of all members.

Public Types

enum  tscrollbar_mode { always_visible, always_invisible, auto_visible, auto_visible_first_run }
 

The way to handle the showing or hiding of the scrollbar.

More...

Public Member Functions

 tscrollbar_container (const unsigned canvas_count)
 ~tscrollbar_container ()
void layout_init (const bool full_initialization)
 Inherited from tcontainer_.
void request_reduce_height (const unsigned maximum_height)
 Inherited from twidget.
void request_reduce_width (const unsigned maximum_width)
 Inherited from tcontrol.
bool can_wrap () const
 Inherited from tcontainer_.
void place (const tpoint &origin, const tpoint &size)
 Inherited from tcontainer_.
void set_origin (const tpoint &origin)
 Inherited from tcontainer_.
void set_visible_area (const SDL_Rect &area)
 Inherited from tcontainer_.
bool get_active () const
 Inherited from tcontainer_.
unsigned get_state () const
 Inherited from tcontainer_.
twidgetfind_at (const tpoint &coordinate, const bool must_be_active)
 Inherited from tcontainer_.
const twidgetfind_at (const tpoint &coordinate, const bool must_be_active) const
 Inherited from tcontainer_.
twidgetfind (const std::string &id, const bool must_be_active)
 Inherited from tcontainer_.
const twidgetfind (const std::string &id, const bool must_be_active) const
 Inherited from tcontrol.
bool disable_click_dismiss () const
 Inherited from tcontainer_.
void set_vertical_scrollbar_mode (const tscrollbar_mode scrollbar_mode)
tscrollbar_mode get_vertical_scrollbar_mode () const
void set_horizontal_scrollbar_mode (const tscrollbar_mode scrollbar_mode)
tscrollbar_mode get_horizontal_scrollbar_mode () const
tgridcontent_grid ()
const tgridcontent_grid () const
const SDL_Rect & content_visible_area () const
void scroll_vertical_scrollbar (const tscrollbar_::tscroll scroll)
 Scrolls the vertical scrollbar.
void scroll_horizontal_scrollbar (const tscrollbar_::tscroll scroll)
 Scrolls the horizontal scrollbar.
void vertical_scrollbar_moved ()
 Callback when the scrollbar moves (NOTE maybe only one callback needed).
void horizontal_scrollbar_moved ()

Protected Member Functions

void show_content_rect (const SDL_Rect &rect)
 Shows a certain part of the content.
void set_scrollbar_button_status ()
 Sets the status of the scrollbar buttons.
bool content_resize_request (const bool force_sizing=false)
 Notification if the content of a child needs a resize.
bool content_resize_request (const int width_modification, const int height_modification)
 Request from the content to modify the size of the container.
virtual void handle_key_home (SDLMod modifier, bool &handled)
 Home key pressed.
virtual void handle_key_end (SDLMod modifier, bool &handled)
 End key pressed.
virtual void handle_key_page_up (SDLMod modifier, bool &handled)
 Page up key pressed.
virtual void handle_key_page_down (SDLMod modifier, bool &handled)
 Page down key pressed.
virtual void handle_key_up_arrow (SDLMod modifier, bool &handled)
 Up arrow key pressed.
virtual void handle_key_down_arrow (SDLMod modifier, bool &handled)
 Down arrow key pressed.
virtual void handle_key_left_arrow (SDLMod modifier, bool &handled)
 Left arrow key pressed.
virtual void handle_key_right_arrow (SDLMod modifier, bool &handled)
 Right arrow key pressed.

Private Types

enum  tstate { ENABLED, DISABLED, COUNT }
 

Possible states of the widget.

More...

Private Member Functions

tpoint calculate_best_size () const
 Inherited from tcontainer_.
bool content_resize_width (const int width_modification)
 Helper for content_resize_request.
bool content_resize_height (const int height_modification)
 Helper for content_resize_request.
void finalize_setup ()
 The builder needs to call us so we do our setup.
virtual void finalize_subclass ()
 Function for the subclasses to do their setup.
void layout_children ()
 Inherited from tcontainer_.
void impl_draw_children (surface &frame_buffer)
 Inherited from tcontainer_.
void impl_draw_children (surface &frame_buffer, int x_offset, int y_offset)
void child_populate_dirty_list (twindow &caller, const std::vector< twidget * > &call_stack)
 Inherited from tcontainer_.
virtual void set_content_size (const tpoint &origin, const tpoint &size)
 Sets the size of the content grid.
void scrollbar_moved ()
 Helper function which needs to be called after the scollbar moved.
const std::string & get_control_type () const
 Inherited from tcontrol.
void signal_handler_sdl_key_down (const event::tevent event, bool &handled, const SDLKey key, SDLMod modifier)
void signal_handler_sdl_wheel_up (const event::tevent event, bool &handled)
void signal_handler_sdl_wheel_down (const event::tevent event, bool &handled)
void signal_handler_sdl_wheel_left (const event::tevent event, bool &handled)
void signal_handler_sdl_wheel_right (const event::tevent event, bool &handled)

Private Attributes

tstate state_
 Current state of the widget.
tscrollbar_mode vertical_scrollbar_mode_
 The mode of how to show the scrollbar.
tscrollbar_mode horizontal_scrollbar_mode_
tgridvertical_scrollbar_grid_
 These are valid after finalize_setup().
tgridhorizontal_scrollbar_grid_
tscrollbar_vertical_scrollbar_
 These are valid after finalize_setup().
tscrollbar_horizontal_scrollbar_
tgridcontent_grid_
 The grid that holds the content.
tspacercontent_
 Dummy spacer to hold the contents location.
SDL_Rect content_visible_area_
 Cache for the visible area for the content.

Friends

class tdebug_layout_graph
struct implementation::tbuilder_scroll_label
struct implementation::tbuilder_scrollbar_panel
class tlistbox
class ttree_view
struct tscrollbar_container_implementation

Detailed Description

Base class for creating containers with one or two scrollbar(s).

For now users can't instanciate this class directly and needs to use small wrapper classes. Maybe in the future users can use the class directly.

Todo:
events are not yet send to the content grid.

Definition at line 40 of file scrollbar_container.hpp.


Member Enumeration Documentation

The way to handle the showing or hiding of the scrollbar.

Enumerator:
always_visible 

The scrollbar is always shown, whether needed or not.

always_invisible 

The scrollbar is never shown even not when needed.

There's also no space reserved for the scrollbar.

auto_visible 

The scrollbar is shown when the number of items is larger as the visible items.

The space for the scrollbar is always reserved, just in case it's needed after the initial sizing (due to adding items).

auto_visible_first_run 

Like auto_visible, but when not needed upon the initial layout phase, the bars are not shown and no space is reserved for them.

(The algorithm hides them by default.

Definition at line 60 of file scrollbar_container.hpp.

Possible states of the widget.

Note the order of the states must be the same as defined in settings.hpp.

Enumerator:
ENABLED 
DISABLED 
COUNT 

Reimplemented in gui2::tscroll_label.

Definition at line 400 of file scrollbar_container.hpp.


Constructor & Destructor Documentation

gui2::tscrollbar_container::tscrollbar_container ( const unsigned  canvas_count  )  [explicit]
gui2::tscrollbar_container::~tscrollbar_container (  )  [inline]

Definition at line 57 of file scrollbar_container.hpp.

References content_grid_.


Member Function Documentation

tpoint gui2::tscrollbar_container::calculate_best_size (  )  const [private, virtual]
bool gui2::tscrollbar_container::can_wrap (  )  const [inline, virtual]

Inherited from tcontainer_.

Reimplemented from gui2::tcontainer_.

Definition at line 98 of file scrollbar_container.hpp.

References gui2::tgrid::can_wrap(), and content_grid_.

Here is the call graph for this function:

void gui2::tscrollbar_container::child_populate_dirty_list ( twindow caller,
const std::vector< twidget * > &  call_stack 
) [private, virtual]

Inherited from tcontainer_.

Reimplemented from gui2::tcontainer_.

Reimplemented in gui2::tlistbox, and gui2::ttree_view.

Definition at line 784 of file scrollbar_container.cpp.

References content_grid_, and gui2::twidget::populate_dirty_list().

Here is the call graph for this function:

const tgrid* gui2::tscrollbar_container::content_grid (  )  const [inline]

Definition at line 157 of file scrollbar_container.hpp.

References content_grid_.

tgrid* gui2::tscrollbar_container::content_grid (  )  [inline]
bool gui2::tscrollbar_container::content_resize_height ( const int  height_modification  )  [private]
bool gui2::tscrollbar_container::content_resize_request ( const bool  force_sizing = false  )  [protected]

Notification if the content of a child needs a resize.

When a resize is required the container first can try to handle it itself. If it can't honour the request the function will call twindow::invalidate_layout().

Note:
Calling this function on a widget with size == (0, 0) results false but doesn't call invalidate_layout, the engine expects to be in build up phase with the layout already invalidated.
Parameters:
force_sizing If the contents fit do we want to force a resize? This is needed in the MP lobby since items might not be properly placed yet. (The listboxes with the player info need it.)
Returns:
True if the resize is handled, false otherwise.

Todo:
Try to handle auto_visible_first_run here as well.

Handling it here makes the code a bit more complex but allows to not reserve space for scrollbars, which will look nicer in the MP lobby. But the extra complexity is no 1.8 material.

Definition at line 454 of file scrollbar_container.cpp.

References always_invisible, auto_visible_first_run, content_, content_grid_, DBG_GUI_L, gui2::twidget::get_origin(), gui2::twidget::get_size(), gui2::twidget::get_visible(), gui2::twidget::get_window(), horizontal_scrollbar_grid_, horizontal_scrollbar_mode_, gui2::twindow::invalidate_layout(), LOG_HEADER, place(), gui2::tgrid::recalculate_best_size(), vertical_scrollbar_grid_, vertical_scrollbar_mode_, gui2::tpoint::x, and gui2::tpoint::y.

Referenced by gui2::ttree_view::resize_content(), gui2::tlistbox::resize_content(), gui2::tscroll_label::set_label(), gui2::tlistbox::set_row_shown(), and gui2::tlistbox::update_content_size().

Here is the call graph for this function:

Here is the caller graph for this function:

bool gui2::tscrollbar_container::content_resize_request ( const int  width_modification,
const int  height_modification 
) [protected]

Request from the content to modify the size of the container.

When the wanted resize fails the function will call twindow::invalidate_layout().

Note:
Calling this function on a widget with size == (0, 0) results false but doesn't call invalidate_layout, the engine expects to be in build up phase with the layout already invalidated.
If twindow::get_need_layout() is true the function returns false and doesn't try to fit the contents since a layout phase will be triggered anyway.
This function might replace the content_resize_request above.
Parameters:
width_modification The wanted modification to the width: * negative values reduce width. * zero leave width as is. * positive values increase width.
height_modification The wanted modification to the height: * negative values reduce height. * zero leave height as is. * positive values increase height.
Returns:
True is wanted modification is accepted false otherwise.

Definition at line 532 of file scrollbar_container.cpp.

References content_, content_grid_, content_resize_height(), content_resize_width(), DBG_GUI_L, gui2::twindow::get_need_layout(), gui2::twidget::get_size(), gui2::twidget::get_window(), LOG_HEADER, and set_scrollbar_button_status().

Here is the call graph for this function:

bool gui2::tscrollbar_container::content_resize_width ( const int  width_modification  )  [private]
const SDL_Rect& gui2::tscrollbar_container::content_visible_area (  )  const [inline]
bool gui2::tscrollbar_container::disable_click_dismiss (  )  const [virtual]

Inherited from tcontainer_.

Reimplemented from gui2::tcontainer_.

Definition at line 447 of file scrollbar_container.cpp.

References content_grid_, and gui2::tgrid::disable_click_dismiss().

Here is the call graph for this function:

void gui2::tscrollbar_container::finalize_setup (  )  [private]
virtual void gui2::tscrollbar_container::finalize_subclass (  )  [inline, private, virtual]

Function for the subclasses to do their setup.

This function is called at the end of finalize_setup().

Reimplemented in gui2::tscroll_label.

Definition at line 451 of file scrollbar_container.hpp.

Referenced by finalize_setup().

Here is the caller graph for this function:

twidget * gui2::tscrollbar_container::find ( const std::string &  id,
const bool  must_be_active 
) [virtual]

Inherited from tcontainer_.

Reimplemented from gui2::tcontainer_.

Definition at line 433 of file scrollbar_container.cpp.

const twidget * gui2::tscrollbar_container::find ( const std::string &  id,
const bool  must_be_active 
) const [virtual]

Inherited from tcontrol.

Reimplemented from gui2::tcontainer_.

Definition at line 440 of file scrollbar_container.cpp.

twidget * gui2::tscrollbar_container::find_at ( const tpoint coordinate,
const bool  must_be_active 
) [virtual]

Inherited from tcontainer_.

Reimplemented from gui2::tcontainer_.

Definition at line 419 of file scrollbar_container.cpp.

const twidget * gui2::tscrollbar_container::find_at ( const tpoint coordinate,
const bool  must_be_active 
) const [virtual]

Inherited from tcontainer_.

Reimplemented from gui2::tcontainer_.

Definition at line 426 of file scrollbar_container.cpp.

bool gui2::tscrollbar_container::get_active (  )  const [inline, virtual]

Inherited from tcontainer_.

Implements gui2::tcontrol.

Reimplemented in gui2::tscroll_label, and gui2::tscrollbar_panel.

Definition at line 123 of file scrollbar_container.hpp.

References state_.

const std::string & gui2::tscrollbar_container::get_control_type (  )  const [private, virtual]

Inherited from tcontrol.

Implements gui2::tcontrol.

Reimplemented in gui2::tlistbox, gui2::tscroll_label, gui2::tscrollbar_panel, and gui2::ttree_view.

Definition at line 1041 of file scrollbar_container.cpp.

References type.

tscrollbar_mode gui2::tscrollbar_container::get_horizontal_scrollbar_mode (  )  const [inline]

Definition at line 153 of file scrollbar_container.hpp.

References horizontal_scrollbar_mode_.

unsigned gui2::tscrollbar_container::get_state (  )  const [inline, virtual]

Inherited from tcontainer_.

Implements gui2::tcontrol.

Reimplemented in gui2::tscroll_label, and gui2::tscrollbar_panel.

Definition at line 126 of file scrollbar_container.hpp.

References state_.

tscrollbar_mode gui2::tscrollbar_container::get_vertical_scrollbar_mode (  )  const [inline]

Definition at line 148 of file scrollbar_container.hpp.

References vertical_scrollbar_mode_.

void gui2::tscrollbar_container::handle_key_down_arrow ( SDLMod  modifier,
bool &  handled 
) [protected, virtual]

Down arrow key pressed.

Parameters:
modifier The SDL keyboard modifier when the key was pressed.
handled If the function handles the key it should set handled to true else do not modify it. This is used in the keyboard event changing.

Reimplemented in gui2::tlistbox.

Definition at line 980 of file scrollbar_container.cpp.

References gui2::tscrollbar_::ITEM_FORWARD, gui2::tscrollbar_::scroll(), scrollbar_moved(), and vertical_scrollbar_.

Referenced by signal_handler_sdl_key_down().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::handle_key_end ( SDLMod  modifier,
bool &  handled 
) [protected, virtual]

End key pressed.

Parameters:
modifier The SDL keyboard modifier when the key was pressed.
handled If the function handles the key it should set handled to true else do not modify it. This is used in the keyboard event changing.

Definition at line 935 of file scrollbar_container.cpp.

References gui2::tscrollbar_::END, gui2::tscrollbar_::scroll(), scrollbar_moved(), and vertical_scrollbar_.

Referenced by signal_handler_sdl_key_down().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::handle_key_home ( SDLMod  modifier,
bool &  handled 
) [protected, virtual]

Home key pressed.

Parameters:
modifier The SDL keyboard modifier when the key was pressed.
handled If the function handles the key it should set handled to true else do not modify it. This is used in the keyboard event changing.

Definition at line 924 of file scrollbar_container.cpp.

References gui2::tscrollbar_::BEGIN, horizontal_scrollbar_, gui2::tscrollbar_::scroll(), scrollbar_moved(), and vertical_scrollbar_.

Referenced by signal_handler_sdl_key_down().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::handle_key_left_arrow ( SDLMod  modifier,
bool &  handled 
) [protected, virtual]

Left arrow key pressed.

Parameters:
modifier The SDL keyboard modifier when the key was pressed.
handled If the function handles the key it should set handled to true else do not modify it. This is used in the keyboard event changing.

Reimplemented in gui2::tlistbox.

Definition at line 991 of file scrollbar_container.cpp.

References gui2::tscrollbar_::ITEM_BACKWARDS.

Referenced by signal_handler_sdl_key_down().

Here is the caller graph for this function:

void gui2::tscrollbar_container::handle_key_page_down ( SDLMod  modifier,
bool &  handled 
) [protected, virtual]

Page down key pressed.

Parameters:
modifier The SDL keyboard modifier when the key was pressed.
handled If the function handles the key it should set handled to true else do not modify it. This is used in the keyboard event changing.

Definition at line 957 of file scrollbar_container.cpp.

References gui2::tscrollbar_::JUMP_FORWARD, gui2::tscrollbar_::scroll(), scrollbar_moved(), and vertical_scrollbar_.

Referenced by signal_handler_sdl_key_down().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::handle_key_page_up ( SDLMod  modifier,
bool &  handled 
) [protected, virtual]

Page up key pressed.

Parameters:
modifier The SDL keyboard modifier when the key was pressed.
handled If the function handles the key it should set handled to true else do not modify it. This is used in the keyboard event changing.

Definition at line 946 of file scrollbar_container.cpp.

References gui2::tscrollbar_::JUMP_BACKWARDS, gui2::tscrollbar_::scroll(), scrollbar_moved(), and vertical_scrollbar_.

Referenced by signal_handler_sdl_key_down().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::handle_key_right_arrow ( SDLMod  modifier,
bool &  handled 
) [protected, virtual]

Right arrow key pressed.

Parameters:
modifier The SDL keyboard modifier when the key was pressed.
handled If the function handles the key it should set handled to true else do not modify it. This is used in the keyboard event changing.

Reimplemented in gui2::tlistbox.

Definition at line 1002 of file scrollbar_container.cpp.

References gui2::tscrollbar_::ITEM_FORWARD.

Referenced by signal_handler_sdl_key_down().

Here is the caller graph for this function:

void gui2::tscrollbar_container::handle_key_up_arrow ( SDLMod  modifier,
bool &  handled 
) [protected, virtual]

Up arrow key pressed.

Parameters:
modifier The SDL keyboard modifier when the key was pressed.
handled If the function handles the key it should set handled to true else do not modify it. This is used in the keyboard event changing.

Reimplemented in gui2::tlistbox.

Definition at line 969 of file scrollbar_container.cpp.

References gui2::tscrollbar_::ITEM_BACKWARDS, gui2::tscrollbar_::scroll(), scrollbar_moved(), and vertical_scrollbar_.

Referenced by signal_handler_sdl_key_down().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::horizontal_scrollbar_moved (  )  [inline]

Definition at line 185 of file scrollbar_container.hpp.

References scrollbar_moved().

Referenced by finalize_setup().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::impl_draw_children ( surface frame_buffer  )  [private, virtual]

Inherited from tcontainer_.

Reimplemented from gui2::tcontainer_.

Definition at line 750 of file scrollbar_container.cpp.

References content_grid_, gui2::twidget::draw_children(), gui2::twidget::get_visible(), and gui2::twidget::VISIBLE.

Referenced by impl_draw_children().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::impl_draw_children ( surface frame_buffer,
int  x_offset,
int  y_offset 
) [private, virtual]

Reimplemented from gui2::tcontainer_.

Definition at line 761 of file scrollbar_container.cpp.

References content_grid_, gui2::twidget::draw_children(), gui2::twidget::get_visible(), impl_draw_children(), and gui2::twidget::VISIBLE.

Here is the call graph for this function:

void gui2::tscrollbar_container::layout_children (  )  [private, virtual]

Inherited from tcontainer_.

Reimplemented from gui2::tcontainer_.

Reimplemented in gui2::tlistbox, and gui2::ttree_view.

Definition at line 775 of file scrollbar_container.cpp.

References content_grid_, and gui2::tgrid::layout_children().

Here is the call graph for this function:

void gui2::tscrollbar_container::layout_init ( const bool  full_initialization  )  [virtual]
void gui2::tscrollbar_container::place ( const tpoint origin,
const tpoint size 
) [virtual]
void gui2::tscrollbar_container::request_reduce_height ( const unsigned  maximum_height  )  [virtual]
void gui2::tscrollbar_container::request_reduce_width ( const unsigned  maximum_width  )  [virtual]
void gui2::tscrollbar_container::scroll_horizontal_scrollbar ( const tscrollbar_::tscroll  scroll  ) 

Scrolls the horizontal scrollbar.

Parameters:
scroll The position to scroll to.

Definition at line 915 of file scrollbar_container.cpp.

References horizontal_scrollbar_, gui2::tscrollbar_::scroll(), and scrollbar_moved().

Referenced by finalize_setup().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::scroll_vertical_scrollbar ( const tscrollbar_::tscroll  scroll  ) 

Scrolls the vertical scrollbar.

Parameters:
scroll The position to scroll to.

Definition at line 906 of file scrollbar_container.cpp.

References gui2::tscrollbar_::scroll(), scrollbar_moved(), and vertical_scrollbar_.

Referenced by gui2::tlobby_main::append_to_chatbox(), and finalize_setup().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::scrollbar_moved (  )  [private]
void gui2::tscrollbar_container::set_content_size ( const tpoint origin,
const tpoint size 
) [private, virtual]

Sets the size of the content grid.

This function normally just updates the content grid but can be overridden by a subclass.

Parameters:
origin The origin for the content.
size The size of the content.

Reimplemented in gui2::tlistbox.

Definition at line 795 of file scrollbar_container.cpp.

References content_grid_, and gui2::tgrid::place().

Referenced by place().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::set_horizontal_scrollbar_mode ( const tscrollbar_mode  scrollbar_mode  ) 
Note:
shouldn't be called after being shown in a dialog.

Definition at line 743 of file scrollbar_container.cpp.

References horizontal_scrollbar_mode_.

void gui2::tscrollbar_container::set_origin ( const tpoint origin  )  [virtual]

Inherited from tcontainer_.

Reimplemented from gui2::tcontainer_.

Definition at line 392 of file scrollbar_container.cpp.

References content_, content_grid_, content_visible_area_, gui2::twidget::get_origin(), gui2::tgrid::set_origin(), and gui2::tgrid::set_visible_area().

Here is the call graph for this function:

void gui2::tscrollbar_container::set_scrollbar_button_status (  )  [protected]

Sets the status of the scrollbar buttons.

This is needed after the scrollbar moves so the status of the buttons will be active or inactive as needed.

Todo:
scrollbar visibility.
Todo:
scrollbar visibility.

Definition at line 851 of file scrollbar_container.cpp.

References gui2::tscrollbar_::all_items_visible(), gui2::tscrollbar_::at_begin(), gui2::tscrollbar_::at_end(), horizontal_scrollbar_, horizontal_scrollbar_grid_, gui2::tscrollbar_::set_active(), gui2::tcontrol::set_active(), vertical_scrollbar_, and vertical_scrollbar_grid_.

Referenced by content_resize_request(), place(), and scrollbar_moved().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::set_vertical_scrollbar_mode ( const tscrollbar_mode  scrollbar_mode  ) 
Note:
shouldn't be called after being shown in a dialog.

Definition at line 735 of file scrollbar_container.cpp.

References vertical_scrollbar_mode_.

void gui2::tscrollbar_container::set_visible_area ( const SDL_Rect &  area  )  [virtual]

Inherited from tcontainer_.

Reimplemented from gui2::tcontainer_.

Definition at line 408 of file scrollbar_container.cpp.

References content_, content_grid_, content_visible_area_, gui2::twidget::get_rect(), intersect_rects(), and gui2::tgrid::set_visible_area().

Here is the call graph for this function:

void gui2::tscrollbar_container::show_content_rect ( const SDL_Rect &  rect  )  [protected]

Shows a certain part of the content.

When the part to be shown is bigger as the visible viewport the top left of the wanted rect will be the top left of the viewport.

Parameters:
rect The rect which should be visible.

Definition at line 801 of file scrollbar_container.cpp.

References content_, gui2::distance(), gui2::twidget::get_height(), gui2::tscrollbar_::get_item_position(), gui2::twidget::get_width(), gui2::twidget::get_x(), gui2::twidget::get_y(), horizontal_scrollbar_, scrollbar_moved(), gui2::tscrollbar_::set_item_position(), and vertical_scrollbar_.

Referenced by gui2::tlistbox::handle_key_down_arrow(), gui2::tlistbox::handle_key_left_arrow(), gui2::tlistbox::handle_key_right_arrow(), gui2::tlistbox::handle_key_up_arrow(), and gui2::tlistbox::place().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::signal_handler_sdl_key_down ( const event::tevent  event,
bool &  handled,
const SDLKey  key,
SDLMod  modifier 
) [private]

Definition at line 1047 of file scrollbar_container.cpp.

References DBG_GUI_E, handle_key_down_arrow(), handle_key_end(), handle_key_home(), handle_key_left_arrow(), handle_key_page_down(), handle_key_page_up(), handle_key_right_arrow(), handle_key_up_arrow(), and LOG_HEADER.

Referenced by tscrollbar_container().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::signal_handler_sdl_wheel_down ( const event::tevent  event,
bool &  handled 
) [private]

Definition at line 1110 of file scrollbar_container.cpp.

References DBG_GUI_E, gui2::twidget::get_visible(), gui2::tscrollbar_::HALF_JUMP_FORWARD, LOG_HEADER, gui2::tscrollbar_::scroll(), scrollbar_moved(), vertical_scrollbar_, and vertical_scrollbar_grid_.

Referenced by tscrollbar_container().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::signal_handler_sdl_wheel_left ( const event::tevent  event,
bool &  handled 
) [private]

Definition at line 1125 of file scrollbar_container.cpp.

References DBG_GUI_E, gui2::twidget::get_visible(), gui2::tscrollbar_::HALF_JUMP_BACKWARDS, horizontal_scrollbar_, horizontal_scrollbar_grid_, LOG_HEADER, gui2::tscrollbar_::scroll(), and scrollbar_moved().

Referenced by tscrollbar_container().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::signal_handler_sdl_wheel_right ( const event::tevent  event,
bool &  handled 
) [private]

Definition at line 1140 of file scrollbar_container.cpp.

References DBG_GUI_E, gui2::twidget::get_visible(), gui2::tscrollbar_::HALF_JUMP_FORWARD, horizontal_scrollbar_, horizontal_scrollbar_grid_, LOG_HEADER, gui2::tscrollbar_::scroll(), and scrollbar_moved().

Referenced by tscrollbar_container().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::signal_handler_sdl_wheel_up ( const event::tevent  event,
bool &  handled 
) [private]

Definition at line 1095 of file scrollbar_container.cpp.

References DBG_GUI_E, gui2::twidget::get_visible(), gui2::tscrollbar_::HALF_JUMP_BACKWARDS, LOG_HEADER, gui2::tscrollbar_::scroll(), scrollbar_moved(), vertical_scrollbar_, and vertical_scrollbar_grid_.

Referenced by tscrollbar_container().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tscrollbar_container::vertical_scrollbar_moved (  )  [inline]

Callback when the scrollbar moves (NOTE maybe only one callback needed).

Maybe also make protected or private and add a friend.

Definition at line 182 of file scrollbar_container.hpp.

References scrollbar_moved().

Referenced by finalize_setup().

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend struct implementation::tbuilder_scroll_label [friend]

Reimplemented in gui2::tscroll_label.

Definition at line 45 of file scrollbar_container.hpp.

Reimplemented in gui2::tscrollbar_panel.

Definition at line 46 of file scrollbar_container.hpp.

friend class tdebug_layout_graph [friend]

Reimplemented from gui2::tcontainer_.

Reimplemented in gui2::tlistbox.

Definition at line 43 of file scrollbar_container.hpp.

friend class tlistbox [friend]

Definition at line 48 of file scrollbar_container.hpp.

friend struct tscrollbar_container_implementation [friend]

Definition at line 51 of file scrollbar_container.hpp.

friend class ttree_view [friend]

Definition at line 50 of file scrollbar_container.hpp.


Member Data Documentation

Cache for the visible area for the content.

The visible area for the content needs to be updated when scrolling.

Definition at line 441 of file scrollbar_container.hpp.

Referenced by content_visible_area(), gui2::ttree_view::layout_children(), gui2::tlistbox::layout_children(), place(), scrollbar_moved(), set_origin(), and set_visible_area().

Current state of the widget.

The state of the widget determines what to render and how the widget reacts to certain 'events'.

Reimplemented in gui2::tscroll_label.

Definition at line 408 of file scrollbar_container.hpp.

Referenced by get_active(), and get_state().

The mode of how to show the scrollbar.

This value should only be modified before showing, doing it while showing results in UB.

Definition at line 417 of file scrollbar_container.hpp.

Referenced by content_resize_height(), content_resize_request(), get_vertical_scrollbar_mode(), layout_init(), place(), request_reduce_height(), scrollbar_moved(), and set_vertical_scrollbar_mode().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:23:22 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs