![]() |
mgsLib
1.3
Mermaja's Graphic Screen. A simple C library to build Windows graphic applications from console programs.
|
Selection lists for the MrMWidgets. More...
Functions | |
Selection lists management functions | |
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 nCol, int bCol, int fCol, 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 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. |