static void station_list_selected(struct rtgui_widget* widget, void* parameter) { rtgui_list_view_t *view; view = RTGUI_LIST_VIEW(parameter); if (view->current_item != 0) rtgui_view_end_modal(RTGUI_VIEW(view), RTGUI_MODAL_OK); else rtgui_view_end_modal(RTGUI_VIEW(view), RTGUI_MODAL_CANCEL); }
static void return_action(void* parameter) #endif { /* 退出模态显示 */ rtgui_view_end_modal(RTGUI_VIEW(_view), RTGUI_MODAL_OK); }
static rt_bool_t picture_view_event_handler(struct rtgui_widget* widget, struct rtgui_event* event) { if (event->type == RTGUI_EVENT_PAINT) { struct rtgui_dc* dc; struct rtgui_rect rect; struct rtgui_image* image; char fn[32]; dc = rtgui_dc_begin_drawing(widget); if (dc == RT_NULL) return RT_FALSE; rtgui_widget_get_rect(widget, &rect); /* open image */ rt_snprintf(fn, sizeof(fn), "%s/%s", PICTURE_DIR, current_fn); image = rtgui_image_create_from_file("hdc", fn, RT_FALSE); if (image != RT_NULL) { /* blit image */ rtgui_image_blit(image, dc, &rect); /* destroy image */ rtgui_image_destroy(image); } else { rtgui_dc_fill_rect(dc, &rect); rtgui_dc_draw_text(dc, "没有文件被打开", &rect); } rtgui_dc_end_drawing(dc); return RT_FALSE; } else if (event->type == RTGUI_EVENT_KBD) { struct rtgui_event_kbd* ekbd = (struct rtgui_event_kbd*)event; if (ekbd->type == RTGUI_KEYDOWN) { switch (ekbd->key) { case RTGUIK_RIGHT: if (view_mode == VIEW_DIR_MODE) picture_show_next(); else if (view_mode == VIEW_FN_LIST_MODE) { picture_fn_list_current ++; if (picture_fn_list_current == picture_fn_list_size) { picture_fn_list_current = 0; } strcpy(current_fn, picture_fn_list[picture_fn_list_current]); rtgui_widget_update(RTGUI_WIDGET(picture_view)); } break; case RTGUIK_LEFT: if (view_mode == VIEW_DIR_MODE) picture_show_prev(); else if (view_mode == VIEW_FN_LIST_MODE) { if (picture_fn_list_current == 0) { picture_fn_list_current = picture_fn_list_size - 1; } else picture_fn_list_current --; strcpy(current_fn, picture_fn_list[picture_fn_list_current]); rtgui_widget_update(RTGUI_WIDGET(picture_view)); } break; case RTGUIK_RETURN: { rtgui_view_t* view; view = RTGUI_VIEW(widget); /* close this view */ current_fn[0] = '\0'; /* end of modal */ rtgui_view_end_modal(view, RTGUI_MODAL_OK); picture_view = RT_NULL; } break; } } return RT_FALSE; } return rtgui_view_event_handler(widget, event); }