add font and change theme.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@327 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong 2010-01-21 10:05:06 +00:00
parent 284727de4a
commit 63dff2e94e
13 changed files with 580 additions and 38 deletions

View File

@ -48,6 +48,23 @@ rtgui_view_t* demo_view(rtgui_workbench_t* workbench)
{
struct rtgui_rect rect;
struct rtgui_button *next_btn, *prev_btn;
struct rtgui_label *label;
struct rtgui_staticline *line;
/* get view's rect */
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
rect.x1 += 5; rect.y1 += 5;
rect.x2 -= 5; rect.y2 -= 5;
rect.y2 = rect.y1 + 20;
/* create view label */
label = rtgui_label_create("Demo Label");
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
rect.y1 += 20; rect.y2 += 20;
line = rtgui_staticline_create(RTGUI_HORIZONTAL);
rtgui_widget_set_rect(RTGUI_WIDGET(line), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(line));
/* get view's rect */
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
@ -93,6 +110,7 @@ rtgui_box_t* demo_view_create_box(rtgui_view_t* view, int orient)
/* get rect of view */
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
rect.y1 += 45;
rect.y2 -= 25;
box = rtgui_box_create(orient, &rect);

View File

@ -7,7 +7,7 @@
static struct rtgui_timer *timer;
static struct rtgui_label* label;
static struct rtgui_win* msgbox;
static struct rtgui_win* msgbox = RT_NULL;
static rt_uint8_t label_text[80];
static int cnt = 5;
@ -29,20 +29,8 @@ void diag_close(struct rtgui_timer* timer, void* parameter)
void window_demo()
{
rt_mq_t mq;
rt_thread_t tid;
rt_uint32_t user_data;
struct rtgui_rect rect = {50, 50, 200, 200};
tid = rt_thread_self();
if (tid == RT_NULL) return; /* can't use in none-scheduler environement */
user_data = tid->user_data;
/* create gui message queue */
mq = rt_mq_create("msgbox", 256, 4, RT_IPC_FLAG_FIFO);
/* register message queue on current thread */
rtgui_thread_register(rt_thread_self(), mq);
msgbox = rtgui_win_create(RT_NULL, "Information", &rect, RTGUI_WIN_STYLE_DEFAULT);
if (msgbox != RT_NULL)
{
@ -64,15 +52,6 @@ void window_demo()
timer = rtgui_timer_create(200, RT_TIMER_FLAG_PERIODIC, diag_close, RT_NULL);
rtgui_timer_start(timer);
rtgui_win_event_loop(msgbox);
rtgui_thread_deregister(rt_thread_self());
/* remove RTGUI message queue */
rt_mq_delete(mq);
/* recover user data */
tid->user_data = user_data;
}
#ifdef RT_USING_FINSH
@ -108,7 +87,6 @@ rtgui_view_t* demo_view_window(rtgui_workbench_t* workbench)
rtgui_button_t *button;
view = demo_view(workbench);
demo_view_get_rect(view, &rect);
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 = rect.x1 + 100;

View File

@ -55,6 +55,7 @@ static void workbench_entry(void* parameter)
/* 在工作台上添加一个视图 */
rtgui_workbench_add_view(workbench, view);
demo_view_window(workbench);
demo_view_label(workbench);
demo_view_button(workbench);
demo_view_checkbox(workbench);

228
rtgui/common/arial12font.c Normal file
View File

@ -0,0 +1,228 @@
/*
* File : arial16font.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2010-01-21 Bernard first version
*/
#include <rtgui/font.h>
#ifdef RTGUI_USING_FONT12
const unsigned char arial12_font[]=
{
/*---char: ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*---char: ! ---*/
0x00,0x00,0x10,0x41,0x04,0x10,0x41,0x00,0x10,
/*---char: " ---*/
0x00,0x00,0x28,0xa2,0x80,0x00,0x00,0x00,0x00,
/*---char: # ---*/
0x00,0x00,0x05,0x17,0xf2,0x8a,0xfc,0xa5,0x14,
/*---char: $ ---*/
0x00,0x00,0x0e,0x55,0x45,0x0e,0x15,0x55,0x4e,
/*---char: % ---*/
0x00,0x00,0x0c,0x49,0x24,0xcd,0x04,0x20,0x84,
/*---char: & ---*/
0x00,0x00,0x06,0x24,0x92,0x8c,0x49,0x14,0x4e,
/*---char: ' ---*/
0x00,0x00,0x10,0x41,0x00,0x00,0x00,0x00,0x00,
/*---char: ( ---*/
0x00,0x00,0x04,0x20,0x84,0x10,0x41,0x04,0x08,
/*---char: ) ---*/
0x00,0x00,0x20,0x41,0x02,0x08,0x20,0x82,0x10,
/*---char: * ---*/
0x00,0x00,0x08,0xf8,0x85,0x00,0x00,0x00,0x00,
/*---char: + ---*/
0x00,0x00,0x00,0x00,0x41,0x1f,0x10,0x40,0x00,
/*---char: , ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,
/*---char: - ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,
/*---char: . ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,
/*---char: / ---*/
0x00,0x00,0x08,0x21,0x04,0x10,0x41,0x08,0x20,
/*---char: 0 ---*/
0x00,0x00,0x0e,0x45,0x14,0x51,0x45,0x14,0x4e,
/*---char: 1 ---*/
0x00,0x00,0x04,0x31,0x41,0x04,0x10,0x41,0x04,
/*---char: 2 ---*/
0x00,0x00,0x0e,0x44,0x10,0x42,0x08,0x42,0x1f,
/*---char: 3 ---*/
0x00,0x00,0x0e,0x44,0x10,0x46,0x04,0x14,0x4e,
/*---char: 4 ---*/
0x00,0x00,0x02,0x18,0x62,0x8a,0x49,0xf0,0x82,
/*---char: 5 ---*/
0x00,0x00,0x0f,0x21,0x07,0x91,0x04,0x14,0x4e,
/*---char: 6 ---*/
0x00,0x00,0x0e,0x45,0x05,0x99,0x45,0x14,0x4e,
/*---char: 7 ---*/
0x00,0x00,0x1f,0x08,0x21,0x04,0x10,0x82,0x08,
/*---char: 8 ---*/
0x00,0x00,0x0e,0x45,0x14,0x4e,0x45,0x14,0x4e,
/*---char: 9 ---*/
0x00,0x00,0x0e,0x45,0x14,0x53,0x34,0x14,0x4e,
/*---char: : ---*/
0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x10,
/*---char: ; ---*/
0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x10,
/*---char: < ---*/
0x00,0x00,0x00,0x00,0x13,0x90,0x38,0x10,0x00,
/*---char: = ---*/
0x00,0x00,0x00,0x00,0x0f,0xc0,0x03,0xf0,0x00,
/*---char: > ---*/
0x00,0x00,0x00,0x01,0x03,0x81,0x39,0x00,0x00,
/*---char: ? ---*/
0x00,0x00,0x0e,0x45,0x10,0x42,0x10,0x40,0x04,
/*---char: @ ---*/
0x00,0x00,0x01,0x18,0x82,0x52,0x51,0x45,0x13,
/*---char: A ---*/
0x00,0x00,0x04,0x28,0xa2,0x91,0x7d,0x18,0x20,
/*---char: B ---*/
0x00,0x00,0x1f,0x41,0x04,0x1f,0x41,0x04,0x1f,
/*---char: C ---*/
0x00,0x00,0x07,0x21,0x04,0x10,0x41,0x02,0x07,
/*---char: D ---*/
0x00,0x00,0x1f,0x41,0x04,0x10,0x41,0x04,0x1f,
/*---char: E ---*/
0x00,0x00,0x1f,0x41,0x04,0x1f,0x41,0x04,0x1f,
/*---char: F ---*/
0x00,0x00,0x1f,0x41,0x04,0x1e,0x41,0x04,0x10,
/*---char: G ---*/
0x00,0x00,0x07,0x21,0x04,0x11,0x41,0x02,0x07,
/*---char: H ---*/
0x00,0x00,0x10,0x41,0x04,0x1f,0x41,0x04,0x10,
/*---char: I ---*/
0x00,0x00,0x10,0x41,0x04,0x10,0x41,0x04,0x10,
/*---char: J ---*/
0x00,0x00,0x02,0x08,0x20,0x82,0x0a,0x28,0x9c,
/*---char: K ---*/
0x00,0x00,0x10,0x41,0x14,0x94,0x69,0x14,0x10,
/*---char: L ---*/
0x00,0x00,0x10,0x41,0x04,0x10,0x41,0x04,0x1f,
/*---char: M ---*/
0x00,0x00,0x10,0x61,0x85,0x55,0x55,0x54,0x92,
/*---char: N ---*/
0x00,0x00,0x10,0x61,0x45,0x12,0x45,0x14,0x10,
/*---char: O ---*/
0x00,0x00,0x07,0x21,0x04,0x10,0x41,0x02,0x07,
/*---char: P ---*/
0x00,0x00,0x1f,0x41,0x04,0x1f,0x41,0x04,0x10,
/*---char: Q ---*/
0x00,0x00,0x07,0x21,0x04,0x10,0x41,0x32,0x07,
/*---char: R ---*/
0x00,0x00,0x1f,0x41,0x04,0x1f,0x45,0x04,0x10,
/*---char: S ---*/
0x00,0x00,0x0f,0x41,0x04,0x0f,0x01,0x04,0x0f,
/*---char: T ---*/
0x00,0x00,0x3f,0x10,0x41,0x04,0x10,0x41,0x04,
/*---char: U ---*/
0x00,0x00,0x10,0x41,0x04,0x10,0x41,0x02,0x07,
/*---char: V ---*/
0x00,0x00,0x20,0x81,0x14,0x51,0x28,0xa1,0x04,
/*---char: W ---*/
0x00,0x00,0x21,0x8a,0x24,0x94,0x51,0x42,0x08,
/*---char: X ---*/
0x00,0x00,0x20,0x45,0x12,0x84,0x29,0x14,0x60,
/*---char: Y ---*/
0x00,0x00,0x20,0x45,0x12,0x84,0x10,0x41,0x04,
/*---char: Z ---*/
0x00,0x00,0x1f,0x04,0x20,0x84,0x20,0x84,0x3f,
/*---char: [ ---*/
0x00,0x00,0x18,0x41,0x04,0x10,0x41,0x04,0x10,
/*---char: \ ---*/
0x00,0x00,0x20,0x81,0x04,0x10,0x41,0x02,0x08,
/*---char: ] ---*/
0x00,0x00,0x30,0x41,0x04,0x10,0x41,0x04,0x10,
/*---char: ^ ---*/
0x00,0x00,0x08,0x51,0x45,0x22,0x00,0x00,0x00,
/*---char: _ ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*---char: ` ---*/
0x00,0x00,0x10,0x20,0x00,0x00,0x00,0x00,0x00,
/*---char: a ---*/
0x00,0x00,0x00,0x00,0xe4,0x41,0x3d,0x14,0xcd,
/*---char: b ---*/
0x00,0x00,0x10,0x41,0x66,0x51,0x45,0x16,0x56,
/*---char: c ---*/
0x00,0x00,0x00,0x00,0xc4,0x90,0x41,0x04,0x8c,
/*---char: d ---*/
0x00,0x00,0x01,0x04,0xd4,0xd1,0x45,0x14,0x4f,
/*---char: e ---*/
0x00,0x00,0x00,0x00,0xe4,0x51,0x7d,0x04,0x4e,
/*---char: f ---*/
0x00,0x00,0x0c,0x43,0x84,0x10,0x41,0x04,0x10,
/*---char: g ---*/
0x00,0x00,0x00,0x00,0xd4,0xd1,0x45,0x14,0xcd,
/*---char: h ---*/
0x00,0x00,0x10,0x41,0x66,0x51,0x45,0x14,0x51,
/*---char: i ---*/
0x00,0x00,0x10,0x01,0x04,0x10,0x41,0x04,0x10,
/*---char: j ---*/
0x00,0x00,0x10,0x01,0x04,0x10,0x41,0x04,0x10,
/*---char: k ---*/
0x00,0x00,0x10,0x41,0x14,0x94,0x71,0x24,0x91,
/*---char: l ---*/
0x00,0x00,0x10,0x41,0x04,0x10,0x41,0x04,0x10,
/*---char: m ---*/
0x00,0x00,0x00,0x01,0x66,0x51,0x45,0x14,0x51,
/*---char: n ---*/
0x00,0x00,0x00,0x01,0x66,0x51,0x45,0x14,0x51,
/*---char: o ---*/
0x00,0x00,0x00,0x00,0xe4,0x51,0x45,0x14,0x4e,
/*---char: p ---*/
0x00,0x00,0x00,0x01,0x66,0x51,0x45,0x16,0x56,
/*---char: q ---*/
0x00,0x00,0x00,0x00,0xd4,0xd1,0x45,0x14,0xcd,
/*---char: r ---*/
0x00,0x00,0x00,0x01,0x46,0x10,0x41,0x04,0x10,
/*---char: s ---*/
0x00,0x00,0x00,0x00,0xe4,0x50,0x38,0x14,0x4e,
/*---char: t ---*/
0x00,0x00,0x10,0x43,0x84,0x10,0x41,0x04,0x18,
/*---char: u ---*/
0x00,0x00,0x00,0x01,0x14,0x51,0x45,0x14,0x4f,
/*---char: v ---*/
0x00,0x00,0x00,0x02,0x28,0x94,0x51,0x42,0x08,
/*---char: w ---*/
0x00,0x00,0x00,0x02,0x28,0x95,0x55,0x52,0x08,
/*---char: x ---*/
0x00,0x00,0x00,0x02,0x25,0x14,0x21,0x45,0x22,
/*---char: y ---*/
0x00,0x00,0x00,0x02,0x28,0x94,0x51,0x42,0x08,
/*---char: z ---*/
0x00,0x00,0x00,0x03,0xe1,0x04,0x21,0x04,0x3e,
/*---char: { ---*/
0x00,0x00,0x08,0x41,0x04,0x10,0x81,0x04,0x10,
/*---char: | ---*/
0x00,0x00,0x10,0x41,0x04,0x10,0x41,0x04,0x10,
/*---char: } ---*/
0x00,0x00,0x10,0x20,0x82,0x08,0x10,0x82,0x08,
/*---char: ~ ---*/
0x00,0x00,0x00,0x00,0x00,0x0c,0x4c,0x00,0x00
};
struct rtgui_font_bitmap arial12 =
{
(const rt_uint8_t*)arial12_font, /* bmp */
6, /* width */
12, /* height */
32, /* first char */
127 /* last char */
};
struct rtgui_font rtgui_font_arial12 =
{
"arial", /* family */
12, /* height */
1, /* refer count */
&bmp_font_engine, /* font engine */
&arial12, /* font private data */
};
#endif

228
rtgui/common/arial16font.c Normal file
View File

@ -0,0 +1,228 @@
/*
* File : arial16font.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2010-01-21 Bernard first version
*/
#include <rtgui/font.h>
#ifdef RTGUI_USING_FONT16
const unsigned char arial16_font[]=
{
/*---char: ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*---char: ! ---*/
0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,
/*---char: " ---*/
0x00,0x00,0x00,0x48,0x48,0x48,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*---char: # ---*/
0x00,0x00,0x00,0x11,0x11,0x11,0x22,0xff,0x22,0x22,0x22,0xff,0x44,0x44,0x44,0x00,
/*---char: $ ---*/
0x00,0x00,0x08,0x1e,0x29,0x49,0x48,0x48,0x38,0x0e,0x09,0x09,0x49,0x2a,0x1c,0x08,
/*---char: % ---*/
0x00,0x00,0x00,0x38,0x44,0x44,0x45,0x45,0x39,0x02,0x02,0x04,0x04,0x08,0x08,0x00,
/*---char: & ---*/
0x00,0x00,0x00,0x1c,0x22,0x22,0x22,0x14,0x18,0x28,0x44,0x42,0x41,0x22,0x1c,0x00,
/*---char: ' ---*/
0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*---char: ( ---*/
0x00,0x00,0x00,0x10,0x20,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,
/*---char: ) ---*/
0x00,0x00,0x00,0x40,0x20,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,
/*---char: * ---*/
0x00,0x00,0x00,0x20,0xf8,0x20,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*---char: + ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x7f,0x08,0x08,0x08,0x00,0x00,0x00,
/*---char: , ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,
/*---char: - ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,
/*---char: . ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,
/*---char: / ---*/
0x00,0x00,0x00,0x10,0x10,0x20,0x20,0x20,0x20,0x40,0x40,0x40,0x40,0x80,0x80,0x00,
/*---char: 0 ---*/
0x00,0x00,0x00,0x1c,0x22,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x22,0x1c,0x00,
/*---char: 1 ---*/
0x00,0x00,0x00,0x04,0x0c,0x14,0x24,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,
/*---char: 2 ---*/
0x00,0x00,0x00,0x1e,0x22,0x41,0x01,0x01,0x02,0x02,0x04,0x08,0x10,0x20,0x7f,0x00,
/*---char: 3 ---*/
0x00,0x00,0x00,0x1c,0x22,0x42,0x02,0x06,0x1c,0x02,0x01,0x01,0x41,0x62,0x1c,0x00,
/*---char: 4 ---*/
0x00,0x00,0x00,0x02,0x06,0x0a,0x12,0x12,0x22,0x42,0x82,0xff,0x02,0x02,0x02,0x00,
/*---char: 5 ---*/
0x00,0x00,0x00,0x3f,0x20,0x20,0x40,0x7c,0x42,0x01,0x01,0x01,0x41,0x22,0x1c,0x00,
/*---char: 6 ---*/
0x00,0x00,0x00,0x1c,0x22,0x41,0x40,0x5c,0x62,0x41,0x41,0x41,0x41,0x22,0x1c,0x00,
/*---char: 7 ---*/
0x00,0x00,0x00,0x7f,0x02,0x02,0x04,0x04,0x08,0x08,0x08,0x08,0x10,0x10,0x10,0x00,
/*---char: 8 ---*/
0x00,0x00,0x00,0x1c,0x22,0x41,0x41,0x22,0x1c,0x22,0x41,0x41,0x41,0x22,0x1c,0x00,
/*---char: 9 ---*/
0x00,0x00,0x00,0x1c,0x22,0x41,0x41,0x41,0x41,0x23,0x1d,0x01,0x41,0x22,0x1c,0x00,
/*---char: : ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,
/*---char: ; ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,
/*---char: < ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0e,0x30,0x40,0x30,0x0e,0x01,0x00,0x00,0x00,
/*---char: = ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,
/*---char: > ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x38,0x06,0x01,0x06,0x38,0x40,0x00,0x00,0x00,
/*---char: ? ---*/
0x00,0x00,0x00,0x1c,0x22,0x41,0x41,0x01,0x02,0x04,0x08,0x08,0x08,0x00,0x08,0x00,
/*---char: @ ---*/
0x00,0x00,0x00,0x03,0x0c,0x10,0x21,0x22,0x44,0x48,0x48,0x48,0x48,0x44,0x23,0x10,
/*---char: A ---*/
0x00,0x00,0x00,0x04,0x0a,0x0a,0x0a,0x11,0x11,0x11,0x3f,0x20,0x20,0x40,0x40,0x00,
/*---char: B ---*/
0x00,0x00,0x00,0x7f,0x40,0x40,0x40,0x40,0x7f,0x40,0x40,0x40,0x40,0x40,0x7f,0x00,
/*---char: C ---*/
0x00,0x00,0x00,0x0f,0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x10,0x0f,0x00,
/*---char: D ---*/
0x00,0x00,0x00,0x7f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7f,0x00,
/*---char: E ---*/
0x00,0x00,0x00,0x7f,0x40,0x40,0x40,0x40,0x7f,0x40,0x40,0x40,0x40,0x40,0x7f,0x00,
/*---char: F ---*/
0x00,0x00,0x00,0x7f,0x40,0x40,0x40,0x40,0x40,0x7f,0x40,0x40,0x40,0x40,0x40,0x00,
/*---char: G ---*/
0x00,0x00,0x00,0x0f,0x10,0x20,0x40,0x40,0x40,0x43,0x40,0x40,0x20,0x10,0x0f,0x00,
/*---char: H ---*/
0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x7f,0x40,0x40,0x40,0x40,0x40,0x40,0x00,
/*---char: I ---*/
0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,
/*---char: J ---*/
0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x42,0x42,0x42,0x3c,0x00,
/*---char: K ---*/
0x00,0x00,0x00,0x40,0x40,0x41,0x42,0x44,0x4c,0x54,0x62,0x41,0x41,0x40,0x40,0x00,
/*---char: L ---*/
0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7f,0x00,
/*---char: M ---*/
0x00,0x00,0x00,0x40,0x60,0x60,0x50,0x50,0x48,0x48,0x45,0x45,0x45,0x42,0x42,0x00,
/*---char: N ---*/
0x00,0x00,0x00,0x40,0x60,0x50,0x50,0x48,0x44,0x44,0x42,0x41,0x41,0x40,0x40,0x00,
/*---char: O ---*/
0x00,0x00,0x00,0x0f,0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x10,0x0f,0x00,
/*---char: P ---*/
0x00,0x00,0x00,0x7f,0x40,0x40,0x40,0x40,0x40,0x7f,0x40,0x40,0x40,0x40,0x40,0x00,
/*---char: Q ---*/
0x00,0x00,0x00,0x0f,0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x23,0x10,0x0f,0x00,
/*---char: R ---*/
0x00,0x00,0x00,0x7f,0x40,0x40,0x40,0x40,0x40,0x7f,0x42,0x41,0x41,0x40,0x40,0x00,
/*---char: S ---*/
0x00,0x00,0x00,0x1f,0x20,0x40,0x40,0x20,0x1c,0x03,0x00,0x00,0x40,0x20,0x1f,0x00,
/*---char: T ---*/
0x00,0x00,0x00,0xff,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,
/*---char: U ---*/
0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x1f,0x00,
/*---char: V ---*/
0x00,0x00,0x00,0x40,0x40,0x20,0x20,0x20,0x11,0x11,0x11,0x0a,0x0a,0x04,0x04,0x00,
/*---char: W ---*/
0x00,0x00,0x00,0x81,0x82,0x42,0x42,0x44,0x44,0x24,0x28,0x28,0x28,0x10,0x10,0x00,
/*---char: X ---*/
0x00,0x00,0x00,0x40,0x20,0x11,0x11,0x0a,0x04,0x0a,0x11,0x11,0x20,0x40,0x80,0x00,
/*---char: Y ---*/
0x00,0x00,0x00,0x80,0x41,0x41,0x22,0x14,0x14,0x08,0x08,0x08,0x08,0x08,0x08,0x00,
/*---char: Z ---*/
0x00,0x00,0x00,0x7f,0x01,0x02,0x02,0x04,0x08,0x08,0x10,0x20,0x20,0x40,0xff,0x00,
/*---char: [ ---*/
0x00,0x00,0x00,0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
/*---char: \ ---*/
0x00,0x00,0x00,0x80,0x80,0x40,0x40,0x40,0x40,0x20,0x20,0x20,0x20,0x10,0x10,0x00,
/*---char: ] ---*/
0x00,0x00,0x00,0xe0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
/*---char: ^ ---*/
0x00,0x00,0x00,0x10,0x28,0x28,0x44,0x44,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*---char: _ ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*---char: ` ---*/
0x00,0x00,0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*---char: a ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x21,0x41,0x07,0x39,0x41,0x41,0x43,0x3d,0x00,
/*---char: b ---*/
0x00,0x00,0x00,0x40,0x40,0x40,0x5c,0x62,0x41,0x41,0x41,0x41,0x41,0x62,0x5c,0x00,
/*---char: c ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x22,0x40,0x40,0x40,0x40,0x40,0x22,0x1c,0x00,
/*---char: d ---*/
0x00,0x00,0x00,0x01,0x01,0x01,0x1d,0x23,0x41,0x41,0x41,0x41,0x41,0x23,0x1d,0x00,
/*---char: e ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x22,0x41,0x41,0x7f,0x40,0x41,0x22,0x1c,0x00,
/*---char: f ---*/
0x00,0x00,0x00,0x30,0x40,0x40,0xf0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,
/*---char: g ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x1d,0x23,0x41,0x41,0x41,0x41,0x41,0x23,0x1d,0x01,
/*---char: h ---*/
0x00,0x00,0x00,0x40,0x40,0x40,0x5c,0x62,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x00,
/*---char: i ---*/
0x00,0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,
/*---char: j ---*/
0x00,0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
/*---char: k ---*/
0x00,0x00,0x00,0x40,0x40,0x40,0x41,0x42,0x44,0x48,0x58,0x64,0x44,0x42,0x41,0x00,
/*---char: l ---*/
0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,
/*---char: m ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x5c,0x63,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x00,
/*---char: n ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x5c,0x62,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x00,
/*---char: o ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x22,0x41,0x41,0x41,0x41,0x41,0x22,0x1c,0x00,
/*---char: p ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x5c,0x62,0x41,0x41,0x41,0x41,0x41,0x62,0x5c,0x40,
/*---char: q ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x1d,0x23,0x41,0x41,0x41,0x41,0x41,0x23,0x1d,0x01,
/*---char: r ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,
/*---char: s ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,0x40,0x3c,0x02,0x02,0x42,0x3c,0x00,
/*---char: t ---*/
0x00,0x00,0x00,0x00,0x40,0x40,0xf0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00,
/*---char: u ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x46,0x3a,0x00,
/*---char: v ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x82,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,
/*---char: w ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x84,0x84,0x4a,0x4a,0x51,0x51,0x51,0x20,0x20,0x00,
/*---char: x ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x44,0x28,0x28,0x10,0x28,0x28,0x44,0x82,0x00,
/*---char: y ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x82,0x84,0x44,0x44,0x28,0x28,0x28,0x10,0x10,
/*---char: z ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x04,0x08,0x08,0x10,0x20,0x20,0x40,0xfe,0x00,
/*---char: { ---*/
0x00,0x00,0x00,0x18,0x20,0x20,0x20,0x20,0x20,0x20,0xc0,0x20,0x20,0x20,0x20,0x20,
/*---char: | ---*/
0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
/*---char: } ---*/
0x00,0x00,0x00,0xc0,0x20,0x20,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0x20,
/*---char: ~ ---*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x71,0x8e,0x00,0x00,0x00,0x00,0x00,0x00
};
struct rtgui_font_bitmap arial16 =
{
(const rt_uint8_t*)arial16_font, /* bmp */
8, /* width */
16, /* height */
32, /* first char */
127 /* last char */
};
struct rtgui_font rtgui_font_arial16 =
{
"arial", /* family */
16, /* height */
1, /* refer count */
&bmp_font_engine, /* font engine */
&arial16, /* font private data */
};
#endif

View File

@ -23,9 +23,6 @@ const rtgui_color_t high_light = RTGUI_RGB(0xff, 0xff, 0xff);
const rtgui_color_t dark_grey = RTGUI_RGB(0x7f, 0x7f, 0x7f);
const rtgui_color_t light_grey = RTGUI_RGB(0xc0, 0xc0, 0xc0);
const rtgui_color_t default_foreground = RTGUI_RGB(0x00, 0x00, 0x00);
const rtgui_color_t default_background = RTGUI_RGB(0xff, 0xff, 0xff);
#define RTGUI_RGB_R(c) ((c) & 0xff)
#define RTGUI_RGB_G(c) (((c) >> 8) & 0xff)
#define RTGUI_RGB_B(c) (((c) >> 16) & 0xff)

View File

@ -18,7 +18,9 @@ static rtgui_list_t _rtgui_font_list;
static struct rtgui_font* rtgui_default_font;
extern struct rtgui_font rtgui_font_asc16;
extern struct rtgui_font rtgui_font_arial16;
extern struct rtgui_font rtgui_font_asc12;
extern struct rtgui_font rtgui_font_arial12;
#ifdef RTGUI_USING_FONTHZ
extern struct rtgui_font rtgui_font_hz16;
extern struct rtgui_font rtgui_font_hz12;
@ -33,6 +35,7 @@ void rtgui_font_system_init()
#ifdef RTGUI_USING_FONT16
rtgui_font_system_add_font(&rtgui_font_asc16);
rtgui_font_system_add_font(&rtgui_font_arial16);
#ifdef RTGUI_USING_FONTHZ
rtgui_font_system_add_font(&rtgui_font_hz16);
#endif
@ -40,16 +43,19 @@ void rtgui_font_system_init()
#ifdef RTGUI_USING_FONT12
rtgui_font_system_add_font(&rtgui_font_asc12);
rtgui_font_system_add_font(&rtgui_font_arial12);
#ifdef RTGUI_USING_FONTHZ
rtgui_font_system_add_font(&rtgui_font_hz12);
#endif
#endif
#ifdef RTGUI_USING_FONT12
rtgui_font_set_defaut(&rtgui_font_asc12);
if (rtgui_default_font == RT_NULL)
rtgui_font_set_defaut(&rtgui_font_asc12);
#endif
#ifdef RTGUI_USING_FONT16
rtgui_font_set_defaut(&rtgui_font_asc16);
if (rtgui_default_font == RT_NULL)
rtgui_font_set_defaut(&rtgui_font_asc16);
#endif
}
@ -166,7 +172,7 @@ struct rtgui_font_engine bmp_font_engine =
void rtgui_bitmap_font_draw_char(struct rtgui_font_bitmap* font, struct rtgui_dc* dc, const char ch,
rtgui_rect_t* rect)
{
const rt_uint8_t* font_ptr = font->bmp + ch * font->height;
const rt_uint8_t* font_ptr;
rt_uint16_t x, y, w, h;
register rt_base_t i, j;
@ -175,6 +181,7 @@ void rtgui_bitmap_font_draw_char(struct rtgui_font_bitmap* font, struct rtgui_dc
/* check first and last char */
if (ch < font->first_char || ch > font->last_char) return;
font_ptr = font->bmp + (ch - font->first_char) * font->height;
w = (font->width + x > rect->x2)? rect->x2 - rect->x1 : font->width;
h = (font->height + y > rect->y2)? rect->y2 - rect->y1 : font->height;

View File

@ -185,6 +185,14 @@ static const rt_uint8_t *close_pressed_xpm[] = {
static rtgui_image_t* close_pressed = RT_NULL;
static rtgui_image_t* close_unpressed = RT_NULL;
const rtgui_color_t default_foreground = RTGUI_RGB(0x00, 0x00, 0x00);
const rtgui_color_t default_background = RTGUI_RGB(212, 208, 200);
extern struct rtgui_font rtgui_font_asc16;
extern struct rtgui_font rtgui_font_arial16;
extern struct rtgui_font rtgui_font_asc12;
extern struct rtgui_font rtgui_font_arial12;
/* init theme */
void rtgui_system_theme_init()
{
@ -192,6 +200,8 @@ void rtgui_system_theme_init()
(const rt_uint8_t*)close_pressed_xpm, sizeof(close_pressed_xpm), RT_TRUE);
close_unpressed = rtgui_image_create_from_mem("xpm",
(const rt_uint8_t*)close_unpressed_xpm, sizeof(close_unpressed_xpm), RT_TRUE);
rtgui_font_set_defaut(&rtgui_font_arial16);
}
/* window drawing */
@ -217,8 +227,21 @@ void rtgui_theme_draw_win(struct rtgui_topwin* win)
/* draw border */
if (win->flag & WINTITLE_BORDER)
{
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(win->title)) = RTGUI_RGB(219, 210, 243);
rtgui_dc_draw_rect(dc, &rect);
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(win->title)) = RTGUI_RGB(212, 208, 200);
rtgui_dc_draw_hline(dc, rect.x1, rect.x2, rect.y1);
rtgui_dc_draw_vline(dc, rect.x1, rect.y1, rect.y2);
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(win->title)) = white;
rtgui_dc_draw_hline(dc, rect.x1 + 1, rect.x2 - 1, rect.y1 + 1);
rtgui_dc_draw_vline(dc, rect.x1 + 1, rect.y1 + 1, rect.y2 - 1);
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(win->title)) = RTGUI_RGB(128, 128, 128);
rtgui_dc_draw_hline(dc, rect.x1 + 1, rect.x2 - 1, rect.y2 - 1);
rtgui_dc_draw_vline(dc, rect.x2 - 1, rect.y1 + 1, rect.y2 - 1);
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(win->title)) = RTGUI_RGB(64, 64, 64);
rtgui_dc_draw_hline(dc, rect.x1, rect.x2 + 1, rect.y2);
rtgui_dc_draw_vline(dc, rect.x2, rect.y1, rect.y2);
/* shrink border */
rect.x1 += WINTITLE_BORDER_SIZE;
@ -230,17 +253,36 @@ void rtgui_theme_draw_win(struct rtgui_topwin* win)
/* draw title */
if (!(win->flag & WINTITLE_NO))
{
rt_uint32_t index;
float r, g, b, delta;
if (win->flag & WINTITLE_ACTIVATE)
{
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(win->title)) = RTGUI_RGB(229, 236, 249);
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(win->title)) = RTGUI_RGB( 51, 102, 204);
r = 10; g = 36; b = 106;
delta = (float)(rect.x2 - rect.x1) / 160;
}
else
{
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(win->title)) = RTGUI_RGB(242, 245, 252);
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(win->title)) = RTGUI_RGB(153, 178, 229);
r = 128; g = 128; b = 128;
delta = (float)(rect.x2 - rect.x1) / 64;
}
rtgui_dc_fill_rect(dc, &rect);
for (index = rect.x1; index < rect.x2; index ++)
{
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(win->title)) = RTGUI_RGB(r, g, b);
rtgui_dc_draw_vline(dc, index, rect.y1, rect.y2);
r += delta; g += delta; b += delta;
}
if (win->flag & WINTITLE_ACTIVATE)
{
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(win->title)) = white;
}
else
{
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(win->title)) = RTGUI_RGB(212, 208, 200);
}
// rtgui_dc_fill_rect(dc, &rect);
rect.x1 += 4;
rect.y1 += 2;
@ -539,6 +581,7 @@ void rtgui_theme_draw_radiobox(struct rtgui_radiobox* radiobox)
struct rtgui_dc* dc;
struct rtgui_rect rect, item_rect;
rt_size_t item_size, bord_size, index;
rtgui_color_t fc;
/* begin drawing */
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(radiobox));
@ -560,7 +603,18 @@ void rtgui_theme_draw_radiobox(struct rtgui_radiobox* radiobox)
/* draw box */
rtgui_rect_inflate(&rect, -bord_size/2);
rtgui_dc_draw_round_rect(dc, &rect);
fc = RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(radiobox));
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(radiobox)) = white;
rect.x1 ++; rect.y1 ++; rect.x2 ++; rect.y2 ++;
rtgui_dc_draw_rect(dc, &rect);
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(radiobox)) = RTGUI_RGB(128, 128, 128);
rect.x1 --; rect.y1 --; rect.x2 --; rect.y2 --;
rtgui_dc_draw_rect(dc, &rect);
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(radiobox)) = fc;
rtgui_rect_inflate(&rect, bord_size/2);
if (radiobox->text != RT_NULL)
{
@ -569,7 +623,9 @@ void rtgui_theme_draw_radiobox(struct rtgui_radiobox* radiobox)
/* draw group text */
rtgui_font_get_metrics(rtgui_dc_get_font(dc), radiobox->text, &text_rect);
rtgui_rect_moveto(&text_rect, rect.x1 + bord_size + 5, rect.y1);
rect.x1 -= 5; rect.x2 += 5;
rtgui_dc_fill_rect(dc, &text_rect);
rect.x1 += 5; rect.x2 -= 5;
rtgui_dc_draw_text(dc, radiobox->text, &text_rect);
}

View File

@ -31,6 +31,8 @@
#define RTGUI_USING_STDIO_FILERW
#define RTGUI_IMAGE_PNG
#define RTGUI_IMAGE_JPG
#define RTGUI_USING_FONT12
#else
#define RTGUI_USING_DFS_FILERW
#define RTGUI_USING_HZ_FILE

View File

@ -31,7 +31,7 @@ enum
};
#define WINTITLE_HEIGHT 20
#define WINTITLE_BORDER_SIZE 1
#define WINTITLE_BORDER_SIZE 2
struct rtgui_topwin
{

View File

@ -0,0 +1,13 @@
/*
* File : filelist_view.c
* This file is part of RTGUI in RT-Thread RTOS
* COPYRIGHT (C) 2010, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2010-01-06 Bernard first version
*/

13
rtgui/widgets/list_view.c Normal file
View File

@ -0,0 +1,13 @@
/*
* File : list_view.c
* This file is part of RTGUI in RT-Thread RTOS
* COPYRIGHT (C) 2010, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2010-01-06 Bernard first version
*/

View File

@ -11,6 +11,7 @@ static void _rtgui_radiobox_constructor(rtgui_radiobox_t *radiobox)
/* init widget and set event handler */
RTGUI_WIDGET(radiobox)->flag |= RTGUI_WIDGET_FLAG_FOCUSABLE;
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(radiobox)) = RTGUI_ALIGN_LEFT | RTGUI_ALIGN_CENTER_VERTICAL;
rtgui_widget_set_rect(RTGUI_WIDGET(radiobox), &rect);
rtgui_widget_set_event_handler(RTGUI_WIDGET(radiobox), rtgui_radiobox_event_handler);