mgsLib  1.3
Mermaja's Graphic Screen. A simple C library to build Windows graphic applications from console programs.
Functions
mrmWidgets.h File Reference

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...
 

Detailed Description

Author
Germán Fabregat
Date
October 2017

Function Documentation

◆ mrmWU3DRectangle()

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.

Parameters
[in]idxSlider reference number.
[in]valNew value for the slider. It is ignored if the calculated cursor position does not fit inside the slider.
Returns
The old value of the slider or MGS_ERRRESNOEXIST in case the button does not exist.

◆ mrmWVersionData()

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:

  • vMajor: Version major number
  • vMinor: Version minor number
  • maxSlider: Maximum number of sliders
  • freeSlider: Current number of free sliders
  • maxButton: Maximum number of buttons
  • freeButton: Current number of free buttons
  • maxTextBox: Maximum number of text boxes
  • freeTextBox: Current number of free text boxes
  • maxSelection: Maximum number of selections
  • freeSelection: Current number of free selections
  • maxList: Maximum number of lists
  • freeList: Current number of free lists
Returns
A mgsInfo structure with these values.

◆ mrmWShow()

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.

◆ mrmWLoop()

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.

◆ mrmNPInit()

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.

Parameters
[in]bgColColor for the background of the NumPad window. Use a negative value for the default color.
[in]nCharMaximum number of characters to be accepted by the NumPad.
[in]callBackFunction to be called when the text is completed -*Ok* is pressed-. If NULL no function is invoked.
Returns
The function returns a 0 or positive integer that references the NumPad screen, or a negative value if an error occurred.

◆ mrmNPDelete()

void mrmNPDelete ( void  )

This functions deletes the NumPad from the system. A new one can then be created if desired.

◆ mrmNPExists()

int mrmNPExists ( void  )

Only one NumPad can be present in the system. This function returns true if the NumPad exists, false if not.

Returns
The function returns 1 if the NumPad exists, 0 if not.

◆ mrmNPMove()

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.

Parameters
[in]xCoordinate of the leftmost position.
[in]yCoordinate of the top position.

◆ mrmNPSetColors()

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.

Parameters
[in]colKeyNumColor for numeric keys.
[in]colKeyEspColor for the special keys.
[in]colScrColor for the display screen.
[in]colKeyTxtColor for text on the keys.
[in]colScrTxtColor for text on the display.
[in]colDisTxtColor 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.

◆ mrmNPGetText()

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.

Parameters
[out]resBuffer to read the characters. Has to hold at least n + 1 bytes.
[in]nMaximum number of characters to be read.
[out]blockedPointer to an integer to retrieve the blocked flag. Ignored if NULL.

◆ mrmNPGetVal()

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.

Parameters
[out]blockedPointer to an integer to retrieve the blocked flag. Ignored if NULL.
Returns
Floating point value of the contents of the NumPad.

◆ mrmKeyboardInit()

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.

Parameters
[in]bgColColor for the background of the Keyboard window. Use a negative value for the default color.
[in]nCharMaximum number of characters to be accepted by the Keyboard.
[in]callBackFunction to be called when the text is completed -*Ok* is pressed-. If NULL no function is invoked.
Returns
The function returns a 0 or positive integer that references the NumPad screen, or a negative value if an error occurred.

◆ mrmKeyboardDelete()

void mrmKeyboardDelete ( void  )

This functions deletes the Keyboard from the system. A new one can then be created if desired.

◆ mrmKeyboardExists()

int mrmKeyboardExists ( void  )

Only one Keyboard can be present in the system. This function returns true if the Keyboard exists, false if not.

Returns
The function returns 1 if the Keyboard exists, 0 if not.

◆ mrmKeyboardMove()

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.

Parameters
[in]xCoordinate of the leftmost position.
[in]yCoordinate of the top position.

◆ mrmKeyboardSetColors()

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.

Parameters
[in]colKeyCharColor for the character keys.
[in]colKeyEspColor for the special keys.
[in]colAltOffColor for the alternate character set key when is not active.
[in]colAltOnColor for the alternate character set key when is active.
[in]colScrColor for the display screen.
[in]colKeyTxtColor for text on the keys.
[in]colScrTxtColor for text on the display.
[in]colDisTxtColor 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.

◆ mrmKeyboardGetText()

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.

Parameters
[out]resBuffer to read the characters. Has to hold at least the max. number of characters of the keyboard + 1 bytes.
[out]blockedPointer to an integer to retrieve the blocked flag. Ignored if NULL.

◆ mrmCPInit()

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.

Parameters
[in]bgColColor for the background of the Color Picker window. Use MWG_CPBCKCOL for the default color.
[in]txtColColor for the texts on the Color Picker. Use MWG_CPTXTCOL for the default color.
Returns
The function returns a 0 or positive integer that references the Color Picker screen, or a negative value if an error occurred.

◆ mrmCPDelete()

void mrmCPDelete ( void  )

This functions deletes the Color Picker from the system. A new one can then be created if desired.

◆ mrmCPExists()

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.

Returns
The function returns 1 if the Color Picker exists, 0 if not.

◆ mrmCPMove()

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.

Parameters
[in]xCoordinate of the leftmost position.
[in]yCoordinate of the top position.

◆ mrmCPSetSelection()

void mrmCPSetSelection ( int  crgb)

The color selected on the Color Picker is set to the RGB value given if the Color Picker exists.

Parameters
[in]crgbRGB value of the color.

◆ mrmCPRGB()

int mrmCPRGB ( void  )

Returns the RGB value selected on the Color Picker, or 0 if it does not exist.

Returns
The RGB coordinates of the color selected, or 0 if the Color Picker does not exist.

◆ mrmButtonInit()

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.

Parameters
[in]scrGraphic screen where the button is placed.
[in]widthWidth in pixels of the button.
[in]heightHeight in pixels of the button.
[in]callBackFunction to be called when the button is clicked. If NULL no function is invoked.
[in]labelText to appear centered on the button. It can be the empty string or NULL if no text is wanted.
[in]nColColor for the button when not pressed.
[in]pColColor for the button when pressed.
[in]dColColor for the button when disabled.
Returns
The function returns a 0 or positive integer that references the created button, or a negative value if an error occurred.

◆ mrmButtonDelete()

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.

Parameters
[in]idxButton reference number.
Returns
A negative value in case of error, positive otherwise.

◆ mrmButtonSetEnabled()

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.

Parameters
[in]idxButton reference number.
[in]enabled0 to disable the button, nonzero to enable.
Returns
A negative value in case of error, positive otherwise.

◆ mrmButtonSetPos()

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.

Parameters
[in]idxButton reference number.
[in]xHorizontal coordinate of the top left corner of the button.
[in]yVertical coordinate of the top left corner of the button.
Returns
A negative value in case of error, positive otherwise.

◆ mrmButtonSetSize()

int mrmButtonSetSize ( int  idx,
int  w,
int  h 
)

This function changes the height, the width of the button or both.

Parameters
[in]idxButton reference number.
[in]wNew width of the button. If 0 let it unchanged.
[in]hNew height of the button. If 0 let it unchanged.
Returns
A negative value in case of error, positive otherwise.

◆ mrmButtonSetColor()

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.

Parameters
[in]idxButton reference number.
[in]nColColor for the button when not pressed.
[in]pColColor for the button when pressed.
[in]dColColor for the button when disabled.
Returns
A negative value in case of error, positive otherwise.

◆ mrmButtonSetFont()

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.

Parameters
[in]idxButton reference number.
[in]szSize of the font.
[in]aRotation angle in degrees.
[in]fnPointer to a string containing the font name. If it is NULL the standard font is used.
[in]sStyle 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.
Returns
A negative value in case of error, positive otherwise.

◆ mrmButtonSetFontColor()

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.

Parameters
[in]idxButton reference number.
[in]nColColor for the button label when not pressed.
[in]pColColor for the button label when pressed.
[in]dColColor for the button label when disabled.
Returns
A negative value in case of error, positive otherwise.

◆ mrmButtonSetLabel()

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.

Parameters
[in]idxButton reference number.
[in]labelText to appear centered on the button. It can be the empty string or NULL if no text is wanted.
Returns
A negative value in case of error, positive otherwise.

◆ mrmButtonSetCounter()

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.

Parameters
[in]idxButton reference number.
[in]valNew value for the counter.
Returns
The old value of the counter or MGS_ERRRESNOEXIST in case the button does not exist.

◆ mrmButtonGetCounter()

int mrmButtonGetCounter ( int  idx)

Each button holds an internal counter that is increased with each click. This function returns the value of this counter.

Parameters
[in]idxButton reference number.
Returns
The value of the counter or MGS_ERRRESNOEXIST in case the button does not exist.

◆ mrmTextBoxInit()

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.

Parameters
[in]scrGraphic screen where the textBox is placed.
[in]widthWidth in pixels of the textBox.
[in]heightHeight in pixels of the textBox.
[in]nCharMax length of the string to be read by the textBox.
[in]kbTypeKeyboard used to enter the text. It can be MWG_KBALPHA for an alphanumeric keyboard or MWG_KBNUMERIC for a Numpad.
[in]callBackFunction to be called when the text is completed. If NULL no function is invoked.
[in]colColor for the textBox.
[in]dColColor for the textBox when disabled.
Returns
The function returns a 0 or positive integer that references the created textBox, or a negative value if an error occurred.

◆ mrmTextBoxDelete()

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.

Parameters
[in]idxTextBox reference number.
Returns
A negative value in case of error, positive otherwise.

◆ mrmTextBoxSetEnabled()

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.

Parameters
[in]idxTextBox reference number.
[in]enabled0 to disable the textBox, nonzero to enable.
Returns
A negative value in case of error, positive otherwise.

◆ mrmTextBoxSetPos()

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.

Parameters
[in]idxTextBox reference number.
[in]xHorizontal coordinate of the top left corner of the textBox.
[in]yVertical coordinate of the top left corner of the textBox.
Returns
A negative value in case of error, positive otherwise.

◆ mrmTextBoxSetSize()

int mrmTextBoxSetSize ( int  idx,
int  w,
int  h 
)

This function changes the height, the width of the button or both.

Parameters
[in]idxTextBox reference number.
[in]wNew width of the textbox. If 0 let it unchanged.
[in]hNew height of the textbox. If 0 let it unchanged.
Returns
A negative value in case of error, positive otherwise.

◆ mrmTextBoxSetColor()

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.

Parameters
[in]idxTextBox reference number.
[in]colColor for the textBox.
[in]dColColor for the textBox when disabled.
Returns
A negative value in case of error, positive otherwise.

◆ mrmTextBoxSetFont()

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.

Parameters
[in]idxTextBox reference number.
[in]szSize of the font.
[in]aRotation angle in degrees.
[in]fnPointer to a string containing the font name. If it is NULL the standard font is used.
[in]sStyle 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.
Returns
A negative value in case of error, positive otherwise.

◆ mrmTextBoxSetFontColor()

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.

Parameters
[in]idxTextBox reference number.
[in]nColColor for the textBox contents.
[in]dColColor for the textBox contents when disabled.
Returns
A negative value in case of error, positive otherwise.

◆ mrmTextBoxSetText()

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.

Parameters
[in]idxTextBox reference number.
[in]textText to be copied to the contents of the textBox.
Returns
A negative value in case of error, positive otherwise.

◆ mrmTextBoxGetText()

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.

Parameters
[in]idxTextBox reference number.
[out]stringString to receie the contents. It must have the required space.
Returns
The old value of the counter or MGS_ERRRESNOEXIST in case the button does not exist.

◆ mrmSliderInit()

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.

Parameters
[in]scrGraphic screen where the slider is placed.
[in]orientationCan be MWG_SLHORIZONTAL for an horizontal slider or MWG_SLVERTICAL for a vertical one.
[in]widthWidth in pixels of the slider.
[in]lengthLength in pixels of the slider.
[in]minValue for the left or top edge of the slider.
[in]maxValue for the right or bottom edge of the slider.
[in]colColor for the slider.
[in]cColColor for the cursor body.
[in]cBcolColor for the cursor lines.
[in]dColColor for the slider when disabled. Cursor lines and body colors are permuted in this case.
Returns
The function returns a 0 or positive integer that references the created slider, or a negative value if an error occurred.

◆ mrmSliderDelete()

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.

Parameters
[in]idxSlider reference number.
Returns
A negative value in case of error, positive otherwise.

◆ mrmSliderSetEnabled()

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.

Parameters
[in]idxSlider reference number.
[in]enabled0 to disable the button, nonzero to enable.
Returns
A negative value in case of error, positive otherwise.

◆ mrmSliderSetPos()

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.

Parameters
[in]idxSlider reference number.
[in]xHorizontal coordinate of the top left corner of the slider.
[in]yVertical coordinate of the top left corner of the slider.
Returns
A negative value in case of error, positive otherwise.

◆ mrmSliderSetColor()

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.

Parameters
[in]idxSlider reference number.
[in]colColor for the slider.
[in]cColColor for the cursor body.
[in]cBcolColor for the cursor lines.
[in]dColColor for the slider when disabled. Cursor lines and body colors are permuted in this case.
Returns
A negative value in case of error, positive otherwise.

◆ mrmSliderSetVal()

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.

Parameters
[in]idxSlider reference number.
[in]valNew value for the slider. It is ignored if the calculated cursor position does not fit inside the slider.
Returns
The old value of the slider or MGS_ERRRESNOEXIST in case the button does not exist.

◆ mrmSliderGetVal()

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.

Parameters
[in]idxSlider reference number.
Returns
The value held by the slider or MGS_ERRRESNOEXIST in case the button does not exist.

◆ mrmSelectionInit()

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.

Parameters
[in]scrGraphic screen where the selection is placed.
[in]widthWidth in pixels of a rectangle to arrange the selection list.
[in]heightHeight in pixels of a rectangle to arrange the selection list.
[in]nSelNumber of selections.
[in]textList of texts to be displayed for each option.
[in]colsNumber 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]modeSpecifies 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.
Returns
The function returns a 0 or positive integer that references the created selection, or a negative value if an error occurred.

◆ mrmSelectionDelete()

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.

Parameters
[in]idxSelection reference number.
Returns
A negative value in case of error, positive otherwise.

◆ mrmSelectionSetEnabled()

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.

Parameters
[in]idxSelection reference number.
[in]enabled0 to disable the button, nonzero to enable.
Returns
A negative value in case of error, positive otherwise.

◆ mrmSelectionSetPos()

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.

Parameters
[in]idxSelection reference number.
[in]xHorizontal coordinate of the top left corner of the selection.
[in]yVertical coordinate of the top left corner of the Selection.
Returns
A negative value in case of error, positive otherwise.

◆ mrmSelectionSetOptionsPos()

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.

Parameters
[in]idxSelection reference number.
[in]pointsVector of x, y coordinates for each selection option.
Returns
A negative value in case of error, positive otherwise.

◆ mrmSelectionSetColor()

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.

Parameters
[in]idxSelection reference number.
[in]nColColor for the selection figure.
[in]bColColor for the selection figure border.
[in]fColColor for the selection figure fill when selected.
[in]dColColor for the selection figure when disabled.
Returns
A negative value in case of error, positive otherwise.

◆ mrmSelectionSetFont()

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.

Parameters
[in]idxSelection reference number.
[in]szSize of the font.
[in]aRotation angle in degrees.
[in]fnPointer to a string containing the font name. If it is NULL the standard font is used.
[in]sStyle 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.
Returns
A negative value in case of error, positive otherwise.

◆ mrmSelectionSetFontColor()

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.

Parameters
[in]idxSelection reference number.
[in]nColColor for the text when not selected.
[in]sColColor for the text when selected.
[in]dColColor for the text when not selected and the selection is disabled.
[in]dsColColor for the text when selected and the selection is disabled.
Returns
A negative value in case of error, positive otherwise.

◆ mrmSelectionSetVal()

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.

Parameters
[in]idxSelection reference number.
[in]valNew value for the selection.
Returns
The old value of the selection or MGS_ERRRESNOEXIST in case the selection does not exist.

◆ mrmSelectionGetVal()

int mrmSelectionGetVal ( int  idx)

Each selection holds a value that represents the selected options. This function gets this value.

Parameters
[in]idxSelection reference number.
Returns
The value of the selection or MGS_ERRRESNOEXIST in case the selection does not exist.

◆ mrmListInit()

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.

Parameters
[in]scrGraphic screen where the List is placed.
[in]widthWidth in pixels of the List on screen.
[in]heightHeight in pixels of the List.
[in]wwidthWidth in pixels of the window to display the List, not considering borders.
[in]modeIt can be MWG_LIORDERED to keep the items alphabetically ordered or MWG_LINONE otherwise.
[in]textsNULL terminated array of pointers to the initial texts of the list.
[in]callBackFunction to be called when the user opens or selects an element of the list. If NULL no function is invoked.
[in]itemsNumber of elements to be displayed on the pop up window.
[in]titleCaption for the pop up window.
Returns
The function returns a 0 or positive integer that references the created List, or a negative value if an error occurred.

◆ mrmListDelete()

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.

Parameters
[in]idxList reference number.
Returns
A negative value in case of error, positive otherwise.

◆ mrmListSetEnabled()

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.

Parameters
[in]idxList reference number.
[in]enabled0 to disable the list, nonzero to enable.
Returns
A negative value in case of error, positive otherwise.

◆ mrmListSetPos()

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.

Parameters
[in]idxList reference number.
[in]xHorizontal coordinate of the top left corner of the list.
[in]yVertical coordinate of the top left corner of the list.
Returns
A negative value in case of error, positive otherwise.

◆ mrmListSetSize()

int mrmListSetSize ( int  idx,
int  w,
int  h,
int  ww 
)

This function changes the height, the width of the button or both.

Parameters
[in]idxList reference number.
[in]wNew width of the list. If 0 let it unchanged.
[in]hNew height of the list. If 0 let it unchanged.
[in]wwNew width of the list window. If 0 let it unchanged.
Returns
A negative value in case of error, positive otherwise.

◆ mrmListSetColor()

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.

Parameters
[in]idxList reference number.
[in]colColor for the list.
[in]dColColor for the list when disabled.
[in]sColColor for the selected item background on the list window.
[in]wColColor for the background of the list window.
[in]wW1ColMain color for the widgets of the list window.
[in]wW2ColSecondary color for the widgets of the list window.
Returns
A negative value in case of error, positive otherwise.

◆ mrmListSetFont()

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.

Parameters
[in]idxList reference number.
[in]szSize of the font.
[in]aRotation angle in degrees.
[in]fnPointer to a string containing the font name. If it is NULL the standard font is used.
[in]sStyle 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.
Returns
A negative value in case of error, positive otherwise.

◆ mrmListSetFontColor()

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.

Parameters
[in]idxList reference number.
[in]nColColor for the list text.
[in]dColColor for the list text when disabled.
[in]tsColColor for the selected item text on the list window.
Returns
A negative value in case of error, positive otherwise.

◆ mrmListAddItems()

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

Parameters
[in]idxList reference number.
[in]itemsNULL terminated list of strings.
Returns
A negative value in case of error or the number of items added.

◆ mrmListInsertItem()

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

Parameters
[in]idxList reference number.
[in]posPosition of the item, starting at 0.
[in]itemText to be added.
Returns
A negative value in case of error, positive otherwise.

◆ mrmListDelItem()

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.

Parameters
[in]idxList reference number.
[in]posPosition of the item, starting at 0.
Returns
A negative value in case of error, positive otherwise.

◆ mrmListSetSelected()

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.

Parameters
[in]idxList reference number.
[in]selIndex of the new selected item.
Returns
The index of the previously selected item or MGS_ERRRESNOEXIST in case the list does not exist.

◆ mrmListGetSelected()

int mrmListGetSelected ( int  idx)

This function reads the index of the item currenlty selected on the list.

Parameters
[in]idxList reference number.
Returns
The index of the selected item or MGS_ERRRESNOEXIST in case the list does not exist.

◆ mrmListItemAtIndex()

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.

Parameters
[in]idxList reference number.
[in]posIndex of the item whose text is to be read.
[out]stringString to receive the contents. It must have the required space.
Returns
A positive value in case of success or a negative one in case of error.