libt3widget
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
t3_widget::split_t Class Reference

A widget that can contain multiple other widgets. More...

Inheritance diagram for t3_widget::split_t:
t3_widget::widget_t t3_widget::container_t t3_widget::window_component_t t3_widget::mouse_target_t t3_widget::window_component_t t3_widget::window_component_t

Public Member Functions

virtual void force_redraw (void)
widget_tget_current (void)
 Get the currently active widget.
virtual bool is_child (window_component_t *component)
void next (void)
 Make the next widget the active widget.
void previous (void)
 Make the previous widget the active widget.
virtual bool process_key (key_t key)
virtual void set_child_focus (window_component_t *target)
virtual void set_focus (focus_t focus)
virtual bool set_size (optint height, optint width)
void split (widget_t *widget, bool _horizontal)
 Divide the available screen space over one more widget.
 split_t (widget_t *widget)
 Create a new split_t.
widget_tunsplit (void)
 Remove the current widget from the split_t (or a nested split_t).
virtual void update_contents (void)
virtual ~split_t (void)
 Destroy a split_t.
- Public Member Functions inherited from t3_widget::widget_t
virtual bool accepts_focus (void)
 Query whether this widget accepts focus.
virtual void force_redraw (void)
virtual void hide (void)
virtual bool is_enabled (void)
 Query the enabled status of this widget.
virtual bool is_hotkey (key_t key)
 Query whether key is a hotkey for this widget.
virtual bool is_shown (void)
 Query the visibility status of this widget.
virtual bool process_mouse_event (mouse_event_t event)
 Process a mouse event.
virtual void set_anchor (window_component_t *anchor, int relation)
 Set this widget's anchor.
virtual void set_enabled (bool enable)
 Set the enabled status of this widget.
virtual void set_focus (focus_t focus)
virtual void set_position (optint top, optint left)
virtual void show (void)
- Public Member Functions inherited from t3_widget::window_component_t
virtual void force_redraw (void)=0
 Request that this window_component_t be completely redrawn.
virtual t3_window_t * get_base_window (void)
 Retrieve the t3_window_t for this window_component_t.
virtual void hide (void)=0
 Hide the window_component_t.
virtual bool process_key (key_t key)=0
 Handle a key press by the user.
virtual void set_focus (focus_t focus)=0
 Set whether this window_component_t has the input focus.
virtual void set_position (optint top, optint left)=0
 Move the window_component_t to a specified position.
virtual bool set_size (optint height, optint width)=0
 Set the size of this window_component_t.
virtual void show (void)=0
 Display the window_component_t.
virtual void update_contents (void)=0
 Update the contents of the window.
 window_component_t (void)
 Base constructor.
virtual ~window_component_t (void)
 Base destructor.
- Public Member Functions inherited from t3_widget::mouse_target_t
void grab_mouse (void)
 Grab all future mouse events.
void register_mouse_target (t3_window_t *target)
 Register a window to receive mouse events.
void release_mouse_grab (void)
 Release a previous mouse grab.
void unregister_mouse_target (t3_window_t *target)
 Unregister a window to receive mouse events.
- Public Member Functions inherited from t3_widget::container_t
virtual bool is_child (window_component_t *component)=0
 Determine whether a window_compnent_t is a child of the container_t.
virtual void set_child_focus (window_component_t *target)=0
 Set the focus to a specific window component.

Protected Member Functions

bool next_recurse (void)
 Make the next widget the current widget (internal).
bool previous_recurse (void)
 Make the previous widget the current widget (internal).
void set_to_begin (void)
 Make the first widget the active widget.
void set_to_end (void)
 Make the last widget the active widget.
bool unsplit (widget_t **widget)
 Remove the currently activated widget from the split_t (internal).
- Protected Member Functions inherited from t3_widget::widget_t
void init_unbacked_window (int height, int width, bool register_as_mouse_target=false)
 Initialize the window with an unbacked t3_window_t with height and width.
void init_window (int height, int width, bool register_as_mouse_target=true)
 Initialize the window with a t3_window_t with height and width.
 widget_t (int height, int width, bool register_as_mouse_target=true)
 Constructor which creates a default t3_window_t with height and width.
 widget_t (void)
 Constructor which does not create a default t3_window_t.
- Protected Member Functions inherited from t3_widget::mouse_target_t
 mouse_target_t (bool use_window=true)
- Protected Member Functions inherited from t3_widget::container_t
virtual bool set_widget_parent (window_component_t *widget)
 Make widget a child window of this container_t, by setting its parent window.
virtual void unset_widget_parent (window_component_t *widget)
 Unset the parent window for a widget.

Protected Attributes

widgets_t::iterator current
 The currently active widget.
bool focus
 Boolean indicating whether this split_t (or rather, one of its children) has the input focus.
bool horizontal
 Boolean indicating whether to divide the space horizontally or vertically.
widgets_t widgets
 The list of widgets contained by this split_t.
- Protected Attributes inherited from t3_widget::widget_t
bool enabled
 Widget is enabled.
bool redraw
 Widget requires redrawing on next update_contents call.
bool shown
 Widget is shown.
- Protected Attributes inherited from t3_widget::window_component_t
cleanup_t3_window_ptr window
 The t3_window_t used for presenting this item on screen (see libt3window).

Additional Inherited Members

- Public Types inherited from t3_widget::window_component_t
enum  focus_t {
  FOCUS_OUT, FOCUS_SET, FOCUS_IN_FWD, FOCUS_IN_BCK,
  FOCUS_REVERT
}
- Static Public Member Functions inherited from t3_widget::mouse_target_t
static bool handle_mouse_event (mouse_event_t event)

Detailed Description

A widget that can contain multiple other widgets.

The space allocated to a split_t widget can be divided either horizontally or vertically. When a horizontally split split_t is asked to split vertically, it will in fact create a new sub split_t which divides its space vertically. This widget is mostly useful to divide an area over widgets like edit_window_t or text_window_t.

Constructor & Destructor Documentation

t3_widget::split_t::split_t ( widget_t widget)

Create a new split_t.

t3_widget::split_t::~split_t ( void  )
virtual

Destroy a split_t.

Deletes all contained widgets as well.

Member Function Documentation

widget_t * t3_widget::split_t::get_current ( void  )

Get the currently active widget.

void t3_widget::split_t::next ( void  )

Make the next widget the active widget.

bool t3_widget::split_t::next_recurse ( void  )
protected

Make the next widget the current widget (internal).

Because split_t widgets may be nested, calling next on this widget may actually need to tell a nested split_t to activate the next widget. This needs slightly different handling than the generic next call, and needs to report whether the end of the list was reached. In the latter case, the return value shall be false.

void t3_widget::split_t::previous ( void  )

Make the previous widget the active widget.

bool t3_widget::split_t::previous_recurse ( void  )
protected

Make the previous widget the current widget (internal).

See next_recurse for details.

void t3_widget::split_t::set_to_begin ( void  )
protected

Make the first widget the active widget.

void t3_widget::split_t::set_to_end ( void  )
protected

Make the last widget the active widget.

void t3_widget::split_t::split ( widget_t widget,
bool  _horizontal 
)

Divide the available screen space over one more widget.

Parameters
widgetThe widget to add.
_horizontalWhether to split the space horizontally or vertically.

This function may create a new nested split_t, if the current split_t is split horizontally and a vertical split is requested or vice versa. Note that if the current split_t is already a nested split_t, it may nest even further.

bool t3_widget::split_t::unsplit ( widget_t **  widget)
protected

Remove the currently activated widget from the split_t (internal).

This function takes into account that split_t widgets may be nested, and if it finds the the widget to remove is in fact a split_t it will ask that to remove its current widget instead. If that leaves only a single widget in the nested split_t, this funciton will return true and the remaining widget in the nested split_t will replace the nested split_t in this widget.

widget_t * t3_widget::split_t::unsplit ( void  )

Remove the current widget from the split_t (or a nested split_t).

Returns
The widget that was removed.

Member Data Documentation

widgets_t::iterator t3_widget::split_t::current
protected

The currently active widget.

bool t3_widget::split_t::focus
protected

Boolean indicating whether this split_t (or rather, one of its children) has the input focus.

bool t3_widget::split_t::horizontal
protected

Boolean indicating whether to divide the space horizontally or vertically.

widgets_t t3_widget::split_t::widgets
protected

The list of widgets contained by this split_t.