?? control.h
字號:
/**
* \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-2004 Feynman Software.
This file is part of MiniGUI, a compact cross-platform Graphics
User Interface (GUI) support system for real-time embedded systems.
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.165 2004/10/20 02:06:00 weiym Exp $
*
* MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks version 1.6.x
* Copyright (C) 1999-2002 Wei Yongming.
* Copyright (C) 2002-2004 Feynman Software.
*/
#ifndef _MGUI_CONTROL_H
#define _MGUI_CONTROL_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/************************** Common definitions *******************************/
/************************** Control Helpers **********************************/
/**
* \addtogroup fns Functions
* @{
*/
/**
* \addtogroup global_fns Global/general functions
* @{
*/
/**
* \addtogroup misc_fns Miscellaneous functions
* @{
*/
int EditOnEraseBackground (HWND hWnd, HDC hdc, const RECT* pClipRect);
/**
* \fn void GUIAPI DrawBoxFromBitmap (HDC hdc, const RECT* box, const BITMAP* bmp, BOOL h_v, BOOL do_clip)
* \brief Draws a box from bitmap.
*
* \param hdc The handle to drawing context.
* \param box The rectangle of the box.
* \param bmp The pointer to the BITMAP object.
* \param h_v Draw the box along horizental or vertical.
* \param do_clip Does clip the drawing in the box?
*/
void GUIAPI DrawBoxFromBitmap (HDC hdc, const RECT* box, const BITMAP* bmp, BOOL h_v, BOOL do_clip);
#define DF_3DBOX_NORMAL 0x0000
#define DF_3DBOX_PRESSED 0x0001
#define DF_3DBOX_STATEMASK 0x000F
#define DF_3DBOX_NOTFILL 0x0000
#define DF_3DBOX_FILL 0x0010
/**
* \fn void GUIAPI Draw3DControlFrameEx (HDC hdc, HWND hwnd, int x0, int y0, int x1, int y1, DWORD flags, gal_pixel fillc)
* \brief Draws a 3D style frame control.
*
* \param hdc The handle to drawing context.
* \param hwnd Tell the function to draw with the color definitions of this window.
* \param x0 Specify the x-coordinate of the upper-left corner.
* \param y0 Specify the y-coordinate of the upper-left corner.
* \param x1 Specify the x-coordinate of the lower-right corner.
* \param y1 Specify the y-coordinate of the lower-right corner.
* \param flags Specify the drawing flag, can be or'ed with the following flags:
* - DF_3DBOX_NORMAL\n The box is displayed with normal status.
* - DF_3DBOX_PRESSED\n The box is pressed.
* - DF_3DBOX_NOTFILL\n Do not fill the box.
* - DF_3DBOX_FILL\n Fill the box and the \a fillc defined the color.
* \param fillc Specify the pixel value to fill the box when DF_3DBOX_FILL specified.
*
* \sa DrawFlatControlFrameEx
*/
void GUIAPI Draw3DControlFrameEx (HDC hdc, HWND hwnd, int x0, int y0, int x1, int y1,
DWORD flags, gal_pixel fillc);
/* back compatibility definitions */
#define Draw3DControlFrame(hdc, l, t, r, b, fillc, updown) \
Draw3DControlFrameEx(hdc, HWND_DESKTOP, l, t, r, b, \
(updown?DF_3DBOX_NORMAL:DF_3DBOX_PRESSED) | ((fillc)?DF_3DBOX_FILL:0), fillc)
/**
* \fn void GUIAPI DrawFlatControlFrameEx(HDC hdc, HWND hwnd, int x0, int y0, int x1, int y1, int corner, DWORD flags, gal_pixel fillc)
* \brief Draws a flat frame control with triangle corner.
*
* \param hdc The handle to drawing context.
* \param hwnd Tell the function to draw with the color definitions of this window.
* \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 corner Specifies the length of the edge of the triangle corner.
* \param flags Specify the drawing flag, can be or'ed with the following flags:
* - DF_3DBOX_NORMAL\n The box is displayed with normal status.
* - DF_3DBOX_PRESSED\n The box is pressed.
* - DF_3DBOX_NOTFILL\n Do not fill the box.
* - DF_3DBOX_FILL\n Fill the box and the \a fillc defined the color.
* \param fillc Specify the pixel value to fill the box when DF_3DBOX_FILL specified.
*
* \sa Draw3DControlFrameEx
*/
void GUIAPI DrawFlatControlFrameEx (HDC hdc, HWND hwnd, int x0, int y0, int x1, int y1,
int corner, DWORD flags, gal_pixel fillc);
#define DrawFlatControlFrame(hdc, x0, y0, x1, y1, fillc, updown) \
DrawFlatControlFrameEx(hdc, HWND_DESKTOP, x0, y0, x1, y1, 3, \
(updown?DF_3DBOX_NORMAL:DF_3DBOX_PRESSED) | ((fillc)?DF_3DBOX_FILL:0), fillc)
/**
* \fn void GUIAPI Draw3DThickFrameEx (HDC hdc, HWND hwnd, int l, int t, int r, int b, DWORD flags, gal_pixel fillc)
* \brief Draws a thick 3D frame.
*
* This function draws a thin 3D frame (the border is 2-pixel wide),
* and fills the frame if a fill flag is specified.
*
* \param hdc The device context.
* \param hwnd Tell the function to draw with the color definitions of this window.
* \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 flags Specify the drawing flag, can be or'ed with the following flags:
* - DF_3DBOX_NORMAL\n The box is displayed with normal status.
* - DF_3DBOX_PRESSED\n The box is pressed.
* - DF_3DBOX_NOTFILL\n Do not fill the box.
* - DF_3DBOX_FILL\n Fill the box and the \a fillc defined the color.
* \param fillc Specify the pixel value to fill the box when DF_3DBOX_FILL specified.
*
* \sa Draw3DControlFrameEx, DrawFlatControlFrameEx
*/
void GUIAPI Draw3DThickFrameEx (HDC hdc, HWND hwnd,
int l, int t, int r, int b, DWORD flags, gal_pixel fillc);
/* back compatibility definitions */
#define Draw3DUpThickFrame(hdc, l, t, r, b, fillc) \
Draw3DThickFrameEx(hdc, HWND_DESKTOP, l, t, r, b, DF_3DBOX_NORMAL | ((fillc)?DF_3DBOX_FILL:0), fillc)
#define Draw3DDownThickFrame(hdc, l, t, r, b, fillc) \
Draw3DThickFrameEx(hdc, HWND_DESKTOP, l, t, r, b, DF_3DBOX_PRESSED | ((fillc)?DF_3DBOX_FILL:0), fillc)
#define Draw3DUpFrame Draw3DUpThickFrame
#define Draw3DDownFrame Draw3DDownThickFrame
/**
* \fn void GUIAPI Draw3DThinFrameEx (HDC hdc, HWND hwnd, int l, int t, int r, int b, DWORD flags, gal_pixel fillc)
* \brief Draws a thin 3D frame.
*
* This function draws a thin 3D frame (the border is 1-pixel wide),
* and fills the frame if a fill flag is specified.
*
* \param hdc The device context.
* \param hwnd Tell the function to draw with the color definitions of this window.
* \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 flags Specify the drawing flag, can be or'ed with the following flags:
* - DF_3DBOX_NORMAL\n The box is displayed with normal status.
* - DF_3DBOX_PRESSED\n The box is pressed.
* - DF_3DBOX_NOTFILL\n Do not fill the box.
* - DF_3DBOX_FILL\n Fill the box and the \a fillc defined the color.
* \param fillc Specify the pixel value to fill the box when DF_3DBOX_FILL specified.
*
* \sa Draw3DControlFrameEx, DrawFlatControlFrameEx
*/
void GUIAPI Draw3DThinFrameEx (HDC hdc, HWND hwnd,
int l, int t, int r, int b, DWORD flags, gal_pixel fillc);
/* back compatibility definitions */
#define Draw3DUpThinFrame(hdc, l, t, r, b, fillc) \
Draw3DThinFrameEx(hdc, HWND_DESKTOP, l, t, r, b, DF_3DBOX_NORMAL | ((fillc)?DF_3DBOX_FILL:0), fillc)
#define Draw3DDownThinFrame(hdc, l, t, r, b, fillc) \
Draw3DThinFrameEx(hdc, HWND_DESKTOP, l, t, r, b, DF_3DBOX_PRESSED | ((fillc)?DF_3DBOX_FILL:0), fillc)
/**
* \fn void GUIAPI Draw3DBorderEx (HDC hdc, HWND hwnd, int l, int t, int r, int b)
* \brief Draws a 3D rectangle border.
*
* This function draws a 3D retangle border which is 2-pixel wide.
*
* \param hdc The device context.
* \param hwnd Tell the function to draw with the color definitions of this window.
* \param l The x-coordinate of upper-left corner of the rectangle.
* \param t The y-coordinate of upper-left corner of the rectangle.
* \param r The x-coordinate of lower-right corner of the rectangle.
* \param b The y-coordinate of lower-right corner of the rectangle.
*
* \sa Draw3DThinFrameEx, Draw3DThickFrameEx
*/
void GUIAPI Draw3DBorderEx (HDC hdc, HWND hwnd, int l, int t, int r, int b);
/* back compatibility definitions */
#define Draw3DBorder(hdc, l, t, r, b) \
Draw3DBorderEx(hdc, HWND_DESKTOP, l, t, r, b)
/**
* \fn void GUIAPI DisabledTextOutEx (HDC hdc, HWND hwnd, int x, int y, const char* szText)
* \brief Outputs disabled (grayed) text.
*
* This function outputs a grayed text at the specified position.
*
* \param hdc The device context.
* \param hwnd Tell the function to draw with the color definitions of this window.
* \param x The x-coordinate of start point.
* \param y The y-coordinate of start point.
* \param szText The null-terminated text to be outputted.
*
* \sa TextOut, DrawText
*/
void GUIAPI DisabledTextOutEx (HDC hdc, HWND hwnd, int x, int y, const char* szText);
/**
* \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
*
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -