rt-thread/examples/rtgui_win/demo_gui_image.c

71 lines
1.7 KiB
C
Raw Normal View History

/*
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DC<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
*
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>view<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾͼ<EFBFBD><EFBFBD>
*/
#include "demo_view.h"
#include <rtgui/widgets/button.h>
#include <rtgui/widgets/filelist_view.h>
#include <string.h>
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
/* <20>򿪰<EFBFBD>ť<EFBFBD>Ļص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD> */
static void open_btn_onbutton(PVOID wdt, rtgui_event_t* event)
{
}
/* <20><>ʾ<EFBFBD><CABE>ͼ<EFBFBD><CDBC><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
static rt_bool_t demo_view_event_handler(PVOID wdt, rtgui_event_t *event)
{
rtgui_widget_t *widget = RTGUI_WIDGET(wdt);
rt_bool_t result;
/* <20>ȵ<EFBFBD><C8B5><EFBFBD>Ĭ<EFBFBD>ϵ<EFBFBD><CFB5>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>PAINT<4E>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ͼ<EFBFBD><CDBC><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD>һЩ<D2BB>ؼ<EFBFBD>) */
result = rtgui_view_event_handler(widget, event);
if (event->type == RTGUI_EVENT_PAINT)
{
rtgui_dc_t* dc;
/* <20><><EFBFBD>ÿؼ<C3BF><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DC */
dc = rtgui_dc_begin_drawing(widget);
if (dc == RT_NULL) return RT_FALSE;
/* <20><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD> */
rtgui_dc_end_drawing(dc);
}
return result;
}
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾͼ<CABE><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ͼ */
rtgui_view_t* demo_gui_image(rtgui_view_t* parent_view)
{
rtgui_button_t* open_btn;
rtgui_view_t *view;
rtgui_filelist_view_t *fview;
/* <20>ȴ<EFBFBD><C8B4><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ͼ */
view = demo_view_create(parent_view, "ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ");
#ifdef _WIN32
fview = rtgui_filelist_view_create(view, "d:\\", "*.*", 5, 65, 200, 180);
#else
fview = rtgui_filelist_view_create(view, "/", "*.*", 5, 65, 200, 180);
#endif
if (view != RT_NULL)
/* <20><><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϵ<EFBFBD><CFB5>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>demo_view_event_handler<65><72><EFBFBD><EFBFBD> */
rtgui_widget_set_event_handler(view, demo_view_event_handler);
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ť */
open_btn = rtgui_button_create(view, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>", 10, 40, 120, 22);
rtgui_button_set_onbutton(open_btn, open_btn_onbutton);
return view;
}
#endif