⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 control.h

📁 MiniGui在ucOS-ii下的一个例子
💻 H
📖 第 1 页 / 共 5 页
字号:
/** * \file control.h * \author Wei Yongming <ymwei@minigui.org> * \date 2001/12/29 *  * This file includes interfaces of standard controls of MiniGUI. * \verbatim    Copyright (C) 1998-2002 Wei Yongming.    Copyright (C) 2002-2003 Feynman Software.    This file is part of MiniGUI, a lightweight Graphics User Interface     support library for real-time embedded Linux.    This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA \endverbatim *//* * $Id: control.h,v 1.107 2004/02/25 02:34:49 weiym Exp $ * *             MiniGUI for Linux, uClinux, eCos, and uC/OS-II version 1.5.x *             Copyright (C) 1999-2002 Wei Yongming. *             Copyright (C) 2002-2004 Feynman Software. */#ifndef _MGUI_CONTROL_H  #define _MGUI_CONTROL_H #ifdef __cplusplusextern "C" {#endif  /* __cplusplus *//************************** Control Helpers **********************************/    /**     * \addtogroup fns Functions     * @{     */    /**     * \addtogroup global_fns Global/general functions     * @{     */    /**     * \addtogroup misc_fns Miscellaneous functions     * @{     *//** * \fn Draw3DControlFrame (HDC hdc, int x0, int y0, int x1, int y1, gal_pixel fillc, BOOL updown) * \brief Draws a 3D style frame control.            * * \param hdc The handle to Drawing context. * \param x0  Specifies the x-coordinate of the upper-left corner. * \param y0  Specifies the y-coordinate of the upper-left corner. * \param x1  Specifies the x-coordinate of the lower-right corner.   * \param y1  Specifies the y-coordinate of the lower-right corner. * \param fillc Specifies the color to fill the frame. * \param updown Specifies the state of the frame control, ie. up or down.  * * \sa Draw3DControlFrame */void GUIAPI Draw3DControlFrame (HDC hdc, int x0, int y0, int x1, int y1,             gal_pixel fillc, BOOL updown);/** * \fn DrawFlatControlFrameEx(HDC hdc, int x0, int y0, int x1, int y1, gal_pixel fillc, int corner, BOOL updown) * \brief Draws a flat frame control with triangle corner. * * \param hdc The handle to Drawing context. * \param x0  Specifies the x-coordinate of the upper-left corner. * \param y0  Specifies the y-coordinate of the upper-left corner. * \param x1  Specifies the x-coordinate of the lower-right corner. * \param y1  Specifies the y-coordinate of the lower-right corner. * \param fillc Specifies the color to fill the frame. * \param corner Specifies the length of the edge of the triangle corner. * \param updown Specifies the state of the frame control, ie. up or down. * * \sa Draw3DControlFrame */void GUIAPI DrawFlatControlFrameEx (HDC hdc, int x0, int y0, int x1, int y1,             gal_pixel fillc, int corner, BOOL updown);/** * \def DrawFlatControlFrame(HDC hdc, int x0, int y0, int x1, int y1, gal_pixel fillc, BOOL updown) * \brief Draws a flat frame control.            * * \param hdc The handle to drawing context. * \param x0  Specifies the x-coordinate of the upper-left corner. * \param y0  Specifies the y-coordinate of the upper-left corner. * \param x1  Specifies the x-coordinate of the lower-right corner.   * \param y1  Specifies the y-coordinate of the lower-right corner. * \param fillc Specifies the color to fill the frame. * \param updown Specifies the state of the frame control, ie. up or down.  * * \note This function is actually a macro of DrawFlatControlFrameEx. * * \sa DrawFlatControlFrameEx */#define DrawFlatControlFrame(hdc, x0, y0, x1, y1, fillc, updown) \                 DrawFlatControlFrameEx(hdc, x0, y0, x1, y1, fillc, 3, updown);/** * \fn void GUIAPI NotifyParentEx (HWND hwnd, int id, int code, DWORD add_data) * \brief Sends a notification message to the parent. * * By default, the notification from a control will be sent to its parent * window within a MSG_COMMAND messsage. * * Since version 1.2.6, MiniGUI defines the Nofication Callback Procedure  * for control. You can specify a callback function for a control by calling * \a SetNotificationCallback to receive and handle the notification from  * the control. * * If you have defined the Notificaton Callback Procedure for the control, * calling NotifyParentEx will call the notification callback procedure, * not send the notification message to the parent. * * \param hwnd The handle to current control window. * \param id The identifier of current control. * \param code The notification code. * \param add_data The additional data of the notification. * * \sa SetNotificationCallback */void GUIAPI NotifyParentEx (HWND hwnd, int id, int code, DWORD add_data);/** * \def NotifyParent(hwnd, id, code) * \brief Sends a notification message to the parent,  *        but without additional data. * * \param hwnd The handle to current control window. * \param id The identifier of current control. * \param code The notification code. * * \note This function is actually a macro of NotifyParentEx with  *       \a dwAddData being zero. * * \sa NotifiyParentEx */#define NotifyParent(hwnd, id, code) \                NotifyParentEx(hwnd, id, code, 0)/** * \var typedef int (*STRCMP) (const char* s1, const char* s2, size_t n) * \brief Type of general strncmp function. * * The function compares the two strings \a s1 and \a s2. It returns * an integer less than, equal to, or greater than zero if  \a s1 is found, * respectively, to be less than, to match, or be greater than \a s2. * * Note that it only compares the first (at most) \a n characters of s1 and s2.  */typedef int (*STRCMP) (const char* s1, const char* s2, size_t n);    /** @} end of misc_fns */    /** @} end of global_fns */    /** @} end of fns */    /**     * \defgroup controls Standard controls     * @{     *//****** control messages *****************************************************//* NOTE: control messages start from 0xF000 to 0xFFFF */#define MSG_FIRSTCTRLMSG    0xF000#define MSG_LASTCTRLMSG     0xFFFF/****** Static Control ******************************************************/#ifdef _CTRL_STATIC    /**     * \defgroup ctrl_static Static control     * @{     *//** * \def CTRL_STATIC * \brief The class name of static control. */#define CTRL_STATIC         ("static")    /**     * \defgroup ctrl_static_styles Styles of static control     * @{     *//** * \def SS_LEFT * \brief Displays the given text flush-left. */#define SS_LEFT             0x00000000L/** * \def SS_CENTER  * \brief Displays the given text centered in the rectangle.  */#define SS_CENTER           0x00000001L/** * \def SS_RIGHT * \brief Displays the given text flush-right. */#define SS_RIGHT            0x00000002L/** * \def SS_ICON  * \brief Designates an icon displayed in the static control. */#define SS_ICON             0x00000003L/** * \def SS_BLACKRECT * \brief Specifies a rectangle filled with the black color. */#define SS_BLACKRECT        0x00000004L/** * \def SS_GRAYRECT * \brief Specifies a rectangle filled with the light gray color. */#define SS_GRAYRECT         0x00000005L/** * \def SS_WHITERECT * \brief Specifies a rectangle filled with the light white color. */#define SS_WHITERECT        0x00000006L/** * \def SS_BLACKFRAME * \brief Specifies a box with a frame drawn with the black color. */#define SS_BLACKFRAME       0x00000007L/** * \def SS_GRAYFRAME * \brief Specifies a box with a frame drawn with the light gray color. */#define SS_GRAYFRAME        0x00000008L/** * \def SS_WHITEFRAME * \brief Specifies a box with a frame drawn with the light gray color. */#define SS_WHITEFRAME       0x00000009L/** * \def SS_GROUPBOX * \brief Creates a rectangle in which other controls can be grouped. */#define SS_GROUPBOX         0x0000000AL/** * \def SS_SIMPLE  * \brief Designates a simple rectangle and displays a single line  *        of text flush-left in the rectangle. */#define SS_SIMPLE           0x0000000BL/** * \def SS_LEFTNOWORDWRAP * \brief Designates a simple rectangle and displays the given text  *        flush-left in the rectangle.  * * Tabs are expanded, but words are not wrapped.  * Text that extends past the end of a line is clipped. */#define SS_LEFTNOWORDWRAP   0x0000000CL#define SS_OWNERDRAW        0x0000000DL/** * \def SS_BITMAP * \brief Specifies that a bitmap will be displayed in the static control. */#define SS_BITMAP           0x0000000EL#define SS_ENHMETAFILE      0x0000000FL#define SS_TYPEMASK         0x0000000FL/** * \def SS_NOPREFIX * \brief Prevents interpretation of any ampersand (&) characters in  *        the control's text as accelerator prefix characters. * * \note Not implemented so far. */#define SS_NOPREFIX         0x00000080L/** * \def SS_NOTIFY * \brief Sends the parent window notification messages when the user  *        clicks or double-clicks the control. */#define SS_NOTIFY           0x00000100L/** * \def SS_CENTERIMAGE * \brief Puts the image in the center of the static control. *        Default is top-left aligned. */#define SS_CENTERIMAGE      0x00000200L/** * \def SS_REALSIZEIMAGE * \brief Does not scale the image. */#define SS_REALSIZEIMAGE    0x00000800L    /** @} end of ctrl_static_styles */        /**     * \defgroup ctrl_static_msgs Messages of static control     * @{     */#define STM_SETICON         0xF170#define STM_GETICON         0xF171/** * \def STM_SETIMAGE * \brief Associates a new image (icon or bitmap) with a static control. * * An application sends an STM_SETIMAGE message to  * associate a new image (icon or bitmap) with a static control. * * \code * STM_SETIMAGE * HICON image; *  or  * BITMAP* image; * * wParam = (WPARAM)image; * lParam = 0; * \endcode *  * \param image The handle to an icon if the type of static control type  *        is SS_ICON, or the pointer to a BITMAP object if the type is SS_BITMAP. * * \return The old image (handle or pointer). */#define STM_SETIMAGE        0xF172/** * \def STM_GETIMAGE * \brief Retrieves a handle to the image. * * An application sends an STM_GETIMAGE message to retrieve a handle  * to the image associated with a static control. * * \code * STM_GETIMAGE * wParam = 0; * lParam = 0; * \endcode * * \return The handle to the icon if the type of static control type is SS_ICON,  *         or the pointer to the BITMAP object if the type is SS_BITMAP. */#define STM_GETIMAGE        0xF173#define STM_MSGMAX          0xF174    /** @} end of ctrl_static_msgs */    /**     * \defgroup ctrl_static_ncs Notification codes of static control     * @{     *//** * \def STN_DBLCLK * \brief Notifies a double-click. * * The STN_DBLCLK notification message is sent when  * the user double-clicks a static control that has the SS_NOTIFY style. */#define STN_DBLCLK          1#define STN_ENABLE          2#define STN_DISABLE         3/** * \def STN_CLICKED * \brief Notifies that a static control is clicked. * * The STN_CLICKED notification message is sent  * when the user clicks a static control that has the SS_NOTIFY style. */#define STN_CLICKED         4    /** @} end of ctrl_static_ncs */    /** @} end of ctrl_static */#endif /* _CTRL_STATIC *//****** Button Control ******************************************************/#ifdef _CTRL_BUTTON    /**     * \defgroup ctrl_button Button control     * @{     *//** * \def CTRL_BUTTON * \brief The class name of button control. */#define CTRL_BUTTON         ("button")    /**     * \defgroup ctrl_button_styles Styles of button control     * @{     *//** * \def BS_PUSHBUTTON * \brief Creates a push button. */#define BS_PUSHBUTTON       0x00000000L/** * \def BS_DEFPUSHBUTTON * \brief Creates a push button that behaves like a BS_PUSHBUTTON style button.  * Creates a push button that behaves like a BS_PUSHBUTTON style button,  * but also has a heavy black border.  If the button is in a dialog box,  * the user can select the button by pressing the enter key,  * even when the button does not have the input focus.  * This style is useful for enabling the user to quickly select  * the most likely (default) option. */#define BS_DEFPUSHBUTTON    0x00000001L/** * \def BS_CHECKBOX * \brief Creates a small, empty check box with text. * * By default, the text is displayed to the right of the check box.  * To display the text to the left of the check box, combine this flag  * with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style). */#define BS_CHECKBOX         0x00000002L/** * \def BS_AUTOCHECKBOX * \brief Creates a button that is almost the same as a check box. * * Creates a button that is the same as a check box,  * except that the check state automatically toggles between  * checked and unchecked each time the user selects the check box. */#define BS_AUTOCHECKBOX     0x00000003L/** * \def BS_RADIOBUTTON * \brief Creates a small circle with text. * * By default, the text is displayed to the right of the circle.  * To display the text to the left of the circle, combine this flag  * with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style).  * Use radio buttons for groups of related, but mutually exclusive choices. */#define BS_RADIOBUTTON      0x00000004L/** * \def BS_3STATE * \brief Creates a button that is almost the same as a check box. *  * Creates a button that is the same as a check box, except  * that the box can be grayed as well as checked or unchecked. * Use the grayed state to show that the state of the check box  * is not determined. */#define BS_3STATE           0x00000005L/** * \def BS_AUTO3STATE * \brief Creates a button that is almost the same as a three-state check box. * * Creates a button that is the same as a three-state check box,  * except that the box changes its state when the user selects it. * The state cycles through checked, grayed, and unchecked. */#define BS_AUTO3STATE       0x00000006L#define BS_GROUPBOX         0x00000007L#define BS_USERBUTTON       0x00000008L/** * \def BS_AUTORADIOBUTTON * \brief Creates a button that is almost the same as a radio button. * 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -