Files
rt-thread/examples/gui/mywidget.h
T
chaos.proton@gmail.com db06460208 merge new RTGUI in to trunk
The full log is at https://github.com/RTGUI/RTGUI/commits/merge_1 and it's difficult to merge the new tree commit by commit. I also converted all the file into unix eol so there are many fake diff. Big changes are noted in rtgui/doc/road_map.txt and rtgui/doc/attention.txt. Keep an eye on them if you want to migrate your old code.

Note that the work is still in progress and the bsp is not prepared in trunk so far.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2092 bbd45198-f89e-11dd-88c7-29a3b14d5316
2012-04-18 15:06:12 +00:00

51 lines
1.7 KiB
C

/*
* ç¨‹åºæ¸…å•:自定义控件
*
* è¿™ä¸ªä¾‹å­æ˜¯è¦å®žçŽ°ä¸€ä¸ªè‡ªå®šä¹‰æŽ§ä»¶ï¼Œå¤–è§‚å¤§è‡´å¦‚
* |
* --o--
* |
* 的形状,中间的o色彩表示了当å‰çš„状æ€ï¼ŒONçŠ¶æ€æ—¶æ˜¯ç»¿è‰²ï¼ŒOFFçŠ¶æ€æ—¶æ˜¯çº¢è‰²ã€?
* 并且,这个oä½ç½®æŽ¥å—鼠标点击,点击下切æ¢ä¸‹ç›¸åº”的状æ€ã€?
*/
#ifndef __MY_WIDGET_H__
#define __MY_WIDGET_H__
#include <rtgui/rtgui.h>
#include <rtgui/widgets/widget.h>
/* 自定义控件的状æ€å€¼å®šä¹?*/
#define MYWIDGET_STATUS_ON 1
#define MYWIDGET_STATUS_OFF 0
DECLARE_CLASS_TYPE(mywidget);
/** æ¯ä¸ªæŽ§ä»¶ä¼šæœ‰ä¸€ä¸ªç±»åž‹ï¼Œé€šè¿‡å¦‚下的å®èŽ·å¾—æŽ§ä»¶ç›¸åº”çš„ç±»åž‹ä¿¡æ?*/
#define RTGUI_MYWIDGET_TYPE (RTGUI_TYPE(mywidget))
/** 对一个对象实例,å¯ä»¥é€šè¿‡ä¸‹é¢çš„å®å®žçŽ°ç±»åž‹è½¬æ¢ */
#define RTGUI_MYWIDGET(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_MYWIDGET_TYPE, rtgui_mywidget_t))
/** å¯ä»¥é€šè¿‡ä¸‹é¢çš„å®ä»¥å†³å®šä¸€ä¸ªå…·ä½“å®žä¾‹æ˜¯å¦æ˜¯è‡ªå®šä¹‰æŽ§ä»¶ç±»åž?*/
#define RTGUI_IS_MYWIDGET(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_MYWIDGET_TYPE))
/* 个性化控件类定�*/
struct rtgui_mywidget
{
/* 这个控件是继承自rtgui_widget控件 */
struct rtgui_widget parent;
/* 状æ€ï¼šONã€OFF */
rt_uint8_t status;
};
typedef struct rtgui_mywidget rtgui_mywidget_t;
/* 控件的创建和删除 */
struct rtgui_mywidget* rtgui_mywidget_create(rtgui_rect_t* r);
void rtgui_mywidget_destroy(struct rtgui_mywidget* me);
/* 控件的默认事件处ç†å‡½æ•°ã€?
* å¯¹ä¸€ä¸ªæŽ§ä»¶è€Œè¨€ï¼Œå¦‚æžœæ´¾ç”Ÿè‡ªå®ƒçš„å­æŽ§ä»¶å¾ˆå¯èƒ½ä¼šè°ƒç”¨çˆ¶æŽ§ä»¶çš„事件处ç†å‡½æ•°ï¼Œ
* 所以这里采用公开声明的方å¼ã€?
*/
rt_bool_t rtgui_mywidget_event_handler(struct rtgui_widget* widget, struct rtgui_event* event);
#endif