libt3widget
|
A widget displaying a text. More...
Public Types | |
enum | align_t { ALIGN_LEFT, ALIGN_RIGHT, ALIGN_LEFT_UNDERFLOW, ALIGN_RIGHT_UNDERFLOW, ALIGN_CENTER } |
Constants defining alignments. More... | |
![]() | |
enum | focus_t { FOCUS_OUT, FOCUS_SET, FOCUS_IN_FWD, FOCUS_IN_BCK, FOCUS_REVERT } |
Public Member Functions | |
virtual bool | accepts_focus (void) |
Query whether this widget accepts focus. More... | |
int | get_text_width (void) const |
Retrieve the natural width of the text. More... | |
label_t (const char *_text) | |
Create a new label_t. More... | |
virtual bool | process_key (key_t key) |
Handle a key press by the user. More... | |
void | set_accepts_focus (bool _can_focus) |
Set whether this label_t accepts the input focus. More... | |
void | set_align (align_t _align) |
Set the alignment. More... | |
virtual void | set_focus (focus_t _focus) |
Set whether this window_component_t has the input focus. More... | |
virtual bool | set_size (optint height, optint width) |
Set the size of this window_component_t. More... | |
void | set_text (const char *_text) |
Set the text. More... | |
virtual void | update_contents (void) |
Update the contents of the window. 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_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... | |
![]() | |
virtual t3_window_t * | get_base_window (void) |
Retrieve the t3_window_t for this window_component_t. More... | |
window_component_t (void) | |
Base constructor. More... | |
virtual | ~window_component_t (void) |
Base destructor. More... | |
![]() | |
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... | |
Additional Inherited Members | |
![]() | |
static bool | handle_mouse_event (mouse_event_t event) |
![]() | |
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... | |
![]() | |
mouse_target_t (bool use_window=true) | |
![]() | |
bool | enabled |
Widget is enabled. More... | |
bool | redraw |
Widget requires redrawing on next update_contents call. More... | |
bool | shown |
Widget is shown. More... | |
![]() | |
cleanup_t3_window_ptr | window |
The t3_window_t used for presenting this item on screen (see libt3window). More... | |
A widget displaying a text.
This widget can display a text. An alignment can be specified. For displaying labels for checkboxes and text fields, see smart_label_t.
Constants defining alignments.
Enumerator | |
---|---|
ALIGN_LEFT |
Align text to the left of the allocated space. |
ALIGN_RIGHT |
Align text to the right of the allocated space. |
ALIGN_LEFT_UNDERFLOW |
Align text to the left of the allocated space, with underflow indicator. Similar to ALIGN_LEFT, but if the allocated space is too small, the text is cut off on the left instead of the right and the first two visible characters of text are replaced by "..". |
ALIGN_RIGHT_UNDERFLOW |
Align text to the right of the allocated space, with underflow indicator. Similar to ALIGN_RIGHT, but if the allocated space is too small, the first two visible characters of text are replaced by "..". |
ALIGN_CENTER |
Center text in the allocated space. |
t3_widget::label_t::label_t | ( | const char * | _text | ) |
Create a new label_t.
|
virtual |
Query whether this widget accepts focus.
Reimplemented from t3_widget::widget_t.
int t3_widget::label_t::get_text_width | ( | void | ) | const |
Retrieve the natural width of the text.
|
virtual |
Handle a key press by the user.
Implements t3_widget::window_component_t.
void t3_widget::label_t::set_accepts_focus | ( | bool | _can_focus | ) |
Set whether this label_t accepts the input focus.
void t3_widget::label_t::set_align | ( | label_t::align_t | _align | ) |
Set the alignment.
|
virtual |
Set whether this window_component_t has the input focus.
Note that this merely notifies the window_component_t that it should change it's appearance to indicate the user that this window_component_t has the input focus. Which window_component_t actually receives the input events is handled outside of the window_component_t.
Reimplemented from t3_widget::widget_t.
Set the size of this window_component_t.
height | The new height of the window_component_t in cells, or None if it should remain unchanged. |
width | The new width of the window_component_t in cells, or None if it should remain unchanged. |
Implements t3_widget::window_component_t.
void t3_widget::label_t::set_text | ( | const char * | _text | ) |
Set the text.
|
virtual |
Update the contents of the window.
Implements t3_widget::window_component_t.