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