![]() |
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 <ButtonWidget.h>


Public Member Functions | |
| ButtonWidget () | |
| ButtonWidget (char *l, int x, int y, int w, int h, Widget *p) | |
| ~ButtonWidget () | |
| virtual bool | ispressed () |
| virtual void | logic (CursorTask *mouse, KeyboardTask *keyboard) override |
| virtual void | render (SDL_Surface *screen, ColorEngine *colors, FontEngine *fonts) override |
Public Member Functions inherited from Widget | |
| 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 *)) |
Friends | |
| class | MiniButtonWidget |
Additional Inherited Members | |
Protected Member Functions inherited from Widget | |
| virtual bool | cursoron (CursorTask *mouse) |
Protected Attributes inherited from Widget | |
| 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 ButtonWidget controls
The following simple example demonstrates how to use the ButtonWidget controls.
ButtonWidget class.
The class to be used for using a ButtonWidget control widget. ButtonWidget inherits from Widget class.
|
inline |
|
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). |
|
inline |
Object destructor.
Object destructor, remove all trace of the object and free allocated memory.
| None |
|
virtual |
Is the ButtonWidget pressed ?
Gives the status of the ButtonWidget (pressed (i.e. clicked) or not).
| None |
Reimplemented in MiniButtonWidget.
|
overridevirtual |
The ButtonWidget 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 Widget.
Reimplemented in CommuterWidget, CheckBoxWidget, MiniButtonWidget, and RadioControlWidget.
|
overridevirtual |
The ButtonWidget render method
Method to be launched to draw the widget.
| screen | : pointer to a SDL_Surface object where we would like to draw the widget |
| 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 Widget.
Reimplemented in CommuterWidget, CheckBoxWidget, MiniButtonWidget, and RadioControlWidget.