MiniGUI API Reference (MiniGUI-Standalone)
v3.2.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
|
Functions | |
MG_EXPORT BOOL GUIAPI | RegisterResFromFile (HDC hdc, const char *file) |
Register a device-dependent bitmap from a file. More... | |
MG_EXPORT BOOL GUIAPI | RegisterResFromMem (HDC hdc, const char *file, const unsigned char *data, size_t data_size) |
Register a device-dependent bitmap to bitmap cache from memory. More... | |
MG_EXPORT BOOL GUIAPI | RegisterResFromBitmap (const char *file, const BITMAP *bmp) |
Register a device-dependent bitmap to bitmap cache. More... | |
MG_EXPORT const BITMAP *GUIAPI | RetrieveRes (const char *file) |
Get a BITMAP object from cache according to the specified resource file name. More... | |
MG_EXPORT void GUIAPI | UnregisterRes (const char *file) |
Unregister the BITMAP object from cache according to the specified resource file name. More... | |
MG_EXPORT BOOL GUIAPI | RegisterSystemBitmap (HDC hdc, const char *rdr_name, const char *id) |
Register a device-dependent bitmap from id to BITMAP cache. More... | |
MG_EXPORT void GUIAPI | UnregisterSystemBitmap (HDC hdc, const char *rdr_name, const char *id) |
Unregister a BITMAP object from BITMAP cache. More... | |
MG_EXPORT const char * | GetResPath (void) |
Get the currrent user's resource path. More... | |
MG_EXPORT int | SetResPath (const char *path) |
Set user's resource path into the search paths of resource manager. More... | |
MG_EXPORT int | AddInnerRes (INNER_RES *inner_res, int count, BOOL copy) |
Add some incore resource into the resource manager in order to call LoadResource to get those resource. More... | |
MG_EXPORT int | RegisterResType (int type, RES_TYPE_OPS *ops) |
Register a new user-defined type into resource manager, so that the LoadResource can load the special resource automatically. More... | |
MG_EXPORT int | UnregisterResType (int type) |
Unregister a user-defined resource type. More... | |
MG_EXPORT void * | LoadResource (const char *res_name, int type, DWORD usr_param) |
Load a resource from disk or memory. More... | |
MG_EXPORT void * | GetResource (RES_KEY key) |
Retrive and return a buffered resource by the key. More... | |
MG_EXPORT int | AddResRef (RES_KEY key) |
Increase the reference count of a buffered resource. More... | |
MG_EXPORT int | ReleaseRes (RES_KEY key) |
Release the buffered resource. It will decrease the reference count of the resource. If the reference count is less then 0, the resource will be released. More... | |
MG_EXPORT RES_KEY | Str2Key (const char *str) |
Translate a string to an unsigned long (RES_KEY), which is used to find a resource in the resource manager. More... | |
int AddInnerRes | ( | INNER_RES * | inner_res, |
int | count, | ||
BOOL | copy | ||
) |
Add some incore resource into the resource manager in order to call LoadResource to get those resource.
inner_res | The pointer to the incore resource. |
count | The bytes count of inner_res. |
copy | TRUE indicate that resource manager will copy the value of inner_res array, otherwise, resource manager just save the pointer to inner_res. |
Referenced by GetWindowInfo().
int AddResRef | ( | RES_KEY | key | ) |
Increase the reference count of a buffered resource.
When you get a resource, you should call this function to ensure that the resource can not be unloaded when you still use it. This function must be called after LoadResource.
key | The key of resource (use Str2Key(res_name) to get the key). |
Referenced by GetWindowInfo().
void * GetResource | ( | RES_KEY | key | ) |
Retrive and return a buffered resource by the key.
You should call LoadResource firstly, and then call GetResource when you need it. Note that GetResource will not increase the reference count automatically.
key | The key of the resource (use Str2Key(res_name) to get the key). |
Referenced by GetWindowInfo().
const char * GetResPath | ( | void | ) |
Get the currrent user's resource path.
Referenced by GetWindowInfo().
void * LoadResource | ( | const char * | res_name, |
int | type, | ||
DWORD | usr_param | ||
) |
Load a resource from disk or memory.
This function loads a resource from disk or memory. If the resource is loaded, it will return the buffered one and increase the reference count. This function will try to find a loader for the resource first according to type.
res_name | The resource name. If res_name is an absolute path (the leading character is '/'), it will load resource from disk directly, else it will:
|
type | The resource type what you want to load. It must be one of the following values:
|
usr_param | The param pass to RES_TYPE_OPS.get_res_data. For resource type RES_TYPE_IMAGE and RES_TYPE_ICON, it must be a handle to DC. |
Referenced by GetWindowInfo().
Register a device-dependent bitmap to bitmap cache.
This function register a device-dependent bitmap to bitmap cache.
file | The name of image file. The suffix indicates image type such as bmp, png, jpg etc. |
bmp | The pointer to a BITMAP object. |
Referenced by GetWindowInfo().
Register a device-dependent bitmap from a file.
This function load a device-dependent bitmap from a file and register it to bitmap cache.
hdc | The device context. |
file | The name of image file. The suffix indicates image type such as bmp, png, jpg etc. |
Referenced by GetWindowInfo().
BOOL GUIAPI RegisterResFromMem | ( | HDC | hdc, |
const char * | file, | ||
const unsigned char * | data, | ||
size_t | data_size | ||
) |
Register a device-dependent bitmap to bitmap cache from memory.
This function load a device-dependent bitmap from memory and register it to bitmap cache.
hdc | The device context. |
file | The name of image file. The suffix indicates image type such as bmp, png, jpg etc. |
data | The pointer to image data. |
data_size | The size of image data. |
Referenced by GetWindowInfo().
int RegisterResType | ( | int | type, |
RES_TYPE_OPS * | ops | ||
) |
Register a new user-defined type into resource manager, so that the LoadResource can load the special resource automatically.
type | The user-defined type. It must >=RES_TYPE_USER and <RES_TYPE_USER_MAX |
ops | the operations of the resource. |
Referenced by GetWindowInfo().
Register a device-dependent bitmap from id to BITMAP cache.
This function load a device-dependent bitmap from id and register it to BITMAP cache.
hdc | The device context. |
rdr_name | The name of window element renderer. NULL for default renderer. |
id | The id of system image. |
Referenced by GetWindowInfo().
int ReleaseRes | ( | RES_KEY | key | ) |
Release the buffered resource. It will decrease the reference count of the resource. If the reference count is less then 0, the resource will be released.
key | The key of the resource (use Str2Key(res_name) to get the key). |
Referenced by GetWindowInfo().
MG_EXPORT const BITMAP * RetrieveRes | ( | const char * | file | ) |
Get a BITMAP object from cache according to the specified resource file name.
This function gets a BITMAP object from cache according to the specified resource file name file.
file | The specified file name. |
Referenced by GetWindowInfo().
int SetResPath | ( | const char * | path | ) |
Set user's resource path into the search paths of resource manager.
If you set this value, resource mamanger will try to find a resource in the path.
path | The path which store the resources. It can be an absolute path or relative path. |
Referenced by GetWindowInfo().
RES_KEY Str2Key | ( | const char * | str | ) |
Translate a string to an unsigned long (RES_KEY), which is used to find a resource in the resource manager.
str | The name of resource. Normaly, it's a path and filename of the resource. |
Referenced by GetWindowInfo().
void UnregisterRes | ( | const char * | file | ) |
Unregister the BITMAP object from cache according to the specified resource file name.
This function unregister the BITMAP object from cache according to the specified resource file name file and the BITMAP bmp.
file | The specified file name. |
Referenced by GetWindowInfo().
int UnregisterResType | ( | int | type | ) |
Unregister a user-defined resource type.
type | The user-defined type registered by calling RegisterResType. |
Referenced by GetWindowInfo().
void GUIAPI UnregisterSystemBitmap | ( | HDC | hdc, |
const char * | rdr_name, | ||
const char * | id | ||
) |
Unregister a BITMAP object from BITMAP cache.
This function unregister a BITMAP object from BITMAP cache.
hdc | The device context. |
rdr_name | The name of window element renderer. NULL for default renderer. |
id | The id of system image. |
Referenced by GetWindowInfo().