mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-16 10:51:54 +08:00
db06460208
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
51 lines
1.7 KiB
C
51 lines
1.7 KiB
C
/*
|
||
* 程åº<C3A5>清å<E280A6>•ï¼šè‡ªå®šä¹‰æŽ§ä»¶
|
||
*
|
||
* 这个例å<C3A5>是è¦<C3A8>实现一个自定义控件,外观大致如
|
||
* |
|
||
* --o--
|
||
* |
|
||
* 的形状,ä¸é—´çš„o色彩表示了当å‰<C3A5>的状æ€<C3A6>,ON状æ€<C3A6>时是绿色,OFF状æ€<C3A6>时是红色ã€?
|
||
* 并且,这个oä½<C3A4>置接å<C2A5>—é¼ æ ‡ç‚¹å‡»ï¼Œç‚¹å‡»ä¸‹åˆ‡æ<E280A1>¢ä¸‹ç›¸åº”的状æ€<C3A6>ã€?
|
||
*/
|
||
#ifndef __MY_WIDGET_H__
|
||
#define __MY_WIDGET_H__
|
||
|
||
#include <rtgui/rtgui.h>
|
||
#include <rtgui/widgets/widget.h>
|
||
|
||
/* 自定义控件的状æ€<C3A6>值定ä¹?*/
|
||
#define MYWIDGET_STATUS_ON 1
|
||
#define MYWIDGET_STATUS_OFF 0
|
||
|
||
DECLARE_CLASS_TYPE(mywidget);
|
||
/** æ¯<C3A6>个控件会有一个类型,通过如下的å®<C3A5>获得控件相应的类型信æ<C2A1>?*/
|
||
#define RTGUI_MYWIDGET_TYPE (RTGUI_TYPE(mywidget))
|
||
/** 对一个对象实例,å<C592>¯ä»¥é€šè¿‡ä¸‹é<E280B9>¢çš„å®<C3A5>实现类型转æ<C2AC>¢ */
|
||
#define RTGUI_MYWIDGET(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_MYWIDGET_TYPE, rtgui_mywidget_t))
|
||
/** å<>¯ä»¥é€šè¿‡ä¸‹é<E280B9>¢çš„å®<C3A5>以决定一个具体实例是å<C2AF>¦æ˜¯è‡ªå®šä¹‰æŽ§ä»¶ç±»åž?*/
|
||
#define RTGUI_IS_MYWIDGET(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_MYWIDGET_TYPE))
|
||
|
||
/* 个性化控件类定�*/
|
||
struct rtgui_mywidget
|
||
{
|
||
/* 这个控件是继承自rtgui_widget控件 */
|
||
struct rtgui_widget parent;
|
||
|
||
/* 状æ€<C3A6>:ONã€<C3A3>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);
|
||
|
||
/* 控件的默认事件处ç<E2809E>†å‡½æ•°ã€?
|
||
* 对一个控件而言,如果派生自它的å<C3A5>控件很å<CB86>¯èƒ½ä¼šè°ƒç”¨çˆ¶æŽ§ä»¶çš„事件处ç<E2809E>†å‡½æ•°ï¼Œ
|
||
* 所以这里采用公开声明的方å¼<C3A5>ã€?
|
||
*/
|
||
rt_bool_t rtgui_mywidget_event_handler(struct rtgui_widget* widget, struct rtgui_event* event);
|
||
|
||
#endif
|