FDOSTUI
FreeDOS Text User Interface
|
Allows the user to choose a value from a list. More...
#include <listbox.hpp>
Public Types | |
typedef void(* | signal_selected_t) (listbox const *i_listbox, void *io_user_data) |
function prototype to recieve signal More... | |
Public Types inherited from widget | |
enum | damage { DAMAGE_NONE = 0, DAMAGE_ALL = (1<<0), DAMAGE_LABEL = (1<<1), DAMAGE_VALUE = (1<<2), DAMAGE_SCROLL = (1<<3), DAMAGE_MOVED = (1<<4), DAMAGE_RESERVED1 = (1<<5), DAMAGE_RESERVED2 = (1<<6), DAMAGE_RESERVED3 = (1<<7) } |
bit mask indicating what needs to be redrawn More... | |
Public Member Functions | |
listbox (int const i_pos_x, int const i_pos_y, unsigned int const i_len_x, unsigned int const i_len_y) | |
constructor More... | |
virtual | ~listbox () |
destructor More... | |
int | add (unsigned char const *i_label) |
adds a value to the end of a list More... | |
virtual void | draw () const |
draws the widget More... | |
virtual enum event_response | event_key (struct event_key const &i_event) |
handle key event More... | |
virtual enum event_response | event_mouse (struct event_mouse const &i_event) |
handle mouse event More... | |
unsigned char const * | get_item (size_t const i_slot) const |
retrieve an item from the listbox More... | |
size_t | get_count () const |
get number of items in listbox More... | |
int | get_selected_first () const |
get the first selected item in the listbox More... | |
int | get_selected_next (int const i_iter) const |
get the next selected item in the listbox More... | |
virtual void | move (int const i_pos_x, int const i_pos_y) |
move the widget to a new position More... | |
virtual void | resize (unsigned int const i_len_x, unsigned int const i_len_y) |
resize the widget More... | |
void | remove (size_t const i_slot) |
remove an item from the listbox More... | |
void | remove_all () |
remove all items from the listbox More... | |
void | set_label (unsigned char const *i_str) |
set the text label of the listbox More... | |
void | set_multiline (bool const i_multiline) |
set whether or not the user can select more than one item More... | |
virtual void | set_parent (group *const i_parent) |
set the parent group of this widget More... | |
void | set_response (int const i_response) |
set the response the widget returns when an item is selected More... | |
void | set_signal_selected (signal_selected_t i_signal) |
set callback More... | |
void | set_selected (size_t const i_slot, bool const i_selected=true) |
set an item as selected or unselected More... | |
void | unselect_all () |
unselect all items in the listbox More... | |
void | scroll_internal () |
called when value in the vertical scrollbar changed | |
Public Member Functions inherited from widget | |
widget (int const i_pos_x, int const i_pos_y, unsigned int const i_len_x, unsigned int const i_len_y) | |
constructor More... | |
virtual | ~widget () |
destructor More... | |
virtual void | set_damage (unsigned int const i_damage=DAMAGE_NONE) |
set the damage bits More... | |
virtual bool | close (bool const i_shutting_down) |
called when widget is about to be destroyed More... | |
bool | contains (int const i_pos_x, int const i_pos_y) const |
test if point is contained within the widget More... | |
bool | contains (struct box const &i_box) const |
test if rectangular region is contained within the widget More... | |
virtual enum event_response | event_key_default (enum scancodes const i_scan) |
default key event handler More... | |
virtual void | focus_enter () |
called when the widget receives focus More... | |
virtual void | focus_leave () |
called when the widget looses focus More... | |
void | get_box (struct box &o_box) const |
gets the rectangular region this widget occupies More... | |
bool | get_can_focus () const |
gets whether or not the widget can receive focus More... | |
bool | get_enabled () const |
gets whether or not the widget is enabled More... | |
bool | get_has_focus () const |
gets whether or not the widget has focus More... | |
group *const | get_parent () const |
gets the parent widget More... | |
void * | get_user_data () const |
gets user defined data pointer More... | |
bool | get_visible () const |
gets whether or not the widget is visible More... | |
int | get_pos_x () const |
gets the relative x position of the widget More... | |
int | get_pos_y () const |
gets the relative y position of the widget More... | |
unsigned int | get_len_x () const |
gets the horizontal length of the widget More... | |
unsigned int | get_len_y () const |
gets the vertical length of the widget More... | |
void | set_can_close (bool const i_can_close) |
set internal indicator if widget can be closed More... | |
void | set_disabled () |
disable the widget More... | |
void | set_enabled () |
enable the widget | |
void | set_hidden () |
hide the widget More... | |
void | set_user_data (void *io_user_data) |
sets the user defined data pointer More... | |
void | set_visible () |
sets the widget as visible More... | |
void | translate_screen (int *const o_pos_x, int *const o_pos_y) const |
translate a widgets relative coordinates to screen coordinates More... | |
Protected Attributes | |
bool | m_multiline |
size_t | m_line |
struct array | m_array |
scrollbar | m_vertical |
unsigned char * | m_label |
enum event_response | m_response |
signal_selected_t | m_signal_selected |
Protected Attributes inherited from widget | |
unsigned int | m_damage |
unsigned int | m_flags |
struct box | m_box |
group * | m_parent |
void * | m_user_data |
Private Member Functions | |
listbox (const listbox &) | |
listbox & | operator= (listbox const &) |
void | select (size_t const i_slot) |
selects an item More... | |
void | vertical_configure () |
configure vertical scrollbar for display More... | |
void | emit_selected () |
emits the selected signal More... | |
Static Private Member Functions | |
static void | vertical_cb (widget const *i_widget, void *io_user_data) |
callback for vertical scrollbar More... | |
Additional Inherited Members | |
Protected Types inherited from widget | |
enum | flags { VISIBLE = (1 << 0), ENABLED = (1 << 1), CAN_FOCUS = (1 << 2), HAS_FOCUS = (1 << 3), CAN_CLOSE = (1 << 4) } |
Allows the user to choose a value from a list.
void(* listbox::signal_selected_t)(listbox const *i_listbox, void *io_user_data) |
function prototype to recieve signal
[in] | i_entry | entry widget |
[in,out] | io_user_data | user defined |
listbox::listbox | ( | int const | i_pos_x, |
int const | i_pos_y, | ||
unsigned int const | i_len_x, | ||
unsigned int const | i_len_y | ||
) |
constructor
[in] | i_pos_x | x position to place widget |
[in] | i_pos_y | y position to place widget |
[in] | i_len_x | x length of widget |
[in] | i_len_y | y length of widget |
|
virtual |
destructor
int listbox::add | ( | unsigned char const * | i_label | ) |
adds a value to the end of a list
[in] | i_label | value to add |
|
virtual |
draws the widget
This method should not be called directly.
Implements widget.
|
inlineprivate |
emits the selected signal
|
virtual |
handle key event
[in] | i_event | key event to handle |
Reimplemented from widget.
|
virtual |
handle mouse event
[in] | i_event | mouse event to handle |
Reimplemented from widget.
|
inline |
get number of items in listbox
unsigned char const * listbox::get_item | ( | size_t const | i_slot | ) | const |
retrieve an item from the listbox
[in] | i_slot | index of item to retrieve |
int listbox::get_selected_first | ( | ) | const |
get the first selected item in the listbox
int listbox::get_selected_next | ( | int const | i_iter | ) | const |
get the next selected item in the listbox
[in] | i_iter | current index |
|
virtual |
move the widget to a new position
[in] | i_pos_x | x position to move the widget |
[in] | i_pos_y | y position to move the widget |
Reimplemented from widget.
void listbox::remove | ( | size_t const | i_slot | ) |
remove an item from the listbox
[in] | i_slot | index of item to remove |
void listbox::remove_all | ( | ) |
remove all items from the listbox
|
virtual |
resize the widget
[in] | i_len_x | new horizontal length |
[in] | i_len_y | new vertical length |
Reimplemented from widget.
|
private |
selects an item
|
inline |
set the text label of the listbox
[in] | i_label | null terminated string of label |
|
inline |
set whether or not the user can select more than one item
[in] | i_multiline | whether or not multiline is in affect |
|
inlinevirtual |
|
inline |
set the response the widget returns when an item is selected
[in] | i_response | response id |
void listbox::set_selected | ( | size_t const | i_slot, |
bool const | i_selected = true |
||
) |
set an item as selected or unselected
[in] | i_slot | index of item to alter |
[in] | i_selected | whether or not the item is selected |
|
inline |
set callback
[in] | i_signal | callback signal |
void listbox::unselect_all | ( | ) |
unselect all items in the listbox
|
staticprivate |
callback for vertical scrollbar
[in] | i_widget | scrollbar widget |
[in] | io_user_data | listbox widget |
|
private |
configure vertical scrollbar for display
|
protected |
Array to hold items
|
protected |
Label of listbox
|
protected |
Index of currently highlighted item
|
protected |
Indicator if multi-selection is in affect
|
protected |
Response returned when an item get's selected
|
protected |
Callback when an item gets's selected
|
protected |
Vertical scrollbar