mGUtils API Reference
v1.2.0
A component of MiniGUI providing users with a number of common dialog templates
|
Data Structures | |
struct | skin_item_s |
struct | skin_item_ops_s |
struct | sie_slider_s |
struct | si_nrmlabel_s |
struct | si_bmplabel_s |
struct | si_nrmslider_s |
struct | si_rotslider_s |
struct | skin_head_s |
Macros | |
#define | SI_TYPE_NRMLABEL 0x10000000 |
#define | SI_TYPE_BMPLABEL 0x20000000 |
#define | SI_TYPE_CMDBUTTON 0x30000000 |
#define | SI_TYPE_CHKBUTTON 0x40000000 |
#define | SI_TYPE_NRMSLIDER 0x50000000 |
#define | SI_TYPE_ROTSLIDER 0x60000000 |
#define | SI_TYPE_CONTROL 0x70000000 |
The item is a control. More... | |
#define | SI_TYPE_MASK 0xF0000000 |
The item type mask. More... | |
#define | SI_TEST_SHAPE_RECT 0x01000000 |
#define | SI_TEST_SHAPE_ELLIPSE 0x02000000 |
#define | SI_TEST_SHAPE_LOZENGE 0x03000000 |
#define | SI_TEST_SHAPE_LTRIANGLE 0x04000000 |
#define | SI_TEST_SHAPE_RTRIANGLE 0x05000000 |
#define | SI_TEST_SHAPE_UTRIANGLE 0x06000000 |
#define | SI_TEST_SHAPE_DTRIANGLE 0x07000000 |
#define | SI_STATUS_OK 0x00000001 |
#define | SI_STATUS_VISIBLE 0x00000002 |
#define | SI_STATUS_DISABLED 0x00000004 |
#define | SI_STATUS_HILIGHTED 0x00000008 |
#define | SI_BTNSTATUS_CLICKED 0x00000010 |
#define | SI_BTNSTATUS_CHECKED SI_BTNSTATUS_CLICKED |
#define | SI_CMDBUTTON_2STATE 0x00000100 |
#define | SI_NRMSLIDER_HORZ 0x00000100 |
#define | SI_NRMSLIDER_VERT 0x00000200 |
#define | SI_NRMSLIDER_STATIC 0x00000400 |
#define | SI_ROTSLIDER_CW 0x00000100 |
#define | SI_ROTSLIDER_ANTICW 0x00000200 |
#define | SI_ROTSLIDER_STATIC 0x00000400 |
#define | CTRL_SKIN "skin" |
The class name of skin control. More... | |
#define | SIE_BUTTON_CLICKED 0x00000001 |
#define | SIE_SLIDER_CHANGED 0x00000002 |
#define | SIE_GAIN_FOCUS 0x00010000 |
#define | SIE_LOST_FOCUS 0x00020000 |
#define | MSG_CB_GOON 0 |
#define | MSG_CB_DEF_GOON 1 |
#define | MSG_CB_STOP 2 |
#define | SKIN_STYLE_NONE 0x00000000 |
The style of the skin is none. More... | |
#define | SKIN_STYLE_TOOLTIP 0x00000001 |
#define | SKIN_STYLE_MODAL 0x00000002 |
The skin has modal window. More... | |
#define | create_skin_main_window(skin, hosting, lx, ty, rx, by, modal) create_skin_main_window_ex (skin, hosting, lx, ty, rx, by, 0, modal) |
Typedefs | |
typedef struct skin_item_ops_s | skin_item_ops_t |
typedef struct skin_head_s | skin_head_t |
typedef struct skin_item_s | skin_item_t |
typedef struct sie_slider_s | sie_slider_t |
typedef struct si_nrmlabel_s | si_nrmlabel_t |
typedef struct si_bmplabel_s | si_bmplabel_t |
typedef struct si_nrmslider_s | si_nrmslider_t |
typedef struct si_rotslider_s | si_rotslider_t |
typedef int(* | skin_event_cb_t) (HWND hwnd, skin_item_t *item, int event, void *data) |
typedef int(* | skin_msg_cb_t) (HWND hwnd, int message, WPARAM wparam, LPARAM lparam, int *result) |
Functions | |
MGUTILS_EXPORT BOOL | skin_init (skin_head_t *skin, skin_event_cb_t event_cb, skin_msg_cb_t msg_cb) |
Initializes a skin. More... | |
MGUTILS_EXPORT void | skin_deinit (skin_head_t *skin) |
Deinitializes an initialized skin. More... | |
MGUTILS_EXPORT HWND | create_skin_main_window_ex (skin_head_t *skin, HWND hosting, int lx, int ty, int rx, int by, DWORD dwExStyle, BOOL modal) |
Creates a main window for a skin. More... | |
MGUTILS_EXPORT HWND | create_skin_control (skin_head_t *skin, HWND parent, int id, int x, int y, int w, int h) |
Creates a control for a skin. More... | |
MGUTILS_EXPORT BOOL | is_skin_main_window (HWND hwnd) |
Determines whether a window is a skin main window or not. More... | |
MGUTILS_EXPORT void | destroy_skin_window (HWND hwnd) |
Destroys a skin window. More... | |
MGUTILS_EXPORT skin_head_t * | set_window_skin (HWND hwnd, skin_head_t *new_skin) |
Sets new skin. More... | |
MGUTILS_EXPORT skin_head_t * | get_window_skin (HWND hwnd) |
Gets new skin. More... | |
static skin_event_cb_t | skin_set_event_cb (skin_head_t *skin, skin_event_cb_t event_cb) |
Sets new event callback of a skin. More... | |
static skin_msg_cb_t | skin_set_msg_cb (skin_head_t *skin, skin_msg_cb_t msg_cb) |
Sets new message callback of a skin window. More... | |
MGUTILS_EXPORT skin_item_t * | skin_get_item (skin_head_t *skin, int id) |
Retrives a skin item through its identifier. More... | |
MGUTILS_EXPORT DWORD | skin_get_item_status (skin_head_t *skin, int id) |
Retrives the common status of a skin item. More... | |
MGUTILS_EXPORT DWORD | skin_set_item_status (skin_head_t *skin, int id, DWORD status) |
Set the common status of a skin item. More... | |
MGUTILS_EXPORT skin_item_t * | skin_get_hilited_item (skin_head_t *skin) |
Gets the current highlighted skin item. More... | |
MGUTILS_EXPORT DWORD | skin_show_item (skin_head_t *skin, int id, BOOL show) |
Showes or hides a skin item. More... | |
MGUTILS_EXPORT DWORD | skin_enable_item (skin_head_t *skin, int id, BOOL enable) |
Enables or disables a skin item. More... | |
MGUTILS_EXPORT skin_item_t * | skin_set_hilited_item (skin_head_t *skin, int id) |
Sets the current highlighted skin item. More... | |
MGUTILS_EXPORT BOOL | skin_get_check_status (skin_head_t *skin, int id) |
Gets the check status of a check button item. More... | |
MGUTILS_EXPORT DWORD | skin_set_check_status (skin_head_t *skin, int id, BOOL check) |
Sets the check status of a check button item. More... | |
MGUTILS_EXPORT const char * | skin_get_item_label (skin_head_t *skin, int id) |
Gets the label string of a label item. More... | |
MGUTILS_EXPORT BOOL | skin_set_item_label (skin_head_t *skin, int id, const char *label) |
Sets the label string of a label item. More... | |
MGUTILS_EXPORT HWND | skin_get_control_hwnd (skin_head_t *skin, int id) |
Gets the handle to a skin control item in the skin. More... | |
MGUTILS_EXPORT int | skin_get_thumb_pos (skin_head_t *skin, int id) |
Gets the thumb position of a slider item. More... | |
MGUTILS_EXPORT BOOL | skin_set_thumb_pos (skin_head_t *skin, int id, int pos) |
Sets the thumb position of a slider item. More... | |
MGUTILS_EXPORT BOOL | skin_get_slider_info (skin_head_t *skin, int id, sie_slider_t *sie) |
Retrives the sliding information of a slider item. More... | |
MGUTILS_EXPORT BOOL | skin_set_slider_info (skin_head_t *skin, int id, const sie_slider_t *sie) |
Sets the sliding information of a slider item. More... | |
MGUTILS_EXPORT int | skin_scale_slider_pos (const sie_slider_t *org, int new_min, int new_max) |
Scales the sliding position. More... | |
#define create_skin_main_window | ( | skin, | |
hosting, | |||
lx, | |||
ty, | |||
rx, | |||
by, | |||
modal | |||
) | create_skin_main_window_ex (skin, hosting, lx, ty, rx, by, 0, modal) |
#define MSG_CB_DEF_GOON 1 |
#define MSG_CB_GOON 0 |
#define MSG_CB_STOP 2 |
#define SI_BTNSTATUS_CHECKED SI_BTNSTATUS_CLICKED |
#define SI_BTNSTATUS_CLICKED 0x00000010 |
#define SI_CMDBUTTON_2STATE 0x00000100 |
#define SI_NRMSLIDER_HORZ 0x00000100 |
#define SI_NRMSLIDER_STATIC 0x00000400 |
#define SI_NRMSLIDER_VERT 0x00000200 |
#define SI_ROTSLIDER_ANTICW 0x00000200 |
#define SI_ROTSLIDER_CW 0x00000100 |
#define SI_ROTSLIDER_STATIC 0x00000400 |
#define SI_STATUS_DISABLED 0x00000004 |
#define SI_STATUS_HILIGHTED 0x00000008 |
#define SI_STATUS_OK 0x00000001 |
#define SI_STATUS_VISIBLE 0x00000002 |
#define SI_TEST_SHAPE_DTRIANGLE 0x07000000 |
#define SI_TEST_SHAPE_ELLIPSE 0x02000000 |
#define SI_TEST_SHAPE_LOZENGE 0x03000000 |
#define SI_TEST_SHAPE_LTRIANGLE 0x04000000 |
#define SI_TEST_SHAPE_RECT 0x01000000 |
#define SI_TEST_SHAPE_RTRIANGLE 0x05000000 |
#define SI_TEST_SHAPE_UTRIANGLE 0x06000000 |
#define SI_TYPE_BMPLABEL 0x20000000 |
#define SI_TYPE_CHKBUTTON 0x40000000 |
#define SI_TYPE_CMDBUTTON 0x30000000 |
#define SI_TYPE_CONTROL 0x70000000 |
#define SI_TYPE_NRMLABEL 0x10000000 |
#define SI_TYPE_NRMSLIDER 0x50000000 |
#define SI_TYPE_ROTSLIDER 0x60000000 |
#define SIE_BUTTON_CLICKED 0x00000001 |
#define SIE_GAIN_FOCUS 0x00010000 |
#define SIE_LOST_FOCUS 0x00020000 |
#define SIE_SLIDER_CHANGED 0x00000002 |
#define SKIN_STYLE_MODAL 0x00000002 |
#define SKIN_STYLE_NONE 0x00000000 |
#define SKIN_STYLE_TOOLTIP 0x00000001 |
typedef struct si_bmplabel_s si_bmplabel_t |
Bitmap label item info structure
typedef struct si_nrmlabel_s si_nrmlabel_t |
Normal label item info structure
typedef struct si_nrmslider_s si_nrmslider_t |
Normal slider item info structure
typedef struct si_rotslider_s si_rotslider_t |
Rotation slider item info structure
typedef struct sie_slider_s sie_slider_t |
Slider information structure
int(* skin_event_cb_t)(HWND hwnd, skin_item_t *item, int event, void *data) |
Event callback of skin item.
The event can be one of the following values:
typedef struct skin_head_s skin_head_t |
typedef struct skin_item_ops_s skin_item_ops_t |
typedef struct skin_item_s skin_item_t |
Skin item information structure
int(* skin_msg_cb_t)(HWND hwnd, int message, WPARAM wparam, LPARAM lparam, int *result) |
This is the type of message callback function of a skin window.
Before a skin window processes a message, it will call the message callback function if the application defined it.
The application defined message callback function can process the message as a normal window procedure and return the result through the parameter result. However, the return value of a message callback function can be used to control the behavior of the skin window's message handling procedure. It can be one of the following values:
HWND create_skin_control | ( | skin_head_t * | skin, |
HWND | parent, | ||
int | id, | ||
int | x, | ||
int | y, | ||
int | w, | ||
int | h | ||
) |
Creates a control for a skin.
This function creates a control for the skin pointed to by skin.
skin | The pointer to the initialized skin object. |
parent | The handle to the parent window of the expected control. |
id | The identifier of the expected control. |
x | X-coordinate of the expected control in the parent window's client area. |
y | Y-coordinate of the expected control in the parent window's client area. |
w | The width of the expected control. |
h | The height of the expected control. |
You can also create a skin control by calling CreateWindowEx in the following manner:
HWND create_skin_main_window_ex | ( | skin_head_t * | skin, |
HWND | hosting, | ||
int | lx, | ||
int | ty, | ||
int | rx, | ||
int | by, | ||
DWORD | dwExStyle, | ||
BOOL | modal | ||
) |
Creates a main window for a skin.
This function creates a main window for the skin pointed to by skin. The main window will have no caption, no menu, and no frame. However, the window's caption string will be the name of the skin object.
skin | The pointer to the initialized skin object. |
hosting | The the hosting main window. |
lx | X-coordinate of the upper-left corner of the expected main window. |
ty | Y-coordinate of the upper-left corner of the expected main window. |
rx | X-coordinate of the lower-right corner of the expected main window. |
by | Y-coordinate of the lower-right corner of the expected main window. |
dwExStyle | The extended style of the expected control. |
modal | Whether to be a modal or modeless main window. |
void destroy_skin_window | ( | HWND | hwnd | ) |
Destroys a skin window.
The function destroys the skin main window or control.
hwnd | The handle to the skin window. |
skin_head_t * get_window_skin | ( | HWND | hwnd | ) |
Gets new skin.
The function gets the skin of skin window hwnd.
hwnd | The handle to the skin window. |
BOOL is_skin_main_window | ( | HWND | hwnd | ) |
Determines whether a window is a skin main window or not.
The function determines whether a window specified by hwnd is a main window created by skin_main_window or not.
hwnd | The handle to the skin window. |
skin_head_t * set_window_skin | ( | HWND | hwnd, |
skin_head_t * | new_skin | ||
) |
Sets new skin.
The function sets a new skin pointed to by new_skin for the skin window hwnd.
hwnd | The handle to the skin window. |
new_skin | The pointer to the new skin object. |
void skin_deinit | ( | skin_head_t * | skin | ) |
Deinitializes an initialized skin.
This function deinitializes a skin, opposed to skin_init.
skin | The pointer to the skin object. |
BOOL skin_enable_item | ( | skin_head_t * | skin, |
int | id, | ||
BOOL | enable | ||
) |
Enables or disables a skin item.
This function enables or disables a skin item whose identifier is id.
skin | The pointer to the skin. |
id | The identifier of the skin item. |
enable | TRUE for enable, FALSE for disable. |
Referenced by skin_set_msg_cb().
BOOL skin_get_check_status | ( | skin_head_t * | skin, |
int | id | ||
) |
Gets the check status of a check button item.
This function gets the check status of a check button item, checked or unchecked.
skin | The pointer to the skin. |
id | The identifier of the skin item. |
Referenced by skin_set_msg_cb().
HWND skin_get_control_hwnd | ( | skin_head_t * | skin, |
int | id | ||
) |
Gets the handle to a skin control item in the skin.
This function returns the handle to a skin control item whose identifier is id.
skin | The pointer to the skin. |
id | The identifier of the skin control item. |
Referenced by skin_set_msg_cb().
skin_item_t * skin_get_hilited_item | ( | skin_head_t * | skin | ) |
Gets the current highlighted skin item.
skin | The pointer to the skin. |
Referenced by skin_set_msg_cb().
skin_item_t * skin_get_item | ( | skin_head_t * | skin, |
int | id | ||
) |
Retrives a skin item through its identifier.
This function retrives the pointer to a skin item by its identifier.
skin | The pointer to the skin. |
id | The identifier of the skin item. |
Referenced by skin_set_msg_cb().
const char * skin_get_item_label | ( | skin_head_t * | skin, |
int | id | ||
) |
Gets the label string of a label item.
This function returns the label string of a label item whose identifier is id.
skin | The pointer to the skin. |
id | The identifier of the skin item. |
Referenced by skin_set_msg_cb().
DWORD skin_get_item_status | ( | skin_head_t * | skin, |
int | id | ||
) |
Retrives the common status of a skin item.
This function retrives the common status of a skin item by its identifier.
skin | The pointer to the skin. |
id | The identifier of the skin item. |
Referenced by skin_set_msg_cb().
BOOL skin_get_slider_info | ( | skin_head_t * | skin, |
int | id, | ||
sie_slider_t * | sie | ||
) |
Retrives the sliding information of a slider item.
This function retrives the sliding information of a slider item whose identifier is id.
skin | The pointer to the skin. |
id | The identifier of the skin item. |
sie | The pointer to a buffer which will be used to return the sliding information. |
Referenced by skin_set_msg_cb().
int skin_get_thumb_pos | ( | skin_head_t * | skin, |
int | id | ||
) |
Gets the thumb position of a slider item.
This function gets the thumb position of a slider item.
skin | The pointer to the skin. |
id | The identifier of the skin item. |
Referenced by skin_set_msg_cb().
BOOL skin_init | ( | skin_head_t * | skin, |
skin_event_cb_t | event_cb, | ||
skin_msg_cb_t | msg_cb | ||
) |
Initializes a skin.
This function initializes a skin skin before it can be used. The initialization of a skin includes skin items initialization, etc, such as creating the hit-test region, allocating space for label, and so on.
skin | The pointer to the skin object. The skin can be a object returned by a hard-coded skin_head_t structure. |
event_cb | The item event callback of the skin. |
msg_cb | The window message callback of the skin window. |
int skin_scale_slider_pos | ( | const sie_slider_t * | org, |
int | new_min, | ||
int | new_max | ||
) |
Scales the sliding position.
This function is a helper function, it calculates and returns the new position value of a sliding information in the new sliding range defined by new_max and new_min.
org | The original sliding information, its range and current position value. |
new_min | The new minimal value. |
new_max | The new maximal value. |
Referenced by skin_set_msg_cb().
DWORD skin_set_check_status | ( | skin_head_t * | skin, |
int | id, | ||
BOOL | check | ||
) |
Sets the check status of a check button item.
This function sets the check status of a check button item.
skin | The pointer to the skin. |
id | The identifier of the skin item. |
check | Checks it or not. |
Referenced by skin_set_msg_cb().
|
inlinestatic |
Sets new event callback of a skin.
This function sets event_cb as the event callback of the skin skin.
skin | The pointer to the skin object. |
event_cb | The new event callback. |
skin_item_t * skin_set_hilited_item | ( | skin_head_t * | skin, |
int | id | ||
) |
Sets the current highlighted skin item.
This function sets the current highlighted skin item.
skin | The pointer to the skin. |
id | The identifier of the skin item. |
Referenced by skin_set_msg_cb().
BOOL skin_set_item_label | ( | skin_head_t * | skin, |
int | id, | ||
const char * | label | ||
) |
Sets the label string of a label item.
This function sets the label string of a label item and reflects the appearance of the item if it is visible.
skin | The pointer to the skin. |
id | The identifier of the skin item. |
label | The pointer to the new label string. |
Referenced by skin_set_msg_cb().
DWORD skin_set_item_status | ( | skin_head_t * | skin, |
int | id, | ||
DWORD | status | ||
) |
Set the common status of a skin item.
This function set the common status of a skin item by its identifier.
skin | The pointer to the skin. |
id | The identifier of the skin item. |
status | The common status of the skin item. |
Referenced by skin_set_msg_cb().
|
inlinestatic |
Sets new message callback of a skin window.
This function sets msg_cb as the message callback of the skin skin.
skin | The pointer to the skin object. |
msg_cb | The new message callback. |
Definition at line 1901 of file mgutils.h.
References skin_enable_item(), skin_get_check_status(), skin_get_control_hwnd(), skin_get_hilited_item(), skin_get_item(), skin_get_item_label(), skin_get_item_status(), skin_get_slider_info(), skin_get_thumb_pos(), skin_scale_slider_pos(), skin_set_check_status(), skin_set_hilited_item(), skin_set_item_label(), skin_set_item_status(), skin_set_slider_info(), skin_set_thumb_pos(), and skin_show_item().
BOOL skin_set_slider_info | ( | skin_head_t * | skin, |
int | id, | ||
const sie_slider_t * | sie | ||
) |
Sets the sliding information of a slider item.
This function sets the sliding information of a slider item whose identifier is id.
skin | The pointer to the skin. |
id | The identifier of the skin item. |
sie | The pointer to a sliding information structure. |
Referenced by skin_set_msg_cb().
BOOL skin_set_thumb_pos | ( | skin_head_t * | skin, |
int | id, | ||
int | pos | ||
) |
Sets the thumb position of a slider item.
This function sets the thumb position of a slider item whose identifier is id to the value of pos. It will redraw the item if the position changed.
skin | The pointer to the skin. |
id | The identifier of the skin item. |
pos | The new position value. |
Referenced by skin_set_msg_cb().
DWORD skin_show_item | ( | skin_head_t * | skin, |
int | id, | ||
BOOL | show | ||
) |
Showes or hides a skin item.
This function showes or hides a skin item whose identifier is id.
skin | The pointer to the skin. |
id | The identifier of the skin item. |
show | TRUE for show, FALSE for hide. |
Referenced by skin_set_msg_cb().