Browse Source

remove rtgui-win

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2097 bbd45198-f89e-11dd-88c7-29a3b14d5316
chaos.proton@gmail.com 13 years ago
parent
commit
5e1494dd32

+ 0 - 46
examples/rtgui_win/SConscript

@@ -1,46 +0,0 @@
-Import('env')
-Import('projects')
-
-src = Split("""
-gui_init.c
-demo_gui_main.c
-demo_gui_benchmark.c
-demo_gui_button.c
-demo_gui_dc_buffer.c
-demo_gui_buffer_animation.c
-demo_gui_label.c
-demo_gui_radiobox.c
-demo_gui_window.c
-demo_gui_checkbox.c
-demo_gui_progressbar.c
-demo_gui_scrollbar.c
-demo_gui_textbox.c
-demo_gui_listbox.c
-demo_gui_combobox.c
-demo_gui_menu.c
-demo_gui_listctrl.c
-demo_gui_slider.c
-demo_gui_image.c
-demo_gui_fnview.c
-demo_gui_rttab.c
-""")
-
-group = {}
-group['name'] = 'GUI demo'
-group['src'] = File(src)
-group['CCFLAGS'] = ''
-group['CPPPATH'] = ['']
-group['CPPDEFINES'] = ''
-group['LINKFLAGS'] = ''
-
-# add group to project list
-projects.append(group)
-
-env.Append(CCFLAGS = group['CCFLAGS'])
-env.Append(CPPPATH = group['CPPPATH'])
-env.Append(CPPDEFINES = group['CPPDEFINES'])
-env.Append(LINKFLAGS = group['LINKFLAGS'])
-
-objs = env.Object(group['src'])
-
-Return('objs')

+ 0 - 118
examples/rtgui_win/demo_gui_animation.c

@@ -1,118 +0,0 @@
-#include <rtgui/dc.h>
-#include <rtgui/rtgui_system.h>
-#include <rtgui/widgets/widget.h>
-#include <rtgui/widgets/view.h>
-#include "demo_view.h"
-
-/*
- * 直接在DC上绘图以实现动画效果
- *
- * 动画是依赖于定时器驱动的,会上下翻滚显示文字
- * "飞线乱飞"
- */
-static rt_int8_t dx = 1, dy = 1;
-static rtgui_rect_t text_rect;
-static rtgui_timer_t *timer;
-
-void timeout(struct rtgui_timer* timer, void* parameter)
-{
-	struct rtgui_dc* dc;
-	rtgui_rect_t rect;
-	rtgui_widget_t *widget;
-
-	/* 控件(view)通过parameter参数传递给定时器 */
-	widget = (rtgui_widget_t*)parameter;
-
-	/* 获得控件所属的DC */
-	dc = rtgui_dc_begin_drawing(widget);
-	if (dc == RT_NULL) /* 如果不能正常获得DC,返回(如果控件或父控件是隐藏状态,DC是获取不成功的) */
-		return ;
-
-	/* 获得demo view允许绘图的区域,主要用于判断边界 */
-	rtgui_widget_get_rect(widget, &rect);
-	rtgui_rect_inflate(&rect, -5);
-	rect.y1 += 35;
-
-	/* 判断是否是第一次绘图 */
-	if ((text_rect.x1 == 0) && (text_rect.y1 == 0))
-	{
-		rtgui_rect_moveto(&text_rect, rect.x1, rect.y1);
-	}
-	else
-	{
-	    /* 擦除老的文字 */
-	    rtgui_dc_fill_rect(dc, &text_rect);
-	}
-
-    /* 设置dx和dy */
-	if (text_rect.x2 >= rect.x2) dx = -1;
-	if (text_rect.x1 < rect.x1)  dx = 1;
-	if (text_rect.y2 >= rect.y2) dy = -1;
-	if (text_rect.y1 < rect.y1) dy = 1;
-
-    /* 移动文本框的位置 */
-	text_rect.x1 += dx; text_rect.x2 += dx;
-	text_rect.y1 += dy; text_rect.y2 += dy;
-
-    /* 绘图 */
-	rtgui_dc_draw_text(dc, "飞线乱飞", &text_rect);
-
-	/* 绘图完成 */
-	rtgui_dc_end_drawing(dc);
-}
-
-rt_bool_t animation_event_handler(PVOID wdt, rtgui_event_t *event)
-{
-	rtgui_widget_t *widget = (rtgui_widget_t*)wdt;
-	if (event->type == RTGUI_EVENT_PAINT)
-	{
-		rtgui_dc_t* dc;
-		rtgui_rect_t rect;
-
-		/* 因为用的是demo view,上面本身有一部分控件,所以在绘图时先要让demo view先绘图 */
-		rtgui_view_event_handler(widget, event);
-
-		/* 获得控件所属的DC */
-		dc = rtgui_dc_begin_drawing(widget);
-		if (dc == RT_NULL) /* 如果不能正常获得DC,返回(如果控件或父控件是隐藏状态,DC是获取不成功的) */
-			return RT_FALSE;
-
-        /* 获得demo view允许绘图的区域 */
-        rtgui_widget_get_rect(widget, &rect);
-		rtgui_rect_inflate(&rect, -5);
-		rect.y1 += 35;
-
-	    /* 擦除所有 */
-	    rtgui_dc_fill_rect(dc, &rect);
-
-        /* 绘图 */
-        rtgui_dc_draw_text(dc, "飞线乱飞", &text_rect);
-
-		/* 绘图完成 */
-		rtgui_dc_end_drawing(dc);
-	}
-	else
-	{
-		/* 调用默认的事件处理函数 */
-		return rtgui_view_event_handler(widget, event);
-	}
-
-	return RT_FALSE;
-}
-
-rtgui_view_t *demo_gui_animation(rtgui_view_t* parent_view)
-{
-	rtgui_view_t *view;
-
-	view = demo_view_create(parent_view, "DC 动画");
-	if (view != RT_NULL)
-		rtgui_widget_set_event_handler(view, animation_event_handler);
-
-	rtgui_font_get_metrics(RTGUI_WIDGET_FONT(view), "飞线乱飞", &text_rect);
-	rtgui_rect_moveto(&text_rect, 5, 40);
-	/* 启动定时器以触发动画 */
-	timer = rtgui_timer_create(2, RT_TIMER_FLAG_PERIODIC, timeout, view);
-	rtgui_timer_start(timer);
-
-	return view;
-}

+ 0 - 119
examples/rtgui_win/demo_gui_benchmark.c

@@ -1,119 +0,0 @@
-#include <rtgui/dc.h>
-#include <rtgui/dc_hw.h>
-#include <rtgui/kbddef.h>
-#include <rtgui/rtgui_system.h>
-#include <rtgui/widgets/view.h>
-#include <stdlib.h>
-#include "demo_view.h"
-
-#if RT_VERSION == 4
-#define RAND(x1, x2) ((rand() % (x2 - x1)) + x1)
-
-static rtgui_view_t* view = RT_NULL;
-static int running = 0;
-
-void _onidle(PVOID wdt, rtgui_event_t *event)
-{
-	rtgui_color_t color;
-	rtgui_rect_t rect, draw_rect;
-	struct rtgui_dc *dc;
-
-	/* 获得控件所属的DC */
-	dc = rtgui_dc_begin_drawing(view);
-	if (dc == RT_NULL) return ;
-
-	rtgui_widget_get_rect(view, &rect);
-	rtgui_rect_inflate(&rect, -5);
-	rect.y1 += 35;
-	draw_rect.x1 = RAND(rect.x1, rect.x2);
-	draw_rect.y1 = RAND(rect.y1, rect.y2);
-	draw_rect.x2 = RAND(draw_rect.x1, rect.x2);
-	draw_rect.y2 = RAND(draw_rect.y1, rect.y2);
-
-	color = RTGUI_RGB(rand() % 255, rand() % 255, rand() % 255);
-	RTGUI_WIDGET_BACKGROUND(view) = color;
-
-	rtgui_dc_fill_rect(dc, &draw_rect);
-
-	/* 绘图完成 */
-	rtgui_dc_end_drawing(dc);
-}
-
-void _draw_default(PVOID wdt, rtgui_event_t* event)
-{
-	struct rtgui_dc* dc;
-	rtgui_widget_t* widget = (rtgui_widget_t*)wdt;
-	rtgui_rect_t rect;
-
-	/* 因为用的是demo view,上面本身有一部分控件,所以在绘图时先要让demo view先绘图 */
-	rtgui_view_event_handler(widget, event);
-
-	/* 获得控件所属的DC */
-	dc = rtgui_dc_begin_drawing(widget);
-	if (dc == RT_NULL) /* 如果不能正常获得DC,返回(如果控件或父控件是隐藏状态,DC是获取不成功的) */
-		return ;
-
-	/* 获得demo view允许绘图的区域 */
-	rtgui_widget_get_rect(widget, &rect);
-	rtgui_rect_inflate(&rect, -5);
-	rect.y1 += 35;
-
-	/* 擦除所有 */
-	RTGUI_WIDGET_BACKGROUND(widget) = default_background;
-	rtgui_dc_fill_rect(dc, &rect);
-
-	/* 显示提示 */
-	rtgui_dc_draw_text(dc, "按鼠标键开始/停止测试...", &rect);
-
-	/* 绘图完成 */
-	rtgui_dc_end_drawing(dc);
-}
-
-rt_bool_t benchmark_event_handler(PVOID wdt, rtgui_event_t *event)
-{
-	rtgui_widget_t *widget = (rtgui_widget_t*)wdt;
-
-	if (event->type == RTGUI_EVENT_PAINT)
-	{
-		_draw_default(widget, event);
-	}
-	else if (event->type == RTGUI_EVENT_MOUSE_BUTTON)
-	{
-		rtgui_event_mouse_t *emouse = (rtgui_event_mouse_t*)event;
-
-		if (emouse->button & RTGUI_MOUSE_BUTTON_DOWN)
-		{
-			if (running)
-			{
-				/* stop */
-				rtgui_thread_set_onidle(RT_NULL);
-				_draw_default(widget, event);
-			}
-			else
-			{
-				/* run */
-				rtgui_thread_set_onidle(_onidle);
-			}
-
-			running = !running;
-		}
-		return RT_TRUE;
-	}
-	else
-	{
-		/* 调用默认的事件处理函数 */
-		return rtgui_view_event_handler(widget, event);
-	}
-
-	return RT_FALSE;
-}
-
-rtgui_view_t *demo_gui_benchmark(rtgui_view_t* parent_view)
-{
-	srand(100);
-	view = demo_view_create(parent_view, "绘图测试");
-	rtgui_widget_set_event_handler(view, benchmark_event_handler);
-
-	return view;
-}
-#endif

+ 0 - 122
examples/rtgui_win/demo_gui_buffer_animation.c

@@ -1,122 +0,0 @@
-#include <rtgui/dc.h>
-#include <rtgui/rtgui_system.h>
-#include <rtgui/widgets/view.h>
-#include "demo_view.h"
-
-/*
- * 直接在DC上绘图以实现动画效果
- *
- * 动画是依赖于定时器驱动的,会上下翻滚显示文字
- * "飞线乱飞"
- */
-static rt_int8_t dx = 1, dy = 1;
-static rtgui_rect_t text_rect;
-static rtgui_timer_t *timer;
-static rtgui_dc_t *dc_buffer;
-static void timeout(struct rtgui_timer* timer, void* parameter)
-{
-	rtgui_dc_t* dc;
-	rtgui_rect_t rect;
-	rtgui_view_t *view;
-
-	/* 控件(view)通过parameter参数传递给定时器 */
-	view = (rtgui_view_t*)parameter;
-
-	/* 获得控件所属的DC */
-	dc = rtgui_dc_begin_drawing(view);
-	if (dc == RT_NULL) /* 如果不能正常获得DC,返回(如果控件或父控件是隐藏状态,DC是获取不成功的) */
-		return ;
-
-	/* 获得demo view允许绘图的区域,主要用于判断边界 */
-	rtgui_widget_get_rect(view, &rect);
-	rtgui_rect_inflate(&rect, -5);
-	rect.y1 += 35;
-
-	/* 判断是否是第一次绘图 */
-	if ((text_rect.x1 == 0) && (text_rect.y1 == 0))
-	{
-		rtgui_rect_moveto(&text_rect, rect.x1, rect.y1);
-	}
-
-    /* 设置dx和dy */
-	if (text_rect.x2 >= rect.x2) dx = -1;
-	if (text_rect.x1 < rect.x1)  dx = 1;
-	if (text_rect.y2 >= rect.y2) dy = -1;
-	if (text_rect.y1 < rect.y1) dy = 1;
-
-    /* 移动文本框的位置 */
-	text_rect.x1 += dx; text_rect.x2 += dx;
-	text_rect.y1 += dy; text_rect.y2 += dy;
-
-    /* 绘图 */
-	rect = text_rect;
-	rect.x2 += 2; rect.y2 += 2;
-	rtgui_dc_blit(dc_buffer, NULL, dc, &rect);
-
-	/* 绘图完成 */
-	rtgui_dc_end_drawing(dc);
-}
-
-static rt_bool_t animation_event_handler(PVOID wdt, rtgui_event_t *event)
-{
-	rtgui_widget_t* widget = (rtgui_widget_t*)wdt;
-	if (event->type == RTGUI_EVENT_PAINT)
-	{
-		struct rtgui_dc* dc;
-		rtgui_rect_t rect;
-
-		/* 因为用的是demo view,上面本身有一部分控件,所以在绘图时先要让demo view先绘图 */
-		rtgui_view_event_handler(widget, event);
-
-		/* 获得控件所属的DC */
-		dc = rtgui_dc_begin_drawing(widget);
-		if (dc == RT_NULL) /* 如果不能正常获得DC,返回(如果控件或父控件是隐藏状态,DC是获取不成功的) */
-			return RT_FALSE;
-
-		/* 绘图 */
-		rect = text_rect;
-		rtgui_dc_blit(dc_buffer, NULL, dc, &rect);
-
-		/* 绘图完成 */
-		rtgui_dc_end_drawing(dc);
-	}
-	else
-	{
-		/* 调用默认的事件处理函数 */
-		return rtgui_view_event_handler(widget, event);
-	}
-
-	return RT_FALSE;
-}
-
-rtgui_view_t *demo_gui_buffer_animation(rtgui_view_t* parent_view)
-{
-	rtgui_view_t *view;
-
-	view = demo_view_create(parent_view, "DC 缓冲区动画");
-	if (view != RT_NULL)
-		rtgui_widget_set_event_handler(view, animation_event_handler);
-
-	rtgui_font_get_metrics(RTGUI_WIDGET_FONT(view), "缓冲动画", &text_rect);
-	if (dc_buffer == RT_NULL)
-	{
-		rtgui_rect_t rect;
-
-		rect.x1 = 0; rect.x2 = rtgui_rect_width(text_rect) + 2;
-		rect.y1 = 0; rect.y2 = rtgui_rect_height(text_rect) + 2;
-
-		/* 创建 DC Buffer,长 50,宽 50 */
-		dc_buffer = rtgui_dc_buffer_create(rtgui_rect_width(rect), rtgui_rect_height(rect));
-		RTGUI_DC_FC(dc_buffer) = RTGUI_WIDGET_BACKGROUND(view);
-		rtgui_dc_fill_rect(dc_buffer, &rect);
-		RTGUI_DC_FC(dc_buffer) = black;
-		rect.x1 = 1; rect.y1 = 1;
-		rtgui_dc_draw_text(dc_buffer, "缓冲动画", &rect);
-	}
-
-	/* 启动定时器以触发动画 */
-	timer = rtgui_timer_create(1, RT_TIMER_FLAG_PERIODIC, timeout, view);
-	rtgui_timer_start(timer);
-
-	return view;
-}

+ 0 - 40
examples/rtgui_win/demo_gui_button.c

@@ -1,40 +0,0 @@
-/*
- * 程序清单:button控件演示
- *
- * 这个例子会在创建出的view上添加几个不同类型的button控件
- */
-
-#include "demo_view.h"
-#include <rtgui/widgets/button.h>
-
-/* 创建用于演示button控件的视图 */
-rtgui_view_t* demo_gui_button(rtgui_view_t* parent_view)
-{
-	rtgui_view_t* view;
-	rtgui_button_t* button;
-	rtgui_font_t* font;
-
-	/* 先创建一个演示用的视图 */
-	view = demo_view_create(parent_view, "Button View");
-
-	/* 创建一个button控件 */
-	button = rtgui_button_create(view, "Red", 5, 40, 100, 25);
-	/* 设置label控件的前景色为红色 */
-	RTGUI_WIDGET_FOREGROUND(button) = red;
-
-	button = rtgui_button_create(view, "Blue", 5, 70, 100, 25);
-	RTGUI_WIDGET_FOREGROUND(button) = blue;
-	
-	button = rtgui_button_create(view, "12 font", 5, 100, 100, 25);
-	/* 设置字体为12点阵的asc字体 */
-	font = rtgui_font_refer("asc", 12);
-	RTGUI_WIDGET_FONT(button) = font;
-	
-	button = rtgui_button_create(view, "16 font", 5, 130, 100, 25);
-	/* 设置字体为16点阵的asc字体 */
-	font = rtgui_font_refer("asc", 16);
-	RTGUI_WIDGET_FONT(button) = font;
-
-
-	return view;
-}

+ 0 - 37
examples/rtgui_win/demo_gui_checkbox.c

@@ -1,37 +0,0 @@
-/*
- * 程序清单:checkbox控件演示
- *
- * 这个例子会在创建出的view上添加几个checkbox控件
- */
-
-#include "demo_view.h"
-#include <rtgui/widgets/checkbox.h>
-
-/* 创建用于演示checkbox控件的视图 */
-rtgui_view_t* demo_gui_checkbox(rtgui_view_t* parent_view)
-{
-	rtgui_view_t* view;
-	rtgui_checkbox_t* checkbox;
-	rtgui_font_t* font;
-
-	/* 先创建一个演示用的视图 */
-	view = demo_view_create(parent_view, "CheckBox View");
-
-	/* 创建一个checkbox控件 */
-	checkbox = rtgui_checkbox_create(view, "Red", RT_TRUE, 5, 40);
-	/* 设置前景色为红色 */
-	RTGUI_WIDGET_FOREGROUND(checkbox) = red;
-
-	checkbox = rtgui_checkbox_create(view, "Blue", RT_TRUE, 5, 60);
-	RTGUI_WIDGET_FOREGROUND(checkbox) = blue;
-
-	checkbox = rtgui_checkbox_create(view, "12 font", RT_TRUE, 5, 80);
-	font = rtgui_font_refer("asc", 12);
-	RTGUI_WIDGET_FONT(checkbox) = font;
-
-	checkbox = rtgui_checkbox_create(view, "16 font", RT_TRUE, 5, 100);
-	font = rtgui_font_refer("asc", 16);
-	RTGUI_WIDGET_FONT(checkbox) = font;
-
-	return view;
-}

+ 0 - 31
examples/rtgui_win/demo_gui_combobox.c

@@ -1,31 +0,0 @@
-/*
- * 程序清单:label控件演示
- *
- * 这个例子会在创建出的view上添加几个不同类型的label控件
- */
-#include "demo_view.h"
-#include <rtgui/widgets/combobox.h>
-
-rtgui_listbox_item_t items[] = 
-{
-	{"item 1", RT_NULL},
-	{"item 2", RT_NULL},
-	{"item 3", RT_NULL},
-};
-
-/* 创建用于演示combobox控件的视图 */
-rtgui_view_t* demo_gui_combobox(rtgui_view_t* parent_view)
-{
-	rtgui_view_t* view;
-	rtgui_combo_t* box;
-
-	/* 先创建一个演示用的视图 */
-	view = demo_view_create(parent_view, "ComboBox View");
-
-	box = rtgui_combo_create(view, "demo combo", 5, 40, 120, 20);
-	rtgui_combo_set_items(box, items, RT_COUNT(items));
-	box->add_string(box, "add item 1");
-	box->add_string(box, "add item 2");
-
-	return view;
-}

+ 0 - 80
examples/rtgui_win/demo_gui_dc_buffer.c

@@ -1,80 +0,0 @@
-/*
- * 程序清单:DC Buffer演示
- *
- * 这个例子会在创建出的view上进行DC Buffer的演示
- */
-#include <rtgui/event.h>
-#include <rtgui/widgets/view.h>
-#include <rtgui/rtgui_system.h>
-#include <rtgui/widgets/label.h>
-#include <rtgui/widgets/slider.h>
-#include <rtgui/image.h>
-#include "demo_view.h"
-
-static struct rtgui_dc *dc_buffer;
-
-/*
- * view的事件处理函数
- */
-static rt_bool_t dc_buffer_event_handler(PVOID wdt, rtgui_event_t *event)
-{
-
-	/* 仅对PAINT事件进行处理 */
-	if (event->type == RTGUI_EVENT_PAINT)
-	{
-		struct rtgui_dc* dc;
-		rtgui_rect_t rect;
-
-		/*
-		 * 因为用的是demo view,上面本身有一部分控件,所以在绘图时先要让demo view
-		 * 先绘图
-		 */
-		rtgui_view_event_handler(wdt, event);
-
-		/* 获得控件所属的DC */
-		dc = rtgui_dc_begin_drawing(wdt);
-		/* 如果不能正常获得DC,返回(如果控件或父控件是隐藏状态,DC是获取不成功的) */
-		if (dc == RT_NULL)
-			return RT_FALSE;
-		rtgui_widget_get_rect(wdt, &rect);
-		rect.x1 += 10;
-		rect.y1 += 40;
-		rtgui_dc_blit(dc_buffer, NULL, dc, &rect);
-
-		/* 绘图完成 */
-		rtgui_dc_end_drawing(dc);
-	}
-	else
-	{
-		/* 其他事件,调用默认的事件处理函数 */
-		return rtgui_view_event_handler(wdt, event);
-	}
-
-	return RT_FALSE;
-}
-
-/* 创建用于DC Buffer操作演示用的视图 */
-rtgui_view_t *demo_gui_dc_buffer(rtgui_view_t* parent_view)
-{
-	rtgui_view_t *view;
-
-	if (dc_buffer == RT_NULL)
-	{
-		rtgui_rect_t rect = {0, 0, 50, 50};
-
-		/* 创建 DC Buffer,长 50,宽 50 */
-		dc_buffer = rtgui_dc_buffer_create(50, 50);
-		RTGUI_DC_FC(dc_buffer) = blue;
-		rtgui_dc_fill_rect(dc_buffer, &rect);
-
-		RTGUI_DC_FC(dc_buffer) = red;
-		rtgui_dc_draw_circle(dc_buffer, 25, 25, 10);
-	}
-
-	view = demo_view_create(parent_view, "缓冲DC演示");
-	if (view == RT_NULL) return RT_NULL;
-	/* 设置成自己的事件处理函数 */
-	rtgui_widget_set_event_handler(view, dc_buffer_event_handler);
-
-	return view;
-}

+ 0 - 44
examples/rtgui_win/demo_gui_fnview.c

@@ -1,44 +0,0 @@
-/*
- * 程序清单:文件列表视图演示
- *
- * 这个例子会先创建出一个演示用的view,当点击上面的按钮时会按照模式显示的形式显示
- * 新的文件列表视图。
- */
-#include "demo_view.h"
-#include <rtgui/widgets/label.h>
-#include <rtgui/widgets/button.h>
-#include <rtgui/widgets/filelist_view.h>
-
-#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
-
-/* 文件处理函数 */
-rt_bool_t demo_fview_on_item(PVOID wdt, struct rtgui_event *event)
-{
-	rt_kprintf("fview file on item.\n");
-	return RT_TRUE;
-}
-
-/* 创建用于演示文件列表视图的视图 */
-/* 方向键: 移动
- * 回车键: 进入下一级目录,或调用文件处理函数
- * 退格键: 返回上一级目录 
- */
-rtgui_view_t* demo_gui_fnview(rtgui_view_t* parent_view)
-{
-	rtgui_view_t *view;
-	rtgui_filelist_view_t *fview;
-
-	/* 创建演示用的视图 */
-	view = demo_view_create(parent_view, "FileList View");
-
-#ifdef _WIN32
-	fview = rtgui_filelist_view_create(view, "d:\\", "*.*", 5, 40, 200, 150);
-#else
-	fview = rtgui_filelist_view_create(view, "/", "*.*", 5, 40, 200, 150);
-#endif
-
-	fview->on_item = demo_fview_on_item;
-
-	return view;
-}
-#endif

+ 0 - 141
examples/rtgui_win/demo_gui_image.c

@@ -1,141 +0,0 @@
-/*
- * 程序清单:DC上显示图像演示
- *
- * 这个例子会在创建出的view上显示图像
- */
-
-#include "demo_view.h"
-#include <rtgui/widgets/button.h>
-#include <rtgui/widgets/filelist_view.h>
-#include <string.h>
-
-#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
-
-rtgui_filelist_view_t *demo_fview;
-static rtgui_view_t *image_view = RT_NULL;
-static rtgui_image_t *demo_image = RT_NULL;
-
-/* 打开文件处理函数,这里只处理图像文件 */
-rt_bool_t demo_image_fview_on_item(PVOID wdt, rtgui_event_t *event)
-{
-	rtgui_filelist_view_t *fview = wdt;
-	if(fview == RT_NULL) return RT_FALSE;
-
-	if(fview->pattern != RT_NULL && fview->items != RT_NULL)
-	{
-		char path[32], image_type[8];
-
-		/* 设置文件路径的标签 */
-		rtgui_filelist_view_get_fullpath(fview, path, sizeof(path));
-		if (demo_image != RT_NULL) 
-		{
-			rtgui_image_destroy(demo_image);
-			demo_image = RT_NULL;
-		}
-
-		rt_memset(image_type, 0, sizeof(image_type));
-
-		/* 获得图像的类型 */
-		if (rt_strstr(path, ".bmp") != RT_NULL ||
-			rt_strstr(path, ".BMP") != RT_NULL)
-			strcat(image_type, "bmp");
-		if (rt_strstr(path, ".png") != RT_NULL ||
-			rt_strstr(path, ".PNG") != RT_NULL)
-			strcat(image_type, "png");
-		if (rt_strstr(path, ".jpg") != RT_NULL ||
-			rt_strstr(path, ".JPG") != RT_NULL)
-			strcat(image_type, "jpeg");
-		if (rt_strstr(path, ".hdc") != RT_NULL ||
-			rt_strstr(path, ".HDC") != RT_NULL)
-			strcat(image_type, "hdc");
-		
-		/* 如果图像文件有效,创建相应的rtgui_image对象 */
-		if (image_type[0] != '\0')
-			demo_image = rtgui_image_create_from_file(image_type, path, RT_TRUE);
-	}
-
-	rtgui_widget_update(image_view);
-	return RT_TRUE;
-}
-
-/* 返回按钮的回调函数 */
-static void back_btn_onbutton(PVOID wdt, rtgui_event_t* event)
-{
-	if(demo_fview != RT_NULL)
-	{
-		rtgui_filelist_view_goto_topfolder(demo_fview);
-	}		
-}
-
-/* 打开按钮的回调函数 */
-static void open_btn_onbutton(PVOID wdt, rtgui_event_t* event)
-{
-	if(demo_fview != RT_NULL)
-	{
-		rtgui_filelist_view_on_enter(demo_fview);
-	}		
-}
-
-/* 演示视图的事件处理函数 */
-static rt_bool_t demo_gui_image_handler(PVOID wdt, rtgui_event_t *event)
-{
-	rtgui_widget_t* widget = wdt;
-
-	if(event->type == RTGUI_EVENT_PAINT)
-	{
-		struct rtgui_dc* dc;
-		rtgui_rect_t rect;
-
-		/* 获得控件所属的DC */
-		dc = rtgui_dc_begin_drawing(widget);
-		if(dc == RT_NULL) return RT_FALSE;
-
-		/* 获得demo view允许绘图的区域 */
-		rtgui_widget_get_rect(widget, &rect);
-		/* 清除背景 */
-		rtgui_dc_fill_rect(dc, &rect);
-		/* 绘制图片 */
-		if(demo_image != RT_NULL) rtgui_image_blit(demo_image, dc, &rect);
-
-		/* 绘图完成 */
-		rtgui_dc_end_drawing(dc);
-	}
-	else
-		return rtgui_view_event_handler(widget, event);
-	
-	return RT_TRUE;
-}
-
-/* 创建用于显示图像的演示视图 */
-rtgui_view_t* demo_gui_image(rtgui_view_t* parent_view)
-{
-	rtgui_button_t* button;
-	rtgui_view_t *view;
-	
-	/* 先创建一个演示视图 */
-	view = demo_view_create(parent_view, "图像演示");
-
-	/* 创建一个文件浏览列表 */
-#ifdef _WIN32
-	demo_fview = rtgui_filelist_view_create(view, "d:\\", "*.hdc", 5, 32, 200, 68);
-#else
-	demo_fview = rtgui_filelist_view_create(view, "/", "*.hdc", 5, 32, 200, 68);
-#endif
-	demo_fview->on_item = demo_image_fview_on_item;
-
-	/* 添加一个返回按钮,浏览文件夹时,用于返回上一级目录 */
-	button = rtgui_button_create(view, "back", 5, 102, 40, 24);
-	rtgui_button_set_onbutton(button, back_btn_onbutton);
-	/* 添加一个打开按钮,浏览文件夹是,用于进入下一级目录,或者打开文件 */
-	button = rtgui_button_create(view, "open", 5, 130, 40, 24);
-	rtgui_button_set_onbutton(button, open_btn_onbutton);
-	
-	/* 创建一个视图,用于显示图片 */
-	image_view = rtgui_view_create(view, "image_view", 50, 102, 160, 120);
-	if(image_view == RT_NULL) return RT_NULL;
-	/* 给image_view设置一个事件处理句柄 */
-	rtgui_widget_set_event_handler(image_view, demo_gui_image_handler);
-
-	return view;
-}
-#endif

+ 0 - 51
examples/rtgui_win/demo_gui_label.c

@@ -1,51 +0,0 @@
-/*
- * 程序清单:label控件演示
- *
- * 这个例子会在创建出的view上添加几个不同类型的label控件
- */
-#include "demo_view.h"
-#include <rtgui/widgets/label.h>
-
-/* 创建用于演示label控件的视图 */
-rtgui_view_t* demo_gui_label(rtgui_view_t* parent_view)
-{
-	rtgui_view_t* view;
-	rtgui_label_t* label;
-	rtgui_font_t* font;
-
-	/* 先创建一个演示用的视图 */
-	view = demo_view_create(parent_view, "Label View");
-
-	/* 创建一个label控件 */
-	label = rtgui_label_create(view, "Red Left", 10, 40, 200, 20);
-	/* 设置label控件上的文本对齐方式为:左对齐 */
-	RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_LEFT|RTGUI_ALIGN_CENTER_VERTICAL;
-	/* 设置label控件的前景色为红色 */
-	RTGUI_WIDGET_FOREGROUND(label) = red;
-	RTGUI_WIDGET_BACKGROUND(label) = white;
-	
-
-	label = rtgui_label_create(view, "Blue Right", 10, 65, 200, 20);
-	RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_RIGHT|RTGUI_ALIGN_CENTER_VERTICAL;
-	RTGUI_WIDGET_FOREGROUND(label) = blue;
-	RTGUI_WIDGET_BACKGROUND(label) = white;
-	
-	label = rtgui_label_create(view, "Green Center", 10, 90, 200, 20);
-	RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_CENTER_HORIZONTAL|RTGUI_ALIGN_CENTER_VERTICAL;
-	RTGUI_WIDGET_FOREGROUND(label) = green;
-	RTGUI_WIDGET_BACKGROUND(label) = white;
-	
-	label = rtgui_label_create(view, "12 font",10, 115, 200, 20);
-	/* 设置字体为12点阵的asc字体 */
-	font = rtgui_font_refer("asc", 12);
-	RTGUI_WIDGET_FONT(label) = font;
-	RTGUI_WIDGET_BACKGROUND(label) = white;
-
-	label = rtgui_label_create(view, "16 font", 10, 140, 200, 20);
-	font = rtgui_font_refer("asc", 16);
-	RTGUI_WIDGET_FONT(RTGUI_WIDGET(label)) = font;
-	RTGUI_WIDGET_BACKGROUND(label) = white;
-
-	return view;
-}
-

+ 0 - 203
examples/rtgui_win/demo_gui_listbox.c

@@ -1,203 +0,0 @@
-/*
- * 程序清单:label控件演示
- *
- * 这个例子会在创建出的view上添加几个不同类型的label控件
- */
-#include "demo_view.h"
-#include <rtgui/widgets/label.h>
-#include <rtgui/widgets/button.h>
-#include <rtgui/widgets/listbox.h>
-/*
-static rtgui_image_t* item_icon = RT_NULL;
-static const char * image_xpm[] = {
-	"16 16 106 2",
-	"  	c None",
-	". 	c #D0C83F",
-	"+ 	c #D0C840",
-	"@ 	c #D0C030",
-	"# 	c #D0B820",
-	"$ 	c #D0B020",
-	"% 	c #D0B01F",
-	"& 	c #5F571F",
-	"* 	c #F0F0C0",
-	"= 	c #FFF8D0",
-	"- 	c #FFF8C0",
-	"; 	c #FFF8B0",
-	"> 	c #FFF8A0",
-	", 	c #F0E870",
-	"' 	c #707030",
-	") 	c #4F87EF",
-	"! 	c #4F78C0",
-	"~ 	c #5088E0",
-	"{ 	c #5078C0",
-	"] 	c #C0D0F0",
-	"^ 	c #FFF8E0",
-	"/ 	c #FFF090",
-	"( 	c #F0E070",
-	"_ 	c #6F97D0",
-	": 	c #C0D8FE",
-	"< 	c #80A8F0",
-	"[ 	c #7088D0",
-	"} 	c #B0D0FF",
-	"| 	c #90B0F0",
-	"1 	c #1040A0",
-	"2 	c #F0F080",
-	"3 	c #707040",
-	"4 	c #7098F0",
-	"5 	c #3068E0",
-	"6 	c #A0B8F0",
-	"7 	c #4070C0",
-	"8 	c #002880",
-	"9 	c #404040",
-	"0 	c #505050",
-	"a 	c #F0F090",
-	"b 	c #F0E860",
-	"c 	c #F0D860",
-	"d 	c #807840",
-	"e 	c #2F5FC0",
-	"f 	c #1050D0",
-	"g 	c #1048B0",
-	"h 	c #002870",
-	"i 	c #C0C080",
-	"j 	c #C0C070",
-	"k 	c #F0F070",
-	"l 	c #F0E060",
-	"m 	c #E0D050",
-	"n 	c #00277F",
-	"o 	c #00287F",
-	"p 	c #1F3F6F",
-	"q 	c #1048C0",
-	"r 	c #0040B0",
-	"s 	c #204080",
-	"t 	c #FFF890",
-	"u 	c #F0D850",
-	"v 	c #E0C840",
-	"w 	c #807040",
-	"x 	c #A0B06F",
-	"y 	c #204880",
-	"z 	c #2048A0",
-	"A 	c #90A8C0",
-	"B 	c #FFF080",
-	"C 	c #F0D050",
-	"D 	c #C0A830",
-	"E 	c #6F682F",
-	"F 	c #F0F0A0",
-	"G 	c #E0D060",
-	"H 	c #B0A040",
-	"I 	c #D0B840",
-	"J 	c #E0C040",
-	"K 	c #D0B030",
-	"L 	c #706820",
-	"M 	c #5F581F",
-	"N 	c #CFBF3F",
-	"O 	c #FFF0A0",
-	"P 	c #A09830",
-	"Q 	c #A08820",
-	"R 	c #908030",
-	"S 	c #807830",
-	"T 	c #707020",
-	"U 	c #605820",
-	"V 	c #6F672F",
-	"W 	c #D0C040",
-	"X 	c #F0E880",
-	"Y 	c #907820",
-	"Z 	c #B09820",
-	"` 	c #B09010",
-	" .	c #B08820",
-	"..	c #806820",
-	"+.	c #5F5F1F",
-	"@.	c #F0E080",
-	"#.	c #B09020",
-	"$.	c #C0B040",
-	"%.	c #A09030",
-	"&.	c #908020",
-	"*.	c #606020",
-	"=.	c #6F5F1F",
-	"-.	c #9F982F",
-	";.	c #A0872F",
-	">.	c #6F681F",
-	",.	c #706020",
-	"                                ",
-	"          . + + + @ @ # # $ % & ",
-	"          + * = = = = - ; > , ' ",
-	"  ) !     ~ { ] ^ = - - > / ( ' ",
-	"_ : < { [ } | 1 - ; > > / 2 ( 3 ",
-	"{ 4 5 1 6 7 5 8 9 0 a / , b c d ",
-	"e f g h 8 8 g h i j / k l c m d ",
-	"  n o   p q r s t 2 , l c u v w ",
-	"        x y z A B , l u C v D E ",
-	"        @ F > t k G H I J K L M ",
-	"      N @ O / 2 l P Q R S T U V ",
-	"      W m 2 X l I Y Z `  ...+.  ",
-	"      W @.l u I R #.Z Y U M     ",
-	"    $.G I $.%.R &.Y *.& =.      ",
-	"  -.;.>.,.L L ,.& M             ",
-	"                                "};
-*/
-static struct rtgui_listbox_item items[] =
-{
-	{"list #0", RT_NULL},
-	{"list #1", RT_NULL},
-	{"list #2", RT_NULL},
-	{"list #3", RT_NULL},
-};
-
-rtgui_listbox_t *__lbox;
-
-/* 给列表添加一个项目 */
-void user_add_one_item(PVOID wdt, rtgui_event_t *event)
-{
-	rtgui_listbox_item_t item={"new item", RT_NULL};
-	if(__lbox != RT_NULL)
-	{
-		__lbox->add_item(__lbox, &item);
-	}	 	
-}
-
-void user_set_one_item(PVOID wdt, rtgui_event_t *event)
-{
-	if(__lbox != RT_NULL)
-	{
-		rtgui_listbox_update_aloc(__lbox, __lbox->item_count-1);
-	}	 	
-}
-
-static rt_bool_t on_items(PVOID wdt, rtgui_event_t* event)
-{
-	rtgui_listbox_t* box;
-	/* get listbox */
-	box = RTGUI_LISTBOX(wdt);
-
-	/* 打印当前的项 */
-	rt_kprintf("current item: %d\n", box->now_aloc);
-
-	return RT_TRUE;
-}
-
-/* 创建用于演示label控件的视图 */
-rtgui_view_t* demo_gui_listbox(rtgui_view_t* parent_view)
-{
-	rtgui_view_t* view;
-	rtgui_button_t* button;
-
-	/* 先创建一个演示用的视图 */
-	view = demo_view_create(parent_view, "ListBox Demo");
-
-	/* if (item_icon == RT_NULL)
-		item_icon = rtgui_image_create_from_mem("xpm",
-			(const rt_uint8_t*)image_xpm, sizeof(image_xpm), RT_TRUE);
-	items[1].image = item_icon; */
-
-	rtgui_label_create(view, "listbox: ", 5, 35, 100, 20);
-	__lbox = rtgui_listbox_create(view, 5, 55, 120, 115, RTGUI_BORDER_SUNKEN);
-	rtgui_listbox_set_items(__lbox, items, RT_COUNT(items));
-	rtgui_listbox_set_onitem(__lbox, on_items);
-
-	button = rtgui_button_create(view, "Add", 5, 175, 50, 20);
-	rtgui_button_set_onbutton(button, user_add_one_item);
-
-	button = rtgui_button_create(view, "last", 65, 175, 50, 20);
-	rtgui_button_set_onbutton(button, user_set_one_item);
-
-	return view;
-}

+ 0 - 235
examples/rtgui_win/demo_gui_listctrl.c

@@ -1,235 +0,0 @@
-/*
- * 程序清单:label控件演示
- *
- * 这个例子会在创建出的view上添加几个不同类型的label控件
- */
-#include "demo_view.h"
-#include <rtgui/widgets/label.h>
-#include <rtgui/widgets/listctrl.h>
-
-static rtgui_image_t* item_icon = RT_NULL;
-static const char * image_xpm[] = {
-	"16 16 106 2",
-	"  	c None",
-	". 	c #D0C83F",
-	"+ 	c #D0C840",
-	"@ 	c #D0C030",
-	"# 	c #D0B820",
-	"$ 	c #D0B020",
-	"% 	c #D0B01F",
-	"& 	c #5F571F",
-	"* 	c #F0F0C0",
-	"= 	c #FFF8D0",
-	"- 	c #FFF8C0",
-	"; 	c #FFF8B0",
-	"> 	c #FFF8A0",
-	", 	c #F0E870",
-	"' 	c #707030",
-	") 	c #4F87EF",
-	"! 	c #4F78C0",
-	"~ 	c #5088E0",
-	"{ 	c #5078C0",
-	"] 	c #C0D0F0",
-	"^ 	c #FFF8E0",
-	"/ 	c #FFF090",
-	"( 	c #F0E070",
-	"_ 	c #6F97D0",
-	": 	c #C0D8FE",
-	"< 	c #80A8F0",
-	"[ 	c #7088D0",
-	"} 	c #B0D0FF",
-	"| 	c #90B0F0",
-	"1 	c #1040A0",
-	"2 	c #F0F080",
-	"3 	c #707040",
-	"4 	c #7098F0",
-	"5 	c #3068E0",
-	"6 	c #A0B8F0",
-	"7 	c #4070C0",
-	"8 	c #002880",
-	"9 	c #404040",
-	"0 	c #505050",
-	"a 	c #F0F090",
-	"b 	c #F0E860",
-	"c 	c #F0D860",
-	"d 	c #807840",
-	"e 	c #2F5FC0",
-	"f 	c #1050D0",
-	"g 	c #1048B0",
-	"h 	c #002870",
-	"i 	c #C0C080",
-	"j 	c #C0C070",
-	"k 	c #F0F070",
-	"l 	c #F0E060",
-	"m 	c #E0D050",
-	"n 	c #00277F",
-	"o 	c #00287F",
-	"p 	c #1F3F6F",
-	"q 	c #1048C0",
-	"r 	c #0040B0",
-	"s 	c #204080",
-	"t 	c #FFF890",
-	"u 	c #F0D850",
-	"v 	c #E0C840",
-	"w 	c #807040",
-	"x 	c #A0B06F",
-	"y 	c #204880",
-	"z 	c #2048A0",
-	"A 	c #90A8C0",
-	"B 	c #FFF080",
-	"C 	c #F0D050",
-	"D 	c #C0A830",
-	"E 	c #6F682F",
-	"F 	c #F0F0A0",
-	"G 	c #E0D060",
-	"H 	c #B0A040",
-	"I 	c #D0B840",
-	"J 	c #E0C040",
-	"K 	c #D0B030",
-	"L 	c #706820",
-	"M 	c #5F581F",
-	"N 	c #CFBF3F",
-	"O 	c #FFF0A0",
-	"P 	c #A09830",
-	"Q 	c #A08820",
-	"R 	c #908030",
-	"S 	c #807830",
-	"T 	c #707020",
-	"U 	c #605820",
-	"V 	c #6F672F",
-	"W 	c #D0C040",
-	"X 	c #F0E880",
-	"Y 	c #907820",
-	"Z 	c #B09820",
-	"` 	c #B09010",
-	" .	c #B08820",
-	"..	c #806820",
-	"+.	c #5F5F1F",
-	"@.	c #F0E080",
-	"#.	c #B09020",
-	"$.	c #C0B040",
-	"%.	c #A09030",
-	"&.	c #908020",
-	"*.	c #606020",
-	"=.	c #6F5F1F",
-	"-.	c #9F982F",
-	";.	c #A0872F",
-	">.	c #6F681F",
-	",.	c #706020",
-	"                                ",
-	"          . + + + @ @ # # $ % & ",
-	"          + * = = = = - ; > , ' ",
-	"  ) !     ~ { ] ^ = - - > / ( ' ",
-	"_ : < { [ } | 1 - ; > > / 2 ( 3 ",
-	"{ 4 5 1 6 7 5 8 9 0 a / , b c d ",
-	"e f g h 8 8 g h i j / k l c m d ",
-	"  n o   p q r s t 2 , l c u v w ",
-	"        x y z A B , l u C v D E ",
-	"        @ F > t k G H I J K L M ",
-	"      N @ O / 2 l P Q R S T U V ",
-	"      W m 2 X l I Y Z `  ...+.  ",
-	"      W @.l u I R #.Z Y U M     ",
-	"    $.G I $.%.R &.Y *.& =.      ",
-	"  -.;.>.,.L L ,.& M             ",
-	"                                "};
-
-static struct list_item
-{
-	const char* name;
-	const char* gender;
-	int age;
-	rtgui_image_t* image;
-} items[] = 
-{
-	{"index0", "00", 30, RT_NULL},
-	{"index1", "m1", 30, RT_NULL},
-	{"index2", "m2", 30, RT_NULL},
-	{"index3", "m3", 30, RT_NULL},
-	{"index4", "m4", 30, RT_NULL},
-	{"index5", "m5", 30, RT_NULL},
-	{"index6", "m6", 30, RT_NULL},
-	{"index7", "m7", 30, RT_NULL},
-	{"index8", "m8", 30, RT_NULL},
-	{"index9", "m9", 30, RT_NULL},
-	{"index10", "m10", 30, RT_NULL},
-	{"index11", "m11", 30, RT_NULL},
-	{"index12", "m12", 30, RT_NULL},
-	{"index13", "m13", 30, RT_NULL},
-	{"index14", "m14", 30, RT_NULL},
-	{"index15", "m15", 30, RT_NULL},
-	{"index16", "m16", 30, RT_NULL},
-	{"index17", "m17", 30, RT_NULL},
-	{"index18", "m18", 30, RT_NULL},
-	{"index19", "m19", 30, RT_NULL},
-};
-
-void _rtgui_listctrl_item_draw(rtgui_listctrl_t *list, struct rtgui_dc* dc, rtgui_rect_t* rect, rt_uint16_t index)
-{
-	char age_str[8];
-	rtgui_rect_t item_rect;
-	struct list_item *items, *item;
-
-	item_rect = *rect;
-	item_rect.x1 += 5;
-	items = (struct list_item*)list->items;
-	item = &items[index];
-
-	/* draw text */
-	rtgui_dc_draw_text(dc, item->name, &item_rect); item_rect.x1 += 60;
-	rtgui_dc_draw_vline(dc, item_rect.x1, item_rect.y1, item_rect.y2);
-
-	item_rect.x1 += 5;
-	rtgui_dc_draw_text(dc, item->gender, &item_rect); item_rect.x1 += 60;
-	rtgui_dc_draw_vline(dc, item_rect.x1, item_rect.y1, item_rect.y2);
-
-	item_rect.x1 += 5;
-	rt_snprintf(age_str, sizeof(age_str), "%d", item->age);
-	rtgui_dc_draw_text(dc, age_str, &item_rect); item_rect.x1 += 40;
-	rtgui_dc_draw_vline(dc, item_rect.x1, item_rect.y1, item_rect.y2);
-
-	item_rect.x1 += 5;
-
-	/* draw image */
-	if (item->image != RT_NULL)
-	{
-		rtgui_rect_t image_rect;
-
-		image_rect.x1 = 0; image_rect.y1 = 0;
-		image_rect.x2 = item->image->w; image_rect.y2 = item->image->h;
-		rtgui_rect_moveto_align(&item_rect, &image_rect, RTGUI_ALIGN_CENTER_VERTICAL);
-		rtgui_image_blit(item->image, dc, &image_rect);
-	}
-}
-
-static void on_items(rtgui_widget_t* widget, struct rtgui_event* event)
-{
-	rtgui_listctrl_t* ctrl;
-	/* get listctrl */
-	ctrl = RTGUI_LISTCTRL(widget);
-
-	/* 打印当前的项 */
-	rt_kprintf("current item: %d\n", ctrl->current_item);
-}
-
-/* 创建用于演示label控件的视图 */
-rtgui_view_t* demo_gui_listctrl(rtgui_view_t* parent_view)
-{
-	rtgui_view_t* view;
-	rtgui_listctrl_t* box;
-
-	/* 先创建一个演示用的视图 */
-	view = demo_view_create(parent_view, "List Control Demo");
-
-	if (item_icon == RT_NULL)
-		item_icon = rtgui_image_create_from_mem("xpm",
-			(const rt_uint8_t*)image_xpm, sizeof(image_xpm), RT_TRUE);
-	items[1].image = item_icon; 
-
-	rtgui_label_create(view, "List Control: ", 5, 40, 120, 20);
-
-	box = rtgui_listctrl_create(view, (rt_uint32_t)items, sizeof(items)/sizeof(items[0]), 
-			5, 60, 210, 100, _rtgui_listctrl_item_draw);
-	rtgui_listctrl_set_onitem(box, on_items);
-
-	return view;
-}

+ 0 - 177
examples/rtgui_win/demo_gui_main.c

@@ -1,177 +0,0 @@
-/*
- * 这个一个RTGUI的例子,演示了如何创建一个RTGUI程序
- * 在rtgui_win这个分支中,没有toplevel控件,默认panel
- * 作为toplevel级别控件,可以把它看作一个“桌面”
- */
-#include <rtthread.h>
-#include <rtgui/rtgui.h>
-#include <panel.h>
-#include <rtgui/event.h>
-#include <rtgui/widgets/widget.h>
-#include <rtgui/widgets/button.h>
-#include <rtgui/widgets/view.h>
-#include <rtgui/rtgui_theme.h>
-
-#include "demo_view.h"
-
-/* 用于存放演示视图的数组,最多可创建32个演示视图 */
-static rtgui_view_t* demo_list[32];
-/* 当前演示视图索引 */
-static rt_uint16_t demo_current = 0;
-/* 总共包括的演示视图数目 */
-static rt_uint16_t demo_number = 0;
-
-/* 显示前一个演示视图 */
-void demo_gui_prev(PVOID wdt, rtgui_event_t *event)
-{
-	rtgui_panel_t *panel = rtgui_panel_get();
-
-	if (demo_current != 0)
-	{
-		RTGUI_WIDGET_HIDE(demo_list[demo_current]);
-		demo_current --;
-		RTGUI_WIDGET_UNHIDE(demo_list[demo_current]);
-		rtgui_panel_update_clip(panel);
-		rtgui_panel_redraw(&RTGUI_WIDGET_EXTENT(demo_list[demo_current]));
-	}
-}
-
-/* 显示下一个演示视图 */
-void demo_gui_next(PVOID wdt, rtgui_event_t *event)
-{
-	rtgui_panel_t *panel = rtgui_panel_get();
-
-	if (demo_current + 1< demo_number)
-	{
-		RTGUI_WIDGET_HIDE(demo_list[demo_current]);
-		demo_current ++;
-		RTGUI_WIDGET_UNHIDE(demo_list[demo_current]);
-		rtgui_panel_update_clip(panel);
-		rtgui_panel_redraw(&RTGUI_WIDGET_EXTENT(demo_list[demo_current]));
-	}
-}
-
-rtgui_view_t* demo_view_create(rtgui_view_t* parent_view, const char* title)
-{
-	rtgui_view_t* view;
-
-	/* 设置视图的名称 */
-	view = rtgui_view_create(parent_view, title, 0,0,
-				rtgui_widget_get_width(parent_view),
-				rtgui_widget_get_height(parent_view));
-	if (view == RT_NULL) return RT_NULL;
-	rtgui_widget_set_style(view, RTGUI_BORDER_SIMPLE);
-	RTGUI_WIDGET_HIDE(view);
-
-	/* 创建标题用的标签 */
-	rtgui_label_create(view, title, 10, 5, 200, 20);
-	/* 创建一个水平的staticline线 */
-	rtgui_staticline_create(view, 10, 30, 2, rtgui_widget_get_width(view)-20, RTGUI_HORIZONTAL);
-
-	/* 创建成功后,添加到数组中 */
-	demo_list[demo_number] = view;
-	demo_number ++;
-
-	return view;
-}
-static void rtgui_panel_entry(void* parameter)
-{
-	const struct rtgui_graphic_driver* gd = rtgui_graphic_driver_get_default();
-	struct rt_messagequeue* mq;
-	rtgui_panel_t *panel;
-	rtgui_view_t *view;
-	rtgui_button_t *button;
-	
-	/* 创建GUI应用需要的消息队列 */
-	mq = rt_mq_create("Panel", 256, 32, RT_IPC_FLAG_FIFO);
-	/* 注册当前线程为GUI线程 */
-	rtgui_thread_register(rt_thread_self(), mq);
-	panel = rtgui_panel_create(0,0,gd->width,gd->height);
-
-	//{{{ TODO: START ADD CODE HERE.
-
-	view = rtgui_view_create(panel, "demo_view", 5, 5, gd->width-10,gd->height-40);
-
-	button = rtgui_button_create(panel, "Prev", 5,gd->height-30,50,25);
-	rtgui_button_set_onbutton(button, demo_gui_prev);
-	button = rtgui_button_create(panel, "Next", gd->width-55,gd->height-30,50,25);
-	rtgui_button_set_onbutton(button, demo_gui_next);
-
-
-	/* 初始化各个例子的视图 */
-#if RT_VERSION == 4
-	demo_gui_benchmark(view);
-#endif
-
-/*	demo_view_dc(view);
-#if RT_VERSION == 4
-#ifdef RTGUI_USING_TTF
-	demo_view_ttf(view);
-#endif
-#endif */
-
-#ifndef RTGUI_USING_SMALL_SIZE
-	demo_gui_dc_buffer(view);
-#endif
-	demo_gui_animation(view);
-#ifndef RTGUI_USING_SMALL_SIZE
-	demo_gui_buffer_animation(view);
-#endif
-	demo_gui_window(view);
-	demo_gui_label(view);
-	demo_gui_button(view);
-	demo_gui_checkbox(view);
-	demo_gui_progressbar(view);
-	demo_gui_scrollbar(view);
-	demo_gui_radiobox(view);
-	demo_gui_textbox(view);
-	demo_gui_listbox(view);
-	demo_gui_menu(view);
-	demo_gui_listctrl(view);
-	demo_gui_combobox(view);
-	demo_gui_slider(view);
-
-#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
-	demo_gui_image(view);
-#endif
-#ifdef RT_USING_MODULE	
-#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
-	demo_gui_module(view);
-#endif
-#endif
-	/* demo_gui_listview(view); */
-	/* demo_gui_listview_icon(view); */
-#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
-	demo_gui_fnview(view);
-#endif
-	demo_gui_rttab(view);
-	rtgui_view_show(demo_list[demo_current]);
-
-	//}}} END ADD CODE.
-
-	rtgui_panel_show(panel);	
-
-	/* 执行工作台事件循环 */
-	rtgui_panel_event_loop(panel);
-	
-	/* 去注册GUI线程 */
-	rtgui_thread_deregister(rt_thread_self());
-	rt_mq_delete(mq);
-}
-
-void rtgui_panel_init(void)
-{
-	static rt_bool_t main_inited = RT_FALSE;
-
-	if(main_inited == RT_FALSE) /* 避免重复初始化而做的保护 */
-	{
-		struct rt_thread* tid;
-
-		tid = rt_thread_create("Panel", rtgui_panel_entry, RT_NULL, 4096, 4, 5);
-
-		if(tid != RT_NULL) rt_thread_startup(tid);
-
-		main_inited = RT_TRUE;
-	}
-}
-

+ 0 - 51
examples/rtgui_win/demo_gui_menu.c

@@ -1,51 +0,0 @@
-/*
- * 程序清单:menu控件演示
- *
- * 这个例子会在创建出的view上添加几个不同类型的label控件
- */
-#include "demo_view.h"
-#include <rtgui/widgets/menu.h>
-#include <rtgui/widgets/button.h>
-
-/* 创建用于演示menu控件的视图 */
-rtgui_view_t* demo_gui_menu(rtgui_view_t* parent_view)
-{
-	rtgui_view_t *view;
-	rtgui_menu_t *main_menu, *sub_menu, *toolmenu;
-
-	/* 先创建一个演示用的视图 */
-	view = demo_view_create(parent_view, "MENU View");
-
-	/* 1.使用动态方式创建菜单 */
-	main_menu = rtgui_menu_create(view, "menu", 5, 40, RTGUI_MENU_NORMAL);
-		sub_menu = rtgui_menu_create(view, "File", 0, 0, RTGUI_MENU_POPUP);
-		rtgui_menu_append(sub_menu, 0, 0x20001, "New", RT_NULL);
-		rtgui_menu_append(sub_menu, 0, 0x20002, "Open", RT_NULL);
-		rtgui_menu_append(sub_menu, 0, 0x20003, "Save", RT_NULL);
-		rtgui_menu_append(sub_menu, 0, 0x20004, "Print", RT_NULL);
-		rtgui_menu_append(sub_menu, 0, 0x20005, "Exit", RT_NULL);
-	rtgui_menu_append(main_menu, RTGUI_MENU_POPUP, (rt_uint32_t)sub_menu, sub_menu->name, RT_NULL);
-		sub_menu = rtgui_menu_create(view, "EditDocument", 0, 0, RTGUI_MENU_POPUP);
-		rtgui_menu_append(sub_menu, 0, 0x30001, "Cut", RT_NULL);
-		rtgui_menu_append(sub_menu, 0, 0x30002, "Copy", RT_NULL);
-		rtgui_menu_append(sub_menu, 0, 0x30002, "Paste", RT_NULL);
-		rtgui_menu_append(sub_menu, 0, 0x30003, "Find...", RT_NULL);
-			toolmenu = rtgui_menu_create(view, "Toolbars", 0, 0, RTGUI_MENU_POPUP);
-			rtgui_menu_append(toolmenu, 0, 0x50001, "File Tools", RT_NULL);
-			rtgui_menu_append(toolmenu, 0, 0x50002, "build Tools", RT_NULL);
-		rtgui_menu_append(sub_menu, RTGUI_MENU_POPUP, (rt_uint32_t)toolmenu, toolmenu->name, RT_NULL);
-	rtgui_menu_append(main_menu, RTGUI_MENU_POPUP, (rt_uint32_t)sub_menu, sub_menu->name, RT_NULL);
-		sub_menu = rtgui_menu_create(view, "View", 0, 0, RTGUI_MENU_POPUP);
-		rtgui_menu_append(sub_menu, 0, 0x40001, "Status bar", RT_NULL);
-		rtgui_menu_append(sub_menu, 0, 0x40001, "Tool bar", RT_NULL);
-		rtgui_menu_append(sub_menu, 0, 0x40001, "Project window", RT_NULL);
-		rtgui_menu_append(sub_menu, 0, 0x40001, "Books window", RT_NULL);
-		rtgui_menu_append(sub_menu, 0, 0x40001, "Functions window", RT_NULL);
-		rtgui_menu_append(sub_menu, 0, 0x40001, "Full screen", RT_NULL);
-	rtgui_menu_append(main_menu, RTGUI_MENU_POPUP, (rt_uint32_t)sub_menu, sub_menu->name, RT_NULL);
-	rtgui_menu_append(main_menu, 0, 0x10004, "Help", RT_NULL);
-
-	/* 2.使用静态方式创建菜单 */
-	/* 菜单的一些功能还在调试中... */
-	return view;
-}

+ 0 - 51
examples/rtgui_win/demo_gui_progressbar.c

@@ -1,51 +0,0 @@
-#include "demo_view.h"
-#include <rtgui/rtgui_system.h>
-#include <rtgui/widgets/label.h>
-#include <rtgui/widgets/progressbar.h>
-
-void hbar_timeout(struct rtgui_timer* timer, void* parameter)
-{
-	static rt_uint32_t value = 0;
-	rtgui_progressbar_t *bar = (rtgui_progressbar_t*)parameter;
-
-	value += 3;
-	if (value >= 100) value = 0;
-
-	rtgui_progressbar_set_value(bar, value);
-}
-
-void vbar_timeout(struct rtgui_timer* timer, void* parameter)
-{
-	static rt_uint32_t value = 0;
-	rtgui_progressbar_t *bar = (rtgui_progressbar_t*)parameter;
-
-	value += 5;
-	if (value >= 100) value = 0;
-
-	rtgui_progressbar_set_value(bar, value);
-}
-
-rtgui_view_t *demo_gui_progressbar(rtgui_view_t* parent_view)
-{
-	rtgui_view_t *view;
-	rtgui_progressbar_t *hbar, *vbar;
-	rtgui_timer_t *timer = RT_NULL;
-	
-	/* create a demo view */
-	view = demo_view_create(parent_view, "ProgressBar View");
-	
-	rtgui_label_create(view, "ˮƽ½ø¶ÈÌõ:", 5, 40, 100, 20);
-	hbar = rtgui_progressbar_create(view, RTGUI_HORIZONTAL, 100, 10, 70, 150, 15);
-
-	rtgui_label_create(view, "´¹Ö±½ø¶ÈÌõ:", 5, 90, 100, 20);
-	vbar = rtgui_progressbar_create(view, RTGUI_VERTICAL, 100, 10, 110, 15, 60);
-
-	timer = rtgui_timer_create(20, RT_TIMER_FLAG_PERIODIC, hbar_timeout, hbar);
-	rtgui_timer_start(timer);
-
-	timer = rtgui_timer_create(20, RT_TIMER_FLAG_PERIODIC, vbar_timeout, vbar);
-	rtgui_timer_start(timer);
-
-	return view;
-}
-

+ 0 - 44
examples/rtgui_win/demo_gui_radiobox.c

@@ -1,44 +0,0 @@
-/*
- * 程序清单:radiobox控件演示
- *
- * 这个例子会在创建出的view上添加两个不同方向的radiobox控件
- */
-
-#include "demo_view.h"
-#include <rtgui/widgets/radiobox.h>
-
-static rt_uint32_t bind_var;
-
-/* 创建用于演示radiobox控件的视图 */
-rtgui_view_t* demo_gui_radiobox(rtgui_view_t* parent_view)
-{
-	rtgui_view_t* view;
-	rtgui_radiobox_t *rbox;
-	rtgui_rb_group_t *group,*_group;
-
-	/* 先创建一个演示用的视图 */
-	view = demo_view_create(parent_view, "RadioBox View");
-
-	/* 使用方法一 */
-	/* 可以先创建一个组对象,再使用 */
-	group = rtgui_radiobox_create_group();
-	rtgui_radiobox_create(view, "radio1", 5, 40, 100, 20, group);
-	rtgui_radiobox_create(view, "radio2", 5, 60, 100, 20, group);
-	
-	/* 使用方法二 */
-	rbox = rtgui_radiobox_create(view, "radio-x", 5, 90, 100, 20, RT_NULL);
-	/* 也可以从radiobox控件中获得一个组对象 */
-	group = rtgui_radiobox_get_group(rbox);
-
-	_group = rtgui_radiobox_create_group();
-	rtgui_radiobox_create(view, "radio_m", 20,110, 100, 20, _group);
-	rtgui_radiobox_create(view, "radio_n", 20,130, 100, 20, _group); 
-	/* 设定一个初始值 */
-	rtgui_rb_group_set_sel(_group, 1);
-	rtgui_radiobox_create(view, "radio-y", 5, 150, 100, 20, group);
-
-	/* 可以为组绑定一个变量,之后可以使用该变量获得group的当前焦点 */
-	rtgui_rb_group_bind(group, &bind_var);
-
-	return view;
-}

+ 0 - 120
examples/rtgui_win/demo_gui_rttab.c

@@ -1,120 +0,0 @@
-/*
- * 程序清单:rttab控件演示
- *
- * 这个例子会在创建出的view上显示一个rttab控件
- */
-#include "demo_view.h"
-#include <rtgui/widgets/label.h>
-#include <rtgui/widgets/button.h>
-#include <rtgui/widgets/rttab.h>
-#include <rtgui/widgets/propel.h>
-
-const unsigned char image_tool[] = {
-'H',  'D',  'C',  0x00, 
-0x10, 0x00, 0x10, 0x00, 
-0x10, 0x00, 0x10, 0x00,
-0x00, 0x00, 0x10, 0x00,
-0x00, 0x00, 0x10, 0x00,
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0x00, 0x04,	
-0x00, 0x04,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0x18, 0xC6,	
-0x00, 0x04,	0xFF, 0xFF,	0xFF, 0xFF,	0x00, 0x04,	
-0x00, 0x04,	0xFF, 0xFF,	0xFF, 0xFF,	0x00, 0x04,	
-0x18, 0xC6,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0x00, 0x04,	
-0x00, 0x04,	0x00, 0x04,	0x00, 0x04,	0x00, 0x04,	
-0x00, 0x04,	0x00, 0x04,	0x00, 0x04,	0x00, 0x04,	
-0x00, 0x04,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0x00, 0x04,	0x00, 0x04,	0x10, 0x04,	0x10, 0x04,	
-0x10, 0x04,	0x10, 0x04,	0x00, 0x04,	0x00, 0x04,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0x00, 0x04,	0x10, 0x04,	0xF3, 0x4C,	0xFF, 0x07,	
-0xFF, 0x07,	0xF3, 0x4C,	0x10, 0x04,	0x00, 0x04,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0x00, 0x04,	0x00, 0x04,	
-0x00, 0x04,	0x10, 0x04,	0xFF, 0x07,	0xFF, 0x07,	
-0xFF, 0x07,	0xFF, 0x07,	0x10, 0x04,	0x00, 0x04,	
-0x00, 0x04,	0x00, 0x04,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0x00, 0x04,	0x00, 0x04,	
-0x00, 0x04,	0x10, 0x04,	0xFF, 0x07,	0xFF, 0x07,	
-0xFF, 0x07,	0xFF, 0x07,	0x10, 0x04,	0x00, 0x04,	
-0x00, 0x04,	0x00, 0x04,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0x00, 0x04,	0x10, 0x04,	0xF3, 0x4C,	0xFF, 0x07,	
-0xFF, 0x07,	0xF3, 0x4C,	0x10, 0x04,	0x00, 0x04,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0x00, 0x04,	0x00, 0x04,	0x10, 0x04,	0x10, 0x04,	
-0x10, 0x04,	0x10, 0x04,	0x00, 0x04,	0x00, 0x04,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0x00, 0x04,	
-0x00, 0x04,	0x00, 0x04,	0x00, 0x04,	0x00, 0x04,	
-0x00, 0x04,	0x00, 0x04,	0x00, 0x04,	0x00, 0x04,	
-0x00, 0x04,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0x18, 0xC6,	
-0x00, 0x04,	0xFF, 0xFF,	0xFF, 0xFF,	0x00, 0x04,	
-0x00, 0x04,	0xFF, 0xFF,	0xFF, 0xFF,	0x00, 0x04,	
-0x18, 0xC6,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0x00, 0x04,	
-0x00, 0x04,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	0xFF, 0xFF,	
-};
-
-/* 创建用于演示rttab控件的视图 */
-rtgui_view_t* demo_gui_rttab(rtgui_view_t* parent_view)
-{
-	rtgui_view_t* view;
-	rtgui_image_t* image;
-	rtgui_rttab_t* tab;
-	rtgui_container_t* box;
-
-	/* 先创建一个演示用的视图 */
-	view = demo_view_create(parent_view, "RTTAB View");
-	image = rtgui_image_create_from_mem("hdc",image_tool,sizeof(image_tool),RT_TRUE); 
-	/* 创建一个rttab控件 */
-	tab = rtgui_rttab_create(view, "TAB", 10, 40, 210, 160);
-	/* 添加标签页 */
-	rtgui_rttab_add_tag(tab, "Editor", image);
-	box = rtgui_rttab_get_container_by_index(tab, 0);
-	rtgui_label_create(box, "label1",5,5,100,20);
-
-	rtgui_rttab_add_tag(tab, "Other", RT_NULL);
-	box = rtgui_rttab_get_container_by_title(tab, "Other");
-	rtgui_label_create(box, "label3",5,5,100,20);
-
-	rtgui_rttab_add_tag(tab, "TAG1", image);
-	box = rtgui_rttab_get_container_by_title(tab, "TAG1");
-	rtgui_button_create(box, "button",5,5,80,25);
-
-	rtgui_rttab_add_tag(tab, "TAG2", RT_NULL);
-	rtgui_rttab_add_tag(tab, "TAG3", RT_NULL);
-	rtgui_rttab_add_tag(tab, "TAG4", RT_NULL);
-	rtgui_rttab_add_tag(tab, "TAG5", RT_NULL);
-	rtgui_rttab_add_tag(tab, "TAG6", RT_NULL);
-	rtgui_rttab_add_tag(tab, "TAG7", RT_NULL);
-	rtgui_rttab_add_tag(tab, "TAG8", RT_NULL);
-
-	return view;
-}
-

+ 0 - 28
examples/rtgui_win/demo_gui_scrollbar.c

@@ -1,28 +0,0 @@
-#include "demo_view.h"
-#include <rtgui/rtgui_system.h>
-#include <rtgui/widgets/label.h>
-#include <rtgui/widgets/scrollbar.h>
-
-rtgui_view_t *demo_gui_scrollbar(rtgui_view_t* parent_view)
-{
-	rtgui_view_t *view;
-	rtgui_scrollbar_t* hbar;
-	rtgui_scrollbar_t* vbar;
-
-	/* create a demo view */
-	view = demo_view_create(parent_view, "ScrollBar View");
-	
-	rtgui_label_create(view, "horizontal bar:", 5, 40, 150, 20);
-	hbar = rtgui_scrollbar_create(view, 5, 65, 20, 100, RTGUI_HORIZONTAL);
-	rtgui_scrollbar_set_range(hbar, 10);
-	rtgui_scrollbar_set_page_step(hbar, 5);
-	rtgui_scrollbar_set_line_step(hbar, 1);
-
-	rtgui_label_create(view, "vertical bar:", 5, 90, 150, 20);
-	vbar = rtgui_scrollbar_create(view, 10, 115, 20, 80, RTGUI_VERTICAL);
-	rtgui_scrollbar_set_range(vbar, 5);
-	rtgui_scrollbar_set_page_step(vbar, 3);
-	rtgui_scrollbar_set_line_step(vbar, 1);
-
-	return view;
-}

+ 0 - 20
examples/rtgui_win/demo_gui_slider.c

@@ -1,20 +0,0 @@
-#include "demo_view.h"
-#include <rtgui/rtgui_system.h>
-#include <rtgui/widgets/label.h>
-#include <rtgui/widgets/slider.h>
-
-rtgui_view_t *demo_gui_slider(rtgui_view_t* parent_view)
-{
-	rtgui_view_t *view;
-
-	/* create a demo view */
-	view = demo_view_create(parent_view, "Slider View");
-
-	rtgui_label_create(view, "horizontal slider:", 5, 40, 150, 20);
-	rtgui_slider_create(view, 0, 100, 5, 60, 100, 16, RTGUI_HORIZONTAL);
-
-	rtgui_label_create(view, "vertical slider:", 5, 80, 150, 20);
-	rtgui_slider_create(view, 0, 100, 10, 100, 16, 80, RTGUI_VERTICAL);
-
-	return view;
-}

+ 0 - 31
examples/rtgui_win/demo_gui_textbox.c

@@ -1,31 +0,0 @@
-/*
- * 程序清单:texbox控件演示
- *
- * 这个例子会在创建出的view上添加几个不同类型的textbox控件
- */
-#include "demo_view.h"
-#include <rtgui/widgets/label.h>
-#include <rtgui/widgets/textbox.h>
-
-/* 创建用于演示textbox控件的视图 */
-rtgui_view_t* demo_gui_textbox(rtgui_view_t* parent_view)
-{
-	rtgui_view_t* view;
-	
-	/* 先创建一个演示用的视图 */
-	view = demo_view_create(parent_view, "TextBox View");
-
-	rtgui_label_create(view, "名字: ", 5, 40, 50, 20);
-	rtgui_textbox_create(view, "bernard",5, 60, 200, 20, RTGUI_TEXTBOX_NONE);
-
-	rtgui_label_create(view, "邮件: ", 5, 80, 50, 20);
-	rtgui_textbox_create(view, "bernard.xiong@gmail.com", 5, 100, 200, 20, RTGUI_TEXTBOX_NONE);
-
-	rtgui_label_create(view, "密码: ", 5, 120, 50, 20);
-	rtgui_textbox_create(view, "rt-thread", 5, 140, 200, 20, RTGUI_TEXTBOX_MASK);
-
-	rtgui_label_create(view, "主页: ", 5, 160, 50, 20);
-	rtgui_textbox_create(view, "http://www.rt-thread.org", 5, 180, 200, 20, RTGUI_TEXTBOX_NONE);
-
-	return view;
-}

+ 0 - 92
examples/rtgui_win/demo_gui_win.c

@@ -1,92 +0,0 @@
-/*
- * 这个例子演示了如何在一个线程中创建一个win
- */
-
-#include <rtthread.h>
-#include <rtgui/rtgui.h>
-#include <rtgui/event.h>
-#include <rtgui/driver.h>
-#include <rtgui/widgets/label.h>
-#include <rtgui/widgets/button.h>
-#include <rtgui/widgets/radiobox.h>
-#include <rtgui/widgets/window.h>
-
-static rt_bool_t demo_win_inited = RT_FALSE;
-
-
-static rt_bool_t demo_gui_win_event_handler(PVOID wdt, rtgui_event_t* event)
-{
-
-	if(event->type == RTGUI_EVENT_PAINT)
-	{
-		
-	}
-	
-	/* 其他事件使用win默认的事件处理函数处理 */
-	return rtgui_win_event_handler(wdt, event);
-}
-
-static void gui_win_entry(void* parameter)
-{
-	const struct rtgui_graphic_driver* gd = rtgui_graphic_driver_get_default();
-	struct rt_messagequeue *mq;
-	rtgui_win_t *win;
-	rtgui_button_t *button;
-	rtgui_point_t p;
-	rtgui_rect_t rect = {0,0,200,180};
-	rtgui_label_t *label;
-	rtgui_font_t *font;
-	
-	/* 创建GUI应用需要的消息队列 */
-	mq = rt_mq_create("demo_win", 256, 32, RT_IPC_FLAG_FIFO);
-	/* 注册当前线程 */
-	rtgui_thread_register(rt_thread_self(), mq);
-
-	/* 窗口居中 */
-	rtgui_rect_moveto(&rect, (gd->width - rtgui_rect_width(rect))/2, (gd->height - rtgui_rect_height(rect))/2);
-	/* 创建窗口 */
-	win = rtgui_win_create(RT_NULL,"demo_win",&rect,RTGUI_WIN_DEFAULT);
-	if(win == RT_NULL) return;
- 
-	/* 取得客户区坐标零点 */
-	p = rtgui_win_get_client_zero(win);
-	label = rtgui_label_create(win, "hello world!", p.x+5, p.y+5, 100,25);
-	font = rtgui_font_refer("asc", 12);	
-	RTGUI_WIDGET_FONT(label) = font;
-
-	button = rtgui_button_create(win, "Exit", (rtgui_rect_width(rect)-50)/2,
-								rtgui_rect_height(rect)-40,50,25);
-	rtgui_button_set_onbutton(button,rtgui_win_close);
-
-	rtgui_widget_set_event_handler(win, demo_gui_win_event_handler);
-	
-	rtgui_win_show(win,RT_FALSE);
-	
-	/* 执行工作台事件循环 */
-	rtgui_win_event_loop(win);
-
-	demo_win_inited = RT_FALSE;
-	
-	/* 去注册GUI线程 */
-	rtgui_thread_deregister(rt_thread_self());
-	rt_mq_delete(mq);
-}
-
-void demo_gui_win(PVOID wdt, rtgui_event_t *event)
-{
-	if(demo_win_inited == RT_FALSE) /* 避免重复初始化而做的保护 */
-	{
-		struct rt_thread* tid;
-		
-		tid = rt_thread_create("demo_win", gui_win_entry, RT_NULL, 1024, 5, 10);
-
-		if(tid != RT_NULL) rt_thread_startup(tid);
-
-		demo_win_inited = RT_TRUE;
-	}
-}
-
-
-
-
-

+ 0 - 192
examples/rtgui_win/demo_gui_window.c

@@ -1,192 +0,0 @@
-/*
- * 程序清单:窗口演示
- *
- * 这个例子会先创建出一个演示用的view,当点击上面的按钮时会不同的模式创建窗口
- */
-
-#include <rtgui/rtgui.h>
-#include <rtgui/rtgui_system.h>
-#include <rtgui/widgets/window.h>
-#include <rtgui/widgets/label.h>
-#include <rtgui/widgets/button.h>
-#include "demo_view.h"
-#include <string.h>
-
-static rtgui_timer_t *timer;
-static char label_text[80];
-static rt_uint8_t cnt = 5;
-
-/* 获取一个递增的窗口标题 */
-static char* get_win_title(void)
-{
-	static rt_uint8_t win_no = 0;
-	static char win_title[16];
-
-	rt_sprintf(win_title, "win %d", ++win_no);
-	return win_title;
-}
-
-rt_bool_t auto_window_close(PVOID wdt, rtgui_event_t* event)
-{
-	if(timer != RT_NULL)
-	{
-		rtgui_timer_stop(timer);
-		rtgui_timer_destory(timer);
-	}
-	return RT_TRUE;
-}
-
-/* 关闭对话框时的回调函数 */
-void diag_close(struct rtgui_timer* timer, void* parameter)
-{
-	rtgui_label_t *label;
-
-	label = (rtgui_label_t*)parameter;
-	cnt --;
-	rt_sprintf(label_text, "closed then %d s", cnt);
-
-	/* 设置标签文本并更新控件 */
-	rtgui_label_set_text(label, label_text);
-	rtgui_widget_update(RTGUI_WIDGET(label));
-
-	if (cnt == 0)
-	{
-		rtgui_win_t *win;
-		win = rtgui_win_get_win_by_widget(label);
-		if(win == RT_NULL) return;
-		/* 超时,关闭对话框 */
-		rtgui_win_close(win, RT_NULL);
-
-		/* 停止并删除定时器 */
-		rtgui_timer_stop(timer);
-		rtgui_timer_destory(timer);
-	}
-}
-
-static rt_uint16_t delta_x = 20;
-static rt_uint16_t delta_y = 40;
-
-/* 触发正常窗口显示 */
-static void demo_win_onbutton(PVOID wdt, rtgui_event_t* event)
-{
-	rtgui_win_t *win;
-	PVOID parent;
-	rtgui_rect_t rect={0, 0, 180, 120};
-
-	parent = rtgui_widget_get_toplevel(wdt);
-	rtgui_rect_moveto(&rect, delta_x, delta_y);
-	delta_x += 20;
-	delta_y += 20;
-
-	/* 创建一个窗口 */
-	win = rtgui_win_create(parent, get_win_title(), &rect, RTGUI_WIN_DEFAULT);
-
-	/* 添加一个文本标签 */
-	rtgui_label_create(win, "这是一个普通窗口", 10, 30, 150, 20);
-
-	/* 非模态显示窗口 */
-	rtgui_win_show(win, RT_FALSE);
-}
-
-/* 触发自动窗口显示 */
-static void demo_autowin_onbutton(PVOID wdt, rtgui_event_t* event)
-{
-	PVOID parent;
-	rtgui_label_t *label = RT_NULL;
-	rtgui_win_t *msgbox;
-	struct rtgui_rect rect ={50, 50, 200, 200};
-
-	parent = rtgui_widget_get_toplevel(wdt);
-	msgbox = rtgui_win_create(parent, "Information", &rect, RTGUI_WIN_DEFAULT);
-	if (msgbox != RT_NULL)
-	{
-		cnt = 5;
-		rt_sprintf(label_text, "closed then %d s", cnt);
-		label = rtgui_label_create(msgbox, label_text, 10,30,120,20);
-		/* 设置关闭窗口时的动作 */
-		rtgui_win_set_onclose(msgbox, auto_window_close);
-
-		rtgui_win_show(msgbox, RT_FALSE);
-	}
-
-	/* 创建一个定时器 */
-	timer = rtgui_timer_create(100, RT_TIMER_FLAG_PERIODIC, diag_close, label);
-	rtgui_timer_start(timer);
-}
-
-/* 触发模态窗口显示 */
-static void demo_modalwin_onbutton(PVOID wdt, rtgui_event_t* event)
-{
-	rtgui_win_t *win;
-	PVOID parent;
-	rtgui_rect_t rect = {0, 0, 180, 120};
-
-	parent = rtgui_widget_get_toplevel(wdt);
-	rtgui_rect_moveto(&rect, (rtgui_widget_get_width(parent) -180)/2, 
-							 (rtgui_widget_get_height(parent)-120)/2);
-
-	/* 创建一个窗口 */
-	win = rtgui_win_create(parent,get_win_title(), &rect, RTGUI_WIN_DEFAULT);
-
-	rect.x1 += 20;
-	rect.x2 -= 5;
-	rect.y1 += 5;
-	rect.y2 = rect.y1 + 20;
-
-	rtgui_label_create(win, "这是一个模式窗口", 20, 30, 150,20);
-
-	/* 模态显示窗口 */
-	rtgui_win_show(win, RT_TRUE);
-}
-
-/* 触发无标题窗口显示 */
-static void demo_ntitlewin_onbutton(PVOID wdt, rtgui_event_t* event)
-{
-	rtgui_win_t *win;
-	rtgui_label_t *label;
-	rtgui_button_t *button;
-	PVOID parent;
-	rtgui_rect_t rect = {0, 0, 180, 120};
-
-	parent = rtgui_widget_get_toplevel(wdt);
-	rtgui_rect_moveto(&rect, delta_x, delta_y);
-	delta_x += 20;
-	delta_y += 20;
-	/* 创建一个窗口,风格为无标题及无边框 */
-	win = rtgui_win_create(parent,"no title", &rect, RTGUI_WIN_DEFAULT);
-	RTGUI_WIDGET_BACKGROUND(win) = white;
-	win->level = RTGUI_WIN_LEVEL_EXPERT;
-	/* 创建一个文本标签 */
-	label = rtgui_label_create(win, "无标题栏窗口", 10, 30, 100, 20);
-	RTGUI_WIDGET_BACKGROUND(label) = white;
-
-	button = rtgui_button_create(win,"关闭", 65, 85, 60, 25);
-	rtgui_button_set_onbutton(button, rtgui_win_close);
-
-	/* 非模态显示窗口 */
-	rtgui_win_show(win, RT_FALSE);
-}
-
-rtgui_view_t* demo_gui_window(rtgui_view_t* parent_view)
-{
-	rtgui_view_t* view;
-	rtgui_button_t *button;
-
-	/* 创建一个演示用的视图 */
-	view = demo_view_create(parent_view, "Window Demo");
-
-
-	button = rtgui_button_create(view, "Normal Win", 10, 40, 100, 25);
-	rtgui_button_set_onbutton(button, demo_win_onbutton);
-
-	button = rtgui_button_create(view, "Auto Win", 10, 70, 100, 25);
-	rtgui_button_set_onbutton(button, demo_autowin_onbutton);
-
-	button = rtgui_button_create(view, "Modal Win", 10, 100, 100, 25);
-	rtgui_button_set_onbutton(button, demo_modalwin_onbutton);
-
-	button = rtgui_button_create(view, "NoTitle Win", 10, 130, 100, 25);
-	rtgui_button_set_onbutton(button, demo_ntitlewin_onbutton);
-
-	return view;
-}

+ 0 - 31
examples/rtgui_win/demo_view.h

@@ -1,31 +0,0 @@
-#ifndef __DEMO_VIEW_H__
-#define __DEMO_VIEW_H__
-
-#include <rtgui/widgets/view.h>
-
-rtgui_view_t* demo_view_create(rtgui_view_t* parent_view, const char* title);
-
-rtgui_view_t* demo_gui_benchmark(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_dc_buffer(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_animation(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_buffer_animation(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_window(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_label(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_button(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_checkbox(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_progressbar(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_scrollbar(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_radiobox(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_textbox(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_listbox(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_menu(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_listctrl(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_listbox(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_combobox(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_slider(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_image(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_fnview(rtgui_view_t* parent_view);
-rtgui_view_t* demo_gui_rttab(rtgui_view_t* parent_view);
-
-#endif
-

+ 0 - 23
examples/rtgui_win/gui_init.c

@@ -1,23 +0,0 @@
-#include <rtgui/rtgui.h>
-#include <rtgui/rtgui_system.h>
-#include <rtgui/rtgui_server.h>
-#include "touch.h"
-
-void rt_hw_lcd_init(void);
-void rt_hw_key_init(void);
-void rtgui_panel_init(void);
-
-
-/* GUI相关演示入口,需放在线程中进行初始化 */
-void rtgui_startup()
-{
-	/* GUI系统初始化 */
-    rtgui_system_server_init();
-
-	/* 按键初始化 */
-	rt_hw_key_init();
-	/* LCD驱动初始化 */
-	rt_hw_lcd_init();
-	rtgui_touch_hw_init();
-	rtgui_panel_init();
-}

+ 0 - 3
examples/rtgui_win/readme.txt

@@ -1,3 +0,0 @@
-这个文件夹下的例子对应于rtgui_win分支,分支地址是:
-http://rt-thread.googlecode.com/svn/branches/rtgui_win/
-新建个文件夹,将SVN update地址设置成上面的地址即可获得rtgui_win分支的代码。