mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-06-18 19:52:28 +08:00
sync with github bd3351e572
As always, full log is in GitHub. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2234 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
Import('RTT_ROOT')
|
||||
import os
|
||||
from building import *
|
||||
|
||||
common_src = Split("""
|
||||
@@ -72,10 +72,10 @@ widgets/panel.c
|
||||
# The set of source files associated with this SConscript file.
|
||||
src = common_src + server_src + widgets_src
|
||||
|
||||
path = [RTT_ROOT + '/components/rtgui/include',
|
||||
RTT_ROOT + '/components/rtgui/common',
|
||||
RTT_ROOT + '/components/rtgui/server',
|
||||
RTT_ROOT + '/components/rtgui/widgets']
|
||||
cwd = GetCurrentDir()
|
||||
dirs = ['include', 'common', 'server', 'widgets']
|
||||
path = [os.path.join(cwd, i) for i in dirs]
|
||||
|
||||
group = DefineGroup('RTGUI', src, depend = ['RT_USING_RTGUI'], CPPPATH = path)
|
||||
|
||||
Return('group')
|
||||
|
||||
@@ -251,21 +251,7 @@ static int mem_read(struct rtgui_filerw *context, void *ptr, rt_size_t size, rt_
|
||||
|
||||
static int mem_write(struct rtgui_filerw *context, const void *ptr, rt_size_t size, rt_size_t num)
|
||||
{
|
||||
#if 0
|
||||
struct rtgui_filerw_mem* mem = (struct rtgui_filerw_mem*)context;
|
||||
|
||||
if ((mem->mem_position + (num * size)) > mem->mem_end)
|
||||
{
|
||||
num = (mem->mem_end - mem->mem_position)/size;
|
||||
}
|
||||
|
||||
rt_memcpy(mem->mem_position, ptr, num*size);
|
||||
mem->mem_position += num*size;
|
||||
|
||||
return num;
|
||||
#else
|
||||
return 0; /* not support memory write */
|
||||
#endif
|
||||
}
|
||||
|
||||
static int mem_tell(struct rtgui_filerw* context)
|
||||
|
||||
@@ -82,7 +82,7 @@ static struct rtgui_image_engine* rtgui_image_get_engine(const char* type)
|
||||
}
|
||||
|
||||
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
|
||||
static struct rtgui_image_engine* rtgui_image_get_engine_by_filename(const char* fn)
|
||||
struct rtgui_image_engine* rtgui_image_get_engine_by_filename(const char* fn)
|
||||
{
|
||||
struct rtgui_list_node *node;
|
||||
struct rtgui_image_engine *engine;
|
||||
|
||||
+171
-155
File diff suppressed because it is too large
Load Diff
+401
-379
File diff suppressed because it is too large
Load Diff
@@ -60,6 +60,7 @@ typedef struct rtgui_image rtgui_image_t;
|
||||
void rtgui_system_image_init(void);
|
||||
|
||||
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
|
||||
struct rtgui_image_engine* rtgui_image_get_engine_by_filename(const char* fn);
|
||||
struct rtgui_image* rtgui_image_create_from_file(const char* type, const char* filename, rt_bool_t load);
|
||||
struct rtgui_image* rtgui_image_create(const char* filename, rt_bool_t load);
|
||||
#endif
|
||||
|
||||
@@ -34,6 +34,7 @@ struct rtgui_notebook* rtgui_notebook_create(const rtgui_rect_t* rect, rt_uint8_
|
||||
void rtgui_notebook_destroy(struct rtgui_notebook* notebook);
|
||||
|
||||
void rtgui_notebook_add(struct rtgui_notebook* notebook, const char* label, struct rtgui_widget* child);
|
||||
void rtgui_notebook_remove(struct rtgui_notebook* notebook, rt_uint16_t index);
|
||||
struct rtgui_widget* rtgui_notebook_get_current(struct rtgui_notebook* notebook);
|
||||
rt_int16_t rtgui_notebook_get_current_index(struct rtgui_notebook* notebook);
|
||||
|
||||
|
||||
@@ -133,10 +133,6 @@ void rtgui_win_move(struct rtgui_win* win, int x, int y);
|
||||
/* reset extent of window */
|
||||
void rtgui_win_set_rect(rtgui_win_t* win, rtgui_rect_t* rect);
|
||||
|
||||
#ifndef RTGUI_USING_SMALL_SIZE
|
||||
void rtgui_win_set_box(rtgui_win_t* win, rtgui_box_t* box);
|
||||
#endif
|
||||
|
||||
void rtgui_win_set_onactivate(rtgui_win_t* win, rtgui_event_handler_ptr handler);
|
||||
void rtgui_win_set_ondeactivate(rtgui_win_t* win, rtgui_event_handler_ptr handler);
|
||||
void rtgui_win_set_onclose(rtgui_win_t* win, rtgui_event_handler_ptr handler);
|
||||
|
||||
@@ -231,6 +231,8 @@ void rtgui_notebook_add(struct rtgui_notebook* notebook, const char* label, stru
|
||||
void rtgui_notebook_remove(struct rtgui_notebook* notebook, rt_uint16_t index)
|
||||
{
|
||||
struct rtgui_notebook_tab tab;
|
||||
rt_bool_t need_update = RT_FALSE;
|
||||
|
||||
RT_ASSERT(notebook != RT_NULL);
|
||||
|
||||
if (index < notebook->count)
|
||||
@@ -244,8 +246,11 @@ void rtgui_notebook_remove(struct rtgui_notebook* notebook, rt_uint16_t index)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (notebook->current == index)
|
||||
need_update = RT_TRUE;
|
||||
|
||||
tab = notebook->childs[index];
|
||||
for (;index < notebook->count - 1; index ++)
|
||||
for (;index < notebook->count - 1; index++)
|
||||
{
|
||||
notebook->childs[index] = notebook->childs[index + 1];
|
||||
}
|
||||
@@ -255,16 +260,17 @@ void rtgui_notebook_remove(struct rtgui_notebook* notebook, rt_uint16_t index)
|
||||
sizeof(struct rtgui_notebook_tab) * notebook->count);
|
||||
}
|
||||
|
||||
// FIXME: do we really want to destroy it?
|
||||
rtgui_widget_destroy(tab.widget);
|
||||
rtgui_free(tab.title);
|
||||
|
||||
if (notebook->current == index)
|
||||
if (need_update)
|
||||
{
|
||||
/* update tab */
|
||||
if (notebook->current > notebook->count - 1)
|
||||
notebook->current = notebook->count - 1;
|
||||
|
||||
rtgui_widget_hide(tab.widget);
|
||||
rtgui_widget_show(notebook->childs[notebook->current].widget);
|
||||
rtgui_widget_update(RTGUI_WIDGET(notebook));
|
||||
rtgui_widget_set_parent(tab.widget, RT_NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ static void _rtgui_widget_destructor(rtgui_widget_t *widget)
|
||||
{
|
||||
if (widget == RT_NULL) return;
|
||||
|
||||
if (widget->parent != RT_NULL)
|
||||
if (widget->parent != RT_NULL && RTGUI_IS_CONTAINER(widget->parent))
|
||||
{
|
||||
/* remove widget from parent's children list */
|
||||
rtgui_list_remove(&(RTGUI_CONTAINER(widget->parent)->children), &(widget->sibling));
|
||||
@@ -413,8 +413,7 @@ rt_bool_t rtgui_widget_onupdate_toplvl(struct rtgui_object *object, struct rtgui
|
||||
|
||||
rt_bool_t rtgui_widget_event_handler(struct rtgui_object* object, rtgui_event_t* event)
|
||||
{
|
||||
RT_ASSERT(object != RT_NULL);
|
||||
RT_ASSERT(event != RT_NULL);
|
||||
RTGUI_WIDGET_EVENT_HANDLER_PREPARE;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
@@ -538,9 +537,10 @@ rt_bool_t rtgui_widget_onshow(struct rtgui_object *object, struct rtgui_event *e
|
||||
{
|
||||
struct rtgui_widget *widget = RTGUI_WIDGET(object);
|
||||
|
||||
/* update the clip info of widget */
|
||||
if (!RTGUI_WIDGET_IS_HIDE(RTGUI_WIDGET(object)))
|
||||
return RT_FALSE;
|
||||
|
||||
RTGUI_WIDGET_UNHIDE(widget);
|
||||
rtgui_widget_update_clip(widget);
|
||||
|
||||
if (widget->on_show != RT_NULL)
|
||||
widget->on_show(RTGUI_OBJECT(widget), RT_NULL);
|
||||
@@ -552,6 +552,9 @@ rt_bool_t rtgui_widget_onhide(struct rtgui_object *object, struct rtgui_event *e
|
||||
{
|
||||
struct rtgui_widget *widget = RTGUI_WIDGET(object);
|
||||
|
||||
if (RTGUI_WIDGET_IS_HIDE(RTGUI_WIDGET(object)))
|
||||
return RT_FALSE;
|
||||
|
||||
/* hide this widget */
|
||||
RTGUI_WIDGET_HIDE(widget);
|
||||
|
||||
|
||||
@@ -594,16 +594,6 @@ void rtgui_win_set_rect(rtgui_win_t* win, rtgui_rect_t* rect)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef RTGUI_USING_SMALL_SIZE
|
||||
void rtgui_win_set_box(rtgui_win_t* win, rtgui_box_t* box)
|
||||
{
|
||||
if (win == RT_NULL || box == RT_NULL) return;
|
||||
|
||||
rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(box));
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(box), &(RTGUI_WIDGET(win)->extent));
|
||||
}
|
||||
#endif
|
||||
|
||||
void rtgui_win_set_onactivate(rtgui_win_t* win, rtgui_event_handler_ptr handler)
|
||||
{
|
||||
if (win != RT_NULL)
|
||||
|
||||
Reference in New Issue
Block a user