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

ColorPicker for the MrMWidgets. More...

Functions

Color Picker management functions

These functions create and handle the Color Picker.

int mrmCPInit (int bgCol, int txtCol)
 Creates the Color Picker with the given colors. More...
 
void mrmCPDelete ()
 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 ()
 Gets the color selected on the Color Picker. More...
 

Detailed Description

Author
Germán Fabregat
Date
October 2017

Function Documentation

◆ 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.
Examples:
colorSelect.c.

◆ 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.
Examples:
colorSelect.c.

◆ 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.
Examples:
colorSelect.c.