MiniGUI API Reference (MiniGUI-Threads)  v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Data Structures | Macros | Typedefs | Functions
Look and Feel Renderer management functions

Data Structures

struct  _WINDOW_ELEMENT_ATTR
 
struct  _LFSCROLLBARINFO
 
struct  _SCROLLBARDATA
 
struct  _LFRDR_WINSTYLEINFO
 
struct  _LFRDR_TRACKBARINFO
 
struct  _WINDOW_ELEMENT_RENDERER
 
struct  _WINDOWINFO
 

Macros

#define WE_FONTS_NUMBER   4
 The number of window element font attributes. More...
 
#define WE_METRICS_NUMBER   6
 The number of window element metric attributes. More...
 
#define WE_COLORS_NUMBER   14
 The number of window element color attributes. More...
 
#define WE_ATTR_TYPE_RDR   0x5000
 The specific type for LF renderer. More...
 
#define SBS_DISABLED_LTUP   0x0100
 
#define SBS_DISABLED_BTDN   0x0200
 
#define SBS_HILITE_LTUP   0x0400
 
#define SBS_HILITE_BTDN   0x0800
 
#define SBS_HILITE_THUMB   0x0010
 
#define SBS_PRESSED_LTUP   0x0020
 
#define SBS_PRESSED_BTDN   0x0040
 
#define SBS_PRESSED_THUMB   0x0080
 
#define LEN_RENDERER_NAME   15
 The maximum length of a renderer name. More...
 

Typedefs

typedef LRESULT(* WNDPROC) (HWND, UINT, WPARAM, LPARAM)
 Type of the window callback procedure. More...
 
typedef void(* NOTIFPROC) (HWND hwnd, LINT id, int nc, DWORD add_data)
 Type of the notification callback procedure. More...
 
typedef struct _WINDOW_ELEMENT_ATTR WINDOW_ELEMENT_ATTR
 
typedef struct _LFSCROLLBARINFO LFSCROLLBARINFO
 
typedef struct _SCROLLBARDATA SCROLLBARDATA
 
typedef struct _LFRDR_WINSTYLEINFO LFRDR_WINSTYLEINFO
 
typedef struct _LFRDR_TRACKBARINFO LFRDR_TRACKBARINFO
 
typedef struct _WINDOW_ELEMENT_RENDERER WINDOW_ELEMENT_RENDERER
 
typedef struct _WINDOWINFO WINDOWINFO
 

Functions

static const WINDOWINFO *GUIAPI GetWindowInfo (HWND hWnd)
 Get the handle of window information. More...
 
MG_EXPORT BOOL GUIAPI InitWindowElementAttrs (PWERENDERER rdr)
 
MG_EXPORT DWORD GUIAPI GetWindowElementAttr (HWND hwnd, int we_attr_id)
 Get a window element data. More...
 
MG_EXPORT DWORD GUIAPI SetWindowElementAttr (HWND hwnd, int we_attr_id, DWORD we_attr)
 Set a new window element data specified by we_attr_id. More...
 
MG_EXPORT gal_pixel GUIAPI GetWindowElementPixelEx (HWND hwnd, HDC hdc, int we_attr_id)
 Get the pixel value of a window element. More...
 
MG_EXPORT WINDOW_ELEMENT_RENDERER *GUIAPI GetWindowRendererFromName (const char *name)
 Get window renderer from name. More...
 
MG_EXPORT BOOL GUIAPI AddWindowElementRenderer (const char *name, const WINDOW_ELEMENT_RENDERER *we_rdr)
 Add a window element renderer to the system. More...
 
MG_EXPORT BOOL GUIAPI RemoveWindowElementRenderer (const char *name)
 Remove a window renderer from MiniGUI. More...
 
MG_EXPORT WINDOW_ELEMENT_RENDERER *GUIAPI GetDefaultWindowElementRenderer (void)
 Get the default window renderer. More...
 
const MG_EXPORT char *GUIAPI SetDefaultWindowElementRenderer (const char *name)
 Set a window element renderer as the default system renderer. More...
 
MG_EXPORT BOOL GUIAPI SetWindowElementRenderer (HWND hWnd, const char *werdr_name, const WINDOW_ELEMENT_ATTR *we_attrs)
 Set a window element renderer and window element attributes for window specified by hwnd. More...
 
MG_EXPORT BOOL InitRendererSystemIcon (const char *rdr_name, HICON *small_icon, HICON *large_icon)
 Initialize large and small system icons in the specified renderer rdr_name. More...
 
MG_EXPORT void TermRendererSystemIcon (HICON *small_icon, HICON *large_icon)
 Release large and small system icon resources. More...
 

Detailed Description

Macro Definition Documentation

◆ LEN_RENDERER_NAME

#define LEN_RENDERER_NAME   15

The maximum length of a renderer name.

Definition at line 5165 of file window.h.

◆ SBS_DISABLED_BTDN

#define SBS_DISABLED_BTDN   0x0200

right or bottom arrow is in disabled state

Definition at line 5090 of file window.h.

◆ SBS_DISABLED_LTUP

#define SBS_DISABLED_LTUP   0x0100

left or up arrow is in disabled state

Definition at line 5087 of file window.h.

◆ SBS_HILITE_BTDN

#define SBS_HILITE_BTDN   0x0800

right or bottom arrow is in hilited state

Definition at line 5096 of file window.h.

◆ SBS_HILITE_LTUP

#define SBS_HILITE_LTUP   0x0400

left or up arrow is in hilited state

Definition at line 5093 of file window.h.

◆ SBS_HILITE_THUMB

#define SBS_HILITE_THUMB   0x0010

thumb is in hilite state as cursor is in the area of thumb

Definition at line 5099 of file window.h.

◆ SBS_PRESSED_BTDN

#define SBS_PRESSED_BTDN   0x0040

right or bottom arrow is in pressed state

Definition at line 5105 of file window.h.

◆ SBS_PRESSED_LTUP

#define SBS_PRESSED_LTUP   0x0020

left or up arrow is in pressed state

Definition at line 5102 of file window.h.

◆ SBS_PRESSED_THUMB

#define SBS_PRESSED_THUMB   0x0080

thumb is in pressed state as left button presses it

Definition at line 5108 of file window.h.

◆ WE_ATTR_TYPE_RDR

#define WE_ATTR_TYPE_RDR   0x5000

The specific type for LF renderer.

Definition at line 4939 of file window.h.

◆ WE_COLORS_NUMBER

#define WE_COLORS_NUMBER   14

The number of window element color attributes.

Definition at line 4818 of file window.h.

◆ WE_FONTS_NUMBER

#define WE_FONTS_NUMBER   4

The number of window element font attributes.

Definition at line 4806 of file window.h.

◆ WE_METRICS_NUMBER

#define WE_METRICS_NUMBER   6

The number of window element metric attributes.

Definition at line 4812 of file window.h.

Typedef Documentation

◆ LFRDR_TRACKBARINFO

The scrollbar information structure. Used by draw_scrollbar and get_scrollbar_rect renderer function.

◆ LFRDR_WINSTYLEINFO

The window style information structure. Used by calc_we_metrics renderer function.

◆ LFSCROLLBARINFO

The scrollbar information structure in look and feel.

◆ NOTIFPROC

typedef void(* NOTIFPROC)(HWND hwnd, LINT id, int nc, DWORD add_data)

Type of the notification callback procedure.

This is the function type of notification callback procedure. If you set the notification callback procedure for a window. When MiniGUI got a notification message, MiniGUI will call this callback procedure in the context of the target window thread.

If you have not set the notification callback procedure of the target window, MiniGUI will send a MSG_COMMAND message to the window procedure.

Since 5.0.0, you can also set the notification callback procedure for a main window or a virtual window. You can call NotifyWindow function to send a notify message to the traget window.

Note
The type of id changed from int to LINT since v3.2.
See also
SetNotificationCallback, NotifyWindow, NotifyParentEx

Definition at line 5014 of file window.h.

◆ SCROLLBARDATA

typedef struct _SCROLLBARDATA SCROLLBARDATA

The scrollbar data construction for scrollbar control.

◆ WINDOW_ELEMENT_ATTR

The window element attributes structure.

◆ WINDOW_ELEMENT_RENDERER

The window element renderer structure.

◆ WINDOWINFO

typedef struct _WINDOWINFO WINDOWINFO

The window information structure.

Note
The layout of this structure changed since 5.0.0 to support virtual window.

◆ WNDPROC

typedef LRESULT(* WNDPROC)(HWND, int, WPARAM, LPARAM)

Type of the window callback procedure.

Definition at line 4992 of file window.h.

Function Documentation

◆ AddWindowElementRenderer()

BOOL GUIAPI AddWindowElementRenderer ( const char *  name,
const WINDOW_ELEMENT_RENDERER we_rdr 
)

Add a window element renderer to the system.

This function adds a new window renderer to MiniGUI system.

Parameters
nameThe renderer name.
we_rdrThe pointer to a new renderer.
Returns
TRUE for success, FALSE for failure.

◆ GetDefaultWindowElementRenderer()

WINDOW_ELEMENT_RENDERER *GUIAPI GetDefaultWindowElementRenderer ( void  )

Get the default window renderer.

This function gets the default window renderer in MiniGUI.

Returns
the pointer to the default renderer.
Note
The prototype had changed since MiniGUI v3.2; the old one returns a const value.

◆ GetWindowElementAttr()

DWORD GUIAPI GetWindowElementAttr ( HWND  hwnd,
int  we_attr_id 
)

Get a window element data.

This function gets a window element data which is identified by we_attr_id.

Parameters
hwndThe handle to the window.
we_attr_idThe window element id number, can be one of the following values:
  • WE_FONT_CAPTION
    The caption font.
  • WE_FONT_MENU
    The menu font. Used by menu and listbox.
  • WE_FONT_MESSAGEBOX
    The messagebox font. Resevered.
  • WE_FONT_TOOLTIP
    The tooltip font. Used by tooltip window.
  • WE_METRICS_CAPTION
    The caption size.
  • WE_METRICS_CAPTION_BUTTON
    The caption button size.
  • WE_METRICS_MENU
    The menu size.
  • WE_METRICS_WND_BORDER
    The border size.
  • WE_METRICS_SCROLLBAR
    The scrollbar size.
  • WE_FGC_ACTIVE_CAPTION
    The active caption foreground color.
  • WE_BGCA_ACTIVE_CAPTION
    The active caption background color A.
  • WE_BGCB_ACTIVE_CAPTION
    The active caption background color B.
  • WE_FGC_MENU
    The menu foreground color.
  • WE_BGC_MENU
    The menu background color.
  • WE_FGC_MESSAGEBOX
    The messagebox foreground color. Reserved.
  • WE_FGC_TOOLTIP
    The tooltip foreground color. Only used by tooltip window.
  • WE_BGC_TOOLTIP
    The tooltip background color. Only used by tooltip window.
  • WE_FGC_ACTIVE_WND_BORDER
    The active border foreground color.
  • WE_FGC_INACTIVE_WND_BORDER
    The inactive border foreground color.
  • WE_FGC_INACTIVE_CAPTION
    The inactive caption foreground color.
  • WE_BGCA_INACTIVE_CAPTION
    The inactive caption background color A.
  • WE_BGCB_INACTIVE_CAPTION
    The inactive caption background color B.
  • WE_FGC_WINDOW
    The window foreground color. Used by window and control.
  • WE_BGC_WINDOW
    The window background color. Used by window and control.
  • WE_FGC_THREED_BODY
    The 3dbox foreground color. Mainly used by drawing 3dbox object, such as dialog and button, etc.
  • WE_MAINC_THREED_BODY
    The 3dbox background color. Mainly used by drawing menubar, dialog, header and button, etc.
  • WE_FGC_SELECTED_ITEM
    The selected item foreground color. Used by menu and control.
  • WE_BGC_SELECTED_ITEM
    The selected item background color. Used by menu and control.
  • WE_BGC_SELECTED_LOSTFOCUS
    The lostfocus selected item background color. Only Used by mledit.
  • WE_FGC_DISABLED_ITEM
    The disabled item foreground color. Used by menu and control.
  • WE_BGC_DISABLED_ITEM
    The disabled item background color. Used by menu and control.
  • WE_FGC_HIGHLIGHT_ITEM
    The highlight item foreground color. Used by menu and control.
  • WE_BGC_HIGHLIGHT_ITEM
    The highlight item background color. Used by menu and control.
  • WE_FGC_SIGNIFICANT_ITEM
    The significant item foreground color. Used by listbox.
  • WE_BGC_SIGNIFICANT_ITEM
    The significant item background color. Used by listbox.
  • WE_BGC_DESKTOP
    The desktop background color. Only used by desktop.
Returns
If succeed, return the window element data; otherwise return -1.
See also
SetWindowElementAttr

◆ GetWindowElementPixelEx()

gal_pixel GUIAPI GetWindowElementPixelEx ( HWND  hwnd,
HDC  hdc,
int  we_attr_id 
)

Get the pixel value of a window element.

This function gets the pixel value of a window element which is identified by we_attr_id and hdc.

Parameters
hwndThe handle to the window.
hdcThe device context. If -1, it will return pixel value according to window handle hwnd; otherwise return pixel value according to pixel format in hdc.
we_attr_idThe window element id number.
Returns
If succeed, return the window element pixel color data; otherwise return -1.
See also
GetWindowElementAttr

◆ GetWindowInfo()

const WINDOWINFO *GUIAPI GetWindowInfo ( HWND  hWnd)
inlinestatic

Get the handle of window information.

This function gets the handle to the window information \ from the specified window handle hWnd.

Parameters
hWndThe handle to the window.
Returns
The handle to the window information.

Definition at line 5686 of file window.h.

◆ GetWindowRendererFromName()

WINDOW_ELEMENT_RENDERER *GUIAPI GetWindowRendererFromName ( const char *  name)

Get window renderer from name.

Parameters
nameThe renderer name.

This function gets window renderer from the specified name name, which is case-insensitive.

Returns
The pointer to the window renderer for success, NULL for failure.
Note
The prototype had changed since MiniGUI v3.2; the old one returns a const value.

◆ InitRendererSystemIcon()

BOOL GUIAPI InitRendererSystemIcon ( const char *  rdr_name,
HICON large_icon,
HICON small_icon 
)

Initialize large and small system icons in the specified renderer rdr_name.

Parameters
rdr_nameThe renderer name.
large_iconThe pointer to large system icons.
small_iconThe pointer to small system icons.
Returns
TRUE for success, FALSE for failure.

◆ InitWindowElementAttrs()

BOOL GUIAPI InitWindowElementAttrs ( PWERENDERER  rdr)

This function initializes window element attributes of the specified renderer rdr according to the appropriate section in configuration file.

Parameters
rdrThe pointer to the specified renderer.
Returns
If succeed, return TRUE; otherwise return FALSE.

◆ RemoveWindowElementRenderer()

BOOL BOOL GUIAPI RemoveWindowElementRenderer ( const char *  name)

Remove a window renderer from MiniGUI.

This function only removes a window renderer named by name.

Parameters
nameThe renderer name.
Returns
TRUE for success, FALSE for failure.

◆ SetDefaultWindowElementRenderer()

const char *GUIAPI SetDefaultWindowElementRenderer ( const char *  name)

Set a window element renderer as the default system renderer.

This function sets a window element renderer as the default system renderer.

Parameters
nameThe renderer name.
Returns
the old renderer's name for success, NULL for failure.

◆ SetWindowElementAttr()

DWORD GUIAPI SetWindowElementAttr ( HWND  hwnd,
int  we_attr_id,
DWORD  we_attr 
)

Set a new window element data specified by we_attr_id.

This function sets a new window element data we_attr to MiniGUI, which is identified by we_attr_id.

Parameters
hwndThe handle to the window.
we_attr_idThe window element id.
we_attrThe new window element data.
Returns
If succeed, return the old window element data; otherwise return -1.
See also
GetWindowElementAttr

◆ SetWindowElementRenderer()

BOOL GUIAPI SetWindowElementRenderer ( HWND  hwnd,
const char *  werdr_name,
const WINDOW_ELEMENT_ATTR we_attrs 
)

Set a window element renderer and window element attributes for window specified by hwnd.

This function sets the window handled by hWnd to use a different window element renderer OR'ed window element attributes and updates window in time.

Parameters
hwndThe handle to the window.
werdr_nameThe renderer name.
we_attrsThe pointer to new window element attributes.
Returns
TRUE for success, FALSE for failure.

◆ TermRendererSystemIcon()

void GUIAPI TermRendererSystemIcon ( HICON large_icon,
HICON small_icon 
)

Release large and small system icon resources.

Parameters
large_iconThe pointer to large system icons.
small_iconThe pointer to small system icons.
See also
InitRendererSystemIcon