mGUtils API Reference  v1.2.0
A component of MiniGUI providing users with a number of common dialog templates
Data Structures | Macros | Typedefs | Functions
Interfaces of mGUtils library (libmgutils)

Data Structures

struct  _NEWFILEDLGDATA
 
struct  _COLORDATA
 

Macros

#define FILE_ERROR_OK   0
 Open file success. More...
 
#define FILE_ERROR_PARAMERR   -1
 Wrong parameters. More...
 
#define MAX_FILTER_LEN   255
 The maximum length of filter string. More...
 
#define MY_NAMEMAX   127
 The maximum length of name. More...
 
#define MY_PATHMAX   255
 The maximum length of path. More...
 

Typedefs

typedef struct _NEWFILEDLGDATA NEWFILEDLGDATA
 
typedef NEWFILEDLGDATAPNEWFILEDLGDATA
 
typedef struct _COLORDATA COLORDATA
 

Functions

MGUTILS_EXPORT BOOL ShowCommonDialog (PDLGTEMPLATE dlg_template, HWND hwnd, WNDPROC proc, void *private_data)
 
MGUTILS_EXPORT BOOL FileOpenSaveDialog (PDLGTEMPLATE dlg_template, HWND hwnd, WNDPROC proc, PFILEDLGDATA pfdd)
 
MGUTILS_EXPORT LRESULT DefFileDialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
MGUTILS_EXPORT int ShowOpenDialog (HWND hWnd, int lx, int ty, int w, int h, PNEWFILEDLGDATA pnfdd)
 Creates an Open File Dialog Box. More...
 
void RGB2HSV (Uint8 r, Uint8 g, Uint8 b, Uint16 *hout, Uint8 *sout, Uint8 *vout)
 Converts r/g/b values of a color in RGB color space to h/s/v of the color in HSV color space. More...
 
void HSV2RGB (Uint16 hin, Uint8 sin, Uint8 vin, Uint8 *rout, Uint8 *gout, Uint8 *bout)
 Converts h/s/v values of a color to r/g/b values of the color. More...
 
void YUV2RGB (int y, int u, int v, Uint8 *r, Uint8 *g, Uint8 *b)
 Converts y/u/v values of a color in YUV color space to to r/g/b values of the color in RGB color space. More...
 
MG_EXPORT void RGB2YUV (Uint8 r, Uint8 g, Uint8 b, int *y, int *u, int *v)
 Converts r/g/b values of a color in RGB color space to y/u/v values of the color in YUV color space. More...
 
MGUTILS_EXPORT BOOL ColorSelectDialog (PDLGTEMPLATE dlg_template, HWND hwnd, WNDPROC proc, PCOLORDLGDATA pcdd)
 
MGUTILS_EXPORT LRESULT DefColorDialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
MGUTILS_EXPORT int ColorSelDialog (HWND hWnd, int x, int y, int w, int h, PCOLORDATA pClrData)
 Creates a Color Selection Dialog Box. More...
 
MGUTILS_EXPORT BOOL FontSelectDialog (PDLGTEMPLATE dlg_template, HWND hwnd, WNDPROC proc, PFONTDLGDATA pfsd)
 
MGUTILS_EXPORT LRESULT DefFontDialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
MGUTILS_EXPORT BOOL InfoShowDialog (PDLGTEMPLATE dlg_template, HWND hwnd, WNDPROC proc, PINFODLGDATA pidd)
 
MGUTILS_EXPORT LRESULT DefInfoDialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 

Detailed Description

mGUtils provides a dialog in a main window of MiniGUI.

Macro Definition Documentation

#define FILE_ERROR_OK   0

Open file success.

Definition at line 563 of file mgutils.h.

#define FILE_ERROR_PARAMERR   -1

Wrong parameters.

Path doesn't exist.

#define MAX_FILTER_LEN   255

The maximum length of filter string.

Definition at line 581 of file mgutils.h.

#define MY_NAMEMAX   127

The maximum length of name.

Definition at line 587 of file mgutils.h.

#define MY_PATHMAX   255

The maximum length of path.

Definition at line 593 of file mgutils.h.

Typedef Documentation

typedef struct _COLORDATA COLORDATA

The color data structure used by ColorSelDialog.

See also
ColorSelDialog.

The file dialog box structure used by ShowOpenDialog.

See also
ShowOpenDialog.

Data type of pointer to a NEWFILEDLGDATA

Definition at line 686 of file mgutils.h.

Function Documentation

int ColorSelDialog ( HWND  hWnd,
int  x,
int  y,
int  w,
int  h,
PCOLORDATA  pClrData 
)

Creates a Color Selection Dialog Box.

This function creates a Color Selection Dialog Box, and returns the values of the color selected by the user.

Parameters
hWndThe hosting main window.
xx,y,w,h: The default position and size of the dialog box.
yx,y,w,h: The default position and size of the dialog box.
wx,y,w,h: The default position and size of the dialog box.
hx,y,w,h: The default position and size of the dialog box.
pClrDataThe pointer to the COLORDATA structure.
Return values
IDOKThe user choosed a color and OK button clicked.
IDCANCELThe user clicked the Cancel button.
See also
COLORDATA, ColorSelDialog
int ColorSelectDialog ( PDLGTEMPLATE  dlg_template,
HWND  hwnd,
WNDPROC  proc,
PCOLORDLGDATA  pcdd 
)

\ brief Creates a modal Color Selection Dialog Box.

This function creates an Color Selection Dialog Box, and returns the values of the color selected by the user.

Parameters
dlg_templateThe pointer to a DLGTEMPLATE structure.
hwndThe handle to the hosting main window.
procThe window procedure of the color selection dialog box.
pcddThe pointer to the COLORDLGDATA structure.
Returns
If the user clicks OK or CLOSE button of the dialog box, the return value is TRUE, otherwise return FALSE.
MGUTILS_EXPORT LRESULT DefColorDialogProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

The default Color Selection Dialog callback procedure.

MGUTILS_EXPORT LRESULT DefFileDialogProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

The default File Open/Save Dialog callback procedure.

MGUTILS_EXPORT LRESULT DefFontDialogProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

The default Font Selection Dialog callback procedure.

MGUTILS_EXPORT LRESULT DefInfoDialogProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

The default Information Dialog callback procedure.

int FileOpenSaveDialog ( PDLGTEMPLATE  dlg_template,
HWND  hwnd,
WNDPROC  proc,
PFILEDLGDATA  pfdd 
)

\ brief Creates a modal Open/Save File Dialog Box.

This function creates an Open/Save File Dialog Box, and returns the full path name of the file selected by user.

Parameters
dlg_templateThe pointer to a DLGTEMPLATE structure.
hwndThe handle to the hosting main window.
procThe window procedure of the common dialog box.
pfddThe pointer to the FILEDLGDATA structure.
Returns
If the user clicks OK or CLOSE button of the dialog box, the return value is TRUE, otherwise return FALSE.
int FontSelectDialog ( PDLGTEMPLATE  dlg_template,
HWND  hwnd,
WNDPROC  proc,
PFONTDLGDATA  pfsd 
)

\ brief Creates a modal Font Selection Dialog Box.

This function creates an Font Selection Dialog Box, and returns the pointer to the logical font selected by user.

Parameters
dlg_templateThe pointer to a DLGTEMPLATE structure.
hwndThe handle to the hosting main window.
procThe window procedure of the font selection dialog box.
pfsdThe pointer to the FONTDLGDATA structure.
Returns
If the user clicks OK or CLOSE button of the dialog box, the return value is TRUE, otherwise return FALSE.
void HSV2RGB ( Uint16  hin,
Uint8  sin,
Uint8  vin,
Uint8 *  rout,
Uint8 *  gout,
Uint8 *  bout 
)

Converts h/s/v values of a color to r/g/b values of the color.

This function converts h/s/v values of a color in HSV color space to r/g/b values of the color in RGB space.

Parameters
hinThe h value of the HSV color space to be converted, the range is between 0 to 359.
sinThe s value of the HSV color space to be converted, the range is between 0 to 255.
vinThe v value of the HSV color space to be converted, the range is between 0 to 255.
routThe pointer to Uint8, returns the red value of the RGB color space.
goutThe pointer to Uint8, returns the green value of the RGB color space.
boutThe pointer to Uint8, returns the bout value of the RGB color space.
See also
RGB2HSV, YUV2RGB, RGB2YUV
int InfoShowDialog ( PDLGTEMPLATE  dlg_template,
HWND  hwnd,
WNDPROC  proc,
PINFODLGDATA  pidd 
)

\ brief Creates a modal Information Dialog Box.

This function creates a Information Dialog Box.

Parameters
dlg_templateThe pointer to a DLGTEMPLATE structure.
hwndThe handle to the hosting main window.
procThe window procedure of the information dialog box.
piddThe pointer to the INFODLGDATA structure.
Returns
If the user clicks OK or CLOSE button of the dialog box, the return value is TRUE, otherwise return FALSE.
void RGB2HSV ( Uint8  r,
Uint8  g,
Uint8  b,
Uint16 *  hout,
Uint8 *  sout,
Uint8 *  vout 
)

Converts r/g/b values of a color in RGB color space to h/s/v of the color in HSV color space.

This function converts r/g/b values of a color in RGB color space to h/s/v values of the color in HSV color space.

Parameters
rThe red value of the color in RGB space to be converted.
gThe green value of the color in RGB space to be converted.
bThe blue value of the color in RGB space to be converted.
houtThe pointer to Uint16, returns the h value of the color in HSV color space.
soutThe pointer to Uint8, returns the s value of the color in HSV color space returned.
voutThe pointer to Uint8, returns the v value of the color in HSV color space returned.
See also
HSV2RGB, YUV2RGB, RGB2YUV
void RGB2YUV ( Uint8  r,
Uint8  g,
Uint8  b,
int *  y,
int *  u,
int *  v 
)

Converts r/g/b values of a color in RGB color space to y/u/v values of the color in YUV color space.

The function converts r/g/b values of a color in RGB color space to y/u/v values of the color in YUV color space.

Parameters
rThe red value of the RGB color space to be converted.
gThe green value of the RGB color space to be converted.
bThe blue value of the RGB color space to be converted.
yThe pointer to int, returns the y value of the YUV color space.
uThe pointer to int, returns the u value of the YUV color space.
vThe pointer to int, returns the v value of the YUV color space.
See also
RGB2HSV, HSV2RGB, YUV2RGB
int ShowCommonDialog ( PDLGTEMPLATE  dlg_template,
HWND  hwnd,
WNDPROC  proc,
void *  private_data 
)

\ brief Creates a modal common dialog box from a dialog box template in memory and other information.

This function can be used for file choosing dialog, color selecting dialog, font selecting dialog, and information dialog.

Parameters
dlg_templateThe pointer to a DLGTEMPLATE structure.
hwndThe handle to the hosting main window.
procThe window procedure of the common dialog box.
private_dataThe parameter will be passed to the window procedure.
Returns
If the user clicks OK or CLOSE button of the dialog box, the return value is TRUE, otherwise return FALSE.
int ShowOpenDialog ( HWND  hWnd,
int  lx,
int  ty,
int  w,
int  h,
PNEWFILEDLGDATA  pnfdd 
)

Creates an Open File Dialog Box.

This function creates an Open File Dialog Box, and returns the full path name of the file selected by user.

Parameters
hWndThe hosting main window.
lxlx,ty,w,h: The default position and size of the dialog box.
tylx,ty,w,h: The default position and size of the dialog box.
wlx,ty,w,h: The default position and size of the dialog box.
hlx,ty,w,h: The default position and size of the dialog box.
pnfddThe pointer to the NEWFILEDLGDATA structure.
Return values
IDOKThe user choosed a file and OK button clicked.
IDCANCLECANCEL button clicked.
Attention
pnfdd->filename is an input & output parameter, you can set your default filename by it. So before use this function, you must init pnfdd->filename.
See also
NEWFILEDLGDATA, ShowOpenDialog
void YUV2RGB ( int  y,
int  u,
int  v,
Uint8 *  r,
Uint8 *  g,
Uint8 *  b 
)

Converts y/u/v values of a color in YUV color space to to r/g/b values of the color in RGB color space.

This function converts y/u/v values of YUV color space to r/g/b values of RGB color space.

Parameters
yThe y value of the YUV color space to be converted.
uThe u value of the YUV color space to be converted.
vThe v value of the YUV color space to be converted.
rThe pointer to Uint8, returns the red value of the RGB color space.
gThe pointer to Uint8, returns the green value of the RGB color space.
bThe pointer to Uint8, returns the bout value of the RGB color space.
See also
RGB2HSV, HSV2RGB, RGB2YUV