![]() |
mgsLib
1.3
Mermaja's Graphic Screen. A simple C library to build Windows graphic applications from console programs.
|
Header file for the MGS Library Widgets. More...
Macros | |
#define | MWG_3DROUT 0x10 /**Projected out*/ |
3D Rectangle construction constants. | |
#define | MWG_3DRIN 0 /**Projected in*/ |
3D Rectangle construction constants. | |
#define | MWG_3DRNORMAL 2 /**Normal projection*/ |
3D Rectangle construction constants. | |
#define | MWG_3DRLOW 1 /**Low projection*/ |
3D Rectangle construction constants. | |
Functions | |
void | mrmWU3DRectangle (int scr, int x0, int y0, int x1, int y1, int col, int type) |
Draws a 3D rectangle with black and white lines on its edges to simulate it to be below or over the screen surface. More... | |
struct mrmWGInfo | mrmWVersionData (void) |
Returns the main MrMWidgets System information. More... | |
void | mrmWShow (void) |
Handles all the active widgets display activity. More... | |
void | mrmWLoop (void) |
Handles all the active widgets working activity. More... | |
int | mrmNPInit (int bgCol, int nChar, void(*callBack)(void)) |
Creates the NumPad. More... | |
void | mrmNPDelete (void) |
Delete the NumPad if exists. More... | |
int | mrmNPExists (void) |
Check the existence of the NumPad. More... | |
void | mrmNPMove (int x, int y) |
Moves the NumPad to a new position. More... | |
void | mrmNPSetColors (int colKeyNum, int colKeyEsp, int colScr, int colKeyTxt, int colScrTxt, int colDisTxt) |
Sets the colors for the NumPad. More... | |
void | mrmNPGetText (char *text, int size, int *blocked) |
Gets the value on the NumPad as text. More... | |
double | mrmNPGetVal (int *blocked) |
Gets the value on the NumPad as floating point value. More... | |
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 | mrmCPInit (int bgCol, int txtCol) |
Creates the Color Picker with the given colors. More... | |
void | mrmCPDelete (void) |
Delete the Color Picker if exists. More... | |
int | mrmCPExists (void) |
Check the existence of the Color Picker. More... | |
void | mrmCPMove (int x, int y) |
Moves the Color Picker to a new position. More... | |
void | mrmCPSetSelection (int crgb) |
Sets the color selected on the Color Picker. More... | |
int | mrmCPRGB (void) |
Gets the color selected on the Color Picker. More... | |
int | mrmButtonInit (int scr, int width, int height, void(*callBack)(int, int), char *label, int nCol, int pCol, int dCol) |
Creates a new button with the given size and colors. More... | |
int | mrmButtonDelete (int idx) |
Delete the button whose reference number is given. More... | |
int | mrmButtonSetEnabled (int idx, int enabled) |
Enable or disable button. More... | |
int | mrmButtonSetPos (int idx, int x, int y) |
Places the button at the given position on the screen. More... | |
int | mrmButtonSetSize (int idx, int w, int h) |
Resizes the button. More... | |
int | mrmButtonSetColor (int idx, int nCol, int pCol, int dCol) |
Sets the colors for the button. More... | |
int | mrmButtonSetFont (int idx, int sz, int a, char *fn, int s) |
Sets the font for the button label. More... | |
int | mrmButtonSetFontColor (int idx, int nCol, int pCol, int dCol) |
Sets the colors for the button label. More... | |
int | mrmButtonSetLabel (int idx, char *label) |
Sets the label of the button. More... | |
int | mrmButtonSetCounter (int idx, unsigned int val) |
Sets the counter for the button to a given value. More... | |
int | mrmButtonGetCounter (int idx) |
Reads the counter of the button. More... | |
int | mrmTextBoxInit (int scr, int width, int height, int nChar, int kbType, void(*callBack)(int, int), int col, int dCol) |
Creates a new textBox with the given size and colors. More... | |
int | mrmTextBoxDelete (int idx) |
Delete the textBox whose reference number is given. More... | |
int | mrmTextBoxSetEnabled (int idx, int enabled) |
Enable or disable textBox. More... | |
int | mrmTextBoxSetPos (int idx, int x, int y) |
Places the textBox at the given position on the screen. More... | |
int | mrmTextBoxSetSize (int idx, int w, int h) |
Resizes the textbox. More... | |
int | mrmTextBoxSetColor (int idx, int col, int dCol) |
Sets the colors for the textBox. More... | |
int | mrmTextBoxSetFont (int idx, int sz, int a, char *fn, int s) |
Sets the font for the textBox contents. More... | |
int | mrmTextBoxSetFontColor (int idx, int nCol, int dCol) |
Sets the colors for the textBox contents. More... | |
int | mrmTextBoxSetText (int idx, char *string) |
Sets the contents of the textBox. More... | |
int | mrmTextBoxGetText (int idx, char *string) |
Reads the contents of the textBox. More... | |
int | mrmSliderInit (int scr, int orientation, int width, int height, double min, double max, int col, int cCol, int cBcol, int dCol) |
Creates a new slider with the given size, values and colors. More... | |
int | mrmSliderDelete (int idx) |
Delete the slider whose reference number is given. More... | |
int | mrmSliderSetEnabled (int idx, int enabled) |
Enable or disable slider. More... | |
int | mrmSliderSetPos (int idx, int x, int y) |
Places the slider at the given position on the screen. More... | |
int | mrmSliderSetColor (int idx, int col, int cCol, int cBcol, int dCol) |
Sets the colors for the slider. More... | |
double | mrmSliderSetVal (int idx, double val) |
Sets the value of the slider and modifies the position of the cursor. More... | |
double | mrmSliderGetVal (int idx) |
Reads the value of the slider. More... | |
int | mrmSelectionInit (int scr, int width, int height, int nSel, char **text, int cols, int mode) |
Creates a new selection with the given settings. More... | |
int | mrmSelectionDelete (int idx) |
Delete the selection whose reference number is given. More... | |
int | mrmSelectionSetEnabled (int idx, int enabled) |
Enable or disable selection. More... | |
int | mrmSelectionSetPos (int idx, int x, int y) |
Places the selection at the given position on the screen. More... | |
int | mrmSelectionSetOptionsPos (int idx, int *points) |
Places the options of selection at the given relative positions. More... | |
int | mrmSelectionSetColor (int idx, int col, int cCol, int cBcol, int dCol) |
Sets the colors for the selection. More... | |
int | mrmSelectionSetFont (int idx, int sz, int a, char *fn, int s) |
Sets the font for the selection texts. More... | |
int | mrmSelectionSetFontColor (int idx, int nCol, int sCol, int dCol, int dsCol) |
Sets the colors for the selection texts. More... | |
int | mrmSelectionSetVal (int idx, int val) |
Sets the value of the selection. More... | |
int | mrmSelectionGetVal (int idx) |
Reads the value of the selection. More... | |
int | mrmListInit (int scr, int width, int height, int wwidth, int mode, char **texts, void(*callBack)(int, int, int), int nSel, char *title) |
Creates a new list with the given parameters. More... | |
int | mrmListDelete (int idx) |
Delete the list whose reference number is given. More... | |
int | mrmListSetEnabled (int idx, int enabled) |
Enable or disable list. More... | |
int | mrmListSetPos (int idx, int x, int y) |
Places the list at the given position on the screen. More... | |
int | mrmListSetSize (int idx, int w, int h, int ww) |
Resizes the list. More... | |
int | mrmListSetColor (int idx, int col, int dCol, int sCol, int wCol, int wBCol, int wW1Col, int wW2Col) |
Sets the colors for the list. More... | |
int | mrmListSetFont (int idx, int sz, int a, char *fn, int s) |
Sets the font for the list contents. More... | |
int | mrmListSetFontColor (int idx, int nCol, int dCol, int tsCol) |
Sets the colors for the list texts. More... | |
int | mrmListAddItems (int idx, char **items) |
Adds contents to the list. More... | |
int | mrmListInsertItem (int idx, int pos, char *item) |
Insert an item in a given position of the list. More... | |
int | mrmListDelItem (int idx, int pos) |
Deletes the item at the given position of the list. More... | |
int | mrmListSetSelected (int idx, int sel) |
Sets the value of the selection of the list. More... | |
int | mrmListGetSelected (int idx) |
Reads the value of the selection of the list. More... | |
int | mrmListItemAtIndex (int idx, int pos, char *string) |
Reads the text of the given index. More... | |
void mrmWU3DRectangle | ( | int | scr, |
int | x0, | ||
int | y0, | ||
int | x1, | ||
int | y1, | ||
int | col, | ||
int | type | ||
) |
The value held by a slider is calculated by means of the linear relation among the max and min values the slider lenght and the position of the cursor. This function sets the new cursor value that most approximates the cursor value if it fits inside the slider, and return the previous value.
[in] | idx | Slider reference number. |
[in] | val | New value for the slider. It is ignored if the calculated cursor position does not fit inside the slider. |
struct mrmWGInfo mrmWVersionData | ( | void | ) |
Retruns a mrmWGInfo structure holding the major and minor version numbers and the maximum and free number of each widget type. The mrmWGInfo strucuture is formed by 12 integers:
void mrmWShow | ( | void | ) |
This function has to be called once during program iteration to perform all the activities required for the widgets to be correctly drawn on screen. It should be called after clearing the screens containing widgets, usually at the end of the application loop.
void mrmWLoop | ( | void | ) |
This function has to be called once during program iteration to perform all the activities required for the correct functionning of the widgets. It should be called before the widget drawing function, as a part of the working activity of the loop.
int mrmNPInit | ( | int | bgCol, |
int | nChar, | ||
void(*)(void) | callBack | ||
) |
This function is used to create the NumPad. 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 NumPad. It also sets a callback function to be invoked when Ok is pressed.
[in] | bgCol | Color for the background of the NumPad window. Use a negative value for the default color. |
[in] | nChar | Maximum number of characters to be accepted by the NumPad. |
[in] | callBack | Function to be called when the text is completed -*Ok* is pressed-. If NULL no function is invoked. |
void mrmNPDelete | ( | void | ) |
This functions deletes the NumPad from the system. A new one can then be created if desired.
int mrmNPExists | ( | void | ) |
Only one NumPad can be present in the system. This function returns true if the NumPad exists, false if not.
void mrmNPMove | ( | int | x, |
int | y | ||
) |
This functions places the NumPad -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 mrmNPSetColors | ( | int | colKeyNum, |
int | colKeyEsp, | ||
int | colScr, | ||
int | colKeyTxt, | ||
int | colScrTxt, | ||
int | colDisTxt | ||
) |
When the NumPad is created default system colors are assigned for its texts and keys. This function allows the user to change them during execution.
[in] | colKeyNum | Color for numeric keys. |
[in] | colKeyEsp | Color for the special keys. |
[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 NumPad value is read. |
void mrmNPGetText | ( | char * | res, |
int | n, | ||
int * | blocked | ||
) |
This function can be called any time while the NumPad exists, and gets its contents as text. It can also read the bloked flag to verifiy if the user has pressed Ok. If the NumPad 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 n + 1 bytes. |
[in] | n | Maximum number of characters to be read. |
[out] | blocked | Pointer to an integer to retrieve the blocked flag. Ignored if NULL. |
double mrmNPGetVal | ( | int * | blocked | ) |
This function can be called any time while the NumPad exists, and gets its contents as a double. Please notice that there can be precission loses if the number of characters is high. It can also read the bloked flag to verifiy if the user has pressed Ok. If the NumPad is blocked, reading its value deletes its contents and resets it to normal state.
[out] | blocked | Pointer to an integer to retrieve the blocked flag. Ignored if NULL. |
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. |
int mrmCPInit | ( | int | bgCol, |
int | txtCol | ||
) |
This function is used to create the Color Picker. Only one can be present in the system, so the call will fail if one already exists.
[in] | bgCol | Color for the background of the Color Picker window. Use MWG_CPBCKCOL for the default color. |
[in] | txtCol | Color for the texts on the Color Picker. Use MWG_CPTXTCOL for the default color. |
void mrmCPDelete | ( | void | ) |
This functions deletes the Color Picker from the system. A new one can then be created if desired.
int mrmCPExists | ( | void | ) |
Only one Color Picker can be present in the system. This function returns true if the Color Picker exists, false if not.
void mrmCPMove | ( | int | x, |
int | y | ||
) |
This functions places the Color Picker -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 mrmCPSetSelection | ( | int | crgb | ) |
The color selected on the Color Picker is set to the RGB value given if the Color Picker exists.
[in] | crgb | RGB value of the color. |
int mrmCPRGB | ( | void | ) |
Returns the RGB value selected on the Color Picker, or 0 if it does not exist.
int mrmButtonInit | ( | int | scr, |
int | width, | ||
int | height, | ||
void(*)(int, int) | callBack, | ||
char * | label, | ||
int | nCol, | ||
int | pCol, | ||
int | dCol | ||
) |
This function is used to create a button of the given width and height on the given screen. If a label is specified it will be printed centered on the button. Three colors are also given; the released and pressed color, and the color to be used when the button is disabled. The button is enabled after creation, but it is not placed on screen -and thus visible and usable- until its position is set using the corresponding function. A callback function can be specified to be called when the button is clicked. This function will receive two integer parameters: the button reference and the screen index.
[in] | scr | Graphic screen where the button is placed. |
[in] | width | Width in pixels of the button. |
[in] | height | Height in pixels of the button. |
[in] | callBack | Function to be called when the button is clicked. If NULL no function is invoked. |
[in] | label | Text to appear centered on the button. It can be the empty string or NULL if no text is wanted. |
[in] | nCol | Color for the button when not pressed. |
[in] | pCol | Color for the button when pressed. |
[in] | dCol | Color for the button when disabled. |
int mrmButtonDelete | ( | int | idx | ) |
This functions deletes from the system the button whose reference number is given, releasing all associated resources. The reference number and button slot are released for further use.
[in] | idx | Button reference number. |
int mrmButtonSetEnabled | ( | int | idx, |
int | enabled | ||
) |
This functions sets the enabled state of the button. When a button is disabled it appears with the disabled colors and cannot be cliked.
[in] | idx | Button reference number. |
[in] | enabled | 0 to disable the button, nonzero to enable. |
int mrmButtonSetPos | ( | int | idx, |
int | x, | ||
int | y | ||
) |
For a button to be displayed on its screen it has to be placed on a given position. This function has to be used to place the button at the desired x,y position on the screen.
[in] | idx | Button reference number. |
[in] | x | Horizontal coordinate of the top left corner of the button. |
[in] | y | Vertical coordinate of the top left corner of the button. |
int mrmButtonSetSize | ( | int | idx, |
int | w, | ||
int | h | ||
) |
This function changes the height, the width of the button or both.
[in] | idx | Button reference number. |
[in] | w | New width of the button. If 0 let it unchanged. |
[in] | h | New height of the button. If 0 let it unchanged. |
int mrmButtonSetColor | ( | int | idx, |
int | nCol, | ||
int | pCol, | ||
int | dCol | ||
) |
When a button is created it is given some colors. This function allows the user to change them during execution.
[in] | idx | Button reference number. |
[in] | nCol | Color for the button when not pressed. |
[in] | pCol | Color for the button when pressed. |
[in] | dCol | Color for the button when disabled. |
int mrmButtonSetFont | ( | int | idx, |
int | sz, | ||
int | a, | ||
char * | fn, | ||
int | s | ||
) |
When a button is created its label is assigned default font and colors. This function allows to set the font for the label.
[in] | idx | Button reference number. |
[in] | sz | Size of the font. |
[in] | a | Rotation angle in degrees. |
[in] | fn | Pointer to a string containing the font name. If it is NULL the standard font is used. |
[in] | s | Style of the font. The three lower bits mean from 0 to 2 italic, underline and strikeout. The higher bits a weight ranging from 0 to 1000. The constants MGS_ITALIC, MGS_UNDERLINE and MGS_STRIKEOUT can be ored to form the lower three bits. MGS_LIGHT, MGS_BOLD and MGS_HEAVY are three predefined values for the weight that can also be ored. |
int mrmButtonSetFontColor | ( | int | idx, |
int | nCol, | ||
int | pCol, | ||
int | dCol | ||
) |
When a button is created its label is assigned default font and colors. This function allows to set colors for the label.
[in] | idx | Button reference number. |
[in] | nCol | Color for the button label when not pressed. |
[in] | pCol | Color for the button label when pressed. |
[in] | dCol | Color for the button label when disabled. |
int mrmButtonSetLabel | ( | int | idx, |
char * | label | ||
) |
When a button is created it is given a label. This function allows the user to change it during execution.
[in] | idx | Button reference number. |
[in] | label | Text to appear centered on the button. It can be the empty string or NULL if no text is wanted. |
int mrmButtonSetCounter | ( | int | idx, |
unsigned int | val | ||
) |
Each button holds an internal counter that is increased with each click. This function sets the couter value and returns the previous one.
[in] | idx | Button reference number. |
[in] | val | New value for the counter. |
int mrmButtonGetCounter | ( | int | idx | ) |
Each button holds an internal counter that is increased with each click. This function returns the value of this counter.
[in] | idx | Button reference number. |
int mrmTextBoxInit | ( | int | scr, |
int | width, | ||
int | height, | ||
int | nChar, | ||
int | kbType, | ||
void(*)(int, int) | callBack, | ||
int | col, | ||
int | dCol | ||
) |
This function is used to create a textBox of the given width and height on the given screen. Two colors are also given; the normal color, and the color to be used when the textBox is disabled. The textBox is enabled after creation, but it is not placed on screen -and thus visible and usable- until its position is set using the corresponding function. The maximum number of characters to be read is also specified, as well as the type of keyboard -alphanueric or numeric- used to enter the text. A callback function can be specified to be called when the text is completed by pressing Ok on the keyboard. This function will receive two integer parameters: the textBox reference and the screen index.
[in] | scr | Graphic screen where the textBox is placed. |
[in] | width | Width in pixels of the textBox. |
[in] | height | Height in pixels of the textBox. |
[in] | nChar | Max length of the string to be read by the textBox. |
[in] | kbType | Keyboard used to enter the text. It can be MWG_KBALPHA for an alphanumeric keyboard or MWG_KBNUMERIC for a Numpad. |
[in] | callBack | Function to be called when the text is completed. If NULL no function is invoked. |
[in] | col | Color for the textBox. |
[in] | dCol | Color for the textBox when disabled. |
int mrmTextBoxDelete | ( | int | idx | ) |
This functions deletes from the system the textBox whose reference number is given, releasing all associated resources. The reference number and textBox slot are released for further use.
[in] | idx | TextBox reference number. |
int mrmTextBoxSetEnabled | ( | int | idx, |
int | enabled | ||
) |
This functions sets the enabled state of the textBox. When a textBox is disabled it appears with the disabled colors and cannot be used to enter text.
[in] | idx | TextBox reference number. |
[in] | enabled | 0 to disable the textBox, nonzero to enable. |
int mrmTextBoxSetPos | ( | int | idx, |
int | x, | ||
int | y | ||
) |
For a textBox to be displayed on its screen it has to be placed on a given position. This function has to be used to place the textBox at the desired x,y position on the screen.
[in] | idx | TextBox reference number. |
[in] | x | Horizontal coordinate of the top left corner of the textBox. |
[in] | y | Vertical coordinate of the top left corner of the textBox. |
int mrmTextBoxSetSize | ( | int | idx, |
int | w, | ||
int | h | ||
) |
This function changes the height, the width of the button or both.
[in] | idx | TextBox reference number. |
[in] | w | New width of the textbox. If 0 let it unchanged. |
[in] | h | New height of the textbox. If 0 let it unchanged. |
int mrmTextBoxSetColor | ( | int | idx, |
int | col, | ||
int | dCol | ||
) |
When a textBox is created it is given some colors. This function allows the user to change them during execution.
[in] | idx | TextBox reference number. |
[in] | col | Color for the textBox. |
[in] | dCol | Color for the textBox when disabled. |
int mrmTextBoxSetFont | ( | int | idx, |
int | sz, | ||
int | a, | ||
char * | fn, | ||
int | s | ||
) |
When a textBox is created its text is assigned default font and colors. This function allows to set the font for the text contained on the box.
[in] | idx | TextBox reference number. |
[in] | sz | Size of the font. |
[in] | a | Rotation angle in degrees. |
[in] | fn | Pointer to a string containing the font name. If it is NULL the standard font is used. |
[in] | s | Style of the font. The three lower bits mean from 0 to 2 italic, underline and strikeout. The higher bits a weight ranging from 0 to 1000. The constants MGS_ITALIC, MGS_UNDERLINE and MGS_STRIKEOUT can be ored to form the lower three bits. MGS_LIGHT, MGS_BOLD and MGS_HEAVY are three predefined values for the weight that can also be ored. |
int mrmTextBoxSetFontColor | ( | int | idx, |
int | nCol, | ||
int | dCol | ||
) |
When a textBox is created its text is assigned default font and colors. This function allows to set colors for the text contained on the box.
[in] | idx | TextBox reference number. |
[in] | nCol | Color for the textBox contents. |
[in] | dCol | Color for the textBox contents when disabled. |
int mrmTextBoxSetText | ( | int | idx, |
char * | text | ||
) |
It is desirable sometimes to fill a textBox with default text before the user enters its own. This function sets the contents of the textBox to the given string.
[in] | idx | TextBox reference number. |
[in] | text | Text to be copied to the contents of the textBox. |
int mrmTextBoxGetText | ( | int | idx, |
char * | string | ||
) |
This function copies the contents of the textBox to the given string. This must have enough space to hold the whole text as no size checking is performed.
[in] | idx | TextBox reference number. |
[out] | string | String to receie the contents. It must have the required space. |
int mrmSliderInit | ( | int | scr, |
int | orientation, | ||
int | width, | ||
int | length, | ||
double | min, | ||
double | max, | ||
int | col, | ||
int | cCol, | ||
int | cBcol, | ||
int | dCol | ||
) |
This function is used to create a slider of the given width and length on the given screen, placed in horizontal or vertical position. The minimum value is that of the left for horizontal or top for vertical edge of the slider, being max that of the opposite edge. These names are not related to absoulte values, as min can be greater than max. The value given by the slider is linearly adjusted between these limits, using the slider length and cursor positions, so the granularity is determined by the length. Four colors are also specified, for the slider, cursor body, cursor lines and slider when disabled. In this case colors for the cursor are permuted. The slider is enabled after creation, but it is not placed on screen -and thus visible and usable- until its position is set using the corresponding function.
[in] | scr | Graphic screen where the slider is placed. |
[in] | orientation | Can be MWG_SLHORIZONTAL for an horizontal slider or MWG_SLVERTICAL for a vertical one. |
[in] | width | Width in pixels of the slider. |
[in] | length | Length in pixels of the slider. |
[in] | min | Value for the left or top edge of the slider. |
[in] | max | Value for the right or bottom edge of the slider. |
[in] | col | Color for the slider. |
[in] | cCol | Color for the cursor body. |
[in] | cBcol | Color for the cursor lines. |
[in] | dCol | Color for the slider when disabled. Cursor lines and body colors are permuted in this case. |
int mrmSliderDelete | ( | int | idx | ) |
This functions deletes from the system the slider whose reference number is given, releasing all associated resources. The reference number and slider slot are released for further use.
[in] | idx | Slider reference number. |
int mrmSliderSetEnabled | ( | int | idx, |
int | enabled | ||
) |
This functions sets the enabled state of the slider. When a slider is disabled it appears with the disabled colors and its cursor cannot be moved.
[in] | idx | Slider reference number. |
[in] | enabled | 0 to disable the button, nonzero to enable. |
int mrmSliderSetPos | ( | int | idx, |
int | x, | ||
int | y | ||
) |
For a slider to be displayed on its screen it has to be placed on a given position. This function has to be used to place the slider at the desired x,y position on the screen.
[in] | idx | Slider reference number. |
[in] | x | Horizontal coordinate of the top left corner of the slider. |
[in] | y | Vertical coordinate of the top left corner of the slider. |
int mrmSliderSetColor | ( | int | idx, |
int | col, | ||
int | cCol, | ||
int | cBcol, | ||
int | dCol | ||
) |
When a slier is created it is given some colors. This function allows the user to change them during execution.
[in] | idx | Slider reference number. |
[in] | col | Color for the slider. |
[in] | cCol | Color for the cursor body. |
[in] | cBcol | Color for the cursor lines. |
[in] | dCol | Color for the slider when disabled. Cursor lines and body colors are permuted in this case. |
double mrmSliderSetVal | ( | int | idx, |
double | val | ||
) |
The value held by a slider is calculated by means of the linear relation among the max and min values the slider lenght and the position of the cursor. This function sets the new cursor value that most approximates the cursor value if it fits inside the slider, and return the previous value.
[in] | idx | Slider reference number. |
[in] | val | New value for the slider. It is ignored if the calculated cursor position does not fit inside the slider. |
double mrmSliderGetVal | ( | int | idx | ) |
The value held by a slider is calculated by means of the linear relation among the max and min values the slider lenght and the position of the cursor. This function gets this value.
[in] | idx | Slider reference number. |
int mrmSelectionInit | ( | int | scr, |
int | width, | ||
int | height, | ||
int | nSel, | ||
char ** | text, | ||
int | cols, | ||
int | mode | ||
) |
This function is used to create a selection with its options evenly displayed in several columns on a rectangle of the given width and height on the given screen. The number of options is indicated as well as an array of texts, one for each option. The working mode can be selected as being multiple or unique selection; the symbol or method for displaying the selected options can also be configured.
[in] | scr | Graphic screen where the selection is placed. |
[in] | width | Width in pixels of a rectangle to arrange the selection list. |
[in] | height | Height in pixels of a rectangle to arrange the selection list. |
[in] | nSel | Number of selections. |
[in] | text | List of texts to be displayed for each option. |
[in] | cols | Number of columns to arrange the selections. If not valid -0, negative or greater than the number of options- a list of points has to be passed later. |
[in] | mode | Specifies the selection mode -unique or multiple selection, by oring one of MWG_SCUNIQUE or MWG_SCMULTI- and the display mode -oring one of MWG_SCROUND, MWG_SCSQUARE, MWG_SCSYMBOL or MWG_SCNONE-. If one of the first two is used, a size for the box has to be ored in the lower byte of the parameter; if MWG_SCSYMBOL is used, the character to be used is ored in the low byte. |
int mrmSelectionDelete | ( | int | idx | ) |
This functions deletes from the system the selection whose reference number is given, releasing all associated resources. The reference number and selection slot are released for further use.
[in] | idx | Selection reference number. |
int mrmSelectionSetEnabled | ( | int | idx, |
int | enabled | ||
) |
This functions sets the enabled state of the Selection. When a selection is disabled it appears with the disabled colors and cannot be cliked.
[in] | idx | Selection reference number. |
[in] | enabled | 0 to disable the button, nonzero to enable. |
int mrmSelectionSetPos | ( | int | idx, |
int | x, | ||
int | y | ||
) |
For a selection to be displayed on its screen it has to be placed on a given position. This function has to be used to place the selection at the desired x,y position on the screen. All item coordinates are to be relative to this point.
[in] | idx | Selection reference number. |
[in] | x | Horizontal coordinate of the top left corner of the selection. |
[in] | y | Vertical coordinate of the top left corner of the Selection. |
int mrmSelectionSetOptionsPos | ( | int | idx, |
int * | points | ||
) |
This function allows individual placement of each option for a selection. The positions are relative to the position of the selection. All item coordinates are be relative to this point.
[in] | idx | Selection reference number. |
[in] | points | Vector of x, y coordinates for each selection option. |
int mrmSelectionSetColor | ( | int | idx, |
int | nCol, | ||
int | bCol, | ||
int | fCol, | ||
int | dCol | ||
) |
When a selection is created it is given some colors. This function allows the user to change them during execution.
[in] | idx | Selection reference number. |
[in] | nCol | Color for the selection figure. |
[in] | bCol | Color for the selection figure border. |
[in] | fCol | Color for the selection figure fill when selected. |
[in] | dCol | Color for the selection figure when disabled. |
int mrmSelectionSetFont | ( | int | idx, |
int | sz, | ||
int | a, | ||
char * | fn, | ||
int | s | ||
) |
When a selection is created its texts are assigned default font and colors. This function allows to set the font for the texts.
[in] | idx | Selection reference number. |
[in] | sz | Size of the font. |
[in] | a | Rotation angle in degrees. |
[in] | fn | Pointer to a string containing the font name. If it is NULL the standard font is used. |
[in] | s | Style of the font. The three lower bits mean from 0 to 2 italic, underline and strikeout. The higher bits a weight ranging from 0 to 1000. The constants MGS_ITALIC, MGS_UNDERLINE and MGS_STRIKEOUT can be ored to form the lower three bits. MGS_LIGHT, MGS_BOLD and MGS_HEAVY are three predefined values for the weight that can also be ored. |
int mrmSelectionSetFontColor | ( | int | idx, |
int | nCol, | ||
int | sCol, | ||
int | dCol, | ||
int | dsCol | ||
) |
When a selection is created its texts are assigned default font and colors. This function allows to set colors for the texts. In case no change is wanted for the selected options text, just use the same colors.
[in] | idx | Selection reference number. |
[in] | nCol | Color for the text when not selected. |
[in] | sCol | Color for the text when selected. |
[in] | dCol | Color for the text when not selected and the selection is disabled. |
[in] | dsCol | Color for the text when selected and the selection is disabled. |
int mrmSelectionSetVal | ( | int | idx, |
int | val | ||
) |
Each selection holds a value that represents the selected options. This function sets the value and returns the previous one. No correctness verification is performed.
[in] | idx | Selection reference number. |
[in] | val | New value for the selection. |
int mrmSelectionGetVal | ( | int | idx | ) |
Each selection holds a value that represents the selected options. This function gets this value.
[in] | idx | Selection reference number. |
int mrmListInit | ( | int | scr, |
int | width, | ||
int | height, | ||
int | wwidth, | ||
int | mode, | ||
char ** | texts, | ||
void(*)(int, int, int) | callBack, | ||
int | items, | ||
char * | title | ||
) |
This function is used to create a List of the given width and height on the given screen. Two colors are also given; the normal color, and the color to be used when the List is disabled. The List is enabled after creation, but it is not placed on screen -and thus visible and usable- until its position is set using the corresponding function. The maximum number of characters to be read is also specified, as well as the type of keyboard -alphanueric or numeric- used to enter the text. A callback function can be specified to be called when the user opens the list window or selects an element of the list. This function will receive three integer parameters: the List reference, the screen index and MWG_LIOPEN if the user has opened the list window by clicking on it, MWG_LICLOSE if the user has closed the window without making a selection or MWG_LISELECT if the user has closed the window and made a selection.
[in] | scr | Graphic screen where the List is placed. |
[in] | width | Width in pixels of the List on screen. |
[in] | height | Height in pixels of the List. |
[in] | wwidth | Width in pixels of the window to display the List, not considering borders. |
[in] | mode | It can be MWG_LIORDERED to keep the items alphabetically ordered or MWG_LINONE otherwise. |
[in] | texts | NULL terminated array of pointers to the initial texts of the list. |
[in] | callBack | Function to be called when the user opens or selects an element of the list. If NULL no function is invoked. |
[in] | items | Number of elements to be displayed on the pop up window. |
[in] | title | Caption for the pop up window. |
int mrmListDelete | ( | int | idx | ) |
This functions deletes from the system the list whose reference number is given, releasing all associated resources. The reference number and list slot are released for further use.
[in] | idx | List reference number. |
int mrmListSetEnabled | ( | int | idx, |
int | enabled | ||
) |
This functions sets the enabled state of the list. When a list is disabled it appears with the disabled colors and cannot be used to select item.
[in] | idx | List reference number. |
[in] | enabled | 0 to disable the list, nonzero to enable. |
int mrmListSetPos | ( | int | idx, |
int | x, | ||
int | y | ||
) |
For a list to be displayed on its screen it has to be placed on a given position. This function has to be used to place the list at the desired x,y position on the screen.
[in] | idx | List reference number. |
[in] | x | Horizontal coordinate of the top left corner of the list. |
[in] | y | Vertical coordinate of the top left corner of the list. |
int mrmListSetSize | ( | int | idx, |
int | w, | ||
int | h, | ||
int | ww | ||
) |
This function changes the height, the width of the button or both.
[in] | idx | List reference number. |
[in] | w | New width of the list. If 0 let it unchanged. |
[in] | h | New height of the list. If 0 let it unchanged. |
[in] | ww | New width of the list window. If 0 let it unchanged. |
int mrmListSetColor | ( | int | idx, |
int | col, | ||
int | dCol, | ||
int | sCol, | ||
int | wCol, | ||
int | wBCol, | ||
int | wW1Col, | ||
int | wW2Col | ||
) |
When a list is created it is given default colors. This function allows the user to change them during execution.
[in] | idx | List reference number. |
[in] | col | Color for the list. |
[in] | dCol | Color for the list when disabled. |
[in] | sCol | Color for the selected item background on the list window. |
[in] | wCol | Color for the background of the list window. |
[in] | wW1Col | Main color for the widgets of the list window. |
[in] | wW2Col | Secondary color for the widgets of the list window. |
int mrmListSetFont | ( | int | idx, |
int | sz, | ||
int | a, | ||
char * | fn, | ||
int | s | ||
) |
When a list is created its text is assigned default font and colors. This function allows to set the font for the text contained on the box and the window text.
[in] | idx | List reference number. |
[in] | sz | Size of the font. |
[in] | a | Rotation angle in degrees. |
[in] | fn | Pointer to a string containing the font name. If it is NULL the standard font is used. |
[in] | s | Style of the font. The three lower bits mean from 0 to 2 italic, underline and strikeout. The higher bits a weight ranging from 0 to 1000. The constants MGS_ITALIC, MGS_UNDERLINE and MGS_STRIKEOUT can be ored to form the lower three bits. MGS_LIGHT, MGS_BOLD and MGS_HEAVY are three predefined values for the weight that can also be ored. |
int mrmListSetFontColor | ( | int | idx, |
int | nCol, | ||
int | dCol, | ||
int | tsCol | ||
) |
When a list is created its text is assigned default font and colors. This function allows to set colors for the text contained on the box and the window text.
[in] | idx | List reference number. |
[in] | nCol | Color for the list text. |
[in] | dCol | Color for the list text when disabled. |
[in] | tsCol | Color for the selected item text on the list window. |
int mrmListAddItems | ( | int | idx, |
char ** | items | ||
) |
Adds a NULL terminated list of strings to the list options. They are added at the end or ordered alphabetically, according to the order settings of the list. It does not check for identical texts. The selected option is reset
[in] | idx | List reference number. |
[in] | items | NULL terminated list of strings. |
int mrmListInsertItem | ( | int | idx, |
int | pos, | ||
char * | item | ||
) |
Adds a new string to the list options before the given position, disregarding the order. If the position is out of the list the fuction does nothing. It does not check for identical texts. The selected option is not reset
[in] | idx | List reference number. |
[in] | pos | Position of the item, starting at 0. |
[in] | item | Text to be added. |
int mrmListDelItem | ( | int | idx, |
int | pos | ||
) |
Deletes the element of the given position of the list. If the position is out of the list the fuction does nothing. The selected option is not reset.
[in] | idx | List reference number. |
[in] | pos | Position of the item, starting at 0. |
int mrmListSetSelected | ( | int | idx, |
int | sel | ||
) |
This function sets the item currenlty selected on the list, and returns the old selected one. If the index is out of range the change is ignored.
[in] | idx | List reference number. |
[in] | sel | Index of the new selected item. |
int mrmListGetSelected | ( | int | idx | ) |
This function reads the index of the item currenlty selected on the list.
[in] | idx | List reference number. |
int mrmListItemAtIndex | ( | int | idx, |
int | pos, | ||
char * | string | ||
) |
This function copies the contents of the text of the given item to the given string. This must have enough space to hold the whole text as no size checking is performed.
[in] | idx | List reference number. |
[in] | pos | Index of the item whose text is to be read. |
[out] | string | String to receive the contents. It must have the required space. |