mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-08-23 02:08:48 +08:00
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@878 bbd45198-f89e-11dd-88c7-29a3b14d5316
44 lines
1.4 KiB
C
44 lines
1.4 KiB
C
#ifndef __RTGUI_CHECKBOX_H__
|
|
#define __RTGUI_CHECKBOX_H__
|
|
|
|
#include <rtgui/rtgui.h>
|
|
#include <rtgui/widgets/widget.h>
|
|
#include <rtgui/widgets/label.h>
|
|
|
|
/** Gets the type of a button */
|
|
#define RTGUI_CHECKBOX_TYPE (rtgui_checkbox_type_get())
|
|
/** Casts the object to an rtgui_button */
|
|
#define RTGUI_CHECKBOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_CHECKBOX_TYPE, rtgui_checkbox))
|
|
/** Checks if the object is an rtgui_button */
|
|
#define RTGUI_IS_CHECKBOX(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_CHECKBOX_TYPE))
|
|
|
|
#define RTGUI_CHECKBOX_STATUS_CHECKED 0
|
|
#define RTGUI_CHECKBOX_STATUS_UNCHECKED 1
|
|
|
|
struct rtgui_checkbox
|
|
{
|
|
/* inherit from label */
|
|
struct rtgui_label parent;
|
|
|
|
/* check box status */
|
|
rt_uint8_t status_down;
|
|
|
|
/* click button event handler */
|
|
void (*on_button)(struct rtgui_widget* widget, rtgui_event_t *event);
|
|
};
|
|
typedef struct rtgui_checkbox rtgui_checkbox_t;
|
|
|
|
rtgui_type_t *rtgui_checkbox_type_get(void);
|
|
|
|
rtgui_checkbox_t* rtgui_checkbox_create(const char* text, rt_bool_t checked);
|
|
void rtgui_checkbox_destroy(rtgui_checkbox_t* checkbox);
|
|
|
|
void rtgui_checkbox_set_checked(rtgui_checkbox_t* checkbox, rt_bool_t checked);
|
|
rt_bool_t rtgui_checkbox_get_checked(rtgui_checkbox_t* checkbox);
|
|
|
|
void rtgui_checkbox_set_onbutton(rtgui_checkbox_t* checkbox, rtgui_onbutton_func_t func);
|
|
|
|
rt_bool_t rtgui_checkbox_event_handler(struct rtgui_widget* widget, struct rtgui_event* event);
|
|
|
|
#endif
|