mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-12-26 17:18:24 +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:
@@ -4,84 +4,84 @@
|
||||
|
||||
static void _rtgui_staticline_constructor(rtgui_staticline_t *staticline)
|
||||
{
|
||||
/* init widget and set event handler */
|
||||
rtgui_rect_t rect = {0, 0, 100, 2};
|
||||
/* init widget and set event handler */
|
||||
rtgui_rect_t rect = {0, 0, 100, 2};
|
||||
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(staticline), &rect);
|
||||
staticline->orient= RTGUI_HORIZONTAL;
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(staticline), &rect);
|
||||
staticline->orient = RTGUI_HORIZONTAL;
|
||||
|
||||
rtgui_object_set_event_handler(RTGUI_OBJECT(staticline), rtgui_staticline_event_handler);
|
||||
rtgui_object_set_event_handler(RTGUI_OBJECT(staticline), rtgui_staticline_event_handler);
|
||||
}
|
||||
|
||||
|
||||
DEFINE_CLASS_TYPE(staticline, "staticline",
|
||||
RTGUI_WIDGET_TYPE,
|
||||
_rtgui_staticline_constructor,
|
||||
RT_NULL,
|
||||
sizeof(struct rtgui_staticline));
|
||||
DEFINE_CLASS_TYPE(staticline, "staticline",
|
||||
RTGUI_WIDGET_TYPE,
|
||||
_rtgui_staticline_constructor,
|
||||
RT_NULL,
|
||||
sizeof(struct rtgui_staticline));
|
||||
|
||||
rt_bool_t rtgui_staticline_event_handler(struct rtgui_object* object, struct rtgui_event* event)
|
||||
rt_bool_t rtgui_staticline_event_handler(struct rtgui_object *object, struct rtgui_event *event)
|
||||
{
|
||||
struct rtgui_staticline* staticline;
|
||||
RTGUI_WIDGET_EVENT_HANDLER_PREPARE
|
||||
struct rtgui_staticline *staticline;
|
||||
RTGUI_WIDGET_EVENT_HANDLER_PREPARE
|
||||
|
||||
staticline = RTGUI_STATICLINE(object);
|
||||
switch (event->type)
|
||||
{
|
||||
case RTGUI_EVENT_PAINT:
|
||||
staticline = RTGUI_STATICLINE(object);
|
||||
switch (event->type)
|
||||
{
|
||||
case RTGUI_EVENT_PAINT:
|
||||
#ifndef RTGUI_USING_SMALL_SIZE
|
||||
if (widget->on_draw != RT_NULL)
|
||||
widget->on_draw(RTGUI_OBJECT(widget), event);
|
||||
else
|
||||
if (widget->on_draw != RT_NULL)
|
||||
widget->on_draw(RTGUI_OBJECT(widget), event);
|
||||
else
|
||||
#endif
|
||||
rtgui_theme_draw_staticline(staticline);
|
||||
break;
|
||||
default:
|
||||
return rtgui_widget_event_handler(object, event);
|
||||
}
|
||||
rtgui_theme_draw_staticline(staticline);
|
||||
break;
|
||||
default:
|
||||
return rtgui_widget_event_handler(object, event);
|
||||
}
|
||||
|
||||
return RT_FALSE;
|
||||
return RT_FALSE;
|
||||
}
|
||||
RTM_EXPORT(rtgui_staticline_event_handler);
|
||||
|
||||
rtgui_staticline_t * rtgui_staticline_create(int orientation)
|
||||
rtgui_staticline_t *rtgui_staticline_create(int orientation)
|
||||
{
|
||||
rtgui_staticline_t* staticline;
|
||||
rtgui_staticline_t *staticline;
|
||||
|
||||
staticline = (struct rtgui_staticline*) rtgui_widget_create(RTGUI_STATICLINE_TYPE);
|
||||
if (staticline!= RT_NULL)
|
||||
{
|
||||
rtgui_staticline_set_orientation(staticline, orientation);
|
||||
}
|
||||
staticline = (struct rtgui_staticline *) rtgui_widget_create(RTGUI_STATICLINE_TYPE);
|
||||
if (staticline != RT_NULL)
|
||||
{
|
||||
rtgui_staticline_set_orientation(staticline, orientation);
|
||||
}
|
||||
|
||||
return staticline;
|
||||
return staticline;
|
||||
}
|
||||
RTM_EXPORT(rtgui_staticline_create);
|
||||
|
||||
void rtgui_staticline_destroy(rtgui_staticline_t* staticline)
|
||||
void rtgui_staticline_destroy(rtgui_staticline_t *staticline)
|
||||
{
|
||||
rtgui_widget_destroy(RTGUI_WIDGET(staticline));
|
||||
rtgui_widget_destroy(RTGUI_WIDGET(staticline));
|
||||
}
|
||||
RTM_EXPORT(rtgui_staticline_destroy);
|
||||
|
||||
void rtgui_staticline_set_orientation(rtgui_staticline_t* staticline, int orientation)
|
||||
void rtgui_staticline_set_orientation(rtgui_staticline_t *staticline, int orientation)
|
||||
{
|
||||
RT_ASSERT(staticline != RT_NULL);
|
||||
RT_ASSERT(staticline != RT_NULL);
|
||||
|
||||
staticline->orient = orientation;
|
||||
staticline->orient = orientation;
|
||||
#ifndef RTGUI_USING_SMALL_SIZE
|
||||
if (orientation == RTGUI_HORIZONTAL)
|
||||
{
|
||||
/* HORIZONTAL */
|
||||
rtgui_widget_set_miniheight(RTGUI_WIDGET(staticline), 2);
|
||||
rtgui_widget_set_miniwidth(RTGUI_WIDGET(staticline), 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* VERTICAL */
|
||||
rtgui_widget_set_miniwidth(RTGUI_WIDGET(staticline), 2);
|
||||
rtgui_widget_set_miniheight(RTGUI_WIDGET(staticline), 100);
|
||||
}
|
||||
if (orientation == RTGUI_HORIZONTAL)
|
||||
{
|
||||
/* HORIZONTAL */
|
||||
rtgui_widget_set_miniheight(RTGUI_WIDGET(staticline), 2);
|
||||
rtgui_widget_set_miniwidth(RTGUI_WIDGET(staticline), 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* VERTICAL */
|
||||
rtgui_widget_set_miniwidth(RTGUI_WIDGET(staticline), 2);
|
||||
rtgui_widget_set_miniheight(RTGUI_WIDGET(staticline), 100);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
RTM_EXPORT(rtgui_staticline_set_orientation);
|
||||
|
||||
Reference in New Issue
Block a user