📄 skin.h
字号:
/** * \file skin.h * \author Feynman Software (http://www.minigui.com). * \date 2003/10/10 * * This file includes interfaces for skin module of MiniGUIExt library, * which provides skin support for MiniGUI applications. * \verbatim Copyright (C) 2003-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: skin.h,v 1.39 2005/01/05 06:26:37 panweiguo Exp $ * * MiniGUI for Linux/uClinux, eCos, uC/OS-II, and VxWorks version 1.6.x * Copyright (C) 2003-2004 Feynman Software. */#ifndef _MGUI_SKIN_H#define _MGUI_SKIN_H#ifdef _EXT_SKIN /** * \addtogroup mgext_fns Interfaces of the MiniGUI extension library (libmgext) * @{ */ /** * \defgroup mgext_skin_fns Skin related routines * * @{ *//* skin messages (send to items) */#define SKIN_MSG_LBUTTONDOWN 1#define SKIN_MSG_LBUTTONUP 2#define SKIN_MSG_CLICK 3//#define SKIN_MSG_DBCLICK 4#define SKIN_MSG_MOUSEMOVE 5#define SKIN_MSG_MOUSEDRAG 6#define SKIN_MSG_SETFOCUS 7#define SKIN_MSG_KILLFOCUS 8/* type of item */#define SI_TYPE_NRMLABEL 0x10000000#define SI_TYPE_BMPLABEL 0x20000000#define SI_TYPE_CMDBUTTON 0x30000000#define SI_TYPE_CHKBUTTON 0x40000000#define SI_TYPE_NRMSLIDER 0x50000000#ifdef _FIXED_MATH#define SI_TYPE_ROTSLIDER 0x60000000#endif#define SI_TYPE_CONTROL 0x70000000#define SI_TYPE_MASK 0xF0000000/* type of hittest shape */#define SI_TEST_SHAPE_RECT 0x01000000#ifdef _USE_NEWGAL#define SI_TEST_SHAPE_ELLIPSE 0x02000000#define SI_TEST_SHAPE_LOZENGE 0x03000000#define SI_TEST_SHAPE_LTRIANGLE 0x04000000#define SI_TEST_SHAPE_RTRIANGLE 0x05000000#define SI_TEST_SHAPE_UTRIANGLE 0x06000000#define SI_TEST_SHAPE_DTRIANGLE 0x07000000#endif#define SI_TEST_SHAPE_MASK 0x0F000000/* common status of item */#define SI_STATUS_OK 0x00000001#define SI_STATUS_VISIBLE 0x00000002#define SI_STATUS_DISABLED 0x00000004#define SI_STATUS_HILIGHTED 0x00000008#define SI_STATUS_MASK 0x0000000F/* status of button item */#define SI_BTNSTATUS_CLICKED 0x00000010#define SI_BTNSTATUS_CHECKED SI_BTNSTATUS_CLICKED#define SI_STATUS_CLICKED SI_BTNSTATUS_CLICKED#define SI_BTNSTATUS_MASK 0x000000F0/* style of command button item */#define SI_CMDBUTTON_2STATE 0x00000100/* style of normal slider item */#define SI_NRMSLIDER_HORZ 0x00000100#define SI_NRMSLIDER_VERT 0x00000200#define SI_NRMSLIDER_STATIC 0x00000400#ifdef _FIXED_MATH/* style of rotation slider item */#define SI_ROTSLIDER_CW 0x00000100#define SI_ROTSLIDER_ANTICW 0x00000200#define SI_ROTSLIDER_STATIC 0x00000400#endif /* _FIXED_MATH */#define SI_STYLE_MASK 0x0000FF00/* skin contrl class name */#define CTRL_SKIN "skin"typedef struct skin_item_ops_s skin_item_ops_t;typedef struct skin_head_s skin_head_t;/** Skin item information structure */typedef struct skin_item_s{ /** The identifier of the item. */ int id; /** * The style of the item. * * The style of an item is composed of five classes of information: * * - The type of an item. * - The hit-test shape type. * - The common status. * - The item specific status. * - The item specific style. * * The type of an item can be one of the following values: * * - SI_TYPE_NRMLABEL\n * The item is a normal label. * - SI_TYPE_BMPLABEL\n * The item is a bitmap label. * - SI_TYPE_CMDBUTTON\n * The item is a command button. * - SI_TYPE_CHKBUTTON\n * The item is a check button. * - SI_TYPE_NRMSLIDER\n * The item is a normal slider. * - SI_TYPE_ROTSLIDER\n * The item is a rotation slider. * * The hit-test shape type can be one of the following values: * * - SI_TEST_SHAPE_RECT\n * The hit-test shape is a rect. * - SI_TEST_SHAPE_ELLIPSE\n * The hit-test shape is an ellipse. * - SI_TEST_SHAPE_LOZENGE\n * The hit-test shape is a lozenge. * - SI_TEST_SHAPE_LTRIANGLE\n * The hit-test shape is a left triangle. * - SI_TEST_SHAPE_RTRIANGLE\n * The hit-test shape is a right triangle. * - SI_TEST_SHAPE_UTRIANGLE\n * The hit-test shape is a up triangle. * - SI_TEST_SHAPE_DTRIANGLE\n * The hit-test shape is a down triangle. * * The common status of an item can be OR'ed with the following values: * * - SI_STATUS_OK\n * The basic status of an item, always be there. * - SI_STATUS_VISIBLE\n * The item is visble. * - SI_STATUS_DISABLED\n * The item is disabled. * - SI_STATUS_HILIGHTED\n * The item is hilighted. * * The item specific status can be one of the following values: * * - SI_BTNSTATUS_CLICKED\n * The three-state button is clicked. * - SI_BTNSTATUS_CHECKED\n * The check button is ckecked. * * The item specific style can be a valued OR'ed with the following values: * * - SI_NRMSLIDER_HORZ\n * The normal slider is horizontal. * - SI_NRMSLIDER_VERT\n * The normal slider is vertical. * - SI_NRMSLIDER_STATIC\n * The normal slider is static, i.e., the slider acts like a progress bar. * - SI_ROTSLIDER_CW\n * The rotation slider is clockwise. * - SI_ROTSLIDER_ANTICW\n * The rotation slider is anti-clockwise. * - SI_ROTSLIDER_STATIC\n * The rotation slider is static, i.e., the slider acts like a progress bar. */ DWORD style; /** X-coordinate of the item in the skin. */ int x; /** Y-coordinate of the item in the skin. */ int y; /** The hit-test rectangle of the item. */ RECT rc_hittest; /** The index of the item bitmap in the skin bitmap array. */ int bmp_index; /** The tip text. */ char* tip; /** The attached private data with the item by application. */ DWORD attached; /** * The type-specific data of the item, * used to define extra information of the item. */ void* type_data; /******** start of internal fields ********/ /* The bounding rectangle of the item. */ RECT shape; /* The region for mouse hittest. */ CLIPRGN region; /* The operation routines of the item. */ skin_item_ops_t *ops; /* The parent skin. */ skin_head_t *hostskin;} skin_item_t;/* skin item operations */struct skin_item_ops_s{ /* operations for initialization and deinitialization. */ int (*init) (skin_head_t*, skin_item_t*); int (*deinit) (skin_item_t*); /* operations when creating and destroying the skin window. */ int (*on_create) (skin_item_t*); int (*on_destroy) (skin_item_t*); /* operations for item drawing. */ void (*draw_bg) (HDC, skin_item_t*); void (*draw_attached) (HDC, skin_item_t*); /* * operations for getting or setting item value. * for button item, value is the click status, non-zero for clicked or checked. * for slider, value is the position. * for label item, value is the label text. * for control item, value is the handle to control. */ DWORD (*get_value) (skin_item_t *item); DWORD (*set_value) (skin_item_t *item, DWORD status); /* item msg proc */ int (*item_msg_proc) (skin_item_t* item, int message, WPARAM wparam, LPARAM lparam);};/** Slider information structure */typedef struct sie_slider_s{ /** The minimal position of the thumb. */ int min_pos; /* The maximal position of the thumb. */ int max_pos; /* The current position of the thumb. */ int cur_pos;} sie_slider_t;/** Normal label item info structure */typedef struct si_nrmlabel_s{ /** The label string. */ char* label; /** The normal text color. */ DWORD color; /** The focus text color. */ DWORD color_focus; /** The click text color. */ DWORD color_click; /** The index of the logical font in the skin fonts array. */ int font_index;} si_nrmlabel_t;/** Bitmap label item info structure */typedef struct si_bmplabel_s{ /** The label string. */ char* label; /** All label characters in the bitmap. */ const char* label_chars;} si_bmplabel_t;/** Normal slider item info structure */typedef struct si_nrmslider_s{ /** The slider information */ sie_slider_t slider_info; /** The index of the thumb bitmap in the skin bitmaps array. */ int thumb_bmp_index;} si_nrmslider_t;#ifdef _FIXED_MATH/** Rotation slider item info structure */typedef struct si_rotslider_s{ /** The rotation radius. */ int radius; /** The start degree. */ int start_deg; /** The end degree. */ int end_deg; /** The current degree. */ int cur_pos; /** The index of the thumb bitmap in the skin bitmaps array. */ int thumb_bmp_index;} si_rotslider_t;#endif /* _FIXED_MATH */#define SIE_BUTTON_CLICKED 0x00000001
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -