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