Snoke
Widget Class Reference

#include <widget.h>

Inheritance diagram for Widget:
Collaboration diagram for Widget:

Public Member Functions

virtual void draw ()
 
void _parent (Widget *parentWidget)
 
WidgetfirstChild ()
 
WidgetlastChild ()
 
Widgetparent ()
 
void _next (Widget *nextWidget)
 
Widgetnext ()
 
void _previous (Widget *previousWidget)
 
Widgetprevious ()
 
void add (Widget *child)
 
unsigned short childLength ()
 
std::vector< Widget * > children ()
 
bool event (unsigned char name)
 
void listener (unsigned char name, Listener function)
 
void dispatch (unsigned char name)
 
 Widget ()
 

Public Attributes

WidgetparentWidget
 
Widgetstart
 
Widgetending
 
WidgetnextWidget
 
WidgetpreviousWidget
 
unsigned short length
 
unsigned char events
 
std::map< unsigned char, std::list< Listener > > listeners
 

Detailed Description

Basic class of the console widget (to store different widgets in one list) Contains widgets tree for parsing events by Console class

Parameters
{Widget*}parentWidget - parent widget
{Widget*}start - pointer to the first child of current widget
{Widget*}ending - pointer to the last child of current widget
{Widget*}nextWidget - pointer to the next sibling
{Widget*}previousWidget - pointer to the previous sibling
{unsignedshort} length - amount of children
{unsignedchar} events - binary store for events could be dispatched at current widget
{std::map<unsignedchar, std::list<Listener>>} listeners - store for event listeners

Definition at line 36 of file widget.h.

Constructor & Destructor Documentation

Widget::Widget ( )

Definition at line 172 of file widget.cpp.

Member Function Documentation

void Widget::_next ( Widget nextWidget)

Sets next widget

Parameters
{Widget*}nextWidget - new next widget

Definition at line 50 of file widget.cpp.

Here is the caller graph for this function:

void Widget::_parent ( Widget parentWidget)

Setter for parent property

Parameters
{Widget*}parentWidget - new parent widget

Definition at line 14 of file widget.cpp.

Here is the caller graph for this function:

void Widget::_previous ( Widget previousWidget)

Sets previous widget

Parameters
{Widget*}previousWidget - new previous widget

Definition at line 68 of file widget.cpp.

Here is the caller graph for this function:

void Widget::add ( Widget child)

Adds a new child to the current widget

Parameters
{Widget*}child - new child widget

Definition at line 86 of file widget.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned short Widget::childLength ( )

Returns amount of children

Returns
{unsigned short}

Definition at line 112 of file widget.cpp.

Here is the caller graph for this function:

std::vector< Widget * > Widget::children ( )

Returns array of child widgets

Returns
{std::vector<Widget*>}

Definition at line 121 of file widget.cpp.

Here is the call graph for this function:

void Widget::dispatch ( unsigned char  name)

Dispatches event on widget Calls all event listeners binded on given event to the widget

Parameters
{unsignedchar} name - name of the event

Definition at line 161 of file widget.cpp.

Here is the caller graph for this function:

void Widget::draw ( )
virtual

Drawing widget method

Reimplemented in Menu, and MenuItem.

Definition at line 7 of file widget.cpp.

Here is the caller graph for this function:

bool Widget::event ( unsigned char  name)

Checks if event is dispatchable

Parameters
{unsignedchar} name - name of the event
Returns
{bool} - true if event listeners are existing and active

Definition at line 140 of file widget.cpp.

Here is the caller graph for this function:

Widget * Widget::firstChild ( )

Returns first child of widget

Returns
{Widget*}

Definition at line 32 of file widget.cpp.

Here is the caller graph for this function:

Widget * Widget::lastChild ( )

Returns last child of widget

Returns
{Widget*}

Definition at line 41 of file widget.cpp.

Here is the caller graph for this function:

void Widget::listener ( unsigned char  name,
Listener  function 
)

Sets listener to the event

Parameters
{unsignedchar} name - name of the event
{Listener}function - event listener function

Definition at line 150 of file widget.cpp.

Here is the caller graph for this function:

Widget * Widget::next ( )

Getter for next widget

Returns
{Widget*}

Definition at line 59 of file widget.cpp.

Here is the caller graph for this function:

Widget * Widget::parent ( )

Getter for parent property

Returns

Definition at line 23 of file widget.cpp.

Here is the caller graph for this function:

Widget * Widget::previous ( )

Getter for previous widget

Returns
{Widget*}

Definition at line 77 of file widget.cpp.

Here is the caller graph for this function:

Member Data Documentation

Widget* Widget::ending

Definition at line 41 of file widget.h.

unsigned char Widget::events

Definition at line 45 of file widget.h.

unsigned short Widget::length

Definition at line 44 of file widget.h.

std::map<unsigned char, std::list<Listener> > Widget::listeners

Definition at line 46 of file widget.h.

Widget* Widget::nextWidget

Definition at line 42 of file widget.h.

Widget* Widget::parentWidget

Definition at line 39 of file widget.h.

Widget* Widget::previousWidget

Definition at line 43 of file widget.h.

Widget* Widget::start

Definition at line 40 of file widget.h.


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