summaryrefslogtreecommitdiff
path: root/components/rtgui/widgets/staticline.c
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-04-18 15:06:12 +0000
committer[email protected] <[email protected]>2012-04-18 15:06:12 +0000
commitdb0646020812efc16ff0beebe35f9049dcc2bfed (patch)
tree5e949e9ba679a07b0198745853e900a016a3834e /components/rtgui/widgets/staticline.c
parent06d45f0c42f2aa3678d509403fcf9cd82be106e6 (diff)
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
Diffstat (limited to 'components/rtgui/widgets/staticline.c')
-rw-r--r--components/rtgui/widgets/staticline.c160
1 files changed, 80 insertions, 80 deletions
diff --git a/components/rtgui/widgets/staticline.c b/components/rtgui/widgets/staticline.c
index a1c38bbd20..19a1caed49 100644
--- a/components/rtgui/widgets/staticline.c
+++ b/components/rtgui/widgets/staticline.c
@@ -1,80 +1,80 @@
-#include <rtgui/dc.h>
-#include <rtgui/rtgui_theme.h>
-#include <rtgui/widgets/staticline.h>
-
-static void _rtgui_staticline_constructor(rtgui_staticline_t *staticline)
-{
- /* 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_event_handler(RTGUI_WIDGET(staticline), rtgui_staticline_event_handler);
-}
-
-
-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_widget* widget, struct rtgui_event* event)
-{
- struct rtgui_staticline* staticline;
- RT_ASSERT(widget != RT_NULL);
-
- staticline = (struct rtgui_staticline*) widget;
- switch (event->type)
- {
- case RTGUI_EVENT_PAINT:
-#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_draw != RT_NULL) widget->on_draw(widget, event);
- else
-#endif
- rtgui_theme_draw_staticline(staticline);
- break;
- }
-
- return RT_FALSE;
-}
-
-rtgui_staticline_t * rtgui_staticline_create(int orientation)
-{
- rtgui_staticline_t* staticline;
-
- staticline = (struct rtgui_staticline*) rtgui_widget_create(RTGUI_STATICLINE_TYPE);
- if (staticline!= RT_NULL)
- {
- rtgui_staticline_set_orientation(staticline, orientation);
- }
-
- return staticline;
-}
-
-void rtgui_staticline_destroy(rtgui_staticline_t* staticline)
-{
- rtgui_widget_destroy(RTGUI_WIDGET(staticline));
-}
-
-void rtgui_staticline_set_orientation(rtgui_staticline_t* staticline, int orientation)
-{
- RT_ASSERT(staticline != RT_NULL);
-
- 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);
- }
-#endif
-}
+#include <rtgui/dc.h>
+#include <rtgui/rtgui_theme.h>
+#include <rtgui/widgets/staticline.h>
+
+static void _rtgui_staticline_constructor(rtgui_staticline_t *staticline)
+{
+ /* 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_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));
+
+rt_bool_t rtgui_staticline_event_handler(struct rtgui_object* object, struct rtgui_event* event)
+{
+ struct rtgui_staticline* staticline;
+ RTGUI_WIDGET_EVENT_HANDLER_PREPARE
+
+ 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(widget, event);
+ else
+#endif
+ rtgui_theme_draw_staticline(staticline);
+ break;
+ }
+
+ return RT_FALSE;
+}
+
+rtgui_staticline_t * rtgui_staticline_create(int orientation)
+{
+ rtgui_staticline_t* staticline;
+
+ staticline = (struct rtgui_staticline*) rtgui_widget_create(RTGUI_STATICLINE_TYPE);
+ if (staticline!= RT_NULL)
+ {
+ rtgui_staticline_set_orientation(staticline, orientation);
+ }
+
+ return staticline;
+}
+
+void rtgui_staticline_destroy(rtgui_staticline_t* staticline)
+{
+ rtgui_widget_destroy(RTGUI_WIDGET(staticline));
+}
+
+void rtgui_staticline_set_orientation(rtgui_staticline_t* staticline, int orientation)
+{
+ RT_ASSERT(staticline != RT_NULL);
+
+ 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);
+ }
+#endif
+}