mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-12-26 09:08:25 +00:00
sync RTGUI with github(https://github.com/RT-Thread/RTGUI) 9ae08379da5b698d6facc40bd0415de2e254ae9c
As always, full log is in GitHub. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2449 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -18,72 +18,72 @@
|
||||
|
||||
static void _rtgui_panel_constructor(rtgui_panel_t *panel)
|
||||
{
|
||||
/* init widget and set event handler */
|
||||
rtgui_object_set_event_handler(RTGUI_OBJECT(panel), rtgui_panel_event_handler);
|
||||
/* init widget and set event handler */
|
||||
rtgui_object_set_event_handler(RTGUI_OBJECT(panel), rtgui_panel_event_handler);
|
||||
|
||||
/* set field */
|
||||
panel->border_style = RTGUI_BORDER_NONE;
|
||||
/* set field */
|
||||
panel->border_style = RTGUI_BORDER_NONE;
|
||||
}
|
||||
|
||||
DEFINE_CLASS_TYPE(panel, "panel",
|
||||
RTGUI_CONTAINER_TYPE,
|
||||
_rtgui_panel_constructor,
|
||||
RT_NULL,
|
||||
sizeof(struct rtgui_panel));
|
||||
DEFINE_CLASS_TYPE(panel, "panel",
|
||||
RTGUI_CONTAINER_TYPE,
|
||||
_rtgui_panel_constructor,
|
||||
RT_NULL,
|
||||
sizeof(struct rtgui_panel));
|
||||
|
||||
rt_bool_t rtgui_panel_event_handler(struct rtgui_object *object, struct rtgui_event* event)
|
||||
rt_bool_t rtgui_panel_event_handler(struct rtgui_object *object, struct rtgui_event *event)
|
||||
{
|
||||
struct rtgui_panel* panel;
|
||||
struct rtgui_panel *panel;
|
||||
|
||||
panel = RTGUI_PANEL(object);
|
||||
switch (event->type)
|
||||
{
|
||||
case RTGUI_EVENT_PAINT:
|
||||
{
|
||||
struct rtgui_dc* dc;
|
||||
struct rtgui_rect rect;
|
||||
panel = RTGUI_PANEL(object);
|
||||
switch (event->type)
|
||||
{
|
||||
case RTGUI_EVENT_PAINT:
|
||||
{
|
||||
struct rtgui_dc *dc;
|
||||
struct rtgui_rect rect;
|
||||
|
||||
rtgui_widget_get_rect(RTGUI_WIDGET(object), &rect);
|
||||
|
||||
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(object));
|
||||
if (dc == RT_NULL) return RT_FALSE;
|
||||
rtgui_widget_get_rect(RTGUI_WIDGET(object), &rect);
|
||||
|
||||
rtgui_dc_fill_rect(dc, &rect);
|
||||
// rtgui_rect_inflate(&rect, RTGUI_WIDGET(panel)->);
|
||||
rtgui_dc_draw_border(dc, &rect, panel->border_style);
|
||||
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(object));
|
||||
if (dc == RT_NULL) return RT_FALSE;
|
||||
|
||||
/* paint on each child */
|
||||
rtgui_container_dispatch_event(RTGUI_CONTAINER(panel), event);
|
||||
rtgui_dc_fill_rect(dc, &rect);
|
||||
// rtgui_rect_inflate(&rect, RTGUI_WIDGET(panel)->);
|
||||
rtgui_dc_draw_border(dc, &rect, panel->border_style);
|
||||
|
||||
rtgui_dc_end_drawing(dc);
|
||||
}
|
||||
break;
|
||||
/* paint on each child */
|
||||
rtgui_container_dispatch_event(RTGUI_CONTAINER(panel), event);
|
||||
|
||||
default:
|
||||
return rtgui_container_event_handler(object, event);
|
||||
}
|
||||
rtgui_dc_end_drawing(dc);
|
||||
}
|
||||
break;
|
||||
|
||||
return RT_FALSE;
|
||||
default:
|
||||
return rtgui_container_event_handler(object, event);
|
||||
}
|
||||
|
||||
return RT_FALSE;
|
||||
}
|
||||
|
||||
rtgui_panel_t* rtgui_panel_create(int border_style)
|
||||
rtgui_panel_t *rtgui_panel_create(int border_style)
|
||||
{
|
||||
struct rtgui_panel* panel;
|
||||
struct rtgui_panel *panel;
|
||||
|
||||
panel = (struct rtgui_panel*) rtgui_widget_create(RTGUI_PANEL_TYPE);
|
||||
panel = (struct rtgui_panel *) rtgui_widget_create(RTGUI_PANEL_TYPE);
|
||||
if (panel != RT_NULL)
|
||||
{
|
||||
rtgui_rect_t rect = {0, 0, 100, 100};
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(panel), &rect);
|
||||
rtgui_rect_t rect = {0, 0, 100, 100};
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(panel), &rect);
|
||||
|
||||
panel->border_style = border_style;
|
||||
panel->border_style = border_style;
|
||||
}
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
void rtgui_panel_destroy(rtgui_panel_t* panel)
|
||||
void rtgui_panel_destroy(rtgui_panel_t *panel)
|
||||
{
|
||||
rtgui_object_destroy(RTGUI_OBJECT(panel));
|
||||
rtgui_object_destroy(RTGUI_OBJECT(panel));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user