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

Base class for widgets. More...

Inheritance diagram for t3_widget::widget_t:
t3_widget::window_component_t t3_widget::mouse_target_t t3_widget::window_component_t t3_widget::attribute_test_line_t t3_widget::bullet_t t3_widget::button_t t3_widget::checkbox_t t3_widget::color_picker_base_t t3_widget::dummy_widget_t t3_widget::edit_window_t t3_widget::expander_t t3_widget::file_pane_t t3_widget::frame_t t3_widget::label_t t3_widget::list_pane_t t3_widget::menu_bar_t t3_widget::menu_item_base_t t3_widget::multi_widget_t t3_widget::scrollbar_t t3_widget::separator_t t3_widget::smart_label_t t3_widget::split_t t3_widget::text_field_t t3_widget::text_window_t t3_widget::widget_group_t

Public Member Functions

virtual bool accepts_focus (void)
 Query whether this widget accepts focus. More...
 
virtual void force_redraw (void)
 Request that this window_component_t be completely redrawn. More...
 
virtual void hide (void)
 Hide the window_component_t. More...
 
virtual bool is_enabled (void)
 Query the enabled status of this widget. More...
 
virtual bool is_hotkey (key_t key)
 Query whether key is a hotkey for this widget. More...
 
virtual bool is_shown (void)
 Query the visibility status of this widget. More...
 
virtual bool process_mouse_event (mouse_event_t event)
 Process a mouse event. More...
 
virtual void set_anchor (window_component_t *anchor, int relation)
 Set this widget's anchor. More...
 
virtual void set_enabled (bool enable)
 Set the enabled status of this widget. More...
 
virtual void set_focus (focus_t focus)
 Set whether this window_component_t has the input focus. More...
 
virtual void set_position (optint top, optint left)
 Move the window_component_t to a specified position. More...
 
virtual void show (void)
 Display the window_component_t. More...
 
- Public Member Functions inherited from t3_widget::window_component_t
virtual t3_window_t * get_base_window (void)
 Retrieve the t3_window_t for this window_component_t. More...
 
virtual bool process_key (key_t key)=0
 Handle a key press by the user. More...
 
virtual bool set_size (optint height, optint width)=0
 Set the size of this window_component_t. More...
 
virtual void update_contents (void)=0
 Update the contents of the window. More...
 
 window_component_t (void)
 Base constructor. More...
 
virtual ~window_component_t (void)
 Base destructor. More...
 
- Public Member Functions inherited from t3_widget::mouse_target_t
void grab_mouse (void)
 Grab all future mouse events. More...
 
void register_mouse_target (t3_window_t *target)
 Register a window to receive mouse events. More...
 
void release_mouse_grab (void)
 Release a previous mouse grab. More...
 
void unregister_mouse_target (t3_window_t *target)
 Unregister a window to receive mouse events. More...
 

Protected Member Functions

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. More...
 
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. More...
 
 widget_t (int height, int width, bool register_as_mouse_target=true)
 Constructor which creates a default t3_window_t with height and width. More...
 
 widget_t (void)
 Constructor which does not create a default t3_window_t. More...
 
- Protected Member Functions inherited from t3_widget::mouse_target_t
 mouse_target_t (bool use_window=true)
 

Protected Attributes

bool enabled
 Widget is enabled. More...
 
bool redraw
 Widget requires redrawing on next update_contents call. More...
 
bool shown
 Widget is shown. More...
 
- 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). More...
 

Friends

class container_t
 

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

Base class for widgets.

Constructor & Destructor Documentation

t3_widget::widget_t::widget_t ( int  height,
int  width,
bool  register_as_mouse_target = true 
)
protected

Constructor which creates a default t3_window_t with height and width.

t3_widget::widget_t::widget_t ( void  )
protected

Constructor which does not create a default t3_window_t.

This constructor should only rarely be necessary. Widgets using this constructor should call either init_window, or init_unbacked_window.

Member Function Documentation

bool t3_widget::widget_t::accepts_focus ( void  )
virtual
void t3_widget::widget_t::force_redraw ( void  )
virtual
void t3_widget::widget_t::hide ( void  )
virtual
void t3_widget::widget_t::init_unbacked_window ( int  height,
int  width,
bool  register_as_mouse_target = false 
)
protected

Initialize the window with an unbacked t3_window_t with height and width.

void t3_widget::widget_t::init_window ( int  height,
int  width,
bool  register_as_mouse_target = true 
)
protected

Initialize the window with a t3_window_t with height and width.

bool t3_widget::widget_t::is_enabled ( void  )
virtual

Query the enabled status of this widget.

bool t3_widget::widget_t::is_hotkey ( key_t  key)
virtual
bool t3_widget::widget_t::is_shown ( void  )
virtual

Query the visibility status of this widget.

bool t3_widget::widget_t::process_mouse_event ( mouse_event_t  event)
virtual
void t3_widget::widget_t::set_anchor ( window_component_t anchor,
int  relation 
)
virtual

Set this widget's anchor.

Use anchor to position this window. See libt3window's t3_win_set_anchor for details on the relation parameter.

Reimplemented in t3_widget::list_pane_t.

void t3_widget::widget_t::set_enabled ( bool  enable)
virtual

Set the enabled status of this widget.

When a widget is not enabled, it will not accept focus.

Reimplemented in t3_widget::expander_t, t3_widget::frame_t, t3_widget::checkbox_t, and t3_widget::multi_widget_t.

void t3_widget::widget_t::set_focus ( focus_t  focus)
virtual
void t3_widget::widget_t::set_position ( optint  top,
optint  left 
)
virtual

Move the window_component_t to a specified position.

Note that the position is relative to the anchor point.

Implements t3_widget::window_component_t.

Reimplemented in t3_widget::list_pane_t, t3_widget::dummy_widget_t, and t3_widget::menu_item_base_t.

void t3_widget::widget_t::show ( void  )
virtual

Member Data Documentation

bool t3_widget::widget_t::enabled
protected

Widget is enabled.

bool t3_widget::widget_t::redraw
protected

Widget requires redrawing on next update_contents call.

bool t3_widget::widget_t::shown
protected

Widget is shown.