![]() |
GUI Toolkit for TI nSpire
0.55 beta (dated 2021-03-21)
A GUI toolkit for Ndless-TI NSpire using SDL and Ndless libraries.
|
#include <CommuterWidget.h>
Public Types | |
enum | commutertype { style1 = 0, style2 = 1, style3 = 2, style4 = 3 } |
Public Member Functions | |
CommuterWidget () | |
CommuterWidget (char *l, int x, int y, int w, int h, Widget *p) | |
virtual | ~CommuterWidget () |
virtual void | invert () |
virtual bool | isticked (void) |
virtual void | logic (CursorTask *mouse, KeyboardTask *keyboard) override |
virtual void | render (SDL_Surface *screen, ColorEngine *colors, FontEngine *fonts) override |
virtual void | settype (commutertype type) |
virtual commutertype | gettype () |
virtual void | setnormal () |
virtual void | setreversed () |
virtual bool | isreversed () |
![]() | |
ButtonWidget () | |
ButtonWidget (char *l, int x, int y, int w, int h, Widget *p) | |
~ButtonWidget () | |
virtual bool | ispressed () |
![]() | |
Widget (char *l, int x, int y, int w, int h, Widget *p) | |
virtual void | focus (Widget *emitter) |
virtual void | unfocusup (Widget *emitter) |
virtual void | unfocusdown (Widget *emitter) |
virtual void | addchild (Widget *child) |
virtual void | setdimensions (int mx, int my, int mw, int mh) |
virtual void | setxpos (int mx) |
virtual void | setypos (int my) |
virtual void | setwidth (int mw) |
virtual void | setheight (int mh) |
virtual void | setlabel (char *l) |
virtual void | setcontainerstatus (bool status) |
virtual void | setparent (Widget *p) |
virtual void | setvisible () |
virtual void | setinvisible () |
virtual void | enable () |
virtual void | disable () |
virtual void | adjust () |
virtual int | getxpos () |
virtual int | getypos () |
virtual int | getwidth () |
virtual int | getheight () |
virtual int | getuseablexpos () |
virtual int | getuseableypos () |
virtual int | getuseablewidth () |
virtual int | getuseableheight () |
virtual char * | getlabel () |
virtual bool | getcontainerstatus () |
virtual Widget * | getparent () |
virtual bool | getisenabled () |
virtual bool | isvisible () |
virtual char * | getwidgettype () |
virtual void | linkonclick (void(*func)(char *)) |
virtual void | linkonrelease (void(*func)(char *)) |
virtual void | linkonhover (void(*func)(char *)) |
Additional Inherited Members | |
![]() | |
virtual bool | cursoron (CursorTask *mouse) |
![]() | |
bool | has_focus = false |
bool | is_enabled = true |
bool | is_visible = true |
char * | widgettype |
char * | label |
int | xpos |
int | xrel |
int | ypos |
int | yrel |
int | width |
int | widrel |
int | height |
int | heirel |
bool | is_container = false |
bool | is_hovering = false |
Widget * | parent = nullptr |
int | nbchildren |
std::vector< Widget * > | children |
void(* | clickfunction )(char *) = nullptr |
void(* | releasefunction )(char *) = nullptr |
void(* | hoverfunction )(char *) = nullptr |
Example of program using CommuterWidget controls
The following simple example demonstrates how to use the CommuterWidget controls.
CommuterWidget class.
The class to be used for using a CommuterWidget control widget. CommuterWidget inherits from ButtonWidget class.
Enumerator for CommuterWidget style.
Gives the style of CommuterWidget (of the colors of both backgroud and commuter button). style1 the commuter background is blank and the button also style2 the commuter background is blank and the button is colorized style3 the commuter background is blank and the button is colorized in color depending on switch position style4 the commuter background and the button are colorized in color depending on switch position
|
inline |
Simple constructor.
Widget properties are set to default, nothing more. Simple constructor, will need specific properties assignement later.
None |
|
inline |
Advanced constructor.
Widget properties are set with parameters values given at call.
l | : text string (char*) that will be used as the widget textual content |
x | : position x in pixels relatively to the parent widget usable drawspace |
y | : position y in pixels relatively to the parent widget usable drawspace |
w | : width in pixel of the widget |
h | : height in pixel of the widget |
p | : pointer type to a Widget* to create a link with the parent widget (if any). |
|
inlinevirtual |
Object destructor
Object destructor, remove all trace of the object and free allocated memory
None |
|
inlinevirtual |
CommuterWidget style getter.
Gives the style of CommuterWidget
None |
|
inlinevirtual |
Invert the CommuterWidget status
Invert the CommuterWidget status, if unticked --> ticked and if ticked --> unticked
None |
|
inlinevirtual |
CommuterWidget normal/reveresed style getter.
Ask if the CommuterWidget is normal or reversed
None |
|
inlinevirtual |
Is the CommuterWidget ticked ?
Gives the status of the CommuterWidget (switched or not).
None |
|
overridevirtual |
The CommuterWidget logic mechanism
Method to be launched to drive the the mechanics behind the widget behavior.
mouse | : pointer to a CursorTask handler object serving at passing the mouse (Touchpad) state and position |
keyboard | : pointer to a KeyboardTask handler object serving at passing the keyboard state |
Reimplemented from ButtonWidget.
|
overridevirtual |
The CommuterWidget render method.
Method to be launched to draw the CommuterWidget.
screen | : pointer to a SDL_Surface object where we would like to draw the wigdet |
colors | : pointer to a ColorEngine object giving all the color options to be used (theme) for drawing the widget |
fonts | : pointer to a FontEngine object giving all the fonts options to be used (theme) for drawing the widget |
Reimplemented from ButtonWidget.
|
inlinevirtual |
CommuterWidget normal style setter.
Set the normal order of the CommuterWidget (false = switch on the left / true = switch on the right)
None |
|
inlinevirtual |
CommuterWidget reversed style setter.
Set the normal order of the CommuterWidget (false = switch on the right / true = switch on the left)
None |
|
inlinevirtual |
CommuterWidget style setter.
Gives the style of CommuterWidget
type | refers to one of the styles given by the tick enumerator |