本文整理汇总了C++中rtgui_widget_update函数的典型用法代码示例。如果您正苦于以下问题:C++ rtgui_widget_update函数的具体用法?C++ rtgui_widget_update怎么用?C++ rtgui_widget_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rtgui_widget_update函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: picture_show_prev
static void picture_show_prev(void)
{
DIR* dir;
struct dirent* entry;
rt_bool_t is_last;
char fn[32];
fn[0] = '\0';
is_last = RT_FALSE;
dir = opendir(PICTURE_DIR);
if (dir == RT_NULL)
{
rt_kprintf("open directory failed\n");
return;
}
do
{
entry = readdir(dir);
if (entry != RT_NULL)
{
if (strstr(entry->d_name, ".hdc") != RT_NULL ||
strstr(entry->d_name, ".HDC") != RT_NULL ||
strstr(entry->d_name, ".bmp") != RT_NULL ||
strstr(entry->d_name, ".BMP") != RT_NULL)
{
/* it's a HDC image */
if ((strcmp(entry->d_name, current_fn) == 0) &&
is_last != RT_TRUE)
{
if (fn[0] == '\0')
{
/* it should be the last image */
is_last = RT_TRUE;
}
else
{
/* display image */
strcpy(current_fn, fn);
rtgui_widget_update(RTGUI_WIDGET(container));
closedir(dir);
return;
}
}
strcpy(fn, entry->d_name);
}
}
}
while(entry != RT_NULL);
/* close directory */
closedir(dir);
if ((is_last == RT_TRUE) && fn[0] != '\0')
{
strcpy(current_fn, fn);
rtgui_widget_update(RTGUI_WIDGET(container));
}
}
示例2: picture_show_prev
static void picture_show_prev(struct rtgui_widget* widget)
{
DIR* dir;
struct dirent* entry;
rt_bool_t is_last;
char fn[32];
struct rtgui_image_engine* engine;
fn[0] = '\0';
is_last = RT_FALSE;
dir = opendir(PICTURE_DIR);
if (dir == RT_NULL)
{
rt_kprintf("open directory failed\n");
return;
}
do
{
entry = readdir(dir);
if (entry != RT_NULL)
{
engine = rtgui_image_get_engine_by_filename(entry->d_name);
if (engine != RT_NULL)
{
/* it's a HDC image */
if ((strcmp(entry->d_name, current_fn) == 0) &&
is_last != RT_TRUE)
{
if (fn[0] == '\0')
{
/* it should be the last image */
is_last = RT_TRUE;
}
else
{
/* display image */
strcpy(current_fn, fn);
rtgui_widget_update(widget);
closedir(dir);
return;
}
}
strcpy(fn, entry->d_name);
}
}
} while(entry != RT_NULL);
/* close directory */
closedir(dir);
if ((is_last == RT_TRUE) && fn[0] != '\0')
{
strcpy(current_fn, fn);
rtgui_widget_update(widget);
}
}
示例3: rtgui_combobox_onmouse_button
static rt_bool_t rtgui_combobox_onmouse_button(struct rtgui_combobox* box, struct rtgui_event_mouse* event)
{
struct rtgui_rect rect;
/* get widget rect */
rect = RTGUI_WIDGET(box)->extent;
/* move to the pull down button */
rect.x1 = rect.x2 - RTGUI_COMBOBOX_BUTTON_WIDTH;
if (rtgui_rect_contains_point(&rect, event->x, event->y) == RT_EOK)
{
/* handle mouse button on pull down button */
if (event->button & RTGUI_MOUSE_BUTTON_LEFT &&
event->button & RTGUI_MOUSE_BUTTON_DOWN)
{
box->pd_pressed = RT_TRUE;
rtgui_widget_update(RTGUI_WIDGET(box));
}
else if (event->button & RTGUI_MOUSE_BUTTON_LEFT &&
event->button & RTGUI_MOUSE_BUTTON_UP)
{
box->pd_pressed = RT_FALSE;
rtgui_widget_update(RTGUI_WIDGET(box));
/* pop pull down window */
if (box->pd_win == RT_NULL)
{
rtgui_listbox_t *list;
/* create pull down window */
rect = RTGUI_WIDGET(box)->extent;
rect.y1 = rect.y2;
rect.y2 = rect.y1 + 5 * (2 + rtgui_theme_get_selected_height());
box->pd_win = rtgui_win_create(RT_NULL, "combo", &rect, RTGUI_WIN_STYLE_NO_TITLE);
rtgui_win_set_ondeactivate(RTGUI_WIN(box->pd_win), rtgui_combobox_pulldown_hide);
/* set user data to parent combobox */
box->pd_win->user_data = (rt_uint32_t)box;
/* create list box */
rtgui_rect_inflate(&rect, -1);
list = rtgui_listbox_create(box->items, box->items_count, &rect);
rtgui_container_add_child(RTGUI_CONTAINER(box->pd_win), RTGUI_WIDGET(list));
rtgui_widget_focus(RTGUI_WIDGET(list));
rtgui_listbox_set_onitem(list, rtgui_combobox_pdwin_onitem);
rtgui_win_set_ondeactivate(box->pd_win, rtgui_combobox_pdwin_ondeactive);
}
/* show combo box pull down window */
rtgui_win_show(RTGUI_WIN(box->pd_win), RT_FALSE);
}
return RT_TRUE;
}
return RT_FALSE;
}
示例4: rtgui_workbench_show_view
void rtgui_workbench_show_view(rtgui_workbench_t* workbench, rtgui_view_t* view)
{
RT_ASSERT(workbench != RT_NULL);
RT_ASSERT(view != RT_NULL);
/* already shown */
if (workbench->current_view == view) return;
if (workbench->current_view != RT_NULL)
{
/* hide old view */
RTGUI_WIDGET_HIDE(RTGUI_WIDGET(workbench->current_view));
}
/* show view */
RTGUI_WIDGET_UNHIDE(RTGUI_WIDGET(view));
workbench->current_view = view;
/* update workbench clip */
rtgui_toplevel_update_clip(RTGUI_TOPLEVEL(workbench));
if (!RTGUI_WIDGET_IS_HIDE(RTGUI_WIDGET(workbench)))
{
rtgui_widget_update(RTGUI_WIDGET(view));
}
}
示例5: demo_bitmap_open
void demo_bitmap_open(struct rtgui_object* object, struct rtgui_event* event)
{
char *str;
rtgui_button_t *button = RTGUI_BUTTON(object);
/* 从textbox控件中取得文件名 */
str = (char*)rtgui_textbox_get_value(bmpdt.box);
if(str == RT_NULL) return;
if(*str == '/' && (rt_strstr(str, ".bmp")!=RT_NULL || rt_strstr(str, ".BMP")!=RT_NULL))
{ /* 如果是bmp文件, 且文件名有效, 则读入图像数据 */
if(bmpdt.filename != RT_NULL)
rt_free(bmpdt.filename);
bmpdt.filename = rt_strdup(str);
if(bmpdt.image != RT_NULL)
rtgui_image_destroy(bmpdt.image);
bmpdt.image = rtgui_image_create_from_file("bmp", bmpdt.filename, RT_TRUE);
if(bmpdt.image != RT_NULL)
{
bmpdt.showimg = bmpdt.image;
bmpdt.scale = 1.0;
bmpdt.angle = 0.0;
rtgui_widget_update(RTGUI_WIDGET(bmpdt.showbox));
}
}
else
rt_kprintf("Bad filename!");
}
示例6: _rtgui_notebook_ondraw
static void _rtgui_notebook_ondraw(struct rtgui_notebook *notebook)
{
struct rtgui_dc* dc;
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(notebook));
if (dc == RT_NULL) return;
if (notebook->count == 0)
{
rtgui_rect_t rect;
rtgui_widget_get_rect(RTGUI_WIDGET(notebook), &rect);
rtgui_dc_fill_rect(dc, &rect);
}
else
{
if (notebook->current == RTGUI_NOT_FOUND)
notebook->current = 0;
_rtgui_notebook_draw_bar(notebook, dc);
/* draw current tab */
rtgui_widget_update(notebook->childs[notebook->current].widget);
}
rtgui_dc_end_drawing(dc);
}
示例7: rtgui_scrollbar_set_value
void rtgui_scrollbar_set_value(struct rtgui_scrollbar* bar, rt_int16_t position)
{
RT_ASSERT(bar != RT_NULL);
bar->thumb_position = position;
rtgui_widget_update(RTGUI_WIDGET(bar));
}
示例8: rtgui_combobox_pulldown_hide
static rt_bool_t rtgui_combobox_pulldown_hide(struct rtgui_object* object, struct rtgui_event* event)
{
struct rtgui_widget *widget;
struct rtgui_combobox *box;
RT_ASSERT(object != RT_NULL);
RT_ASSERT(event != RT_NULL);
widget = RTGUI_WIDGET(object);
box = RTGUI_COMBOBOX(object);
if (widget == RT_NULL) return RT_TRUE;
box = (struct rtgui_combobox*) (((struct rtgui_win*)widget)->user_data);
if (box == RT_NULL) return RT_TRUE;
/* hide pull down window */
rtgui_win_hiden(RTGUI_WIN(box->pd_win));
/* clear pull down button state */
box->pd_pressed = RT_FALSE;
rtgui_widget_update(RTGUI_WIDGET(box));
return RT_TRUE;
}
示例9: rtgui_scrollbar_set_value
/* use VALUE change be binding widget's frist item. */
void rtgui_scrollbar_set_value(rtgui_scrollbar_t* bar, rt_int16_t value)
{
RT_ASSERT(bar != RT_NULL);
bar->value = value;
if(bar->value < 0) bar->value = 0;
rtgui_widget_update(RTGUI_WIDGET(bar));
}
示例10: picture_show_next
static void picture_show_next(void)
{
DIR* dir;
struct dirent* entry;
rt_bool_t found, has_image;
found = RT_FALSE;
has_image = RT_FALSE;
__restart:
dir = opendir(PICTURE_DIR);
if (dir == RT_NULL)
{
rt_kprintf("open directory failed\n");
return;
}
do
{
entry = readdir(dir);
if (entry != RT_NULL)
{
if (strstr(entry->d_name, ".hdc") != RT_NULL ||
strstr(entry->d_name, ".HDC") != RT_NULL ||
strstr(entry->d_name, ".bmp") != RT_NULL ||
strstr(entry->d_name, ".BMP") != RT_NULL)
{
/* this directory includes image */
has_image = RT_TRUE;
if (found == RT_TRUE || current_fn[0] == '\0')
{
strcpy(current_fn, entry->d_name);
rtgui_widget_update(RTGUI_WIDGET(container));
closedir(dir);
return;
}
/* it's a HDC image */
if (strcmp(entry->d_name, current_fn) == 0)
found = RT_TRUE;
}
}
}
while(entry != RT_NULL);
/* close directory */
closedir(dir);
if (has_image != RT_TRUE) return;
current_fn[0] = '\0';
goto __restart;
}
示例11: rtgui_listbox_set_items
void rtgui_listbox_set_items(rtgui_listbox_t* box, struct rtgui_listbox_item* items, rt_uint16_t count)
{
rtgui_rect_t rect;
box->items = items;
box->items_count = count;
box->current_item = 0;
rtgui_widget_get_rect(RTGUI_WIDGET(box), &rect);
box->page_items = rtgui_rect_height(rect) / (2 + rtgui_theme_get_selected_height());
rtgui_widget_update(RTGUI_WIDGET(box));
}
示例12: rtgui_terminal_set_text
void rtgui_terminal_set_text(rtgui_terminal_t* tma, const char* text)
{
RT_ASSERT(tma != RT_NULL);
/* calculate line width and line page count */
rtgui_terminal_calc_width(tma);
/* set text */
rtgui_terminal_calc_line(tma, text);
/* update widget */
rtgui_widget_update(RTGUI_WIDGET(tma));
}
示例13: rtgui_textview_set_text
void rtgui_textview_set_text(rtgui_textview_t* textview, const char* text)
{
RT_ASSERT(textview != RT_NULL);
/* calculate line width and line page count */
_calc_width(textview);
/* set text */
_calc_line(textview, text);
/* update widget */
rtgui_widget_update(RTGUI_WIDGET(textview));
}
示例14: rtgui_listctrl_set_items
void rtgui_listctrl_set_items(rtgui_listctrl_t* ctrl, rt_uint32_t items, rt_uint16_t count)
{
rtgui_rect_t rect;
ctrl->items = items;
ctrl->items_count = count;
ctrl->current_item = 0;
rtgui_widget_get_rect(RTGUI_WIDGET(ctrl), &rect);
ctrl->page_items = rtgui_rect_height(rect) / (2 + rtgui_theme_get_selected_height());
rtgui_widget_update(RTGUI_WIDGET(ctrl));
}
示例15: picture_show_next
static void picture_show_next(struct rtgui_widget* widget)
{
DIR* dir;
struct dirent* entry;
rt_bool_t found, has_image;
struct rtgui_image_engine* engine;
found = RT_FALSE; has_image = RT_FALSE;
__restart:
dir = opendir(PICTURE_DIR);
if (dir == RT_NULL)
{
rt_kprintf("open directory failed\n");
return;
}
do
{
entry = readdir(dir);
if (entry != RT_NULL)
{
engine = rtgui_image_get_engine_by_filename(entry->d_name);
if (engine != RT_NULL)
{
/* this directory includes image */
has_image = RT_TRUE;
if (found == RT_TRUE || current_fn[0] == '\0')
{
strcpy(current_fn, entry->d_name);
rtgui_widget_update(widget);
closedir(dir);
return;
}
/* it's a HDC image */
if (strcmp(entry->d_name, current_fn) == 0)
found = RT_TRUE;
}
}
} while(entry != RT_NULL);
/* close directory */
closedir(dir);
if (has_image != RT_TRUE) return;
current_fn[0] = '\0';
goto __restart;
}