Nspire I/O  3.0
 All Data Structures Files Functions Pages
Functions
cursor.c File Reference
#include <os.h>
#include "nspireio.h"

Functions

unsigned nio_time_get ()
 
void nio_cursor_draw (nio_console *c)
 
void nio_cursor_erase (nio_console *c)
 
void nio_cursor_blinking_draw (nio_console *c)
 
void nio_cursor_blinking_reset (nio_console *c)
 
void nio_cursor_enable (nio_console *c, BOOL enable_cursor)
 
void nio_cursor_blinking_enable (nio_console *c, BOOL enable_cursor_blink)
 
void nio_cursor_blinking_duration (nio_console *c, int duration)
 
void nio_cursor_type (nio_console *c, int cursor_type)
 
void nio_cursor_width (nio_console *c, int cursor_width)
 
void nio_cursor_custom (nio_console *c, unsigned char cursor_data[6])
 

Detailed Description

Author
Albert Huang aka alberthrocks alber.nosp@m.thro.nosp@m.cks.p.nosp@m.ubli.nosp@m.c@gma.nosp@m.il.c.nosp@m.om
Julian Mackeben aka compu compu.nosp@m.juck.nosp@m.el@go.nosp@m.ogle.nosp@m.mail..nosp@m.com
Version
3.0

LICENSE

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

DESCRIPTION

Cursor functions

Function Documentation

void nio_cursor_blinking_draw ( nio_console c)

Draws a blinking cursor, if enabled. Blinking occurs on an interval set inside the console.

Parameters
cConsole
void nio_cursor_blinking_duration ( nio_console c,
int  duration 
)

Sets the console cursor blink duration (the time it takes to switch on or off)

Parameters
cConsole
durationThe time (in seconds) it takes to switch on or off.
void nio_cursor_blinking_enable ( nio_console c,
BOOL  enable_cursor_blink 
)

Enables console cursor blinking.

Parameters
cConsole
enable_cursor_blinkWhen this is true, the cursor will blink, false: no cursor blinking will occur.
void nio_cursor_blinking_reset ( nio_console c)

Resets the blinking cursor timer.

Parameters
cConsole
void nio_cursor_custom ( nio_console c,
unsigned char  cursor_data[6] 
)

Sets the console cursor width.

Parameters
cConsole
cursor_dataThe custom cursor data. This is in the form of a char[6] array. This pretty much uses the format (and the drawing code) for character drawing, so take a look at charmap.h for examples. Note that the characters in charmap.h are truncated, so they will display differently.

By default, if this is not specified and the cursor type is set to the custom cursor type (3), the custom cursor will be set to {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} (a block cursor).

void nio_cursor_draw ( nio_console c)

Draws the cursor of the console, if enabled.

Parameters
cConsole
void nio_cursor_enable ( nio_console c,
BOOL  enable_cursor 
)

Enables the console cursor.

Parameters
cConsole
enable_cursorWhen this is true, a cursor will be drawn to the screen, false: no cursor shown.
void nio_cursor_erase ( nio_console c)

Erases the cursor of the console, if enabled.

Parameters
cConsole
void nio_cursor_type ( nio_console c,
int  cursor_type 
)

Sets the console cursor type.

Parameters
cConsole
cursor_typeThe cursor type. 0 is a block cursor (default, like a Linux X11 terminal), 1 is an underscore cursor (like a Windows Command Prompt window), 2 is a vertical bar cursor (like a regular text box), and 3 is a custom cursor that is set via SetCursorCustom.

If you specify an invalid value, NspireIO will silenty fail and set the cursor type to 0, a block cursor.

You may also use the predefined types as arguments. (NIO_CURSOR_*)

void nio_cursor_width ( nio_console c,
int  cursor_width 
)

Sets the console cursor width.

Parameters
cConsole
cursor_widthThe cursor line width. This only applies to cursors 1 and 2 (underscore and vertical bar). All others cursor types will not be affected by this setting.

For the underscore cursor, it must be greater than 0 and less than or equal to CHAR_HEIGHT (as defined by charmap.h). At the time of writing, CHAR_HEIGHT is 8. Therefore, for an underscore cursor, 0 < cursor_width <= 8.

For a vertical bar cursor, it must be greater than 0 and less than or equal to CHAR_WIDTH (as defined by charmap.h). At the time of writing, CHAR_WIDTH is 6. Therefore, for a vertical bar cursor, 0 < cursor_width < 6.

If you wish to draw a blank cursor, you probably should disable the cursor altogether with EnableCursor(nio_console, FALSE).

Note that if you specify an out-of-range value, NspireIO will silently fail and reset the cursor width to 1.

unsigned nio_time_get ( )
inline

Returns the current time.

Returns
Current RTC time