summaryrefslogtreecommitdiff
path: root/components/rtgui_win/widgets/progressbar.c
diff options
context:
space:
mode:
author[email protected] <[email protected]>2011-03-24 14:12:30 +0000
committer[email protected] <[email protected]>2011-03-24 14:12:30 +0000
commit0621f30e9d4e69220991ad2a18ba6e89814f46f9 (patch)
tree87af4a64ad418226d98f216f3b5ea8e8e6406760 /components/rtgui_win/widgets/progressbar.c
parent0e93e6809c7beac4597148edc1dc09bcdf9a2ab3 (diff)
move rtgui_win to branches.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1346 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui_win/widgets/progressbar.c')
-rw-r--r--components/rtgui_win/widgets/progressbar.c128
1 files changed, 0 insertions, 128 deletions
diff --git a/components/rtgui_win/widgets/progressbar.c b/components/rtgui_win/widgets/progressbar.c
deleted file mode 100644
index 0de2595c53..0000000000
--- a/components/rtgui_win/widgets/progressbar.c
+++ /dev/null
@@ -1,128 +0,0 @@
-#include <rtgui/dc.h>
-#include <rtgui/rtgui_theme.h>
-#include <rtgui/widgets/progressbar.h>
-
-#define RTGUI_PROGRESSBAR_DEFAULT_RANGE 100
-
-static void _rtgui_progressbar_constructor(rtgui_progressbar_t *bar)
-{
- rtgui_rect_t rect = {0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT};
-
- rtgui_widget_set_event_handler(bar, rtgui_progressbar_event_handler);
- rtgui_widget_set_rect(bar, &rect);
-
- bar->orient = RTGUI_HORIZONTAL;
- bar->range = RTGUI_PROGRESSBAR_DEFAULT_RANGE;
- bar->position = 0;
-
- /* set gc */
- RTGUI_WIDGET_TEXTALIGN(bar) = RTGUI_ALIGN_CENTER_HORIZONTAL|RTGUI_ALIGN_CENTER_VERTICAL;
-}
-
-static void _rtgui_progressbar_destructor(rtgui_progressbar_t *bar)
-{
-
-}
-
-rtgui_type_t *rtgui_progressbar_type_get(void)
-{
- static rtgui_type_t *progressbar_type = RT_NULL;
-
- if(!progressbar_type)
- {
- progressbar_type = rtgui_type_create("progressbar", RTGUI_WIDGET_TYPE,
- sizeof(rtgui_progressbar_t),
- RTGUI_CONSTRUCTOR(_rtgui_progressbar_constructor),
- RTGUI_DESTRUCTOR(_rtgui_progressbar_destructor));
- }
-
- return progressbar_type;
-}
-
-rt_bool_t rtgui_progressbar_event_handler(PVOID wdt, rtgui_event_t* event)
-{
- rtgui_widget_t *widget = (rtgui_widget_t*)wdt;
- rtgui_progressbar_t* bar = (rtgui_progressbar_t*)widget;
-
- switch (event->type)
- {
- case RTGUI_EVENT_PAINT:
- if(widget->on_draw != RT_NULL)
- widget->on_draw(widget, event);
- else
- {
- rtgui_theme_draw_progressbar(bar);
- }
-
- break;
- }
-
- return RT_FALSE;
-}
-
-rtgui_progressbar_t* rtgui_progressbar_create(PVOID parent, int orient, int range, int left, int top, int w, int h)
-{
- rtgui_progressbar_t* bar;
-
- RT_ASSERT(parent != RT_NULL);
-
- bar = rtgui_widget_create (RTGUI_PROGRESSBAR_TYPE);
- if(bar != RT_NULL)
- {
- rtgui_rect_t rect;
- rtgui_widget_get_rect(bar, &rect);
- rtgui_widget_rect_to_device(parent,&rect);
- rect.x1 += left;
- rect.y1 += top;
- rect.x2 = rect.x1+w;
- rect.y2 = rect.y1+h;
- rtgui_widget_set_rect(bar, &rect);
-
- bar->orient = orient;
- bar->range = range;
-
- rtgui_container_add_child(parent, bar);
- }
-
- return bar;
-}
-
-void rtgui_progressbar_destroy(rtgui_progressbar_t* bar)
-{
- rtgui_widget_destroy(bar);
-}
-
-void rtgui_progressbar_set_value(rtgui_progressbar_t *bar, int value)
-{
- RT_ASSERT(bar != RT_NULL);
-
- bar->position = value;
-
- rtgui_theme_draw_progressbar(bar);
- return;
-}
-
-int rtgui_progressbar_get_value(rtgui_progressbar_t *bar)
-{
- RT_ASSERT(bar != RT_NULL);
-
- return bar->position;
-}
-
-void rtgui_progressbar_set_range(rtgui_progressbar_t *bar, int range)
-{
- RT_ASSERT(bar != RT_NULL);
-
- bar->range = range;
-
- rtgui_theme_draw_progressbar(bar);
- return;
-}
-
-int rtgui_progressbar_get_range(rtgui_progressbar_t *bar)
-{
- RT_ASSERT(bar != RT_NULL);
-
- return bar->range;
-}
-