![]() |
mgsLib
1.3
Mermaja's Graphic Screen. A simple C library to build Windows graphic applications from console programs.
|
Keyboard for the MrMWidgets. More...
Functions | |
Keyboard management functions | |
int | mrmKeyboardInit (int bgCol, int nChar, void(*callBack)(void)) |
Creates the Keyboard. More... | |
void | mrmKeyboardDelete (void) |
Delete the Keyboard if exists. More... | |
int | mrmKeyboardExists (void) |
Check the existence of the Keyboard. More... | |
void | mrmKeyboardMove (int x, int y) |
Moves the Keyboard to a new position. More... | |
void | mrmKeyboardSetColors (int colKeyChar, int colKeyEsp, int colAltOff, int colAltOn, int colScr, int colKeyTxt, int colScrTxt, int colDisTxt) |
Sets the colors for the Keyboard. More... | |
void | mrmKeyboardGetText (char *res, int *blocked) |
Gets the text on the Keyboard. More... | |
int mrmKeyboardInit | ( | int | bgCol, |
int | nChar, | ||
void(*)(void) | callBack | ||
) |
This function is used to create the Keyboard. Only one can be present in the system, so the call will fail if one already exists. The function sets the background color and max. number of characters accepted by the Keyboard. It also sets a callback function to be invoked when Ok is pressed.
[in] | bgCol | Color for the background of the Keyboard window. Use a negative value for the default color. |
[in] | nChar | Maximum number of characters to be accepted by the Keyboard. |
[in] | callBack | Function to be called when the text is completed -*Ok* is pressed-. If NULL no function is invoked. |
void mrmKeyboardDelete | ( | void | ) |
This functions deletes the Keyboard from the system. A new one can then be created if desired.
int mrmKeyboardExists | ( | void | ) |
Only one Keyboard can be present in the system. This function returns true if the Keyboard exists, false if not.
void mrmKeyboardMove | ( | int | x, |
int | y | ||
) |
This functions places the Keyboard -top left corner- to the indicated position, without altering proportion nor contents. No bounding checks are performed.
[in] | x | Coordinate of the leftmost position. |
[in] | y | Coordinate of the top position. |
void mrmKeyboardSetColors | ( | int | colKeyChar, |
int | colKeyEsp, | ||
int | colAltOff, | ||
int | colAltOn, | ||
int | colScr, | ||
int | colKeyTxt, | ||
int | colScrTxt, | ||
int | colDisTxt | ||
) |
When the Keyboard is created default system colors are assigned for its texts and keys. This function allows the user to change them during execution.
[in] | colKeyChar | Color for the character keys. |
[in] | colKeyEsp | Color for the special keys. |
[in] | colAltOff | Color for the alternate character set key when is not active. |
[in] | colAltOn | Color for the alternate character set key when is active. |
[in] | colScr | Color for the display screen. |
[in] | colKeyTxt | Color for text on the keys. |
[in] | colScrTxt | Color for text on the display. |
[in] | colDisTxt | Color for the text on the display when it is blocked, that is, from the moment when Ok is pressed until the Keyboard value is read. |
void mrmKeyboardGetText | ( | char * | res, |
int * | blocked | ||
) |
This function can be called any time while the Keyboard exists, and gets its contents as text. It can also read the bloked flag to verifiy if the user has pressed Ok. If the Keyboard is blocked, reading its value deletes its contents and resets it to normal state.
[out] | res | Buffer to read the characters. Has to hold at least the max. number of characters of the keyboard + 1 bytes. |
[out] | blocked | Pointer to an integer to retrieve the blocked flag. Ignored if NULL. |