FDOSTUI
FreeDOS Text User Interface
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | List of all members
scroller Class Reference

Allows the user to view a small portion of a large area via scrolling. More...

#include <scroller.hpp>

Inheritance diagram for scroller:
Inheritance graph
[legend]

Public Member Functions

 scroller (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 ~scroller ()
 destructor More...
 
virtual int add (widget *const i_widget)
 add widget to the scroll bar group 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...
 
int get_scroll_pos_x () const
 get scroll (horizontal) position in x direction More...
 
int get_scroll_pos_y () const
 get scroll (vertical) position in y direction More...
 
virtual void set_parent (group *const i_parent)
 set parent widget More...
 
void scroll_internal ()
 internal scroll handler, called when scrollbar changes.
 
- Public Member Functions inherited from group
 group (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 ~group ()
 destructor More...
 
virtual void set_damage (unsigned int const i_damage=DAMAGE_NONE)
 sets damage mask More...
 
virtual enum event_response event_key_default (enum scancodes const i_scan)
 default scan code event handler More...
 
virtual void focus_enter ()
 handle entering focus More...
 
virtual void focus_leave ()
 handle leaving focus More...
 
void set_focus (widget &i_widget)
 set widget focus More...
 
- 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 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...
 
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...
 
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 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 Member Functions

void set_scroll_bounds ()
 configure scrollbar boundaries
 

Protected Attributes

scrollbar m_horizontal
 
scrollbar m_vertical
 
int m_scroll_pos_x
 
int m_scroll_pos_y
 
- Protected Attributes inherited from group
widgetm_focused
 widget that has focus
 
size_t m_slot
 focused widget slot (index into array)
 
struct array m_array
 widget container
 
- Protected Attributes inherited from widget
unsigned int m_damage
 
unsigned int m_flags
 
struct box m_box
 
groupm_parent
 
void * m_user_data
 

Private Member Functions

 scroller (const scroller &)
 
scrolleroperator= (scroller const &)
 

Static Private Member Functions

static void horizontal_cb (widget const *i_widget, void *io_user_data)
 horizontal scrollbar callback More...
 
static void vertical_cb (widget const *i_widget, void *io_user_data)
 vertical scrollbar callback More...
 

Additional Inherited Members

- 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...
 
- 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)
}
 

Detailed Description

Allows the user to view a small portion of a large area via scrolling.

Constructor & Destructor Documentation

◆ scroller()

scroller::scroller ( int const  i_pos_x,
int const  i_pos_y,
unsigned int const  i_len_x,
unsigned int const  i_len_y 
)

constructor

Parameters
[in]i_pos_xx position to place widget
[in]i_pos_yy position to place widget
[in]i_len_xx length of widget
[in]i_len_yy length of widget
Returns
none

◆ ~scroller()

scroller::~scroller ( )
virtual

destructor

Returns
none

Member Function Documentation

◆ add()

int scroller::add ( widget *const  i_widget)
inlinevirtual

add widget to the scroll bar group

Parameters
[in]i_widgetwidget to add

i_widget must not belong to another group. Once added the scrollbar takes ownership of the widget.

Reimplemented from group.

◆ draw()

void scroller::draw ( ) const
virtual

draws the widget

This method should not be called directly.

See also
widget::draw for details.

Reimplemented from group.

◆ event_key()

enum event_response scroller::event_key ( struct event_key const &  i_event)
virtual

handle key event

Parameters
[in]i_eventkey event to handle
Returns
response how event was handled

Reimplemented from group.

◆ event_mouse()

enum event_response scroller::event_mouse ( struct event_mouse const &  i_event)
virtual

handle mouse event

Parameters
[in]i_eventmouse event to handle
Returns
response how event was handled

Reimplemented from group.

◆ get_scroll_pos_x()

int scroller::get_scroll_pos_x ( ) const
inline

get scroll (horizontal) position in x direction

Returns
scroll position

◆ get_scroll_pos_y()

int scroller::get_scroll_pos_y ( ) const
inline

get scroll (vertical) position in y direction

Returns
scroll position

◆ horizontal_cb()

void scroller::horizontal_cb ( widget const *  i_widget,
void *  io_user_data 
)
staticprivate

horizontal scrollbar callback

Parameters
[in]i_widgethorizontal scrollbar
[in,out]io_user_datascroller widget

◆ set_parent()

void scroller::set_parent ( group *const  i_parent)
inlinevirtual

set parent widget

Parameters
[in]i_parentgroup to set widget

This is overwritten to set internal member parent group

Reimplemented from widget.

◆ vertical_cb()

void scroller::vertical_cb ( widget const *  i_widget,
void *  io_user_data 
)
staticprivate

vertical scrollbar callback

Parameters
[in]i_widgetvertical scrollbar
[in,out]io_user_datascroller widget

Member Data Documentation

◆ m_horizontal

scroller::m_horizontal
protected

horizontal scrollbar

◆ m_scroll_pos_x

int scroller::m_scroll_pos_x
protected

horizontal x scroll position

◆ m_scroll_pos_y

int scroller::m_scroll_pos_y
protected

vertical y scroll position

◆ m_vertical

scroller::m_vertical
protected

vertical scrollbar


The documentation for this class was generated from the following files: