?? minigui.h
字號:
const char* pKey, char* pValue, int iLen);/** * \fn int GUIAPI GetIntValueFromEtcFile (const char* pEtcFile, const char* pSection, const char* pKey, int* value) * \brief Gets integer value from a configuration file. * * This function gets the integer value of the key \a pKey in the section \a pSection * of the configuration file \a pEtcFile, and returns the integer value through the buffer * pointed to by \a value. * * \param pEtcFile The path name of the configuration file. * \param pSection The section name in which the value located. * \param pKey The key name of the value. * \param value The integer value will be saved in this buffer. * \return ETC_OK on success, < 0 on error. * * \retval ETC_OK Gets value successfullly. * \retval ETC_FILENOTFOUND Can not find the specified configuration file. * \retval ETC_SECTIONNOTFOUND Can not find the specified section in the configuration file. * \retval ETC_KEYNOTFOUND Can not find the specified key in the section. * \retval ETC_FILEIOFAILED File I/O operation error occurred. * \retval ETC_INTCONV Can not convert the value string to an integer. * * \note MiniGUI uses \a strtol to convert the string value to an integer, and pass the base as 0. * Thus, the valid string value can be converted to integer should be in the following forms: * * - [+|-]0x[0-9|A-F]*\n * Will be read in base 16. * - [+|-]0[0-7]*\n * Will be read in base 8. * - [+|-][1-9][0-9]*\n * Will be read in base 10. * * \sa GetValueFromEtcFile, SetValueToEtcFile, strtol(3) */int GUIAPI GetIntValueFromEtcFile (const char* pEtcFile, const char* pSection, const char* pKey, int* value);/** * \fn int GUIAPI SetValueToEtcFile (const char* pEtcFile, const char* pSection, const char* pKey, char* pValue) * \brief Sets a value in a configuration file. * * This function sets the value of the key \a pKey in the section \a pSection * of the configuration file \a pEtcFile to be the string pointed to by \a pValue. * * \param pEtcFile The path name of the configuration file. * \param pSection The section name in which the value located. * \param pKey The key name of the value. * \param pValue The null-terminated value string. * \return ETC_OK on success, < 0 on error. * * \retval ETC_OK Sets value successfullly. * \retval ETC_FILEIOFAILED File I/O operation error occurred. * \retval ETC_TMPFILEFAILED Can not create temporary file. * * \note If the specified configuration file does not exist, MiniGUI will try to * create this file. * * \sa GetValueFromEtcFile, GetIntValueFromEtcFile */int GUIAPI SetValueToEtcFile (const char* pEtcFile, const char* pSection, const char* pKey, char* pValue);/** * \fn GHANDLE GUIAPI LoadEtcFile (const char * pEtcFile) * \brief Loads an etc file into memory. * * This function loads the content of an etc file into the memory, later, you * can visit the content using \a GetValueFromEtc function. * * \param pEtcFile The path name of the configuration file. * \return Handle of the etc object on success, NULL on error. * * \sa UnloadEtcFile, GetValueFromEtc */GHANDLE GUIAPI LoadEtcFile (const char * pEtcFile);/** * \fn GUIAPI UnloadEtcFile (GHANDLE hEtc) * \brief Unloads an etc file. * * This function unloads the etc object generated by using \sa LoadEtcFile function. * * \param hEtc Handle of the etc object. * \return 0 on success, -1 on error. * * \sa LoadEtcFile, GetValueFromEtc */int GUIAPI UnloadEtcFile (GHANDLE hEtc);/** * \fn GUIAPI GetValueFromEtc (GHANDLE hEtc, const char* pSection, const char* pKey, char* pValue, int iLen) * \brief Gets value from a configuration etc object. * * This function gets value from an etc object, similar to GetValueFromEtcFile. * This function gets the value of the key \a pKey in the section \a pSection * of the etc object \a hEtc, and saves the value to the buffer * pointed to by \a pValue. * * \param hEtc Handle of the etc object. * \param pSection The section name in which the value located. * \param pKey The key name of the value. * \param pValue The value will be saved in this buffer. * \param iLen The length in bytes of the buffer. * \return ETC_OK on success, < 0 on error. * * \retval ETC_OK Gets value successfullly. * \retval ETC_FILENOTFOUND Can not find the specified configuration file. * \retval ETC_SECTIONNOTFOUND Can not find the specified section in the configuration file. * \retval ETC_KEYNOTFOUND Can not find the specified key in the section. * \retval ETC_FILEIOFAILED File I/O operation error occurred. * * \sa LoadEtcFile, UnloadEtcFile */int GUIAPI GetValueFromEtc (GHANDLE hEtc, const char* pSection, const char* pKey, char* pValue, int iLen);/** * \fn int GUIAPI GetIntValueFromEtc (GHANDLE hEtc, const char* pSection, const char* pKey, int* pValue) * \brief Gets the integer value from a configuration etc object. * * \sa GetValueFromEtc, GetIntValueFromEtcFile */int GUIAPI GetIntValueFromEtc (GHANDLE hEtc, const char* pSection, const char* pKey, int* pValue);/** * \def SetValueToEtc (GHANDLE hEtc, const char* pSection, const char* pKey, char* pValue) * \brief Sets the value in the etc object. * * This fuctions sets the value in the etc object, somewhat similiar to \sa SetValueToEtcFile. */#define SetValueToEtc(hEtc, pSection, pKey, pValue) \ GetValueFromEtc(hEtc, pSection, pKey, pValue, -1)/* global MiniGUI etc file object */extern GHANDLE hMgEtc;/* Gets value from MiniGUI configuration etc object */static inline int GetMgEtcValue(const char* pSection, const char *pKey, char *pValue, int iLen) {#ifndef _INCORE_RES if (!hMgEtc) return GetValueFromEtcFile (ETCFILEPATH, pSection, pKey, pValue, iLen);#endif return GetValueFromEtc (hMgEtc, pSection, pKey, pValue, iLen);}/* Gets integer value from MiniGUI configuration etc object */static inline int GetMgEtcIntValue (const char *pSection, const char* pKey, int *value){#ifndef _INCORE_RES if (!hMgEtc) return GetIntValueFromEtcFile (ETCFILEPATH, pSection, pKey, value);#endif return GetIntValueFromEtc (hMgEtc, pSection, pKey, value);} /** @} end of etc_fns */#ifdef _CLIPBOARD_SUPPORT /** * \addtogroup clipboard_fns ClipBoard Operations * @{ */#define LEN_CLIPBOARD_NAME 15#define NR_CLIPBOARDS 4#define CBNAME_TEXT ("text")#define CBERR_OK 0#define CBERR_BADNAME 1#define CBERR_NOMEM 2/** * \fn int GUIAPI CreateClipBoard (const char* cb_name, size_t size) * \brief Create a new clip board. * * This function creates a new clip board with the name \a cb_name. * MiniGUI itself creates a clip board for text copying/pasting * called CBNAME_TEXT. * * \param cb_name The name of the new clip board. * \param size The size of the clip board. * * \retval CBERR_OK The clip board created. * \retval CBERR_BADNAME Duplicated clip board name. * \retval CBERR_NOMEM No enogh memory. * */int GUIAPI CreateClipBoard (const char* cb_name, size_t size);/** * \fn int GUIAPI DestroyClipBoard (const char* cb_name) * \brief Destroy a new clip board. * * This function destroies a clip board with the name \a cb_name. * * \param cb_name The name of the clip board. * * \retval CBERR_OK The clip board created. * \retval CBERR_BADNAME Can not find the clip board with the name. */int GUIAPI DestroyClipBoard (const char* cb_name);/** * \fn int GUIAPI SetClipBoardData (const char* cb_name, void* data, size_t n) * \brief Set the data of a clip board. * * This function set the data into the clipboard named \a cb_name. * * \param cb_name The name of the clip board. * \param data The pointer to the data. * \param n The length of the data. * * \retval CBERR_OK Success. * \retval CBERR_BADNAME Bad clip board name. * \retval CBERR_NOMEM No enogh memory. */int GUIAPI SetClipBoardData (const char* cb_name, void* data, size_t n);/** * \fn size_t GUIAPI GetClipBoardDataLen (const char* cb_name); * \brief Get the length of the data of a clip board. * * This function the data length of the clipboard named \a cb_name. * * \param cb_name The name of the clip board. * \return The size of the data if success, otherwise zero. */size_t GUIAPI GetClipBoardDataLen (const char* cb_name);/** * \fn size_t GUIAPI GetClipBoardData (const char* cb_name, void* data, size_t n); * \brief Get the data of a clip board. * * This function get the all data from the clipboard named \a cb_name. * * \param cb_name The name of the clip board. * \param data The pointer to a buffer will save the data. * \param n The length of the buffer. * * \return The size of the data got if success, otherwise zero. */size_t GUIAPI GetClipBoardData (const char* cb_name, void* data, size_t n);/** * \fn int GUIAPI GetClipBoardByte (const char* cb_name, int index, unsigned char* byte); * \brief Get a byte of from a clip board. * * This function gets a byte from the clipboard named \a cb_name. * * \param cb_name The name of the clip board. * \param index The index of the byte. * \param byte The buffer saving the returned byte. * * \retval CBERR_OK The clip board created. * \retval CBERR_BADNAME Duplicated clip board name. * \retval CBERR_NOMEM The index is beyond the data in the clipboard. */int GUIAPI GetClipBoardByte (const char* cb_name, int index, unsigned char* byte); /** @} end of clipboard_fns */#endif /* _CLIPBOARD_SUPPORT */ /** * \addtogroup misc_fns Miscellaneous functions * @{ *//** * \fn void GUIAPI Ping (void) * \brief Makes a beep sound. * \sa Beep */void GUIAPI Ping (void);/** * \def Beep * \brief Alias of Ping. * \sa Ping */#define Beep Ping/** * \fn void GUIAPI Tone (int frequency_hz, int duration_ms) * \brief Makes a tone. * * This function will return after the tone. Thus, your program * will be blocked when the tone is being played. * * \param frequency_hz The frequency of the tone in hertz. * \param duration_ms The duration of the tone in millisecond. * * \bug When MiniGUI runs on X Window, the tone can not be played correctly. * * \sa Ping */void GUIAPI Tone (int frequency_hz, int duration_ms);/** * \fn void* GUIAPI GetOriginalTermIO (void) * \brief Gets \a termios structure of the original terminal before initializing MiniGUI. * * \return The pointer to the original \a termios structure. */void* GUIAPI GetOriginalTermIO (void);/** * \fn void GUIAPI Draw3DUpFrame (HDC hDC, int l, int t, int r, int b, gal_pixel fillc) * \brief Draws a thick 3D up frame. * * This function draws a thick 3D up frame (the border is 2-pixel wide), * and fills the frame if a valid filling pixel is specified. * * \param hDC The device context. * \param l The x-coordinate of upper-left corner of the frame. * \param t The y-coordinate of upper-left corner of the frame. * \param r The x-coordinate of lower-right corner of the frame. * \param b The y-coordinate of lower-right corner of the frame. * \param fillc The filling color. * * \note If \a fillc is zero, this function will not fill the frame. * * \sa Draw3DDownFrame, Draw3DUpThinFrame */void GUIAPI Draw3DUpFrame (HDC hDC, int l, int t, int r, int b, gal_pixel fillc);/** * \fn void GUIAPI Draw3DDownFrame (HDC hDC, int l, int t, int r, int b, gal_pixel fillc) * \brief Draws a thick 3D down frame. * * This function draws a thick 3D down frame (the border is 2-pixel wide), * and fills the frame if a valid filling pixel is specified. * * \param hDC The device context. * \param l The x-coordinate of upper-left corner of the frame. * \param t The y-coordinate of upper-left corner of the frame. * \param r The x-coordinate of lower-right corner of the frame. * \param b The y-coordinate of lower-right corner of the frame. * \param fillc The filling color. * * \note If \a fillc is zero, this function will not fill the frame. * * \sa Draw3DUpFrame, Draw3DDownThinFrame */void GUIAPI Draw3DDownFrame (HDC hDC, int l, int t, int r, int b, gal_pixel fillc);/** * \def Draw3DUpThickFrame * \brief Alias of Draw3DUpFrame */#define Draw3DUpThickFrame Draw3DUpFrame/** * \def Draw3DDownThickFrame * \brief Alias of Draw3DDownFrame */#define Draw3DDownThickFrame Draw3DDownFrame/** * \fn void GUIAPI Draw3DUpThinFrame (HDC hDC, int l, int t, int r, int b, gal_pixel fillc) * \brief Draws a thin 3D up frame. * * This function draws a thin 3D up frame (the border is 1-pixel wide), * and fills the frame if a valid filling pixel is specified. * * \param hDC The device context. * \param l The x-coordinate of upper-left corner of the frame. * \param t The y-coordinate of upper-left corner of the frame. * \param r The x-coordinate of lower-right corner of the frame. * \param b The y-coordinate of lower-right corner of the frame. * \param fillc The filling color. * * \note If \a fillc is zero, this function will not fill the frame. * * \sa Draw3DDownThinFrame, Draw3DUpFrame */void GUIAPI Draw3DUpThinFrame (HDC hDC, int l, int t, int r, int b, gal_pixel fillc);/** * \fn void GUIAPI Draw3DDownThinFrame (HDC hDC, int l, int t, int r, int b, gal_pixel fillc) * \brief Draws a thin 3D down frame. * * This function draws a thin 3D down frame (the border is 1-pixel wide), * and fills the frame if a valid filling pixel is specified. * * \param hDC The device context. * \param l The x-coordinate of upper-left corner of the frame. * \param t The y-coordinate of upper-left corner of the frame. * \param r The x-coordinate of lower-right corner of the frame. * \param b The y-coordinate of lower-right corner of the frame. * \param fillc The filling color. * * \note If \a fillc is zero, this function will not fill the frame. * * \sa Draw3DUpThinFrame, Draw3DDownFrame */void GUIAPI Draw3DDownThinFrame (HDC hDC, int l, int t, int r, int b, gal_pixel fillc);/** * \fn void GUIAPI Draw3DBorder (HDC hdc, int l, int t, int r, int b)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -