📄 minigui.h
字号:
* - IDC_NODROP\n * No droping cursor. * - IDC_HAND_POINT\n * Hand point cursor. * - IDC_HAND_SELECT\n * Hand selection cursor. * - IDC_SPLIT_HORZ\n * Horizontal splitting cursor. * - IDC_SPLIT_VERT\n * Vertical splitting cursor. * * \param csrid The identifier of the system cursor. * \return Handle to the system cursor, otherwise zero. */ HCURSOR GUIAPI GetSystemCursor (int csrid);/** * \fn HCURSOR GUIAPI GetCurrentCursor (void) * \brief Gets the handle to the current cursor. * * This function retrives the current cursor and returns its handle. * * \return Handle to the current system cursor, zero means no current cursor. */ HCURSOR GUIAPI GetCurrentCursor (void);#else #define LoadCursorFromFile(filename) (do_nothing(), 0) #define CreateCursor(x, y, w, h, ANDbs, XORbs, cr) (do_nothing(), 0) #define DestroyCursor(hcsr) (do_nothing(), 0) #define GetSystemCursor(csrid) (do_nothing(), 0) #define GetCurrentCursor() (do_nothing(), 0)#endif /* _CURSOR_SUPPORT */#define MAX_SYSCURSORINDEX 22/* System cursor index. */#define IDC_ARROW 0#define IDC_IBEAM 1#define IDC_PENCIL 2#define IDC_CROSS 3#define IDC_MOVE 4#define IDC_SIZENWSE 5#define IDC_SIZENESW 6#define IDC_SIZEWE 7#define IDC_SIZENS 8#define IDC_UPARROW 9#define IDC_NONE 10#define IDC_HELP 11#define IDC_BUSY 12#define IDC_WAIT 13#define IDC_RARROW 14#define IDC_COLOMN 15#define IDC_ROW 16#define IDC_DRAG 17#define IDC_NODROP 18#define IDC_HAND_POINT 19#define IDC_HAND_SELECT 20#define IDC_SPLIT_HORZ 21#define IDC_SPLIT_VERT 22/** * \fn void GUIAPI ClipCursor (const RECT* prc) * \brief Clips the cursor range. * * This function sets cursor's clipping rectangle. \a prc * is the new clipping rectangle in screen coordinates. If \a prc is NULL, * \a ClipCursor will disable cursor clipping. * * \param prc The clipping rectangle. * \return None. */void GUIAPI ClipCursor (const RECT* prc);/** * \fn void GUIAPI GetClipCursor (RECT* prc) * \brief Gets the current cursor clipping rectangle. * * This function copies the current clipping rectangle to * a RECT pointed to by \a prc. * * \param prc The clipping rectangle will be saved to this rectangle. * \return None. */void GUIAPI GetClipCursor (RECT* prc);/** * \fn void GUIAPI GetCursorPos (POINT* ppt) * \brief Gets position of the current cursor. * * This function copies the current mouse cursor position to * a POINT structure pointed to by \a ppt. * * \param ppt The position will be saved in this buffer. * \return None. * * \sa SetCursorPos, POINT */void GUIAPI GetCursorPos (POINT* ppt);/** * \fn void GUIAPI SetCursorPos (int x, int y) * \brief Sets position of the current cursor. * * This function sets mouse cursor position with the given * arguments: \a (x,y). * * \param x The x-corrdinate of the expected poistion. * \param y The y-corrdinate of the expected poistion. * \return None. * * \sa GetCursorPos */void GUIAPI SetCursorPos (int x, int y);#ifdef _CURSOR_SUPPORT/** * \fn HCURSOR GUIAPI SetCursorEx (HCURSOR hcsr, BOOL set_def) * \brief Changes the current cursor. * * This function changes the current cursor to be \a hcsr, * and/or sets it to be the default cursor. * * If you pass \a set_def as TRUE, the expected cursor will be the default cursor. * The default cursor will be used when you move cursor to the desktop. * * \param hcsr The expected cursor handle. * \param set_def Indicates whether setting the cursor as the default cursor. * \return The old cursor handle. * * \sa SetCursor, SetDefaultCursor, GetDefaultCursor */ HCURSOR GUIAPI SetCursorEx (HCURSOR hcsr, BOOL set_def);/** * \def SetCursor(hcsr) * \brief Changes the current cursor. * * This function changes the current cursor to be \a hcsr. * * \param hcsr The expected cursor handle. * \return The old cursor handle. * * \note This function defined as a macro calling \a SetCursorEx with * passing \a set_def as FALSE. * * \sa SetCursorEx, SetDefaultCursor */ #define SetCursor(hcsr) SetCursorEx (hcsr, FALSE)/** * \def SetDefaultCursor(hcsr) * \brief Changes the current cursor, and set it as the default cursor. * * This function changes the current cursor to be \a hcsr, and set it as the default cursor. * * \param hcsr The expected cursor handle. * \return The old cursor handle. * * \note This function defined as a macro calling \a SetCursorEx with * passing \a set_def as TRUE. * * \sa SetCursorEx, SetCursor */ #define SetDefaultCursor(hcsr) SetCursorEx (hcsr, TRUE)/** * \fn HCURSOR GUIAPI GetDefaultCursor (void) * \brief Gets the default cursor. * * This function gets the current default cursor. * * \return The current default cursor handle. * * \sa SetCursorEx, SetDefaultCursor */ HCURSOR GUIAPI GetDefaultCursor (void);#else #define SetCursorEx(hcsr, set_def) (do_nothing(), 0) #define SetCursor(hcsr) (do_nothing(), 0) #define SetDefaultCursor(hcsr) (do_nothing(), 0) #define GetDefaultCursor() (do_nothing(), 0)#endif /* _CURSOR_SUPPORT */#ifdef _CURSOR_SUPPORT/** * \fn int GUIAPI ShowCursor (BOOL fShow) * \brief Shows or hides cursor. * * This function shows or hides cursor according to the argument \a fShow. * Show cursor when \a fShow is TRUE, and hide cursor when \a fShow is FALSE. * MiniGUI maintains a showing count value. Calling \a ShowCursor once, the count * will increase when \a fShow is TRUE, or decrease one when FALSE. * When the count is less than 0, the cursor will disapear actually. * * \param fShow Indicates show or hide the cursor. * \return Cursor showing count value. */ int GUIAPI ShowCursor (BOOL fShow);#else #define ShowCursor(fShow) (do_nothing(), 0)#endif /* _CURSOR_SUPPORT */ /** @} end of cursor_fns */ /** * \defgroup key_status Asynchronous key status functions * @{ *//** * \fn BOOL GUIAPI GetKeyStatus (UINT uKey) * \brief Gets a key or a mouse button status. * * This function gets a key or a mouse button status, returns TRUE * when pressed, or FALSE when released. \a uKey indicates * the key or mouse button. For keys on keyboard, \a uKey should be * the scancode of the key, for mouse button, \a uKey should be one * value of the following: * * - SCANCODE_LEFTBUTTON\n * Left mouse button. * - SCANCODE_MIDDLBUTTON\n * Middle mouse button. * - SCANCODE_RIGHTBUTTON\n * Right mouse button. * * These constants and the scancodes of keys are defined in <minigui/common.h>. * * \param uKey Indicates the key or mouse button. * \return Returns TRUE when pressed, or FALSE when released. * * \sa GetShiftKeyStatus */BOOL GUIAPI GetKeyStatus (UINT uKey);/** * \fn DWORD GUIAPI GetShiftKeyStatus (void) * \brief Gets status of the shift keys. * * This function gets ths status of the shift keys, the returned value * indicates the status of shift keys -- CapsLock, ScrollLock, NumLock, Left Shift, * Right Shift, Left Ctrl, Right Ctrl, Left Alt, and Right Alt. * You can use KS_* ORed with the status value to determine one shift key's status: * * - KS_CAPSLOCK\n * Indicates that CapsLock is locked. * - KS_NUMLOCK\n * Indicates that NumLock is locked. * - KS_SCROLLLOCK\n * Indicates that ScrollLock is locked. * - KS_LEFTCTRL\n * Indicates that left Ctrl key is pressed. * - KS_RIGHTCTRL\n * Indicates that right Ctrl key is pressed. * - KS_CTRL\n * Indicates that either left or right Ctrl key is pressed. * - KS_LEFTALT\n * Indicates that left Alt key is pressed. * - KS_RIGHTALT\n * Indicates that right Alt key is pressed. * - KS_ALT\n * Indicates that either left or right Alt key is pressed. * - KS_LEFTSHIFT\n * Indicates that left Shift key is pressed. * - KS_RIGHTSHIFT\n * Indicates that right Shift key is pressed. * - KS_SHIFT\n * Indicates that either left or right Shift key is pressed. * * These constants are defined in <minigui/common.h>. * * \return The status of the shift keys. * \sa key_defs */DWORD GUIAPI GetShiftKeyStatus (void); /** @} end of key_status */ /** * \defgroup sys_text Internationlization of system text * @{ *//** * \fn const char* GetSysText (const char* text); * \brief Translates system text to localized text. * * When MiniGUI display some system messages, it will call \a GetSysText function * to translate system text from English to other language. * Global variable \a SysText contains all text used by MiniGUI in English. * * \a GetSysText function returns localized text from \a local_SysText. * MiniGUI have already defined localized sytem text for en_US, zh_CN.GB2312 * and zh_TW.Big5 locales. MiniGUI initializes \a local_SysText to * point one of above localized system text when startup. You can also * let \a local_SysText point to your customized string array. * * \param text The system text in en_US locale. * \return The localized text. * * \sa SysText, local_SysText */const char* GetSysText (const char* text);/** * \var const char* SysText [] * \brief Contains all text used by MiniGUI in English. * * System text defined as follows in MiniGUI: * * \code * const char* SysText [] = * { * "Windows...", * "Start...", * "Refresh Background", * "Close All Windows", * "End Session", * "Operations...", * "Minimize", * "Maximize", * "Restore", * "Close", * "OK", * "Next", * "Cancel", * "Previous", * "Yes", * "No", * "Abort", * "Retry", * "Ignore", * "About MiniGUI...", * NULL * }; * \endcode * * \sa GetSysText, local_SysText */extern const char* SysText [];/** * \var const char** local_SysText * \brief The pointer to the current localized system text array. * * Changing \a local_SysText will lead to \a GetSysText returns a different * localized system text. Please set it after calling \a SetDesktopRect, * and send desktop a MSG_REINITSESSION message (call \a ReinitDesktop function) * after assigned a different value to this variable. * * \sa GetSysText, SysText, ReinitDesktopEx */extern const char** local_SysText; /** @} end of sys_text */ /** * \defgroup str_helpers String operation helpers * @{ *//** * \fn char* strnchr (const char* s, size_t n, int c); * \brief Locates character in the first \a n characters of string \a s. * * \param s The pointer to the string. * \param n The number of first characters will be searched. * \param c The expected character. * \return Returns a pointer to the first occurrence of the character \a c in the string \a s * * \sa strchr(3) */char* strnchr (const char* s, size_t n, int c);/** * \fn int substrlen (const char* text, int len, char delimiter, int* nr_delim) * \brief Locates a substring delimited by one or more delimiters in the first \a len characters of string \a text. * * \param text The pointer to the string. * \param len The number of first characters will be searched. * \param delimiter The delimiter which delimites the substring from other. * \param nr_delim The number of continuous delimiters will be returned through this pointer. * \return The length of the substring. * * \sa strstr(3) */int substrlen (const char* text, int len, char delimiter, int* nr_delim); /** @} end of str_helpers */ /** @} end of global_fns */ /** @} end of fns */#ifdef __cplusplus}#endif /* __cplusplus */#endif /* _MGUI_MINIGUI_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -