GUI Toolkit for TI nSpire  0.55 beta (dated 2021-03-21)
A GUI toolkit for Ndless-TI NSpire using SDL and Ndless libraries.
KeyboardTask Class Reference

#include <KeyboardTask.h>

Public Member Functions

virtual void logic ()
 
virtual bool iskeypressed ()
 
virtual bool iskeyevent ()
 
virtual bool iskeypressevent ()
 
virtual bool iskeyreleaseevent ()
 
virtual bool iskeyarrowevent ()
 

Public Attributes

bool keypressevent = false
 
bool keyreleaseevent = false
 
bool keyevent = false
 
bool keyevent_arrow = false
 
bool capsonmode = false
 
bool kbRET = false
 
bool kbENTER = false
 
bool kbMINUSPAR = false
 
bool kbSPACE = false
 
bool kbZ = false
 
bool kbY = false
 
bool kb0 = false
 
bool kbQUESTION = false
 
bool kbON = false
 
bool kbX = false
 
bool kbW = false
 
bool kbV = false
 
bool kb3 = false
 
bool kbU = false
 
bool kbT = false
 
bool kbS = false
 
bool kb1 = false
 
bool kbPI = false
 
bool kbTRIG = false
 
bool kb10X = false
 
bool kbR = false
 
bool kbQ = false
 
bool kbP = false
 
bool kb6 = false
 
bool kbO = false
 
bool kbN = false
 
bool kbM = false
 
bool kb4 = false
 
bool kbEE = false
 
bool kbX2 = false
 
bool kbL = false
 
bool kbK = false
 
bool kbJ = false
 
bool kb9 = false
 
bool kbI = false
 
bool kbH = false
 
bool kbG = false
 
bool kb7 = false
 
bool kbDIV = false
 
bool kbEX = false
 
bool kbF = false
 
bool kbE = false
 
bool kbD = false
 
bool kbC = false
 
bool kbB = false
 
bool kbA = false
 
bool kbEQUAL = false
 
bool kbMULTIPLY = false
 
bool kbPOWER = false
 
bool kbVAR = false
 
bool kbMINUS = false
 
bool kbPARCLOSE = false
 
bool kbDOT = false
 
bool kbPAROPEN = false
 
bool kb5 = false
 
bool kbCATALOG = false
 
bool kbFRAC = false
 
bool kbDEL = false
 
bool kbSCRATCH = false
 
bool kbFLAG = false
 
bool kbPLUS = false
 
bool kbDOC = false
 
bool kb2 = false
 
bool kbMENU = false
 
bool kb8 = false
 
bool kbESC = false
 
bool kbTAB = false
 
bool kbSHIFT = false
 
bool kbCTRL = false
 
bool kbCOMMA = false
 
bool kbUP = false
 
bool kbUPRIGHT = false
 
bool kbRIGHT = false
 
bool kbRIGHTDOWN = false
 
bool kbDOWN = false
 
bool kbDOWNLEFT = false
 
bool kbLEFT = false
 
bool kbLEFTUP = false
 

Detailed Description

Example of program using KeyboardTask

The following simple example demonstrates how to use the KeyboardTask controls.

Examples of usage:

#include "Toolkit/GUIToolkit.h"
int main ( int argc, char** argv )
{
bool done = false;
MyApp->setuniformbackgroundcolor(0, 0, 0);
DesktopWidget *desktop1 = new DesktopWidget( (char*) "First Desktop", 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, nullptr );
WindowWidget *window = new WindowWidget( (char*) "Examples of ButtonWidgets", 20, 30, 250, 160, desktop1 );
ContainerVWidget *contH = new ContainerVWidget( (char*) "ContainerH", 1, 1, 1, 1, window );
ButtonWidget *button = new ButtonWidget(); // Simple constructor so we need to assign all the parameters
// First the label to be written on the button
button->setlabel( (char*) "Enabled Button" );
// then the dimensions (one by one in that case)
button->setxpos( 5 );
button->setypos( 10 );
button->setwidth( 150 );
button->setheight( 15 );
// note : we can also use the method button->setdimensions( 5, 10, 150, 15 ) instead
// and finally we assign the parent by adding the button as a child to conH
contH->addchild( button );
// This is a second button with all parameters passed through the constructon
ButtonWidget *button2 = new ButtonWidget( (char*) "Disabled Button", 1, 1, 1, 1, contH );
// We disable the button by using the inherited method Wigdet::disable()
button2->disable();
// the button to be clicked to quit
ButtonWidget *buttonQuit = new ButtonWidget( (char*) "Quit [CTRL]+[ESC]", 1, 1, 1, 1, contH );
// We ask for an automatic positioning of the widgets in the grid
// Note : this will fully override the dimensions given to the Widgets manually
window->adjust();
MyApp->addchild( desktop1 );
KeyboardTask *keyboard = MyApp->getkeyboardhandler();
// We render the app for the first time so what we can see what's happening on the screen
MyApp->render();
while (!done)
{
MyApp->logic();
if ((keyboard->kbCTRL && keyboard->kbESC) || buttonQuit->ispressed()) done = true;
}
return 0;
}

KeyboardTask class.

The class to be used for accessing the keyboard and keys information.

Examples of usage:

KeyboardTask* myKeys = new KeyboardTask(); // Simple constructor, will need specific properties assignement later
KeyboardTask* myKeys = myApp->getkeyboardhandler();
Note
WidgetApplication creates a KeyboardTask object at initialisation. It is then better to ask for a direct access to its KeyboardTask by using the WidgetApplication::getkeyboardhandler() method.
See also
WidgetApplication::getkeyboardhandler()

Direct key status

Each key is defined by a boolean: true is the corresponding key is pressed and false overwise

Keynames are given as follows


The documentation for this class was generated from the following files:
DesktopWidget
Definition: DesktopWidget.h:7
WidgetApplication
Definition: WidgetApplication.h:32
ButtonWidget::ispressed
virtual bool ispressed()
Definition: ButtonWidget.cpp:5
ContainerVWidget
Definition: ContainerVWidget.h:105
WindowWidget
Definition: WindowWidget.h:7
ButtonWidget
Definition: ButtonWidget.h:91
KeyboardTask
Definition: KeyboardTask.h:99