summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/module/README4
-rw-r--r--examples/module/SConstruct73
-rw-r--r--examples/module/basicapp/SConstruct27
-rw-r--r--examples/module/basicapp/Sconscript7
-rw-r--r--examples/module/basicapp/basicapp.c12
-rw-r--r--examples/module/extapp/SConstruct24
-rw-r--r--examples/module/extapp/Sconscript7
-rw-r--r--examples/module/extapp/extapp.c2
-rw-r--r--examples/module/extension/SConscript32
-rw-r--r--examples/module/extension/SConstruct27
-rw-r--r--examples/module/extension/extension.c33
-rw-r--r--examples/module/ftk_app/ftk_calculator/SConstruct34
-rw-r--r--examples/module/ftk_app/ftk_calculator/calc.desktop3
-rw-r--r--examples/module/ftk_app/ftk_calculator/ftk_app_calc.c262
-rw-r--r--examples/module/ftk_app/ftk_calculator/ftk_app_calc.h13
-rw-r--r--examples/module/ftk_app/ftk_demo/SConstruct34
-rw-r--r--examples/module/ftk_app/ftk_demo/demo.pngbin597 -> 0 bytes
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_button.c92
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_check_button.c84
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_combo_box.c89
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_dialog.c119
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_entry.c94
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_file_browser.c100
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_fullscreen.c101
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_hello.c29
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_icon_view.c101
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_image.c67
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_image_button.c124
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_ime.c60
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_label.c104
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_listview.c130
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_menu.c107
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_msgbox.c101
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_multi_win.c87
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_popup.c133
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_progress_bar.c87
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_scroll_bar.c89
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_sprite.c85
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_statusbar.c66
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_tab.c89
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_text_view.c61
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_transparent.c137
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_wait_box.c72
-rw-r--r--examples/module/ftk_app/ftk_demo/demo_xul.c56
-rw-r--r--examples/module/ftk_app/ftk_demo/demos.desktop26
-rw-r--r--examples/module/ftk_app/ftk_demo/ftk_app_demo.c67
-rw-r--r--examples/module/ftk_app/ftk_demo/ftk_app_demo.h12
-rw-r--r--examples/module/ftk_app/ftk_demo/t1.xul14
-rw-r--r--examples/module/ftk_app/ftk_demo/t2.xul14
-rw-r--r--examples/module/ftk_app/ftk_demo/t3.xul14
-rw-r--r--examples/module/ftk_app/ftk_demo/t4.xul8
-rw-r--r--examples/module/ftk_app/ftk_demo/t5.xul9
-rw-r--r--examples/module/ftk_app/ftk_demo/t6.xul15
-rw-r--r--examples/module/ftk_app/ftk_demo/t7.xul15
-rw-r--r--examples/module/rtconfig.py23
-rw-r--r--examples/module/rtconfig_lm3s.py23
-rw-r--r--examples/module/rtgui_app/tetris/SConstruct31
-rw-r--r--examples/module/tetris/Sconscript7
-rw-r--r--examples/module/tetris/tetris.h (renamed from examples/module/rtgui_app/tetris/tetris.h)0
-rw-r--r--examples/module/tetris/tetris_modal.c (renamed from examples/module/rtgui_app/tetris/tetris_modal.c)0
-rw-r--r--examples/module/tetris/tetris_ui.c (renamed from examples/module/rtgui_app/tetris/tetris_ui.c)2
-rw-r--r--examples/module/tetris/tetris_view.c (renamed from examples/module/rtgui_app/tetris/tetris_view.c)0
62 files changed, 154 insertions, 3184 deletions
diff --git a/examples/module/README b/examples/module/README
new file mode 100644
index 0000000000..d5990192ce
--- /dev/null
+++ b/examples/module/README
@@ -0,0 +1,4 @@
+example:
+1.edit rtconfig.py to config toolchain and bsp
+2.scons --app=basicapp
+3.copy basicapp/build/$bsp/basicapp.so to filesystem
diff --git a/examples/module/SConstruct b/examples/module/SConstruct
new file mode 100644
index 0000000000..dae6292170
--- /dev/null
+++ b/examples/module/SConstruct
@@ -0,0 +1,73 @@
+import os
+import sys
+import SCons.cpp
+import rtconfig
+
+if os.getenv('RTT_ROOT'):
+ RTT_ROOT = os.getenv('RTT_ROOT')
+else:
+ RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
+
+sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
+from building import *
+
+Export('RTT_ROOT')
+
+# add target option
+AddOption('--app',
+ dest='app',
+ nargs=1, type='string',
+ action='store',
+ metavar='DIR',
+ help='installation prefix')
+
+# add target option
+AddOption('--type',
+ dest='type',
+ nargs=1, type='string',
+ action='store',
+ metavar='DIR',
+ help='installation prefix')
+
+app = GetOption('app')
+
+if GetOption('type') == 'ext':
+ linkflags = rtconfig.LFLAGS + ' -e 0'
+else:
+ linkflags = rtconfig.LFLAGS + ' -e main'
+
+env = Environment(tools = ['mingw'],
+ AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
+ CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
+ CXX = rtconfig.CXX,
+ AR = rtconfig.AR, ARFLAGS = '-rc',
+ LINK = rtconfig.LINK, LINKFLAGS = linkflags,
+ CPPPATH = [
+ RTT_ROOT + '/include',
+ RTT_ROOT + '/bsp/' + rtconfig.BSP,
+ RTT_ROOT + '/components/finsh',
+ RTT_ROOT + '/components/rtgui/include',
+ RTT_ROOT + '/components/rgtui/common',
+ RTT_ROOT + '/components/rtgui/server',
+ RTT_ROOT + '/components/rtgui/widgets',
+ RTT_ROOT + '/components/libdl',
+ RTT_ROOT + '/components/external/ftk/ftk/src/os/rt-thread',
+ RTT_ROOT + '/components/external/ftk/ftk/src/demos',
+ RTT_ROOT + '/components/external/ftk/ftk/apps/common',
+ RTT_ROOT + '/components/external/ftk/ftk/src',
+ RTT_ROOT + '/components/dfs',
+ RTT_ROOT + '/components/dfs/include',
+ RTT_ROOT + '/components/libc/newlib',
+ RTT_ROOT + '/components/external/cairo/cairo-1.10.2/src',
+ RTT_ROOT + '/components/external/cairo/'
+ ])
+env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
+
+PrepareModuleBuilding(env, RTT_ROOT)
+
+dir = app + '/build/' + rtconfig.BSP
+objs = SConscript(app + '/Sconscript', variant_dir=dir, duplicate=0)
+TARGET = dir + '/' + app + '.' + rtconfig.TARGET_EXT
+
+# build program
+env.Program(TARGET, objs)
diff --git a/examples/module/basicapp/SConstruct b/examples/module/basicapp/SConstruct
deleted file mode 100644
index 35df31d886..0000000000
--- a/examples/module/basicapp/SConstruct
+++ /dev/null
@@ -1,27 +0,0 @@
-import os
-import sys
-
-EXEC_PATH = '/home/shaolin/CodeSourcery/Sourcery_G++_Lite/bin'
-RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
-sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
-PREFIX = 'arm-none-eabi-'
-env = Environment(tools = ['mingw'],
- AS = PREFIX + 'gcc',
- ASFLAGS = '',
- CC = PREFIX + 'gcc',
- CCFLAGS = '-mcpu=arm920t -O0 -fPIC' ,
- AR = PREFIX + 'ar',
- ARFLAGS = '-rc',
- LINK = PREFIX + 'ld',
- LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e rt_application_init -nostdlib -s',
- CPPPATH = [
- RTT_ROOT + '/include',
- RTT_ROOT + '/bsp/mini2440'
- ])
-env.PrependENVPath('PATH', EXEC_PATH)
-
-target = 'basicapp.so'
-src = Glob('*.c')
-
-env.Program(target, src)
-
diff --git a/examples/module/basicapp/Sconscript b/examples/module/basicapp/Sconscript
new file mode 100644
index 0000000000..690ae8c7dd
--- /dev/null
+++ b/examples/module/basicapp/Sconscript
@@ -0,0 +1,7 @@
+import rtconfig
+Import('RTT_ROOT')
+from building import *
+
+src = Glob('*.c')
+group = DefineGroup('', src, depend = [''])
+Return('group') \ No newline at end of file
diff --git a/examples/module/basicapp/basicapp.c b/examples/module/basicapp/basicapp.c
index cd251a34bc..3a1927277e 100644
--- a/examples/module/basicapp/basicapp.c
+++ b/examples/module/basicapp/basicapp.c
@@ -1,18 +1,22 @@
#include <rtthread.h>
-int a = 0;
-int b = 1000000;
-int c = 0;
+static int a = 0;
+static int b = 1000000;
+int c = 100;
static void function(int count1, int count2, int count3)
{
rt_kprintf("Hello RT-Thread %d %d\n", count1, count2, count3);
}
-int rt_application_init(void)
+int main(void)
{
int i;
+
rt_kprintf("application entry\n");
+ rt_kprintf("[addr]a-0x%x,b-0x%x,c-0x%x\n", &a, &b, &c);
+ rt_kprintf("[value]a-%d,b-%d,c-%d\n", a, b, c);
+
for(i=0; i<100; i++)
{
a++;
diff --git a/examples/module/extapp/SConstruct b/examples/module/extapp/SConstruct
deleted file mode 100644
index d02d847ab8..0000000000
--- a/examples/module/extapp/SConstruct
+++ /dev/null
@@ -1,24 +0,0 @@
-import os
-import sys
-
-EXEC_PATH = '/home/shaolin/CodeSourcery/Sourcery_G++_Lite/bin'
-RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
-sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
-PREFIX = 'arm-none-eabi-'
-env = Environment(tools = ['mingw'],
- AS = PREFIX + 'gcc',
- ASFLAGS = '',
- CC = PREFIX + 'gcc',
- CCFLAGS = '-mcpu=arm920t -O0 -fPIC' ,
- AR = PREFIX + 'ar',
- ARFLAGS = '-rc',
- LINK = PREFIX + 'ld',
- LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e rt_application_init -nostdlib -s',
- CPPPATH = [RTT_ROOT + '/include', RTT_ROOT + '/examples/module', RTT_ROOT + '/bsp/mini2440', RTT_ROOT + '/components/libdl'])
-env.PrependENVPath('PATH', EXEC_PATH)
-
-target = 'extapp.so'
-src = Glob('extapp.c')
-
-env.Program(target, src)
-
diff --git a/examples/module/extapp/Sconscript b/examples/module/extapp/Sconscript
new file mode 100644
index 0000000000..690ae8c7dd
--- /dev/null
+++ b/examples/module/extapp/Sconscript
@@ -0,0 +1,7 @@
+import rtconfig
+Import('RTT_ROOT')
+from building import *
+
+src = Glob('*.c')
+group = DefineGroup('', src, depend = [''])
+Return('group') \ No newline at end of file
diff --git a/examples/module/extapp/extapp.c b/examples/module/extapp/extapp.c
index 5d2bbd2814..29d48164e5 100644
--- a/examples/module/extapp/extapp.c
+++ b/examples/module/extapp/extapp.c
@@ -3,7 +3,7 @@
typedef void (*func)(void);
-int rt_application_init(void)
+int main(void)
{
func f1, f2, f3, f4, f5;
diff --git a/examples/module/extension/SConscript b/examples/module/extension/SConscript
deleted file mode 100644
index d7ed70eaa1..0000000000
--- a/examples/module/extension/SConscript
+++ /dev/null
@@ -1,32 +0,0 @@
-Import('env')
-Import('projects')
-Import('RTT_ROOT')
-Import('rtconfig')
-Import('TARGET')
-
-RTMLINKER = RTT_ROOT + '/tools/rtmlinker.exe '
-
-# group definitions
-group = {}
-group['name'] = 'examples'
-group['src'] = Glob('*.c')
-group['CCFLAGS'] = ''
-group['CPPPATH'] = [RTT_ROOT + '/include', RTT_ROOT + '/examples/module']
-group['CPPDEFINES'] = ''
-
-target = 'extension.so'
-POST_ACTION = RTMLINKER + '-l ' + TARGET + ' -o extension.mo ' + '$TARGET'
-
-# add group to project list
-projects.append(group)
-
-src_local = Glob('extension.c')
-
-env.Append(CCFLAGS = group['CCFLAGS'])
-env.Append(CPPPATH = group['CPPPATH'])
-env.Append(CPPDEFINES = group['CPPDEFINES'])
-module_env = env.Clone(CCFLAGS = ' -mcpu=arm920t -O0 -fPIC')
-module_env.Replace(LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e 0 -nostdlib -s')
-module_env.Program(target, src_local)
-module_env.AddPostAction(target, POST_ACTION)
-
diff --git a/examples/module/extension/SConstruct b/examples/module/extension/SConstruct
deleted file mode 100644
index 2603e456d7..0000000000
--- a/examples/module/extension/SConstruct
+++ /dev/null
@@ -1,27 +0,0 @@
-import os
-import sys
-
-EXEC_PATH = '/home/shaolin/CodeSourcery/Sourcery_G++_Lite/bin'
-RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
-sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
-PREFIX = 'arm-none-eabi-'
-env = Environment(tools = ['mingw'],
- AS = PREFIX + 'gcc',
- ASFLAGS = '',
- CC = PREFIX + 'gcc',
- CCFLAGS = '-mcpu=arm920t -O0 -fPIC' ,
- AR = PREFIX + 'ar',
- ARFLAGS = '-rc',
- LINK = PREFIX + 'ld',
- LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e 0 -nostdlib -s',
- CPPPATH = [
- RTT_ROOT + '/include',
- RTT_ROOT + '/bsp/mini2440'
- ])
-env.PrependENVPath('PATH', EXEC_PATH)
-
-target = 'extension.so'
-src = Glob('*.c')
-
-env.Program(target, src)
-
diff --git a/examples/module/extension/extension.c b/examples/module/extension/extension.c
deleted file mode 100644
index e5dd094c54..0000000000
--- a/examples/module/extension/extension.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <rtthread.h>
-#include <rtm.h>
-
-void function1(void)
-{
- rt_kprintf("Hello RT-Thread function1\n");
-}
-
-void function2(void)
-{
- rt_kprintf("Hello RT-Thread function2\n");
-}
-
-void function3(void)
-{
- rt_kprintf("Hello RT-Thread function3\n");
-}
-
-void function4(void)
-{
- rt_kprintf("Hello RT-Thread function4\n");
-}
-
-void function5(void)
-{
- rt_kprintf("Hello RT-Thread function5\n");
-}
-
-RTM_EXPORT(function1)
-RTM_EXPORT(function2)
-RTM_EXPORT(function3)
-RTM_EXPORT(function4)
-RTM_EXPORT(function5) \ No newline at end of file
diff --git a/examples/module/ftk_app/ftk_calculator/SConstruct b/examples/module/ftk_app/ftk_calculator/SConstruct
deleted file mode 100644
index 29a251075b..0000000000
--- a/examples/module/ftk_app/ftk_calculator/SConstruct
+++ /dev/null
@@ -1,34 +0,0 @@
-import os
-import sys
-
-EXEC_PATH = '/home/shaolin/CodeSourcery/Sourcery_G++_Lite/bin'
-RTT_ROOT = os.path.normpath(os.getcwd() + '/../../../..')
-sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
-PREFIX = 'arm-none-eabi-'
-env = Environment(tools = ['mingw'],
- AS = PREFIX + 'gcc',
- ASFLAGS = '',
- CC = PREFIX + 'gcc',
- CCFLAGS = '-DRT_THREAD -DFTK_AS_PLUGIN -mcpu=arm920t -O0 -fPIC' ,
- AR = PREFIX + 'ar',
- ARFLAGS = '-rc',
- LINK = PREFIX + 'ld',
- LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e 0 -nostdlib -s',
- CPPPATH = [
- RTT_ROOT + '/include',
- RTT_ROOT + '/bsp/mini2440',
- RTT_ROOT + '/components/external/ftk/ftk/src/os/rt-thread',
- RTT_ROOT + '/components/external/ftk/ftk/src/demos',
- RTT_ROOT + '/components/external/ftk/ftk/apps/common',
- RTT_ROOT + '/components/external/ftk/ftk/src',
- RTT_ROOT + '/components/dfs',
- RTT_ROOT + '/components/dfs/include',
- RTT_ROOT + '/components/libc/newlib'
- ])
-env.PrependENVPath('PATH', EXEC_PATH)
-
-target = 'calculator.so'
-src = Glob('*.c')
-
-env.Program(target, src)
-
diff --git a/examples/module/ftk_app/ftk_calculator/calc.desktop b/examples/module/ftk_app/ftk_calculator/calc.desktop
deleted file mode 100644
index 3c6407e662..0000000000
--- a/examples/module/ftk_app/ftk_calculator/calc.desktop
+++ /dev/null
@@ -1,3 +0,0 @@
-<applications>
-<application name="calc" exec="/ftk/apps/calculator.so" init="ftk_app_calc_create" />
-</applications>
diff --git a/examples/module/ftk_app/ftk_calculator/ftk_app_calc.c b/examples/module/ftk_app/ftk_calculator/ftk_app_calc.c
deleted file mode 100644
index e2952572bc..0000000000
--- a/examples/module/ftk_app/ftk_calculator/ftk_app_calc.c
+++ /dev/null
@@ -1,262 +0,0 @@
-#include "ftk_xul.h"
-#include "ftk_expr.h"
-#include "ftk_app_calc.h"
-
-typedef struct _PrivInfo
-{
- FtkBitmap* icon;
-}PrivInfo;
-
-#define IDC_ENTRY 100
-
-static Ret ftk_calc_on_button_clicked(void* ctx, void* obj);
-
-const char* ftk_translate_path(const char* path, char out_path[FTK_MAX_PATH+1])
-{
- snprintf(out_path, FTK_MAX_PATH, "%s/%s", APP_DATA_DIR, path);
- if(access(out_path, R_OK) < 0)
- {
- snprintf(out_path, FTK_MAX_PATH, "%s/%s", APP_LOCAL_DATA_DIR, path);
- }
- ftk_logd("%s->%s\n", path, out_path);
-
- return out_path;
-}
-
-const char* buttons[] =
-{
- "0",
- "1",
- "2",
- "3",
- "4",
- "5",
- "6",
- "7",
- "8",
- "9",
- ".",
- "+",
- "-",
- "*",
- "/",
- "(",
- ")",
- "=",
- "<--",
- "Quit"
-};
-
-static FtkWidget* ftk_calc_create_window(void)
-{
- int i = 0;
- int j = 0;
- int x = 0;
- int y = 0;
- int row = 0;
- int col = 0;
- int small = 0;
- int xoffset = 0;
- int yoffset = 0;
- int width = 0;
- int height = 0;
- int v_margin = 5;
- int h_margin = 5;
- int item_width = 0;
- int item_height = 0;
- FtkGc gc = {0};
- FtkWidget* entry = NULL;
- FtkWidget* button = NULL;
- FtkBitmap* bitmap_normal = NULL;
- FtkBitmap* bitmap_active = NULL;
- FtkBitmap* bitmap_focus = NULL;
- char path[FTK_MAX_PATH+1] = {0};
- FtkWidget* win = ftk_app_window_create();
- ftk_window_set_animation_hint(win, "app_main_window");
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
- entry = ftk_entry_create(win, 0, 0, width, 30);
- ftk_widget_set_id(entry, IDC_ENTRY);
- height -= ftk_widget_height(entry);
-
- row = width > height ? 4 : 5;
- col = width > height ? 5 : 4;
-
- item_width = width / col;
- item_height = height /row;
- small = (item_width < 60 || item_height < 60) ? 1 : 0;
-
- item_width = item_height = small ? 36 : 60;
-
- h_margin = width/col - item_width;
- h_margin = h_margin > 5 ? 5 : h_margin;
-
- v_margin = height/row - item_height;
- v_margin = v_margin > 5 ? 5 : v_margin;
-
- xoffset = (width - (h_margin + item_width) * col) >> 1;
- yoffset = (height - (v_margin + item_height) * row) >> 1;
-
- xoffset = xoffset < 0 ? 0 : xoffset;
- yoffset = yoffset < 0 ? 0 : yoffset;
-
- yoffset += ftk_widget_height(entry);
- gc.mask = FTK_GC_BITMAP;
- if(small)
- {
- bitmap_normal = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), ftk_translate_path("icons/button-small.png", path));
- bitmap_active = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), ftk_translate_path("icons/button-pressed-small.png", path));
- bitmap_focus = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), ftk_translate_path("icons/button-selected-small.png", path));
- }
- else
- {
- bitmap_normal = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), ftk_translate_path("icons/button.png", path));
- bitmap_active = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), ftk_translate_path("icons/button-pressed.png", path));
- bitmap_focus = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), ftk_translate_path("icons/button-selected.png", path));
- }
-
- for(i = 0; i < row; i++)
- {
- y = yoffset + i * (item_height + v_margin);
- for(j = 0; j < col; j++)
- {
- const char* text = buttons[i * col + j];
- if(text != NULL)
- {
- x = xoffset + j * (item_width + h_margin);
- button = ftk_button_create(win, x, y, item_width, item_height);
- ftk_widget_set_text(button, text);
- ftk_button_set_clicked_listener(button, ftk_calc_on_button_clicked, win);
- gc.bitmap = bitmap_normal;
- ftk_widget_set_gc(button, FTK_WIDGET_NORMAL, &gc);
-
- gc.bitmap = bitmap_focus;
- ftk_widget_set_gc(button, FTK_WIDGET_FOCUSED, &gc);
-
- gc.bitmap = bitmap_active;
- ftk_widget_set_gc(button, FTK_WIDGET_ACTIVE, &gc);
- }
- }
- }
-
- ftk_bitmap_unref(bitmap_normal);
- ftk_bitmap_unref(bitmap_active);
- ftk_bitmap_unref(bitmap_focus);
-
- return win;
-}
-
-static Ret ftk_calc_on_shutdown(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-static Ret ftk_calc_on_prepare_options_menu(void* ctx, FtkWidget* menu_panel)
-{
- FtkWidget* item = ftk_menu_item_create(menu_panel);
- ftk_widget_set_text(item, _("Quit"));
- ftk_menu_item_set_clicked_listener(item, ftk_calc_on_shutdown, ctx);
- ftk_widget_show(item, 1);
-
- return RET_OK;
-}
-
-static Ret ftk_calc_on_button_clicked(void* ctx, void* obj)
-{
- FtkWidget* entry = ftk_widget_lookup(ctx, IDC_ENTRY);
- const char* text = ftk_widget_get_text(obj);
- return_val_if_fail(text != NULL && entry != NULL, RET_FAIL);
-
- if(text[0] == '=')
- {
- char buff[32] = {0};
- double val = ftk_expr_eval(ftk_entry_get_text(entry));
- ftk_snprintf(buff, sizeof(buff), "%lf", val);
- ftk_entry_set_text(entry, buff);
- }
- else if(text[0] == '<')
- {
- ftk_entry_set_text(entry, "");
- }
- else if(text[0] == 'Q' || strcmp(text, _("Quit")) == 0)
- {
- ftk_widget_unref(ctx);
- }
- else
- {
- ftk_entry_insert_text(entry, -1, text);
- }
-
- return RET_OK;
-}
-
-static FtkBitmap* ftk_app_calc_get_icon(FtkApp* thiz)
-{
- DECL_PRIV(thiz, priv);
- const char* name="calc.png";
- char file_name[FTK_MAX_PATH + 1] = {0};
- return_val_if_fail(priv != NULL, NULL);
-
- if(priv->icon != NULL) return priv->icon;
-
- snprintf(file_name, FTK_MAX_PATH, "%s/icons/%s", APP_DATA_DIR, name);
- priv->icon = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), file_name);
- if(priv->icon != NULL) return priv->icon;
-
- snprintf(file_name, FTK_MAX_PATH, "%s/icons/%s", APP_LOCAL_DATA_DIR, name);
- priv->icon = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), file_name);
-
- return priv->icon;
-}
-
-static const char* ftk_app_calc_get_name(FtkApp* thiz)
-{
- return _("Calculator");
-}
-
-static Ret ftk_app_calc_run(FtkApp* thiz, int argc, char* argv[])
-{
- DECL_PRIV(thiz, priv);
- FtkWidget* win = NULL;
- return_val_if_fail(priv != NULL, RET_FAIL);
-
- win = ftk_calc_create_window();
- ftk_app_window_set_on_prepare_options_menu(win, ftk_calc_on_prepare_options_menu, win);
- ftk_widget_show_all(win, 1);
-
-#ifdef HAS_MAIN
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-#endif
-
- return RET_OK;
-}
-
-static void ftk_app_calc_destroy(FtkApp* thiz)
-{
- if(thiz != NULL)
- {
- DECL_PRIV(thiz, priv);
- ftk_bitmap_unref(priv->icon);
- FTK_FREE(thiz);
- }
-
- return;
-}
-
-FtkApp* ftk_app_calc_create(void)
-{
- FtkApp* thiz = FTK_ZALLOC(sizeof(FtkApp) + sizeof(PrivInfo));
-
- if(thiz != NULL)
- {
- thiz->run = ftk_app_calc_run;
- thiz->get_icon = ftk_app_calc_get_icon;
- thiz->get_name = ftk_app_calc_get_name;
- thiz->destroy = ftk_app_calc_destroy;
- }
-
- return thiz;
-}
-
diff --git a/examples/module/ftk_app/ftk_calculator/ftk_app_calc.h b/examples/module/ftk_app/ftk_calculator/ftk_app_calc.h
deleted file mode 100644
index f25758f79f..0000000000
--- a/examples/module/ftk_app/ftk_calculator/ftk_app_calc.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef FTK_APP_CALC_H
-#define FTK_APP_CALC_H
-
-#include "ftk_app.h"
-
-FTK_BEGIN_DECLS
-
-FtkApp* ftk_app_calc_create(void);
-
-FTK_END_DECLS
-
-#endif/*FTK_APP_CALC_H*/
-
diff --git a/examples/module/ftk_app/ftk_demo/SConstruct b/examples/module/ftk_app/ftk_demo/SConstruct
deleted file mode 100644
index b1b4ef8e79..0000000000
--- a/examples/module/ftk_app/ftk_demo/SConstruct
+++ /dev/null
@@ -1,34 +0,0 @@
-import os
-import sys
-
-EXEC_PATH = '/home/shaolin/CodeSourcery/Sourcery_G++_Lite/bin'
-RTT_ROOT = os.path.normpath(os.getcwd() + '/../../../..')
-sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
-PREFIX = 'arm-none-eabi-'
-env = Environment(tools = ['mingw'],
- AS = PREFIX + 'gcc',
- ASFLAGS = '',
- CC = PREFIX + 'gcc',
- CCFLAGS = '-DRT_THREAD -DFTK_AS_PLUGIN -mcpu=arm920t -O0 -fPIC' ,
- AR = PREFIX + 'ar',
- ARFLAGS = '-rc',
- LINK = PREFIX + 'ld',
- LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e 0 -nostdlib -s',
- CPPPATH = [
- RTT_ROOT + '/include',
- RTT_ROOT + '/bsp/mini2440',
- RTT_ROOT + '/components/external/ftk/ftk/src/os/rt-thread',
- RTT_ROOT + '/components/external/ftk/ftk/src/demos',
- RTT_ROOT + '/components/external/ftk/ftk/apps/common',
- RTT_ROOT + '/components/external/ftk/ftk/src',
- RTT_ROOT + '/components/dfs',
- RTT_ROOT + '/components/dfs/include',
- RTT_ROOT + '/components/libc/newlib'
- ])
-env.PrependENVPath('PATH', EXEC_PATH)
-
-target = 'libftk_demos.so'
-src = Glob('*.c')
-
-env.Program(target, src)
-
diff --git a/examples/module/ftk_app/ftk_demo/demo.png b/examples/module/ftk_app/ftk_demo/demo.png
deleted file mode 100644
index 91cc0b9acb..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo.png
+++ /dev/null
Binary files differ
diff --git a/examples/module/ftk_app/ftk_demo/demo_button.c b/examples/module/ftk_app/ftk_demo/demo_button.c
deleted file mode 100644
index c9eca6b3c4..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_button.c
+++ /dev/null
@@ -1,92 +0,0 @@
-#include "ftk.h"
-
-#define IDC_TEST_BUTTON 1000
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-static Ret button_hide_clicked(void* ctx, void* obj)
-{
- ftk_widget_show(ftk_widget_lookup(ctx, IDC_TEST_BUTTON), 0);
-
- return RET_OK;
-}
-
-static Ret button_show_clicked(void* ctx, void* obj)
-{
- ftk_widget_show(ftk_widget_lookup(ctx, IDC_TEST_BUTTON), 1);
-
- return RET_OK;
-}
-
-static Ret button_default_clicked(void* ctx, void* obj)
-{
- printf("%s: button %s is clicked.\n", __func__, ftk_widget_get_text(obj));
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_button_create()
-{
- return ftk_app_demo_create(_("button"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
-
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- ftk_window_set_animation_hint(win, "app_main_window");
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- width = width/3 - 10;
- button = ftk_button_create(win, 0, 30, width, 50);
- ftk_widget_set_text(button, "show");
- ftk_button_set_clicked_listener(button, button_show_clicked, win);
-
- button = ftk_button_create(win, width + 10, 30, width, 50);
- ftk_widget_set_text(button, "hide");
- ftk_button_set_clicked_listener(button, button_hide_clicked, win);
-
- button = ftk_button_create(win, 2*(width + 10), 30, width, 50);
- ftk_widget_set_text(button, "按钮测试");
- ftk_widget_set_id(button, IDC_TEST_BUTTON);
- ftk_button_set_clicked_listener(button, button_default_clicked, win);
-
- button = ftk_button_create(win, 0, 130, width, 40);
- ftk_widget_set_text(button, "yes");
- ftk_button_set_clicked_listener(button, button_default_clicked, win);
-
- button = ftk_button_create(win, 2*(width + 10), 130, width, 40);
- ftk_widget_set_text(button, "no");
- ftk_button_set_clicked_listener(button, button_default_clicked, win);
-
- button = ftk_button_create(win, width + 10, height/2, width, 60);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_quit_clicked, win);
- ftk_window_set_focus(win, button);
-
- ftk_widget_set_text(win, "button demo");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_check_button.c b/examples/module/ftk_app/ftk_demo/demo_check_button.c
deleted file mode 100644
index b0b5803fda..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_check_button.c
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "ftk.h"
-
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-static Ret button_clicked(void* ctx, void* obj)
-{
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_check_button_create()
-{
- return ftk_app_demo_create(_("check_button"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
- FtkWidget* group = NULL;
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- ftk_window_set_animation_hint(win, "app_main_window");
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- width = width/2 - 10;
- button = ftk_check_button_create(win,0, 10, width, 50);
- ftk_widget_set_text(button, "show");
- ftk_check_button_set_clicked_listener(button, button_clicked, win);
-
- button = ftk_check_button_create(win, width + 10, 10, width, 50);
- ftk_widget_set_text(button, "hide");
- ftk_check_button_set_clicked_listener(button, button_clicked, win);
-
- group = ftk_radio_group_create(win, 0, 60, 2 * width, 60);
-
- button = ftk_check_button_create_radio(group,0, 10, width, 50);
- ftk_widget_set_text(button, "Male");
- ftk_check_button_set_clicked_listener(button, button_clicked, win);
-
- button = ftk_check_button_create_radio(group, width + 10, 10, width, 50);
- ftk_widget_set_text(button, "Female");
- ftk_check_button_set_clicked_listener(button, button_clicked, win);
-
- group = ftk_radio_group_create(win, 0, 120, 2 * width, 60);
-
- button = ftk_check_button_create_radio(group,0, 10, width, 50);
- ftk_widget_set_text(button, "1(图标右)");
- ftk_check_button_set_icon_position(button, 1);
- ftk_check_button_set_clicked_listener(button, button_clicked, win);
-
- button = ftk_check_button_create_radio(group, width + 10, 10, width, 50);
- ftk_widget_set_text(button, "2(图标右)");
- ftk_check_button_set_icon_position(button, 1);
- ftk_check_button_set_clicked_listener(button, button_clicked, win);
-
- button = ftk_button_create(win, width/2, 3*height/4, width, 60);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_quit_clicked, win);
- ftk_window_set_focus(win, button);
-
- ftk_widget_set_text(win, "check button demo");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_combo_box.c b/examples/module/ftk_app/ftk_demo/demo_combo_box.c
deleted file mode 100644
index 941e652a34..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_combo_box.c
+++ /dev/null
@@ -1,89 +0,0 @@
-#include "ftk.h"
-
-#define IDC_TEST_BUTTON 1000
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_combo_box_create()
-{
- return ftk_app_demo_create(_("combo_box"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
- FtkWidget* combo_box = NULL;
-
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- ftk_window_set_animation_hint(win, "app_main_window");
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- width = width/2 - 10;
- combo_box = ftk_combo_box_create(win, 0, height/4, width, 50);
- ftk_combo_box_set_text(combo_box, "1 second");
- ftk_combo_box_append(combo_box, NULL, "1 second");
- ftk_combo_box_append(combo_box, NULL, "2 seconds");
- ftk_combo_box_append(combo_box, NULL, "3 seconds");
- combo_box = ftk_combo_box_create(win, width + 10, height/4, width, 50);
- ftk_combo_box_set_text(combo_box, "1 second");
- ftk_combo_box_append(combo_box, NULL, "1 second");
- ftk_combo_box_append(combo_box, NULL, "2 seconds");
- ftk_combo_box_append(combo_box, NULL, "3 seconds");
- ftk_combo_box_append(combo_box, NULL, "4 seconds");
- ftk_combo_box_append(combo_box, NULL, "5 seconds");
- ftk_combo_box_append(combo_box, NULL, "6 seconds");
- ftk_combo_box_append(combo_box, NULL, "7 seconds");
- ftk_combo_box_append(combo_box, NULL, "8 seconds");
- ftk_combo_box_append(combo_box, NULL, "9 seconds");
- ftk_combo_box_append(combo_box, NULL, "0 seconds");
- ftk_combo_box_append(combo_box, NULL, "0 seconds");
-
- button = ftk_button_create(win, width/2, height/2, width, 60);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_quit_clicked, win);
- ftk_window_set_focus(win, button);
-
- combo_box = ftk_combo_box_create(win, 0, 3*height/4+5, width, 50);
- ftk_combo_box_set_text(combo_box, "1 second");
- ftk_combo_box_append(combo_box, NULL, "1 second");
- ftk_combo_box_append(combo_box, NULL, "2 seconds");
- ftk_combo_box_append(combo_box, NULL, "3 seconds");
- combo_box = ftk_combo_box_create(win, width + 10, 3*height/4+5, width, 50);
- ftk_combo_box_set_text(combo_box, "1 second");
- ftk_combo_box_append(combo_box, NULL, "1 second");
- ftk_combo_box_append(combo_box, NULL, "2 seconds");
- ftk_combo_box_append(combo_box, NULL, "3 seconds");
- ftk_combo_box_append(combo_box, NULL, "4 seconds");
- ftk_combo_box_append(combo_box, NULL, "5 seconds");
- ftk_combo_box_append(combo_box, NULL, "6 seconds");
- ftk_combo_box_append(combo_box, NULL, "7 seconds");
- ftk_combo_box_append(combo_box, NULL, "8 seconds");
- ftk_combo_box_append(combo_box, NULL, "9 seconds");
- ftk_combo_box_append(combo_box, NULL, "0 seconds");
- ftk_combo_box_append(combo_box, NULL, "0 seconds");
-
- ftk_widget_set_text(win, "ComboBox Demo");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_dialog.c b/examples/module/ftk_app/ftk_demo/demo_dialog.c
deleted file mode 100644
index a8ae518900..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_dialog.c
+++ /dev/null
@@ -1,119 +0,0 @@
-#include "ftk.h"
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_dialog_create()
-{
- return ftk_app_demo_create(_("dialog"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- if(ctx != NULL)
- {
- /*modal*/
- *(int*)ctx = ftk_widget_id(obj);
- }
- else
- {
- /*modal-less*/
- ftk_widget_unref(ftk_widget_toplevel(obj));
- }
-
- return RET_QUIT;
-}
-
-static Ret button_close_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-static Ret button_dialog_clicked(void* ctx, void* obj)
-{
- int id = 0;
- int width = 0;
- int height = 0;
- FtkWidget* label = NULL;
- FtkWidget* button = NULL;
- FtkWidget* dialog = NULL;
- FtkBitmap* icon = NULL;
- int modal = (int)ctx;
-
- ftk_logd("%s:%d begin\n", __func__, __LINE__);
- dialog = ftk_dialog_create(0, 40, 320, 240);
-
- icon = ftk_theme_load_image(ftk_default_theme(), "info-icon"FTK_STOCK_IMG_SUFFIX);
- ftk_dialog_set_icon(dialog, icon);
-
- width = ftk_widget_width(dialog);
- height = ftk_widget_height(dialog);
- label = ftk_label_create(dialog, width/6, height/4, 5*width/6, 20);
- ftk_widget_set_text(label, "Are you sure to quit?");
-
- button = ftk_button_create(dialog, width/6, height/2, width/3, 50);
- ftk_widget_set_text(button, "yes");
- ftk_button_set_clicked_listener(button, button_quit_clicked, modal ? &id : NULL);
-
- button = ftk_button_create(dialog, width/2, height/2, width/3, 50);
- ftk_widget_set_text(button, "no");
- ftk_button_set_clicked_listener(button, button_quit_clicked, modal ? &id : NULL);
- ftk_window_set_focus(dialog, button);
-
- ftk_widget_set_text(dialog, modal ? "model dialog" : "normal dialog");
- ftk_widget_show_all(dialog, 1);
-
- if(modal)
- {
- assert(ftk_dialog_run(dialog) == id);
- ftk_widget_unref(dialog);
- }
- else
- {
- ftk_widget_show_all(dialog, 1);
- }
- ftk_logd("%s:%d end\n", __func__, __LINE__);
-
- return RET_OK;
-}
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
-
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- ftk_window_set_animation_hint(win, "app_main_window");
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- button = ftk_button_create(win, 0, height/6, width/3, 50);
- ftk_widget_set_text(button, "Normal");
- ftk_button_set_clicked_listener(button, button_dialog_clicked, NULL);
-
- button = ftk_button_create(win, 2*width/3, height/6, width/3, 50);
- ftk_widget_set_text(button, "Modal");
- ftk_button_set_clicked_listener(button, button_dialog_clicked, (void*)1);
-
- button = ftk_button_create(win, width/4, height/2, width/2, 60);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_close_clicked, win);
-
- ftk_widget_set_text(win, "demo dialog");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_entry.c b/examples/module/ftk_app/ftk_demo/demo_entry.c
deleted file mode 100644
index e49f951047..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_entry.c
+++ /dev/null
@@ -1,94 +0,0 @@
-#include "ftk.h"
-
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_logd("%s: %s\n", __func__, ftk_widget_get_text(ftk_widget_lookup(ctx, 100)));
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-static Ret ftk_digit_only_filter(void* ctx, void* data)
-{
- FtkEvent* event = data;
- if(event->type == FTK_EVT_KEY_UP || event->type == FTK_EVT_KEY_DOWN)
- {
- int code = event->u.key.code;
- if(code >= FTK_KEY_0 && code <= FTK_KEY_9)
- {
- return RET_OK;
- }
- else if(code == FTK_KEY_UP
- || code == FTK_KEY_DOWN
- || code == FTK_KEY_LEFT
- || code == FTK_KEY_RIGHT
- || code == FTK_KEY_BACKSPACE
- || code == FTK_KEY_DELETE
- || code == FTK_KEY_HOME
- || code == FTK_KEY_END
- || code == FTK_KEY_TAB)
- {
- return RET_OK;
- }
-
- return RET_REMOVE;
- }
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_entry_create()
-{
- return ftk_app_demo_create(_("entry"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-#define STR_TEXT1 "Single line editor, that means you can input a one line only."
-#define STR_TEXT2 "Single line editor, 也就是说你只能输入一行文字."
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
- FtkWidget* entry = NULL;
-
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- ftk_window_set_animation_hint(win, "app_main_window");
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
- entry = ftk_entry_create(win, 10, 30, ftk_widget_width(win) - 20, 30);
- ftk_widget_set_id(entry, 100);
- ftk_widget_set_text(entry, "1234");
- ftk_widget_set_event_listener(entry, ftk_digit_only_filter, NULL);
- ftk_entry_set_tips(entry, "Please input some digits.");
- entry = ftk_entry_create(win, 10, 80, ftk_widget_width(win) - 20, 30);
- ftk_widget_set_text(entry, STR_TEXT1);
- assert(strcmp(STR_TEXT1, ftk_widget_get_text(entry)) == 0);
-
- entry = ftk_entry_create(win, 10, 130, ftk_widget_width(win) - 20, 30);
- ftk_widget_set_text(entry, STR_TEXT2);
- assert(strcmp(STR_TEXT2, ftk_widget_get_text(entry)) == 0);
-
- button = ftk_button_create(win, width/4, 3*height/4, width/2, 60);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_quit_clicked, win);
- ftk_window_set_focus(win, button);
-
- ftk_widget_set_text(win, "entry demo");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_file_browser.c b/examples/module/ftk_app/ftk_demo/demo_file_browser.c
deleted file mode 100644
index a7a9fc0752..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_file_browser.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#include "ftk.h"
-#include "ftk_file_browser.h"
-
-static Ret on_file_selected(void* ctx, int index, const char* path)
-{
- ftk_logd("%s: [%d] %s\n", __func__, index, path);
-
- return RET_OK;
-}
-
-#define IDC_TEST_BUTTON 1000
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-static Ret button_browser_clicked(void* ctx, void* obj)
-{
- FtkWidget* win = ftk_file_browser_create(FTK_FILE_BROWER_APP);
- ftk_file_browser_set_path(win, "./");
- ftk_file_browser_load(win);
-
- return RET_OK;
-}
-
-static Ret button_single_choose_clicked(void* ctx, void* obj)
-{
- FtkWidget* win = ftk_file_browser_create(FTK_FILE_BROWER_SINGLE_CHOOSER);
- ftk_file_browser_set_choosed_handler(win, on_file_selected, NULL);
- ftk_file_browser_set_path(win, "./");
- ftk_file_browser_load(win);
-
- return RET_OK;
-}
-
-static Ret button_multi_choose_clicked(void* ctx, void* obj)
-{
- FtkWidget* win = ftk_file_browser_create(FTK_FILE_BROWER_MULTI_CHOOSER);
- ftk_file_browser_set_choosed_handler(win, on_file_selected, NULL);
- ftk_file_browser_set_path(win, "./");
- ftk_file_browser_load(win);
-
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_file_browser_create()
-{
- return ftk_app_demo_create(_("file_browser"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
-
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- ftk_window_set_animation_hint(win, "app_main_window");
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- width = width/2 - 10;
- button = ftk_button_create(win, 0, height/4, width, 50);
- ftk_widget_set_text(button, "Single Choose");
- ftk_button_set_clicked_listener(button, button_single_choose_clicked, win);
-
- button = ftk_button_create(win, width + 10, height/4, width, 50);
- ftk_widget_set_text(button, "Browser");
- ftk_button_set_clicked_listener(button, button_browser_clicked, win);
-
- button = ftk_button_create(win, 0, height/2, width, 50);
- ftk_widget_set_text(button, "Multi Choose");
- ftk_button_set_clicked_listener(button, button_multi_choose_clicked, win);
-
- button = ftk_button_create(win, width + 10, height/2, width, 50);
- ftk_widget_set_text(button, "Quit");
- ftk_button_set_clicked_listener(button, button_quit_clicked, win);
- ftk_window_set_focus(win, button);
-
- ftk_widget_set_text(win, "FileBrowser");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_fullscreen.c b/examples/module/ftk_app/ftk_demo/demo_fullscreen.c
deleted file mode 100644
index a2cf78d12e..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_fullscreen.c
+++ /dev/null
@@ -1,101 +0,0 @@
-#include "ftk.h"
-
-static Ret on_prepare_options_menu(void* ctx, FtkWidget* menu_panel)
-{
- int i = 0;
- for(i = 0; i < 3; i++)
- {
- char text[32] = {0};
- FtkWidget* item = ftk_menu_item_create(menu_panel);
- ftk_snprintf(text, sizeof(text), "Menu%02d", i);
- ftk_widget_set_text(item, text);
- ftk_widget_show(item, 1);
- }
-
- return i > 0 ? RET_OK : RET_FAIL;
-}
-#define IDC_TEST_BUTTON 1000
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-static const char* buttons[] = {"OK", NULL};
-static Ret button_unfullscreen_clicked(void* ctx, void* obj)
-{
- if(!ftk_window_is_fullscreen(ctx))
- {
- ftk_infomation("Infomation", "Windows is not fullscreen.", buttons);
- }
- else
- {
- ftk_window_set_fullscreen(ctx, 0);
- }
-
- return RET_OK;
-}
-
-static Ret button_fullscreen_clicked(void* ctx, void* obj)
-{
- if(ftk_window_is_fullscreen(ctx))
- {
- ftk_infomation("Infomation", "Windows is fullscreen.", buttons);
- }
- else
- {
- ftk_window_set_fullscreen(ctx, 1);
- }
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_fullscreen_create()
-{
- return ftk_app_demo_create(_("fullscreen"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
-
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- ftk_window_set_animation_hint(win, "app_main_window");
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- width = width/2 - 10;
- button = ftk_button_create(win, 0, height/4, width, 50);
- ftk_widget_set_text(button, "Fullscreen");
- ftk_button_set_clicked_listener(button, button_fullscreen_clicked, win);
-
- button = ftk_button_create(win, width + 10, height/4, width, 50);
- ftk_widget_set_text(button, "Unfullscreen");
- ftk_button_set_clicked_listener(button, button_unfullscreen_clicked, win);
-
- button = ftk_button_create(win, width/2, height/2, width, 60);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_quit_clicked, win);
- ftk_window_set_focus(win, button);
-
- ftk_widget_set_text(win, "fullscreen");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
- ftk_app_window_set_on_prepare_options_menu(win, on_prepare_options_menu, win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_hello.c b/examples/module/ftk_app/ftk_demo/demo_hello.c
deleted file mode 100644
index af2dbeee09..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_hello.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "ftk.h"
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_hello_create()
-{
- return ftk_app_demo_create(_("hello"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- FtkWidget* win = NULL;
-
- FTK_INIT(argc, argv);
- win = ftk_app_window_create();
- ftk_window_set_animation_hint(win, "app_main_window");
- ftk_widget_set_text(win, "Hello FTK!");
- ftk_widget_show(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_icon_view.c b/examples/module/ftk_app/ftk_demo/demo_icon_view.c
deleted file mode 100644
index 534bbae8b0..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_icon_view.c
+++ /dev/null
@@ -1,101 +0,0 @@
-#include "ftk.h"
-
-#define IDC_TEST_BUTTON 1000
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-static int i = 0;
-static Ret button_more_clicked(void* ctx, void* obj)
-{
- int j = 0;
- FtkIconViewItem item;
- FtkWidget* icon_view = ftk_widget_lookup(ctx, 100);
- item.icon = ftk_theme_load_image(ftk_default_theme(), "flag-32.png");
-
- for(j=0; j < 4; j++)
- {
- char text[100] = {0};
- ftk_snprintf(text, sizeof(text), "%d", i);
- item.text = text;
- ftk_bitmap_ref(item.icon);
- item.user_data = (void*)i;
- ftk_icon_view_add(icon_view, &item);
- i+=1000;
- }
- ftk_bitmap_unref(item.icon);
-
- return RET_OK;
-}
-
-static Ret item_clicked(void* ctx, void* obj)
-{
- FtkIconViewItem* item = obj;
-
- ftk_logd("%s: %s: user_data=%d\n", __func__, item->text, item->user_data);
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_icon_view_create()
-{
- return ftk_app_demo_create(_("icon_view"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
- FtkWidget* icon_view = NULL;
- FtkIconViewItem item;
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- ftk_window_set_animation_hint(win, "app_main_window");
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- button = ftk_button_create(win, 10, 0, width/3-10, 60);
- ftk_widget_set_text(button, "more");
- ftk_button_set_clicked_listener(button, button_more_clicked, win);
- ftk_window_set_focus(win, button);
-
- button = ftk_button_create(win, 2*width/3, 0, width/3-10, 60);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_quit_clicked, win);
- ftk_window_set_focus(win, button);
-
- item.icon = ftk_theme_load_image(ftk_default_theme(), "flag-32.png");
- icon_view = ftk_icon_view_create(win, 5, 70, width-10, height-80);
- ftk_widget_set_id(icon_view, 100);
- ftk_icon_view_set_clicked_listener(icon_view, item_clicked, win);
- for(; i < 4; i++)
- {
- char text[100] = {0};
- ftk_snprintf(text, sizeof(text), "%d", i);
- item.text = text;
- item.user_data = (void*)i;
- ftk_icon_view_add(icon_view, &item);
- }
-
- ftk_bitmap_unref(item.icon);
- ftk_widget_set_text(win, "icon view demo");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_image.c b/examples/module/ftk_app/ftk_demo/demo_image.c
deleted file mode 100644
index cca9712812..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_image.c
+++ /dev/null
@@ -1,67 +0,0 @@
-#include "ftk.h"
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_image_create()
-{
- return ftk_app_demo_create(_("image"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- FtkWidget* image = NULL;
- FtkWidget* win = NULL;
- char filename[FTK_MAX_PATH+1] = {0};
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- ftk_window_set_animation_hint(win, "app_main_window");
-
- ftk_snprintf(filename, FTK_MAX_PATH, "%s/earth.png",
- ftk_config_get_test_data_dir(ftk_default_config()));
-
- image = ftk_image_create(win, 0, 0, ftk_widget_width(win)/2, ftk_widget_height(win)/2);
- ftk_image_set_image(image,
- ftk_bitmap_factory_load(ftk_default_bitmap_factory(), filename));
-
- ftk_snprintf(filename, FTK_MAX_PATH, "%s/png_RGB_tRNS.png",
- ftk_config_get_test_data_dir(ftk_default_config()));
- image = ftk_image_create(win, 0, 0, ftk_widget_width(win)/2, ftk_widget_height(win)/2);
- ftk_image_set_image(image,
- ftk_bitmap_factory_load(ftk_default_bitmap_factory(), filename));
- ftk_widget_set_attr(image, FTK_ATTR_TRANSPARENT);
-
- ftk_snprintf(filename, FTK_MAX_PATH, "%s/Calculator.png",
- ftk_config_get_test_data_dir(ftk_default_config()));
- image = ftk_image_create(win, ftk_widget_width(win)/2, 0, ftk_widget_width(win)/2, ftk_widget_height(win)/2);
- ftk_image_set_image(image,
- ftk_bitmap_factory_load(ftk_default_bitmap_factory(), filename));
- ftk_widget_set_attr(image, FTK_ATTR_BG_TILE);
-
- ftk_snprintf(filename, FTK_MAX_PATH, "%s/t8.bmp",
- ftk_config_get_test_data_dir(ftk_default_config()));
- image = ftk_image_create(win, 0, ftk_widget_height(win)/2, ftk_widget_width(win)/2, ftk_widget_height(win)/2);
- ftk_image_set_image(image,
- ftk_bitmap_factory_load(ftk_default_bitmap_factory(), filename));
- ftk_widget_set_attr(image, FTK_ATTR_BG_CENTER);
-
- ftk_snprintf(filename, FTK_MAX_PATH, "%s/jpeg1.jpg",
- ftk_config_get_test_data_dir(ftk_default_config()));
- image = ftk_image_create(win, ftk_widget_width(win)/2, ftk_widget_height(win)/2, ftk_widget_width(win)/2, ftk_widget_height(win)/2);
- ftk_image_set_image(image,
- ftk_bitmap_factory_load(ftk_default_bitmap_factory(), filename));
- ftk_widget_set_attr(image, FTK_ATTR_BG_TILE);
-
- ftk_widget_set_text(win, "image demo");
- ftk_widget_show_all(win, 1);
-
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
diff --git a/examples/module/ftk_app/ftk_demo/demo_image_button.c b/examples/module/ftk_app/ftk_demo/demo_image_button.c
deleted file mode 100644
index 026289c816..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_image_button.c
+++ /dev/null
@@ -1,124 +0,0 @@
-#include "ftk.h"
-
-const char* pngs[] =
-{
- "/Camera.png",
- "/Notes.png",
- "/RSS.png",
- "/Calculator.png",
- "/Twitter.png",
- "/Clock.png",
- "/Games.png",
- "/Youtube.png",
- "/AIM.png",
- "/LastFm.png",
- "/IP.png",
- "/Acrobat.png",
- "/Settings.png",
- "/App",
- "/Customize.png",
- "/Skype.png",
- "/Linkedin.png",
- "/Calender.png",
- "/Call.png",
- "/Install.png",
- "/Facebook.png",
- "/iPod.png",
- "/Chat.png",
- "/WLM.png",
- "/Flickr.png",
- "/Photos.png",
- "/Stock.png",
- "/Delicious.png",
- "/Maps.png",
- "/iTunes.png",
- "/Memory.png",
- "/Weather.png",
- "/Wordpress.png",
- "/iradio.png",
- "/Safari.png",
- "/Google.png",
- "/Yahoo.png",
- "/VLC.png",
- "/Sms.png",
- "/Mail.png",
- NULL
-};
-
-static Ret button_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_image_button_create()
-{
- return ftk_app_demo_create(_("image_button"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int i = 0;
- int j = 0;
- int width = 0;
- int height = 0;
- char filename[FTK_MAX_PATH] = {0};
- FtkGc gc = {0};
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
- FTK_INIT(argc, argv);
-
- gc.mask = FTK_GC_BITMAP;
- win = ftk_app_window_create();
- ftk_window_set_animation_hint(win, "app_main_window");
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
- for(i = 0; i < height/80; i++)
- {
- for(j = 0; j < width/80; j++)
- {
- ftk_snprintf(filename, sizeof(filename), "%s%s",
- ftk_config_get_test_data_dir(ftk_default_config()), pngs[i + 2]);
- gc.bitmap = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), filename);
- button = ftk_button_create(win, j * 80, i * 80, ftk_bitmap_width(gc.bitmap), ftk_bitmap_height(gc.bitmap));
- if(i == 0)
- {
- ftk_widget_unset_attr(button, FTK_ATTR_TRANSPARENT);
- }
- ftk_widget_set_gc(button, FTK_WIDGET_NORMAL, &gc);
- ftk_bitmap_unref(gc.bitmap);
-
- ftk_snprintf(filename, sizeof(filename), "%s%s",
- ftk_config_get_test_data_dir(ftk_default_config()), pngs[1]);
- gc.bitmap = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), filename);
- ftk_widget_set_gc(button, FTK_WIDGET_FOCUSED, &gc);
- ftk_bitmap_unref(gc.bitmap);
-
- ftk_snprintf(filename, sizeof(filename), "%s%s",
- ftk_config_get_test_data_dir(ftk_default_config()), pngs[0]);
- gc.bitmap = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), filename);
- ftk_widget_set_gc(button, FTK_WIDGET_ACTIVE, &gc);
- ftk_bitmap_unref(gc.bitmap);
-
- if(i == 0 && j == 0)
- {
- ftk_button_set_clicked_listener(button, button_clicked, win);
- ftk_widget_set_text(button, "Quit");
- }
- }
- }
- ftk_widget_set_text(win, "image button demo");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
diff --git a/examples/module/ftk_app/ftk_demo/demo_ime.c b/examples/module/ftk_app/ftk_demo/demo_ime.c
deleted file mode 100644
index 459a71c3f5..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_ime.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#include "ftk.h"
-
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_ime_create()
-{
- return ftk_app_demo_create(_("ime"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
- FtkWidget* entry = NULL;
-
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- ftk_window_set_animation_hint(win, "app_main_window");
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
- entry = ftk_entry_create(win, 10, 30, ftk_widget_width(win) - 20, 30);
- ftk_entry_set_text(entry, "Single line editor");
- ftk_input_method_manager_set_current(ftk_default_input_method_manager(), 0);
-
- entry = ftk_entry_create(win, 10, 80, ftk_widget_width(win) - 20, 30);
- ftk_entry_set_text(entry, "Single line editor, that means you can input a one line only.");
-
- entry = ftk_entry_create(win, 10, 130, ftk_widget_width(win) - 20, 30);
- ftk_entry_set_text(entry, "Single line editor, 也就是说你只能输入一行文字.");
-
- button = ftk_button_create(win, width/4, height/2, width/2, 60);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_quit_clicked, win);
- ftk_window_set_focus(win, button);
-
- entry = ftk_entry_create(win, 10, height-60, ftk_widget_width(win) - 20, 30);
- ftk_entry_set_text(entry, "Single line editor");
-
- ftk_widget_set_text(win, "entry demo");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_label.c b/examples/module/ftk_app/ftk_demo/demo_label.c
deleted file mode 100644
index 4f8d2b03af..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_label.c
+++ /dev/null
@@ -1,104 +0,0 @@
-#include "ftk.h"
-
-typedef struct _TimerInfo
-{
- int times;
- FtkWidget* label;
-}TimerInfo;
-
-static Ret timeout(void* ctx)
-{
- TimerInfo* info = ctx;
- char buffer[32] = {0};
- if(info->times > 0)
- {
- ftk_snprintf(buffer, sizeof(buffer), "Quit after %d seconds", info->times);
- ftk_widget_set_text(info->label, buffer);
- info->times--;
-
- return RET_OK;
- }
- else
- {
- ftk_widget_unref(ftk_widget_toplevel(info->label));
- ftk_logd("%s: timeout and quit.\n", __func__);
- FTK_FREE(info);
- FTK_QUIT();
- return RET_REMOVE;
- }
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_label_create()
-{
- return ftk_app_demo_create(_("label"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkGc gc = {0};
- TimerInfo* info = NULL;
- FtkSource* timer = NULL;
- FtkWidget* win = NULL;
- FtkWidget* label = NULL;
-
- gc.mask = FTK_GC_BG;
-
- FTK_INIT(argc, argv);
- info = (TimerInfo*)FTK_ZALLOC(sizeof(TimerInfo));
- info->times = 5;
-
- timer = ftk_source_timer_create(1000, timeout, info);
- win = ftk_app_window_create();
- ftk_window_set_animation_hint(win, "app_main_window");
-
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
-#ifdef WIN32
- label = ftk_label_create(win, 10, 10, width - 20, 20);
- ftk_widget_set_text(label, "中文文本");
-#else
-#endif
- label = ftk_label_create(win, 10, 40, width - 20, 20);
- ftk_widget_set_text(label, "English Text(center)");
- ftk_label_set_alignment(label, FTK_ALIGN_CENTER);
- assert(strcmp(ftk_widget_get_text(label), "English Text(center)") == 0);
-
- label = ftk_label_create(win, 10, 70, width - 20, 20);
- ftk_widget_set_text(label, "English Text(right)");
- ftk_label_set_alignment(label, FTK_ALIGN_RIGHT);
-
- gc.bg.a = 0xff;
- gc.bg.r = 0xF0;
- gc.bg.g = 0xF0;
- gc.bg.b = 0x80;
- label = ftk_label_create(win, 10, height/2, width - 20, 120);
- ftk_widget_set_gc(label, FTK_WIDGET_INSENSITIVE, &gc);
- ftk_widget_unset_attr(label, FTK_ATTR_TRANSPARENT);
-#ifdef WIN32
- ftk_widget_set_text(label, "The linux mobile development(with background color)");
-#else
- ftk_widget_set_text(label, "中英文混合多行文本显示:the linux mobile development.带有背景颜色。");
-#endif
- label = ftk_label_create(win, 50, height/2-30, width, 20);
- info->label = label;
-
- ftk_widget_set_text(win, "label demo");
- ftk_widget_show_all(win, 1);
-
- ftk_widget_set_attr(win, FTK_ATTR_IGNORE_CLOSE);
- ftk_main_loop_add_source(ftk_default_main_loop(), timer);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_listview.c b/examples/module/ftk_app/ftk_demo/demo_listview.c
deleted file mode 100644
index 058f652c82..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_listview.c
+++ /dev/null
@@ -1,130 +0,0 @@
-#include "ftk.h"
-
-#include "ftk_list_view.h"
-#include "ftk_list_render_default.h"
-#include "ftk_list_model_default.h"
-
-#define IDC_TEST_BUTTON 1000
-static int g_index = 0;
-static FtkBitmap* left_icon = NULL;
-static FtkBitmap* right_icon = NULL;
-
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-static Ret button_more_clicked(void* ctx, void* obj)
-{
- int i = 0;
- char text[32] = {0};
- FtkListItemInfo info = {0};
- FtkListModel* model = ctx;
-
- for(i = 0; i < 4; i++)
- {
- g_index++;
- ftk_snprintf(text, sizeof(text), "item%04d", g_index);
- info.text = (text);
- info.left_icon = left_icon;
- info.right_icon = right_icon;
- info.type = g_index%4;
- ftk_list_model_add(model, &info);
- }
-
- return RET_OK;
-}
-
-Ret on_item_clicked(void* ctx, void* list)
-{
- FtkListItemInfo* info = NULL;
- FtkListModel* model = ftk_list_view_get_model(list);
- int i = ftk_list_view_get_selected(list);
-
- ftk_list_model_get_data(model, i, (void**)&info);
- if(info != NULL)
- {
- info->state = !info->state;
- }
- ftk_logd("%s: %d/%d\n", __func__,
- ftk_list_view_get_selected(list),
- ftk_list_model_get_total(model));
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_listview_create()
-{
- return ftk_app_demo_create(_("listview"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
- FtkWidget* list = NULL;
- FtkListModel* model = NULL;
- FtkListRender* render = NULL;
- FtkListItemInfo info = {0};
- char filename[FTK_MAX_PATH+1] = {0};
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- list = ftk_list_view_create(win, 10, 5, width - 20, 3 * height/4-5);
- ftk_list_view_set_clicked_listener(list, on_item_clicked, NULL);
-
- model = ftk_list_model_default_create(10);
- render = ftk_list_render_default_create();
- ftk_snprintf(filename, FTK_MAX_PATH, "%s/alarm/%s",
- ftk_config_get_test_data_dir(ftk_default_config()), FTK_STOCK_IMG_SUFFIX);
- left_icon = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), filename);
- ftk_snprintf(filename, FTK_MAX_PATH, "%s/search/%s",
- ftk_config_get_test_data_dir(ftk_default_config()), FTK_STOCK_IMG_SUFFIX);
- right_icon = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), filename);
-
- g_index = 0;
- for(g_index = 0; g_index < 4; g_index++)
- {
- info.text = "滚动文字:Only those who attempt the absurd can achieve the impossible.";
- info.left_icon = left_icon;
- info.right_icon = right_icon;
- info.type = g_index%4;
- ftk_list_model_add(model, &info);
- }
-
- ftk_list_render_default_set_marquee_attr(render, FTK_MARQUEE_AUTO | FTK_MARQUEE_RIGHT2LEFT | FTK_MARQUEE_FOREVER);
- ftk_list_view_init(list, model, render, 40);
- ftk_list_model_unref(model);
-
- button = ftk_button_create(win, width/4, 3 * height/4 + 5, width/4, 60);
- ftk_widget_set_text(button, "more");
- ftk_widget_set_font_size(button, 20);
- ftk_button_set_clicked_listener(button, button_more_clicked, model);
-
- button = ftk_button_create(win, width/2, 3 * height/4 + 5, width/4, 60);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_quit_clicked, win);
- ftk_window_set_focus(win, button);
-
- ftk_widget_set_text(win, "list view demo");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_menu.c b/examples/module/ftk_app/ftk_demo/demo_menu.c
deleted file mode 100644
index 7736276346..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_menu.c
+++ /dev/null
@@ -1,107 +0,0 @@
-#include "ftk.h"
-
-static void create_app_window(void);
-static Ret button_open_clicked(void* ctx, void* obj)
-{
- create_app_window();
-
- return RET_OK;
-}
-
-static Ret button_close_clicked(void* ctx, void* obj)
-{
- FtkWidget* win = ctx;
- ftk_logd("%s: close window %s\n", __func__, ftk_widget_get_text(win));
- ftk_widget_unref(win);
-
- return RET_OK;
-}
-
-
-static int g_index = 0;
-static void on_window_close(void* user_data)
-{
- g_index--;
-
- ftk_logd("%s: g_index=%d\n", __func__, g_index);
- if(g_index == 0)
- {
- FTK_QUIT();
- }
-
- return ;
-}
-
-static Ret on_prepare_options_menu(void* ctx, FtkWidget* menu_panel)
-{
- int i = 0;
- for(i = 0; i < g_index && i < 8; i++)
- {
- char text[32] = {0};
- FtkWidget* item = ftk_menu_item_create(menu_panel);
- ftk_snprintf(text, sizeof(text), "Menu%02d", i);
- ftk_widget_set_text(item, text);
- ftk_widget_show(item, 1);
- }
-
- return i > 0 ? RET_OK : RET_FAIL;
-}
-
-static void create_app_window(void)
-{
- int width = 0;
- int height = 0;
- char title[128] = {0};
- FtkWidget* win = ftk_app_window_create();
- FtkWidget* label = NULL;
- FtkWidget* button = NULL;
-
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- button = ftk_button_create(win, 0, height/6, width/2-5, 50);
- ftk_widget_set_text(button, "创建窗口");
- ftk_button_set_clicked_listener(button, button_open_clicked, win);
-
- button = ftk_button_create(win, width/2+5, height/6, width/2-5, 50);
- ftk_widget_set_text(button, "关闭窗口");
- ftk_button_set_clicked_listener(button, button_close_clicked, win);
-
- label = ftk_label_create(win, 10, height/2, width-20, 60);
-
- ftk_snprintf(title, sizeof(title),
- "Press F2 to open menu, Presss F3 close window%02d", g_index++);
- ftk_widget_set_text(label, title);
-
- ftk_snprintf(title, sizeof(title), "window%02d", g_index++);
- ftk_widget_set_text(win, title);
- ftk_widget_show_all(win, 1);
- ftk_widget_set_user_data(win, on_window_close, win);
-
- ftk_app_window_set_on_prepare_options_menu(win, on_prepare_options_menu, win);
-
- return;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_menu_create()
-{
- return ftk_app_demo_create(_("menu"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- FTK_INIT(argc, argv);
-
- create_app_window();
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_msgbox.c b/examples/module/ftk_app/ftk_demo/demo_msgbox.c
deleted file mode 100644
index 90d80f7d4e..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_msgbox.c
+++ /dev/null
@@ -1,101 +0,0 @@
-#include "ftk.h"
-
-static const char* buttons1[] = {"Yes", NULL};
-static const char* buttons2[] = {"Yes", "No", NULL};
-static const char* buttons3[] = {"Yes", "No", "Cancel", NULL};
-static Ret button_warning(void* ctx, void* obj)
-{
- int ret = ftk_warning("Warning", "December 31, 2008: patchwork.kernel.org is now available for general use. It is currently only monitoring the Linux Kernel mailing-list, but should be useful to kernel developers in dealing with patches flying across the wire.", buttons1);
-
- ftk_logd("%s: ret = %d\n", __func__, ret);
-
- return RET_OK;
-}
-
-static Ret button_info(void* ctx, void* obj)
-{
- int ret = ftk_infomation("Infomation", "September 19, 2008: mirrors.kernel.org has been flipped over to using our new GeoDNS based bind server (named-geodns). This means that, at the dns query level, our servers will attempt to direct you to the nearest / fastest kernel.org mirror for your request. This means that you no longer have to use mirrors.us.kernel.org or mirrors.eu.kernel.org to generally route you to the right place. This does mean a change to mirrors.kernel.org no longer explicitly pointing at mirrors.us.kernel.org. Additional information on named-geodns will be forth coming, check back here for an addendum soon.", buttons2);
-
- ftk_logd("%s: ret = %d\n", __func__, ret);
- return RET_OK;
-}
-
-static Ret button_question(void* ctx, void* obj)
-{
- int ret = ftk_question("Question", "Are you sure to quit?", buttons3);
- ftk_logd("%s: ret = %d\n", __func__, ret);
-
- return RET_OK;
-}
-
-static Ret button_tips(void* ctx, void* obj)
-{
- int ret = ftk_tips("The dialog will quit in 3 seconds.");
- ftk_logd("%s: ret = %d\n", __func__, ret);
-
- return RET_OK;
-}
-
-static Ret button_quit(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_msgbox_create()
-{
- return ftk_app_demo_create(_("msgbox"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int y = 0;
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
-
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- y = (height - 240)/2;
- y = y > 0 ? y : 0;
-
- button = ftk_button_create(win, 0, y, width/2, 50);
- ftk_widget_set_text(button, "question");
- ftk_button_set_clicked_listener(button, button_question, win);
-
- button = ftk_button_create(win, width/2, y, width/2, 50);
- ftk_widget_set_text(button, "warning");
- ftk_button_set_clicked_listener(button, button_warning, win);
-
- button = ftk_button_create(win, 0, y+60, width/2, 50);
- ftk_widget_set_text(button, "info");
- ftk_button_set_clicked_listener(button, button_info, win);
-
- button = ftk_button_create(win, width/2, y+60, width/2, 50);
- ftk_widget_set_text(button, "tips");
- ftk_button_set_clicked_listener(button, button_tips, win);
-
- button = ftk_button_create(win, width/4, y+120, width/2, 50);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_quit, win);
-
- ftk_widget_set_text(win, "message box demo");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_multi_win.c b/examples/module/ftk_app/ftk_demo/demo_multi_win.c
deleted file mode 100644
index 151341553d..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_multi_win.c
+++ /dev/null
@@ -1,87 +0,0 @@
-#include "ftk.h"
-
-static void create_app_window(void);
-static Ret button_open_clicked(void* ctx, void* obj)
-{
- create_app_window();
-
- return RET_OK;
-}
-
-static Ret button_close_clicked(void* ctx, void* obj)
-{
- FtkWidget* win = ctx;
- ftk_logd("%s: close window %s\n", __func__, ftk_widget_get_text(win));
- ftk_widget_unref(win);
-
- return RET_OK;
-}
-
-static int g_index = 0;
-static void on_window_close(void* user_data)
-{
- g_index--;
-
- ftk_logd("%s: g_index=%d\n", __func__, g_index);
- if(g_index == 0)
- {
- FTK_QUIT();
- }
-
- return ;
-}
-
-
-static void create_app_window(void)
-{
- char title[32] = {0};
- int width = 0;
- int height = 0;
- FtkWidget* win = ftk_app_window_create();
- FtkWidget* label = NULL;
- FtkWidget* button = NULL;
-
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- button = ftk_button_create(win, 0, height/6, width/3, 50);
- ftk_widget_set_text(button, "创建窗口");
- ftk_button_set_clicked_listener(button, button_open_clicked, win);
-
- button = ftk_button_create(win, 2*width/3, height/6, width/3, 50);
- ftk_widget_set_text(button, "关闭窗口");
- ftk_button_set_clicked_listener(button, button_close_clicked, win);
-
- ftk_snprintf(title, sizeof(title), "window%02d", g_index++);
- label = ftk_label_create(win, width/4, height/2, width/2, 30);
- ftk_widget_set_text(label, title);
-
- ftk_widget_set_text(win, title);
- ftk_widget_show_all(win, 1);
- ftk_widget_set_user_data(win, on_window_close, win);
-
- return;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_multi_win_create()
-{
- return ftk_app_demo_create(_("multi_win"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- FTK_INIT(argc, argv);
-
- create_app_window();
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_popup.c b/examples/module/ftk_app/ftk_demo/demo_popup.c
deleted file mode 100644
index bdf655e40c..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_popup.c
+++ /dev/null
@@ -1,133 +0,0 @@
-#include "ftk.h"
-
-static Ret button_close_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-static FtkListItemInfo g_infos[4];
-static Ret on_menu_item_clicked(void* ctx, void* data)
-{
- FtkListItemInfo* info = data;
-
- ftk_logd("%s: %s is selected\n", __func__, info->text);
-
- return RET_OK;
-}
-
-static Ret button_normal_clicked(void* ctx, void* obj)
-{
- FtkBitmap* icon = ftk_theme_load_image(ftk_default_theme(), "info"FTK_STOCK_IMG_SUFFIX);
- FtkWidget* thiz = ftk_popup_menu_create(0, 0, 0, 200, icon, "Edit");
-
- size_t i = 0;
- for(i = 0; i < FTK_ARRAY_SIZE(g_infos); i++)
- {
- g_infos[i].type = FTK_LIST_ITEM_NORMAL;
- ftk_popup_menu_add(thiz, g_infos+i);
- }
- ftk_bitmap_unref(icon);
-
- ftk_widget_show_all(thiz, 1);
-
- return RET_OK;
-}
-
-static Ret button_radio_clicked(void* ctx, void* obj)
-{
- FtkBitmap* icon = ftk_theme_load_image(ftk_default_theme(), "info"FTK_STOCK_IMG_SUFFIX);
- FtkWidget* thiz = ftk_popup_menu_create(0, 0, 0, 200, icon, "Edit");
-
- size_t i = 0;
- for(i = 0; i < FTK_ARRAY_SIZE(g_infos); i++)
- {
- g_infos[i].type = FTK_LIST_ITEM_RADIO;
- g_infos[i].state = i == 0;
- ftk_popup_menu_add(thiz, g_infos+i);
- }
- ftk_bitmap_unref(icon);
-
- ftk_widget_show_all(thiz, 1);
-
- return RET_OK;
-}
-
-static Ret button_check_clicked(void* ctx, void* obj)
-{
- FtkBitmap* icon = ftk_theme_load_image(ftk_default_theme(), "info"FTK_STOCK_IMG_SUFFIX);
- FtkWidget* thiz = ftk_popup_menu_create(0, 0, 0, 200, icon, "Edit");
-
- size_t i = 0;
- for(i = 0; i < FTK_ARRAY_SIZE(g_infos); i++)
- {
- g_infos[i].type = FTK_LIST_ITEM_CHECK;
- g_infos[i].state = i%2;
- ftk_popup_menu_add(thiz, g_infos+i);
- }
- ftk_bitmap_unref(icon);
-
- ftk_widget_show_all(thiz, 1);
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_popup_create()
-{
- return ftk_app_demo_create(_("popup"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
-
- FTK_INIT(argc, argv);
-
- g_infos[0].text = "Copy";
- g_infos[1].text = "Paste";
- g_infos[2].text = "Cut";
- g_infos[3].text = "Select All";
- g_infos[0].extra_user_data = on_menu_item_clicked;
- g_infos[1].extra_user_data = on_menu_item_clicked;
- g_infos[2].extra_user_data = on_menu_item_clicked;
- g_infos[3].extra_user_data = on_menu_item_clicked;
-
- win = ftk_app_window_create();
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- button = ftk_button_create(win, 0, height/6, width/3, 50);
- ftk_widget_set_text(button, "Normal");
- ftk_button_set_clicked_listener(button, button_normal_clicked, NULL);
-
- button = ftk_button_create(win, 2*width/3, height/6, width/3, 50);
- ftk_widget_set_text(button, "Radio");
- ftk_button_set_clicked_listener(button, button_radio_clicked, NULL);
-
- button = ftk_button_create(win, 0, height/2, width/3, 50);
- ftk_widget_set_text(button, "CheckBox");
- ftk_button_set_clicked_listener(button, button_check_clicked, NULL);
-
- button = ftk_button_create(win, 2*width/3, height/2, width/3, 50);
- ftk_widget_set_text(button, "Quit");
- ftk_button_set_clicked_listener(button, button_close_clicked, win);
-
- ftk_widget_set_text(win, "pupup");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_progress_bar.c b/examples/module/ftk_app/ftk_demo/demo_progress_bar.c
deleted file mode 100644
index 7694cf407a..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_progress_bar.c
+++ /dev/null
@@ -1,87 +0,0 @@
-#include "ftk.h"
-#include "ftk_util.h"
-
-static void on_window_destroy(void* user_data)
-{
- FtkSource* timer = user_data;
-
- ftk_source_disable(timer);
- ftk_main_loop_remove_source(ftk_default_main_loop(), timer);
-
- return;
-}
-
-static Ret update_progress(void* ctx)
-{
- int percent = 0;
- char text[32] = {0};
- FtkWidget* progress_bar = ctx;
-
- percent = ftk_progress_bar_get_percent(progress_bar);
- if(percent == 100)
- {
- return RET_REMOVE;
- }
- ftk_progress_bar_set_percent(progress_bar, percent + 10);
-
- ftk_itoa(text, sizeof(text), ftk_progress_bar_get_percent(progress_bar));
- strcat(text, "%");
- ftk_widget_set_text(progress_bar, text);
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_progress_bar_create()
-{
- return ftk_app_demo_create(_("progress_bar"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* progress_bar = NULL;
- FtkSource* timer = NULL;
-
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- width = width - 20;
- progress_bar = ftk_progress_bar_create(win, 10, height/6, width, 32);
- ftk_progress_bar_set_percent(progress_bar, 20);
- timer = ftk_source_timer_create(1000, update_progress, progress_bar);
- ftk_main_loop_add_source(ftk_default_main_loop(), timer);
- ftk_widget_set_user_data(progress_bar, on_window_destroy, timer);
-
- progress_bar = ftk_progress_bar_create(win, 10, height/3, width, 20);
- ftk_progress_bar_set_percent(progress_bar, 20);
- timer = ftk_source_timer_create(1000, update_progress, progress_bar);
- ftk_main_loop_add_source(ftk_default_main_loop(), timer);
- ftk_widget_set_user_data(progress_bar, on_window_destroy, timer);
- ftk_progress_bar_set_interactive(progress_bar, 1);
-
- progress_bar = ftk_progress_bar_create(win, 10, height/2, width, 32);
- ftk_progress_bar_set_percent(progress_bar, 20);
- timer = ftk_source_timer_create(1000, update_progress, progress_bar);
- ftk_main_loop_add_source(ftk_default_main_loop(), timer);
- ftk_widget_set_user_data(progress_bar, on_window_destroy, timer);
-
- ftk_widget_set_text(win, "progress_bar demo");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_scroll_bar.c b/examples/module/ftk_app/ftk_demo/demo_scroll_bar.c
deleted file mode 100644
index b541d09a08..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_scroll_bar.c
+++ /dev/null
@@ -1,89 +0,0 @@
-#include "ftk.h"
-
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-static Ret scroll_bar_on_scroll(void* ctx, void* scroll_bar)
-{
- ftk_logd("%s: value=%d\n", __func__, ftk_scroll_bar_get_value(scroll_bar));
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_scroll_bar_create()
-{
- return ftk_app_demo_create(_("scroll_bar"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
- FtkWidget* scroll_bar = NULL;
-
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- /*v*/
- scroll_bar = ftk_scroll_bar_create(win, width/8, 5, 0, height/2);
- ftk_scroll_bar_set_param(scroll_bar, 0, 120, 120);
- ftk_scroll_bar_set_listener(scroll_bar, scroll_bar_on_scroll, NULL);
-
- scroll_bar = ftk_scroll_bar_create(win, width/4, 5, 0, height/2);
- ftk_scroll_bar_set_param(scroll_bar, 40, 120, 60);
- ftk_scroll_bar_set_listener(scroll_bar, scroll_bar_on_scroll, NULL);
-
- scroll_bar = ftk_scroll_bar_create(win, 3*width/8, 5, 0, height/2);
- ftk_scroll_bar_set_param(scroll_bar, 110, 120, 30);
- ftk_scroll_bar_set_listener(scroll_bar, scroll_bar_on_scroll, NULL);
-
- scroll_bar = ftk_scroll_bar_create(win, width/2, 5, 0, height/2);
- ftk_scroll_bar_set_param(scroll_bar, 120, 120, 20);
- ftk_scroll_bar_set_listener(scroll_bar, scroll_bar_on_scroll, NULL);
-
- /*h*/
- scroll_bar = ftk_scroll_bar_create(win, 5, height/2 + 10, width - 10, 0);
- ftk_scroll_bar_set_param(scroll_bar, 120, 120, 20);
- ftk_scroll_bar_set_listener(scroll_bar, scroll_bar_on_scroll, NULL);
-
- scroll_bar = ftk_scroll_bar_create(win, 5, height/2 + 30, width - 10, 0);
- ftk_scroll_bar_set_param(scroll_bar, 110, 120, 30);
- ftk_scroll_bar_set_listener(scroll_bar, scroll_bar_on_scroll, NULL);
-
- scroll_bar = ftk_scroll_bar_create(win, 5, height/2 + 50, width - 10, 0);
- ftk_scroll_bar_set_param(scroll_bar, 40, 120, 60);
- ftk_scroll_bar_set_listener(scroll_bar, scroll_bar_on_scroll, NULL);
-
- scroll_bar = ftk_scroll_bar_create(win, 5, height/2 + 80, width - 10, 0);
- ftk_scroll_bar_set_param(scroll_bar, 0, 120, 120);
- ftk_scroll_bar_set_listener(scroll_bar, scroll_bar_on_scroll, NULL);
-
- button = ftk_button_create(win, 2*width/3, height/4, width/3-5, 50);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_quit_clicked, win);
- ftk_window_set_focus(win, button);
-
- ftk_widget_set_text(win, "scroll_bar demo");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_sprite.c b/examples/module/ftk_app/ftk_demo/demo_sprite.c
deleted file mode 100644
index 1c1ee551c5..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_sprite.c
+++ /dev/null
@@ -1,85 +0,0 @@
-#include "ftk.h"
-
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
- return RET_OK;
-}
-
-Ret on_move(void* ctx, void* obj)
-{
- ftk_logd("%s: %d %d\n", __func__, ftk_sprite_get_x(obj), ftk_sprite_get_y(obj));
-
- return RET_OK;
-}
-
-Ret move_cursor(void* ctx, void* obj)
-{
- FtkEvent* event = obj;
-
- if(event->type == FTK_EVT_MOUSE_MOVE)
- {
- ftk_sprite_move(ctx, event->u.mouse.x, event->u.mouse.y);
- }
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_sprite_create()
-{
- return ftk_app_demo_create(_("sprite"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
- FtkSprite* sprite = NULL;
- FtkBitmap* icon = NULL;
-
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- button = ftk_button_create(win, width/4, height/2, width/2, 60);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_quit_clicked, win);
- ftk_window_set_focus(win, button);
-
- ftk_widget_set_text(win, "sprite demo");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
-#if 0
- /*multi sprite still has some problems.*/
- sprite = ftk_sprite_create();
- icon=ftk_theme_load_image(ftk_default_theme(), "flag-32"FTK_STOCK_IMG_SUFFIX);
- ftk_sprite_set_icon(sprite, icon);
- ftk_sprite_move(sprite, width/2, 0);
- ftk_sprite_set_move_listener(sprite, on_move, NULL);
- ftk_sprite_show(sprite, 1);
- ftk_main_loop_add_source(ftk_default_main_loop(), ftk_source_timer_create(200, timer, sprite));
-#endif
-
- sprite = ftk_sprite_create();
- icon=ftk_theme_load_image(ftk_default_theme(), "cursor"FTK_STOCK_IMG_SUFFIX);
- ftk_sprite_set_icon(sprite, icon);
- ftk_sprite_show(sprite, 1);
- ftk_wnd_manager_add_global_listener(ftk_default_wnd_manager(), move_cursor, sprite);
-
- FTK_RUN();
-
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_statusbar.c b/examples/module/ftk_app/ftk_demo/demo_statusbar.c
deleted file mode 100644
index a7e5003d29..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_statusbar.c
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "ftk.h"
-#include <time.h>
-
-#define IDC_TIME_ITEM 2000
-
-static Ret update_time(void* ctx)
-{
- char text[10] = {0};
- FtkWidget* item = NULL;
- FtkWidget* panel = NULL;
-
- time_t now = time(0);
- struct tm* t = localtime(&now);
- panel = ftk_default_status_panel();
-
- ftk_snprintf(text, sizeof(text)-1, "%2d:%2d", t->tm_hour, t->tm_min);
-
- item = ftk_widget_lookup(panel, IDC_TIME_ITEM);
-
- ftk_widget_set_text(item, text);
-
- ftk_logd("%s: %s\n", __func__, text);
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_statusbar_create()
-{
- return ftk_app_demo_create(_("status_bar"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- FtkSource* timer = NULL;
- FtkWidget* win = NULL;
- FtkWidget* item = NULL;
- FtkWidget* panel = NULL;
- FTK_INIT(argc, argv);
-
- /*create a time widget in statusbar.*/
- panel = ftk_default_status_panel();
- item = ftk_status_item_create(panel, -2, 60);
- ftk_widget_set_id(item, IDC_TIME_ITEM);
-
- ftk_widget_show(item, 1);
-
- win = ftk_app_window_create();
- ftk_widget_set_text(win, "Hello FTK!");
-
- ftk_widget_show(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- update_time(NULL);
- timer = ftk_source_timer_create(60000, update_time, NULL);
- ftk_main_loop_add_source(ftk_default_main_loop(), timer);
-
- FTK_RUN();
-
- return 0;
-}
diff --git a/examples/module/ftk_app/ftk_demo/demo_tab.c b/examples/module/ftk_app/ftk_demo/demo_tab.c
deleted file mode 100644
index 514bec0d56..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_tab.c
+++ /dev/null
@@ -1,89 +0,0 @@
-#include "ftk.h"
-#include "ftk_tab.h"
-
-static Ret button_default_clicked(void* ctx, void* obj)
-{
- printf("%s: button %s is clicked.\n", __func__, ftk_widget_get_text(obj));
-
- return RET_OK;
-}
-
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_tab_create()
-{
- return ftk_app_demo_create(_("tab"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-static void add_page(FtkWidget* tab, const char* text, FtkBitmap* bitmap)
-{
- int width = 0;
- int height = 0;
- FtkWidget* page = NULL;
- FtkWidget* button = NULL;
-
- page = ftk_tab_add_page(tab, text, bitmap);
- width = ftk_widget_width(page);
- height = ftk_widget_height(page);
-
- button = ftk_button_create(page, 0, height/2-30, width/2, 60);
- ftk_widget_set_text(button, text);
- ftk_widget_show(button, 1);
- ftk_button_set_clicked_listener(button, button_default_clicked, tab);
-
- button = ftk_button_create(page, width/2, height/2-30, width/2, 60);
- ftk_widget_set_text(button, text);
- ftk_widget_show(button, 1);
- ftk_button_set_clicked_listener(button, button_default_clicked, tab);
-
- return;
-}
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* tab = NULL;
- FtkWidget* button = NULL;
- FtkBitmap* bitmap = NULL;
- FTK_INIT(argc, argv);
-
- bitmap = ftk_theme_load_image(ftk_default_theme(), "mime_audio"FTK_STOCK_IMG_SUFFIX);
- win = ftk_app_window_create();
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- tab = ftk_tab_create(win, 0, 0, width, height - 50);
-
- add_page(tab, "General", bitmap);
- add_page(tab, "Graphic", bitmap);
- add_page(tab, "Audio", bitmap);
-
- ftk_tab_set_active_page(tab, 0);
-
- button = ftk_button_create(win, width/4, height - 50, width/2, 50);
- ftk_widget_set_text(button, _("Quit"));
- ftk_widget_show(button, 1);
-
- ftk_button_set_clicked_listener(button, button_quit_clicked, win);
-
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
- FTK_BITMAP_UNREF(bitmap);
-
- FTK_RUN();
-
- return 0;
-}
diff --git a/examples/module/ftk_app/ftk_demo/demo_text_view.c b/examples/module/ftk_app/ftk_demo/demo_text_view.c
deleted file mode 100644
index 96f5fbe116..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_text_view.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "ftk.h"
-#include <assert.h>
-
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-#define TEXT_STR "libpng is the official PNG reference library. It supports almost all PNG features, is extensible, and has been extensively tested for over 15 years. The home site for development versions (i.e., may be buggy or subject to change or include experimental features) is http://libpng.sourceforge.net/, and the place to go for questions about the library is the png-mng-implement mailing list.\n\nlibpng is available as ANSI C (C89) source code and requires zlib 1.0.4 or later (1.2.3 or later recommended for performance and security reasons). The current public release, libpng 1.4.3, contains fixes for two potential security issues: "
-
-#define TEXT1_STR "Several versions of libpng through 1.4.2 (and through 1.2.43 in the older series) contain a bug whereby progressive applications such as web browsers (or the rpng2 demo app included in libpng) could receive an extra row of image data beyond the height reported in the header, potentially leading to an out-of-bounds write to memory (depending on how the application is written) and the possibility of execution of an attacker's code with the privileges of the libpng user (including remote compromise in the case of a libpng-based browser visiting a hostile web site). This vulnerability has been assigned ID CVE-2010-1205 (via Mozilla). \n\n4\n5\n6\n7\n8\nlast line"
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_text_view_create()
-{
- return ftk_app_demo_create(_("text_view"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
- FtkWidget* text_view = NULL;
-
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- text_view = ftk_text_view_create(win, 10, 10, ftk_widget_width(win) - 20, height/3);
- ftk_widget_set_text(text_view, TEXT1_STR);
- assert(strcmp(TEXT1_STR, ftk_widget_get_text(text_view)) == 0);
-
- text_view = ftk_text_view_create(win, 10, 15 + height/3, ftk_widget_width(win) - 20, height/3);
- ftk_widget_set_text(text_view, TEXT_STR);
- assert(strcmp(TEXT_STR, ftk_widget_get_text(text_view)) == 0);
- ftk_text_view_set_readonly(text_view, 1);
-
- button = ftk_button_create(win, width/4, 3*height/4, width/2, 60);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_quit_clicked, win);
- ftk_window_set_focus(win, button);
-
- ftk_widget_set_text(win, "text_view demo");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_transparent.c b/examples/module/ftk_app/ftk_demo/demo_transparent.c
deleted file mode 100644
index 0ab01435b6..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_transparent.c
+++ /dev/null
@@ -1,137 +0,0 @@
-#include "ftk.h"
-
-void create_dialog(FtkBitmap* bitmap, FtkColor bg);
-static void create_app_window(void);
-
-static Ret button_open_image_dialog(void* ctx, void* obj)
-{
- char filename[FTK_MAX_PATH+1] = {0};
- FtkBitmap* bitmap = NULL;
- FtkColor bg = {0};
- bg.r = 0xff;
- bg.g = 0xff;
- bg.b = 0xff;
- ftk_snprintf(filename, FTK_MAX_PATH, "%s/earth.png",
- ftk_config_get_test_data_dir(ftk_default_config()));
- bitmap = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), filename);
- bg.a = 0x0;
- create_dialog(bitmap, bg);
-
- return RET_OK;
-}
-
-static Ret button_open_transparent_dialog(void* ctx, void* obj)
-{
- FtkColor bg = {0};
- bg.a = 0x80;
- bg.r = 0xff;
- bg.g = 0xff;
- bg.b = 0xff;
- create_dialog(NULL, bg);
-
- return RET_OK;
-}
-
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- *(int*)ctx = ftk_widget_id(obj);
-
- return RET_QUIT;
-}
-
-static Ret button_close_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
-
- return RET_OK;
-}
-
-void create_dialog(FtkBitmap* bitmap, FtkColor bg)
-{
- int id = 0;
- int width = ftk_display_width(ftk_default_display());
- int height = ftk_display_height(ftk_default_display());
- FtkWidget* button = NULL;
- FtkWidget* label = NULL;
- FtkWidget* dialog = ftk_dialog_create(0, 5, 320, height-60);
-
- ftk_widget_set_attr(dialog, FTK_ATTR_BG_CENTER);
- ftk_window_set_background_with_alpha(dialog, bitmap, bg);
-
- width = ftk_widget_width(dialog);
- height = ftk_widget_height(dialog);
-
- //label = ftk_label_create(dialog, width/8, height/4, 3*width/4, 20);
- //ftk_widget_set_text(label, "Are you sure to quit?");
-
- label = ftk_label_create(dialog, width/8, height/2, 3*width/4, 20);
- ftk_widget_set_text(label, "Are you sure to quit?");
-
- button = ftk_button_create(dialog, width/6, 3*height/4, width/3, 50);
- ftk_widget_set_text(button, "yes");
- ftk_button_set_clicked_listener(button, button_quit_clicked, &id);
-
- button = ftk_button_create(dialog, width/2, 3*height/4, width/3, 50);
- ftk_widget_set_text(button, "no");
- ftk_button_set_clicked_listener(button, button_quit_clicked, &id);
- ftk_window_set_focus(dialog, button);
-
- ftk_widget_set_text(dialog, "transparent demo");
- ftk_widget_show_all(dialog, 1);
-
- assert(ftk_dialog_run(dialog) == id);
- ftk_widget_unref(dialog);
-
- return;
-}
-
-static void create_app_window(void)
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = ftk_app_window_create();
- FtkWidget* button = NULL;
-
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- button = ftk_button_create(win, 0, height/6, width/3, 50);
- ftk_widget_set_text(button, "图片背景");
- ftk_button_set_clicked_listener(button, button_open_image_dialog, win);
-
- button = ftk_button_create(win, 2*width/3, height/6, width/3, 50);
- ftk_widget_set_text(button, "半透明效果");
- ftk_button_set_clicked_listener(button, button_open_transparent_dialog, win);
-
- button = ftk_button_create(win, width/4, height/2, width/2, 60);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_close_clicked, win);
-
- ftk_widget_set_text(win, "transparent");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- return;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_transparent_create()
-{
- return ftk_app_demo_create(_("transparent"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- FTK_INIT(argc, argv);
-
- create_app_window();
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_wait_box.c b/examples/module/ftk_app/ftk_demo/demo_wait_box.c
deleted file mode 100644
index 4997c26fb1..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_wait_box.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "ftk.h"
-
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
- return RET_OK;
-}
-
-static Ret button_start_clicked(void* ctx, void* obj)
-{
- ftk_widget_show(ctx, 1);
- ftk_wait_box_start_waiting(ctx);
-
- return RET_OK;
-}
-
-static Ret button_stop_clicked(void* ctx, void* obj)
-{
- ftk_wait_box_stop_waiting(ctx);
-
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_wait_box_create()
-{
- return ftk_app_demo_create(_("wait_box"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- int width = 0;
- int height = 0;
- FtkWidget* win = NULL;
- FtkWidget* button = NULL;
- FtkWidget* wait_box = NULL;
-
- FTK_INIT(argc, argv);
-
- win = ftk_app_window_create();
- width = ftk_widget_width(win);
- height = ftk_widget_height(win);
-
- wait_box = ftk_wait_box_create(win, width/2 - 16, height/4);
-
- button = ftk_button_create(win, 0, height/2, width/3, 50);
- ftk_widget_set_text(button, "start");
- ftk_button_set_clicked_listener(button, button_start_clicked, wait_box);
-
- button = ftk_button_create(win, 2*width/3, height/2, width/3, 50);
- ftk_widget_set_text(button, "stop");
- ftk_button_set_clicked_listener(button, button_stop_clicked, wait_box);
-
- button = ftk_button_create(win, width/4, 3*height/4, width/2, 60);
- ftk_widget_set_text(button, "quit");
- ftk_button_set_clicked_listener(button, button_quit_clicked, win);
- ftk_window_set_focus(win, button);
-
- ftk_widget_set_text(win, "wait_box demo");
- ftk_widget_show_all(win, 1);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- FTK_RUN();
-
- return 0;
-}
-
diff --git a/examples/module/ftk_app/ftk_demo/demo_xul.c b/examples/module/ftk_app/ftk_demo/demo_xul.c
deleted file mode 100644
index 3b0a4e171a..0000000000
--- a/examples/module/ftk_app/ftk_demo/demo_xul.c
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "ftk.h"
-#include "ftk_xul.h"
-
-const char* t1 = "<window> </window>";
-
-#define IDC_QUIT 100
-
-static Ret button_quit_clicked(void* ctx, void* obj)
-{
- ftk_widget_unref(ctx);
- return RET_OK;
-}
-
-#ifdef FTK_AS_PLUGIN
-#include "ftk_app_demo.h"
-FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
-FtkApp* ftk_app_demo_xul_create()
-{
- return ftk_app_demo_create(_("xul"), ftk_main);
-}
-#else
-#define FTK_HIDE extern
-#endif /*FTK_AS_PLUGIN*/
-
-FTK_HIDE int FTK_MAIN(int argc, char* argv[])
-{
- if(argc > 1)
- {
- FtkWidget* win = NULL;
- FtkWidget* quit = NULL;
- FtkXulCallbacks callbacks;
-
- FTK_INIT(argc, argv);
-
- callbacks.translate_text = NULL;
- callbacks.load_image = (FtkXulLoadImage)ftk_icon_cache_load;
- callbacks.ctx = ftk_icon_cache_create(NULL, "testdata");
- win = ftk_xul_load_file(argv[1], &callbacks);
- ftk_icon_cache_destroy(callbacks.ctx);
- FTK_QUIT_WHEN_WIDGET_CLOSE(win);
-
- quit = ftk_widget_lookup(win, IDC_QUIT);
- ftk_button_set_clicked_listener(quit, button_quit_clicked, win);
- ftk_widget_show_all(win, 1);
-
- FTK_RUN();
- }
- else
- {
- ftk_logd("Usage: %s xul\n", argv[0]);
-
- return 0;
- }
-
- return 0;
-}
diff --git a/examples/module/ftk_app/ftk_demo/demos.desktop b/examples/module/ftk_app/ftk_demo/demos.desktop
deleted file mode 100644
index 330df5a88a..0000000000
--- a/examples/module/ftk_app/ftk_demo/demos.desktop
+++ /dev/null
@@ -1,26 +0,0 @@
-<application name="button" exec="ftk_demos" init="ftk_app_demo_button_create" />
-<application name="check_button" exec="ftk_demos" init="ftk_app_demo_check_button_create" />
-<application name="combo_box" exec="ftk_demos" init="ftk_app_demo_combo_box_create" />
-<application name="dialog" exec="ftk_demos" init="ftk_app_demo_dialog_create" />
-<application name="entry" exec="ftk_demos" init="ftk_app_demo_entry_create" />
-<application name="file_browser" exec="ftk_demos" init="ftk_app_demo_file_browser_create" />
-<application name="fullscreen" exec="ftk_demos" init="ftk_app_demo_fullscreen_create" />
-<application name="hello" exec="ftk_demos" init="ftk_app_demo_hello_create" />
-<application name="icon_view" exec="ftk_demos" init="ftk_app_demo_icon_view_create" />
-<application name="image_button" exec="ftk_demos" init="ftk_app_demo_image_button_create" />
-<application name="image" exec="ftk_demos" init="ftk_app_demo_image_create" />
-<application name="ime" exec="ftk_demos" init="ftk_app_demo_ime_create" />
-<application name="label" exec="ftk_demos" init="ftk_app_demo_label_create" />
-<application name="listview" exec="ftk_demos" init="ftk_app_demo_listview_create" />
-<application name="menu" exec="ftk_demos" init="ftk_app_demo_menu_create" />
-<application name="msgbox" exec="ftk_demos" init="ftk_app_demo_msgbox_create" />
-<application name="multi_win" exec="ftk_demos" init="ftk_app_demo_multi_win_create" />
-<application name="popup" exec="ftk_demos" init="ftk_app_demo_popup_create" />
-<application name="progress_bar" exec="ftk_demos" init="ftk_app_demo_progress_bar_create" />
-<application name="scroll_bar" exec="ftk_demos" init="ftk_app_demo_scroll_bar_create" />
-<application name="sprite" exec="ftk_demos" init="ftk_app_demo_sprite_create" />
-<application name="statusbar" exec="ftk_demos" init="ftk_app_demo_statusbar_create" />
-<application name="text_view" exec="ftk_demos" init="ftk_app_demo_text_view_create" />
-<application name="transparent" exec="ftk_demos" init="ftk_app_demo_transparent_create" />
-<application name="wait_box" exec="ftk_demos" init="ftk_app_demo_wait_box_create" />
-<application name="tab" exec="ftk_demos" init="ftk_app_demo_tab_create" />
diff --git a/examples/module/ftk_app/ftk_demo/ftk_app_demo.c b/examples/module/ftk_app/ftk_demo/ftk_app_demo.c
deleted file mode 100644
index 6d189330a8..0000000000
--- a/examples/module/ftk_app/ftk_demo/ftk_app_demo.c
+++ /dev/null
@@ -1,67 +0,0 @@
-#include "ftk_app_demo.h"
-
-typedef struct _PrivInfo
-{
- char* name;
- FtkMain ftk_main;
- FtkBitmap* icon;
-}PrivInfo;
-
-static FtkBitmap* ftk_app_demo_get_icon(FtkApp* thiz)
-{
- DECL_PRIV(thiz, priv);
- return_val_if_fail(priv != NULL, NULL);
-
- return priv->icon;
-}
-
-static const char* ftk_app_demo_get_name(FtkApp* thiz)
-{
- DECL_PRIV(thiz, priv);
- return_val_if_fail(priv != NULL, NULL);
-
- return priv->name;
-}
-
-static Ret ftk_app_demo_run(FtkApp* thiz, int argc, char* argv[])
-{
- DECL_PRIV(thiz, priv);
- return_val_if_fail(priv != NULL, RET_FAIL);
-
- priv->ftk_main(argc, argv);
-
- return RET_OK;
-}
-
-static void ftk_app_demo_destroy(FtkApp* thiz)
-{
- if(thiz != NULL)
- {
- DECL_PRIV(thiz, priv);
- FTK_FREE(priv->name);
- ftk_bitmap_unref(priv->icon);
- FTK_FREE(thiz);
- }
-
- return;
-}
-
-FtkApp* ftk_app_demo_create(const char* name, FtkMain ftk_main)
-{
- FtkApp* thiz = FTK_ZALLOC(sizeof(FtkApp) + sizeof(PrivInfo));
-
- if(thiz != NULL)
- {
- DECL_PRIV(thiz, priv);
-
- priv->ftk_main = ftk_main;
- priv->name = ftk_strdup(name);
- priv->icon = ftk_theme_load_image(ftk_default_theme(), "flag-32"FTK_STOCK_IMG_SUFFIX);
- thiz->get_icon = ftk_app_demo_get_icon;
- thiz->get_name = ftk_app_demo_get_name;
- thiz->run = ftk_app_demo_run;
- thiz->destroy = ftk_app_demo_destroy;
- }
-
- return thiz;
-}
diff --git a/examples/module/ftk_app/ftk_demo/ftk_app_demo.h b/examples/module/ftk_app/ftk_demo/ftk_app_demo.h
deleted file mode 100644
index f52fc7a78e..0000000000
--- a/examples/module/ftk_app/ftk_demo/ftk_app_demo.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef FTK_APP_DEMO_H
-#define FTK_APP_DEMO_H
-
-#include "ftk_app.h"
-
-#define FTK_HIDE static
-
-typedef int (*FtkMain)(int argc, char* argv[]);
-FtkApp* ftk_app_demo_create(const char* name, FtkMain main);
-
-#endif/*FTK_APP_DEMO_H*/
-
diff --git a/examples/module/ftk_app/ftk_demo/t1.xul b/examples/module/ftk_app/ftk_demo/t1.xul
deleted file mode 100644
index 0f607d292f..0000000000
--- a/examples/module/ftk_app/ftk_demo/t1.xul
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<window value="Entry Label" visible="1">
- <label id="1" x="5" y="5" w="$ww/4" h="30" value="Name" />
- <entry id="2" x="$ww/4+5" y="5" w="3*$ww/4-15" h="30" value="Li XianJing" />
-
- <label id="3" x="5" y="40" w="$ww/4" h="30" value="EMail" />
- <entry id="4" x="$ww/4+5" y="40" w="3*$ww/4-15" h="30" value="[email protected]" />
-
- <label id="5" x="5" y="75" w="$ww/4" h="30" value="Mobile" />
- <entry id="6" x="$ww/4+5" y="75" w="3*$ww/4-15" h="30" value="+8613911112222" />
-
- <button id="99" x="5" y="3*$wh/4" w="$ww/2-5" h="50" attr="$FTK_ATTR_INSENSITIVE" value="Save" />
- <button id="100" x="$ww/2" y="3*$wh/4" w="$ww/2-5" h="50" attr="$FTK_ATTR_FOCUSED" value="Quit" />
-</window>
diff --git a/examples/module/ftk_app/ftk_demo/t2.xul b/examples/module/ftk_app/ftk_demo/t2.xul
deleted file mode 100644
index 9541005ab1..0000000000
--- a/examples/module/ftk_app/ftk_demo/t2.xul
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<window value="ProgressBar">
- <label id="1" x="5" y="5" w="$ww/4" h="30" value="Progress1" />
- <progress_bar id="2" x="$ww/4+5" y="5" w="3*$ww/4-15" h="30" value="0" />
-
- <label id="3" x="5" y="40" w="$ww/4" h="30" value="Progress2" />
- <progress_bar id="4" x="$ww/4+5" y="40" w="3*$ww/4-15" h="30" value="50" />
-
- <label id="5" x="5" y="75" w="$ww/4" h="30" value="Progress3" />
- <progress_bar id="6" x="$ww/4+5" y="75" w="3*$ww/4-15" h="30" value="100" />
-
- <button id="99" x="5" y="3*$wh/4" w="$ww/2-5" h="50" value="Save" />
- <button id="100" x="$ww/2" y="3*$wh/4" w="$ww/2-5" h="50" value="Quit" />
-</window>
diff --git a/examples/module/ftk_app/ftk_demo/t3.xul b/examples/module/ftk_app/ftk_demo/t3.xul
deleted file mode 100644
index b52b37ce1f..0000000000
--- a/examples/module/ftk_app/ftk_demo/t3.xul
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<window value="Wait box">
- <wait_box id="1" x="5" y="5" w="$ww/4" h="30" value="1" />
- <progress_bar id="2" x="$ww/4+5" y="5" w="3*$ww/4-15" h="30" value="0" />
-
- <wait_box id="3" x="5" y="40" w="$ww/4" h="30" value="0" />
- <progress_bar id="4" x="$ww/4+5" y="40" w="3*$ww/4-15" h="30" value="50" />
-
- <wait_box id="5" x="5" y="75" w="$ww/4" h="30" value="1" />
- <progress_bar id="6" x="$ww/4+5" y="75" w="3*$ww/4-15" h="30" value="100" />
-
- <button id="99" x="5" y="3*$wh/4" w="$ww/2-5" h="50" value="Save" />
- <button id="100" x="$ww/2" y="3*$wh/4" w="$ww/2-5" h="50" value="Quit" />
-</window>
diff --git a/examples/module/ftk_app/ftk_demo/t4.xul b/examples/module/ftk_app/ftk_demo/t4.xul
deleted file mode 100644
index ba002b2ce5..0000000000
--- a/examples/module/ftk_app/ftk_demo/t4.xul
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<window value="Image">
- <image id="1" x="0" y="5" w="$ww/2" h="3*$wh/4-5" value="jpeg1.jpg" />
- <image id="1" x="$ww/2" y="5" w="$ww/2" h="3*$wh/4-5" attr="$FTK_ATTR_BG_CENTER" value="Acrobat.png" />
-
- <button id="99" x="5" y="3*$wh/4" w="$ww/2-5" h="50" value="Save" />
- <button id="100" x="$ww/2" y="3*$wh/4" w="$ww/2-5" h="50" value="Quit" />
-</window>
diff --git a/examples/module/ftk_app/ftk_demo/t5.xul b/examples/module/ftk_app/ftk_demo/t5.xul
deleted file mode 100644
index fb871ac0b7..0000000000
--- a/examples/module/ftk_app/ftk_demo/t5.xul
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<window value="Check button">
- <check_button id="1" x="5" y="10" w="$ww/2" h="50" checked="1" value="Check Option1" />
- <check_button id="3" x="5" y="60" w="$ww/2" h="50" checked="0" value="Check Option2" />
- <check_button id="5" x="5" y="110" w="$ww/2" h="50" checked="1" value="Check Option3" />
-
- <button id="99" x="5" y="3*$wh/4" w="$ww/2-5" h="50" value="Save" />
- <button id="100" x="$ww/2" y="3*$wh/4" w="$ww/2-5" h="50" value="Quit" />
-</window>
diff --git a/examples/module/ftk_app/ftk_demo/t6.xul b/examples/module/ftk_app/ftk_demo/t6.xul
deleted file mode 100644
index 2f519d87c8..0000000000
--- a/examples/module/ftk_app/ftk_demo/t6.xul
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<window value="Radio button">
- <radio_group x="0" y="0" w="$ww" h="$wh/3">
- <radio_button id="1" x="5" y="10" w="$ww/2" h="50" checked="1" value="Radio Option1" />
- <radio_button id="3" x="5" y="60" w="$ww/2" h="50" checked="0" value="Radio Option2" />
- </radio_group>
-
- <radio_group x="0" y="$wh/3+5" w="$ww" h="$wh/3">
- <radio_button id="1" x="5" y="10" w="$ww/2" h="50" checked="1" value="Radio Option1" />
- <radio_button id="3" x="5" y="60" w="$ww/2" h="50" checked="0" value="Radio Option2" />
- </radio_group>
-
- <button id="99" x="5" y="3*$wh/4" w="$ww/2-5" h="50" value="Save" />
- <button id="100" x="$ww/2" y="3*$wh/4" w="$ww/2-5" h="50" value="Quit" />
-</window>
diff --git a/examples/module/ftk_app/ftk_demo/t7.xul b/examples/module/ftk_app/ftk_demo/t7.xul
deleted file mode 100644
index bac74dc848..0000000000
--- a/examples/module/ftk_app/ftk_demo/t7.xul
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<window value="background">
- <button id="99" x="5" y="30" w="64" h="64" attr="$FTK_ATTR_INSENSITIVE"
- bg_image[disable]="Flickr.png" bg[disable]="ffff0000"/>
-
- <button id="99" x="$ww/2-32" y="30" w="64" h="64"
- bg[normal]="ffff0000" bg[focused]="ff00ff00" bg[active]="ff0000ff"
- bg_image[normal]="Acrobat.png" bg_image[focused]="Chat.png" bg_image[active]="Flickr.png" />
-
- <button id="99" x="$ww-70" y="30" w="64" h="64"
- bg_image[normal]="Acrobat.png" bg_image[focused]="Chat.png" bg_image[active]="Flickr.png" />
-
- <button id="99" x="5" y="3*$wh/4" w="$ww/2-5" h="50" value="Save" />
- <button id="100" x="$ww/2" y="3*$wh/4" w="$ww/2-5" h="50" value="Quit" />
-</window>
diff --git a/examples/module/rtconfig.py b/examples/module/rtconfig.py
new file mode 100644
index 0000000000..00163c4e85
--- /dev/null
+++ b/examples/module/rtconfig.py
@@ -0,0 +1,23 @@
+# bsp name
+BSP = 'mini2440'
+
+# toolchains
+EXEC_PATH = 'C:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
+PREFIX = 'arm-none-eabi-'
+CC = PREFIX + 'gcc'
+CXX = PREFIX + 'g++'
+AS = PREFIX + 'gcc'
+AR = PREFIX + 'ar'
+LINK = PREFIX + 'gcc'
+TARGET_EXT = 'so'
+SIZE = PREFIX + 'size'
+OBJDUMP = PREFIX + 'objdump'
+OBJCPY = PREFIX + 'objcopy'
+
+DEVICE = ' -mcpu=arm920t'
+CFLAGS = DEVICE + ' -O0 -fPIC -DFTK_AS_PLUGIN -DRT_THREAD '
+AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
+LFLAGS = DEVICE + ' -Wl,-z,max-page-size=0x4 -shared -fPIC -nostdlib -s'
+
+CPATH = ''
+LPATH = ''
diff --git a/examples/module/rtconfig_lm3s.py b/examples/module/rtconfig_lm3s.py
new file mode 100644
index 0000000000..7958047f2b
--- /dev/null
+++ b/examples/module/rtconfig_lm3s.py
@@ -0,0 +1,23 @@
+# bsp name
+BSP = 'lm3s8962'
+
+# toolchains
+EXEC_PATH = 'C:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
+PREFIX = 'arm-none-eabi-'
+CC = PREFIX + 'gcc'
+CXX = PREFIX + 'g++'
+AS = PREFIX + 'gcc'
+AR = PREFIX + 'ar'
+LINK = PREFIX + 'gcc'
+TARGET_EXT = 'so'
+SIZE = PREFIX + 'size'
+OBJDUMP = PREFIX + 'objdump'
+OBJCPY = PREFIX + 'objcopy'
+
+DEVICE = ' -mcpu=cortex-m3'
+CFLAGS = DEVICE + ' -mthumb -Dsourcerygxx -O0 -fPIC'
+AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
+LFLAGS = DEVICE + ' -mthumb -Wl,-z,max-page-size=0x4 -shared -fPIC -e main -nostdlib'
+
+CPATH = ''
+LPATH = ''
diff --git a/examples/module/rtgui_app/tetris/SConstruct b/examples/module/rtgui_app/tetris/SConstruct
deleted file mode 100644
index a1a9923d80..0000000000
--- a/examples/module/rtgui_app/tetris/SConstruct
+++ /dev/null
@@ -1,31 +0,0 @@
-import os
-import sys
-
-EXEC_PATH = '/home/shaolin/CodeSourcery/Sourcery_G++_Lite/bin'
-RTT_ROOT = os.path.normpath(os.getcwd() + '/../../../..')
-sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
-PREFIX = 'arm-none-eabi-'
-env = Environment(tools = ['mingw'],
- AS = PREFIX + 'gcc',
- ASFLAGS = '',
- CC = PREFIX + 'gcc',
- CCFLAGS = '-mcpu=arm920t -O0 -fPIC' ,
- AR = PREFIX + 'ar',
- ARFLAGS = '-rc',
- LINK = PREFIX + 'ld',
- LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e rt_application_init -nostdlib -s',
- CPPPATH = [
- RTT_ROOT + '/include',
- RTT_ROOT + '/bsp/mini2440',
- RTT_ROOT + '/components/rtgui/include',
- RTT_ROOT + '/components/rgtui/common',
- RTT_ROOT + '/components/rtgui/server',
- RTT_ROOT + '/components/rtgui/widgets'
- ])
-env.PrependENVPath('PATH', EXEC_PATH)
-
-target = 'tetris.so'
-src = Glob('*.c')
-
-env.Program(target, src)
-
diff --git a/examples/module/tetris/Sconscript b/examples/module/tetris/Sconscript
new file mode 100644
index 0000000000..690ae8c7dd
--- /dev/null
+++ b/examples/module/tetris/Sconscript
@@ -0,0 +1,7 @@
+import rtconfig
+Import('RTT_ROOT')
+from building import *
+
+src = Glob('*.c')
+group = DefineGroup('', src, depend = [''])
+Return('group') \ No newline at end of file
diff --git a/examples/module/rtgui_app/tetris/tetris.h b/examples/module/tetris/tetris.h
index b5ef13785f..b5ef13785f 100644
--- a/examples/module/rtgui_app/tetris/tetris.h
+++ b/examples/module/tetris/tetris.h
diff --git a/examples/module/rtgui_app/tetris/tetris_modal.c b/examples/module/tetris/tetris_modal.c
index 01b5850e96..01b5850e96 100644
--- a/examples/module/rtgui_app/tetris/tetris_modal.c
+++ b/examples/module/tetris/tetris_modal.c
diff --git a/examples/module/rtgui_app/tetris/tetris_ui.c b/examples/module/tetris/tetris_ui.c
index 99a8b2f56c..86bb7f3b3a 100644
--- a/examples/module/rtgui_app/tetris/tetris_ui.c
+++ b/examples/module/tetris/tetris_ui.c
@@ -194,7 +194,7 @@ static const struct rtgui_list_item function_list[] =
{"�˳���Ϸ", RT_NULL, listitem_action_return, RT_NULL},
};
-void rt_application_init(void* parameter)
+void main(void)
{
rt_mq_t mq;
rtgui_rect_t rect;
diff --git a/examples/module/rtgui_app/tetris/tetris_view.c b/examples/module/tetris/tetris_view.c
index dcb0cb312a..dcb0cb312a 100644
--- a/examples/module/rtgui_app/tetris/tetris_view.c
+++ b/examples/module/tetris/tetris_view.c