improve radio box drawing; fix focus issue; fix modal showing; add mouse support on list and file list view.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@409 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
3c831420de
commit
49e090149a
|
@ -1,228 +0,0 @@
|
||||||
/*
|
|
||||||
* 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
|
|
|
@ -1,228 +0,0 @@
|
||||||
/*
|
|
||||||
* 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
|
|
|
@ -226,8 +226,8 @@ void rtgui_dc_draw_text (struct rtgui_dc* dc, const rt_uint8_t* text, struct rtg
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtgui_dc_draw_byte(struct rtgui_dc*dc, int x, int y, int h, const rt_uint8_t* data)
|
void rtgui_dc_draw_byte(struct rtgui_dc*dc, int x, int y, int h, const rt_uint8_t* data)
|
||||||
{
|
{
|
||||||
int i, k;
|
int i, k;
|
||||||
|
|
||||||
/* draw byte */
|
/* draw byte */
|
||||||
|
@ -240,7 +240,7 @@ void rtgui_dc_draw_byte(struct rtgui_dc*dc, int x, int y, int h, const rt_uint8_
|
||||||
rtgui_dc_draw_point(dc, x + k, y + i);
|
rtgui_dc_draw_point(dc, x + k, y + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtgui_dc_draw_word(struct rtgui_dc*dc, int x, int y, int h, const rt_uint8_t* data)
|
void rtgui_dc_draw_word(struct rtgui_dc*dc, int x, int y, int h, const rt_uint8_t* data)
|
||||||
|
@ -638,6 +638,44 @@ void rtgui_dc_fill_polygon(struct rtgui_dc* dc, const int* vx, const int* vy, in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
void rtgui_dc_draw_circle(struct rtgui_dc *dc,
|
||||||
|
int xCenter, int yCenter, int radius)
|
||||||
|
{
|
||||||
|
int x =0;
|
||||||
|
int y = radius;
|
||||||
|
int p = 1-radius;
|
||||||
|
|
||||||
|
rtgui_dc_draw_point(dc,xCenter+x,yCenter+y);
|
||||||
|
rtgui_dc_draw_point(dc,xCenter-x,yCenter+y);
|
||||||
|
rtgui_dc_draw_point(dc,xCenter+x,yCenter-y);
|
||||||
|
rtgui_dc_draw_point(dc,xCenter-x,yCenter-y);
|
||||||
|
|
||||||
|
rtgui_dc_draw_point(dc,xCenter+y,yCenter+x);
|
||||||
|
rtgui_dc_draw_point(dc,xCenter-y,yCenter+x);
|
||||||
|
rtgui_dc_draw_point(dc,xCenter+y,yCenter-x);
|
||||||
|
rtgui_dc_draw_point(dc,xCenter-y,yCenter-x);
|
||||||
|
|
||||||
|
while(x<y){
|
||||||
|
x++;
|
||||||
|
if(p<0)
|
||||||
|
p+=2*x+1;
|
||||||
|
else{
|
||||||
|
y--;
|
||||||
|
p+=2*(x-y)+1;
|
||||||
|
}
|
||||||
|
rtgui_dc_draw_point(dc,xCenter+x,yCenter+y);
|
||||||
|
rtgui_dc_draw_point(dc,xCenter-x,yCenter+y);
|
||||||
|
rtgui_dc_draw_point(dc,xCenter+x,yCenter-y);
|
||||||
|
rtgui_dc_draw_point(dc,xCenter-x,yCenter-y);
|
||||||
|
|
||||||
|
rtgui_dc_draw_point(dc,xCenter+y,yCenter+x);
|
||||||
|
rtgui_dc_draw_point(dc,xCenter-y,yCenter+x);
|
||||||
|
rtgui_dc_draw_point(dc,xCenter+y,yCenter-x);
|
||||||
|
rtgui_dc_draw_point(dc,xCenter-y,yCenter-x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
void rtgui_dc_draw_circle(struct rtgui_dc* dc, int x, int y, int r)
|
void rtgui_dc_draw_circle(struct rtgui_dc* dc, int x, int y, int r)
|
||||||
{
|
{
|
||||||
rt_int16_t cx = 0;
|
rt_int16_t cx = 0;
|
||||||
|
@ -713,6 +751,7 @@ void rtgui_dc_draw_circle(struct rtgui_dc* dc, int x, int y, int r)
|
||||||
cx++;
|
cx++;
|
||||||
}while (cx <= cy);
|
}while (cx <= cy);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void rtgui_dc_fill_circle(struct rtgui_dc* dc, rt_int16_t x, rt_int16_t y, rt_int16_t r)
|
void rtgui_dc_fill_circle(struct rtgui_dc* dc, rt_int16_t x, rt_int16_t y, rt_int16_t r)
|
||||||
{
|
{
|
||||||
|
@ -801,10 +840,10 @@ void rtgui_dc_draw_arc(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16
|
||||||
rt_uint8_t drawoct;
|
rt_uint8_t drawoct;
|
||||||
int startoct, endoct, oct, stopval_start, stopval_end;
|
int startoct, endoct, oct, stopval_start, stopval_end;
|
||||||
double temp;
|
double temp;
|
||||||
|
|
||||||
stopval_start = 0;
|
stopval_start = 0;
|
||||||
stopval_end = 0;
|
stopval_end = 0;
|
||||||
temp = 0;
|
temp = 0;
|
||||||
|
|
||||||
/* Sanity check radius */
|
/* Sanity check radius */
|
||||||
if (r < 0) return ;
|
if (r < 0) return ;
|
||||||
|
|
|
@ -35,7 +35,6 @@ void rtgui_font_system_init()
|
||||||
|
|
||||||
#ifdef RTGUI_USING_FONT16
|
#ifdef RTGUI_USING_FONT16
|
||||||
rtgui_font_system_add_font(&rtgui_font_asc16);
|
rtgui_font_system_add_font(&rtgui_font_asc16);
|
||||||
rtgui_font_system_add_font(&rtgui_font_arial16);
|
|
||||||
#ifdef RTGUI_USING_FONTHZ
|
#ifdef RTGUI_USING_FONTHZ
|
||||||
rtgui_font_system_add_font(&rtgui_font_hz16);
|
rtgui_font_system_add_font(&rtgui_font_hz16);
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,7 +42,6 @@ void rtgui_font_system_init()
|
||||||
|
|
||||||
#ifdef RTGUI_USING_FONT12
|
#ifdef RTGUI_USING_FONT12
|
||||||
rtgui_font_system_add_font(&rtgui_font_asc12);
|
rtgui_font_system_add_font(&rtgui_font_asc12);
|
||||||
rtgui_font_system_add_font(&rtgui_font_arial12);
|
|
||||||
#ifdef RTGUI_USING_FONTHZ
|
#ifdef RTGUI_USING_FONTHZ
|
||||||
rtgui_font_system_add_font(&rtgui_font_hz12);
|
rtgui_font_system_add_font(&rtgui_font_hz12);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -361,7 +361,10 @@ rt_err_t rtgui_thread_send(rt_thread_t tid, rtgui_event_t* event, rt_size_t even
|
||||||
|
|
||||||
result = rt_mq_send(thread->mq, event, event_size);
|
result = rt_mq_send(thread->mq, event, event_size);
|
||||||
if (result != RT_EOK)
|
if (result != RT_EOK)
|
||||||
rt_kprintf("send event failed\n");
|
{
|
||||||
|
if (event->type != RTGUI_EVENT_TIMER)
|
||||||
|
rt_kprintf("send event to %s failed\n", thread->tid->name);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,19 +37,19 @@ extern struct rtgui_font rtgui_font_arial12;
|
||||||
|
|
||||||
/* init theme */
|
/* init theme */
|
||||||
void rtgui_system_theme_init()
|
void rtgui_system_theme_init()
|
||||||
{
|
{
|
||||||
#if RTGUI_DEFAULT_FONT_SIZE == 16
|
#if RTGUI_DEFAULT_FONT_SIZE == 16
|
||||||
rtgui_font_set_defaut(&rtgui_font_asc16);
|
rtgui_font_set_defaut(&rtgui_font_asc16);
|
||||||
#elif RTGUI_DEFAULT_FONT_SIZE == 12
|
#elif RTGUI_DEFAULT_FONT_SIZE == 12
|
||||||
rtgui_font_set_defaut(&rtgui_font_asc12);
|
rtgui_font_set_defaut(&rtgui_font_asc12);
|
||||||
#else
|
#else
|
||||||
rtgui_font_set_defaut(&rtgui_font_asc12);
|
rtgui_font_set_defaut(&rtgui_font_asc12);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static const rt_uint8_t close_byte[14] = {0x06, 0x18, 0x03, 0x30, 0x01, 0xE0, 0x00,
|
static const rt_uint8_t close_byte[14] = {0x06, 0x18, 0x03, 0x30, 0x01, 0xE0, 0x00,
|
||||||
0xC0, 0x01, 0xE0, 0x03, 0x30, 0x06, 0x18
|
0xC0, 0x01, 0xE0, 0x03, 0x30, 0x06, 0x18
|
||||||
};
|
};
|
||||||
|
|
||||||
/* window drawing */
|
/* window drawing */
|
||||||
void rtgui_theme_draw_win(struct rtgui_topwin* win)
|
void rtgui_theme_draw_win(struct rtgui_topwin* win)
|
||||||
|
@ -406,10 +406,7 @@ void rtgui_theme_draw_iconbox(rtgui_iconbox_t* iconbox)
|
||||||
rtgui_dc_end_drawing(dc);
|
rtgui_dc_end_drawing(dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHECK_BOX_W 13
|
static const rt_uint8_t checked_byte[7] = {0x02, 0x06, 0x8E, 0xDC, 0xF8, 0x70, 0x20};
|
||||||
#define CHECK_BOX_H 13
|
|
||||||
static const rt_uint8_t checked_byte[7] = {0x02, 0x06, 0x8E, 0xDC, 0xF8, 0x70, 0x20};
|
|
||||||
|
|
||||||
void rtgui_theme_draw_checkbox(struct rtgui_checkbox* checkbox)
|
void rtgui_theme_draw_checkbox(struct rtgui_checkbox* checkbox)
|
||||||
{
|
{
|
||||||
struct rtgui_dc* dc;
|
struct rtgui_dc* dc;
|
||||||
|
@ -472,6 +469,21 @@ void rtgui_theme_draw_checkbox(struct rtgui_checkbox* checkbox)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const rt_uint8_t radio_unchecked_byte[] =
|
||||||
|
{
|
||||||
|
0x0f, 0x00, 0x30, 0xc0, 0x40, 0x20,
|
||||||
|
0x40, 0x20, 0x80, 0x10, 0x80, 0x10,
|
||||||
|
0x80, 0x10, 0x80, 0x10, 0x40, 0x20,
|
||||||
|
0x40, 0x20, 0x30, 0xc0, 0x0f, 0x00,
|
||||||
|
};
|
||||||
|
static const rt_uint8_t radio_checked_byte[] =
|
||||||
|
{
|
||||||
|
0x0f, 0x00, 0x30, 0xc0, 0x40, 0x20,
|
||||||
|
0x40, 0x20, 0x86, 0x10, 0x8f, 0x10,
|
||||||
|
0x8f, 0x10, 0x86, 0x10, 0x40, 0x20,
|
||||||
|
0x40, 0x20, 0x30, 0xc0, 0x0f, 0x00,
|
||||||
|
};
|
||||||
|
|
||||||
void rtgui_theme_draw_radiobox(struct rtgui_radiobox* radiobox)
|
void rtgui_theme_draw_radiobox(struct rtgui_radiobox* radiobox)
|
||||||
{
|
{
|
||||||
struct rtgui_dc* dc;
|
struct rtgui_dc* dc;
|
||||||
|
@ -531,9 +543,12 @@ void rtgui_theme_draw_radiobox(struct rtgui_radiobox* radiobox)
|
||||||
|
|
||||||
if (radiobox->orient == RTGUI_VERTICAL)
|
if (radiobox->orient == RTGUI_VERTICAL)
|
||||||
{
|
{
|
||||||
|
rt_uint16_t offset;
|
||||||
|
|
||||||
/* set the first text rect */
|
/* set the first text rect */
|
||||||
item_rect.y2 = item_rect.y1 + item_size;
|
item_rect.y2 = item_rect.y1 + item_size;
|
||||||
|
|
||||||
|
offset = (item_size - RADIO_BOX_H) / 2;
|
||||||
/* draw each radio button */
|
/* draw each radio button */
|
||||||
for (index = 0; index < radiobox->item_count; index ++)
|
for (index = 0; index < radiobox->item_count; index ++)
|
||||||
{
|
{
|
||||||
|
@ -544,12 +559,12 @@ void rtgui_theme_draw_radiobox(struct rtgui_radiobox* radiobox)
|
||||||
{
|
{
|
||||||
if (RTGUI_WIDGET_IS_FOCUSED(RTGUI_WIDGET(radiobox)))
|
if (RTGUI_WIDGET_IS_FOCUSED(RTGUI_WIDGET(radiobox)))
|
||||||
rtgui_dc_draw_focus_rect(dc, &item_rect);
|
rtgui_dc_draw_focus_rect(dc, &item_rect);
|
||||||
rtgui_dc_draw_circle(dc, item_rect.x1 + item_size/2 + 2, item_rect.y1 + item_size/2 + 2, item_size/2 - 2);
|
|
||||||
rtgui_dc_fill_circle(dc, item_rect.x1 + item_size/2 + 2, item_rect.y1 + item_size/2 + 2, item_size/2 - 4);
|
rtgui_dc_draw_word(dc, item_rect.x1, item_rect.y1 + offset, RADIO_BOX_H, radio_checked_byte);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rtgui_dc_draw_circle(dc, item_rect.x1 + item_size/2 + 2, item_rect.y1 + item_size/2 + 2, item_size/2 - 2);
|
rtgui_dc_draw_word(dc, item_rect.x1, item_rect.y1 + offset, RADIO_BOX_H, radio_unchecked_byte);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw text */
|
/* draw text */
|
||||||
|
@ -576,12 +591,12 @@ void rtgui_theme_draw_radiobox(struct rtgui_radiobox* radiobox)
|
||||||
if (radiobox->item_selection == index)
|
if (radiobox->item_selection == index)
|
||||||
{
|
{
|
||||||
rtgui_dc_draw_focus_rect(dc, &item_rect);
|
rtgui_dc_draw_focus_rect(dc, &item_rect);
|
||||||
rtgui_dc_draw_circle(dc, item_rect.x1 + bord_size/2 + 2, item_rect.y1 + bord_size/2 + 2, bord_size/2 - 2);
|
|
||||||
rtgui_dc_fill_circle(dc, item_rect.x1 + bord_size/2 + 2, item_rect.y1 + bord_size/2 + 2, bord_size/2 - 4);
|
rtgui_dc_draw_word(dc, item_rect.x1, item_rect.y1, RADIO_BOX_H, radio_checked_byte);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rtgui_dc_draw_circle(dc, item_rect.x1 + bord_size/2 + 2, item_rect.y1 + bord_size/2 + 2, bord_size/2 - 2);
|
rtgui_dc_draw_word(dc, item_rect.x1, item_rect.y1, RADIO_BOX_H, radio_unchecked_byte);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw text */
|
/* draw text */
|
||||||
|
|
|
@ -19,6 +19,19 @@
|
||||||
/* RTGUI options */
|
/* RTGUI options */
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
/* name length of RTGUI object */
|
||||||
|
#define RTGUI_NAME_MAX 12
|
||||||
|
/* support 16 weight font */
|
||||||
|
#define RTGUI_USING_FONT16
|
||||||
|
/* support Chinese font */
|
||||||
|
#define RTGUI_USING_FONTHZ
|
||||||
|
/* use small size in RTGUI */
|
||||||
|
#define RTGUI_USING_SMALL_SIZE
|
||||||
|
/* use mouse cursor */
|
||||||
|
/* #define RTGUI_USING_MOUSE_CURSOR */
|
||||||
|
/* default font size in RTGUI */
|
||||||
|
#define RTGUI_DEFAULT_FONT_SIZE 12
|
||||||
|
|
||||||
#define RTGUI_USING_STDIO_FILERW
|
#define RTGUI_USING_STDIO_FILERW
|
||||||
#define RTGUI_IMAGE_PNG
|
#define RTGUI_IMAGE_PNG
|
||||||
#define RTGUI_IMAGE_JPEG
|
#define RTGUI_IMAGE_JPEG
|
||||||
|
|
|
@ -17,6 +17,12 @@
|
||||||
#include <rtgui/rtgui.h>
|
#include <rtgui/rtgui.h>
|
||||||
#include <rtgui/rtgui_server.h>
|
#include <rtgui/rtgui_server.h>
|
||||||
|
|
||||||
|
#define CHECK_BOX_W 13
|
||||||
|
#define CHECK_BOX_H 13
|
||||||
|
|
||||||
|
#define RADIO_BOX_W 12
|
||||||
|
#define RADIO_BOX_H 12
|
||||||
|
|
||||||
#include <rtgui/widgets/label.h>
|
#include <rtgui/widgets/label.h>
|
||||||
#include <rtgui/widgets/button.h>
|
#include <rtgui/widgets/button.h>
|
||||||
#include <rtgui/widgets/textbox.h>
|
#include <rtgui/widgets/textbox.h>
|
||||||
|
|
|
@ -52,7 +52,10 @@ struct rtgui_win
|
||||||
|
|
||||||
/* top window style */
|
/* top window style */
|
||||||
rt_uint8_t style;
|
rt_uint8_t style;
|
||||||
|
|
||||||
|
rt_uint8_t flag;
|
||||||
rtgui_modal_code_t modal_code;
|
rtgui_modal_code_t modal_code;
|
||||||
|
rtgui_widget_t* modal_widget;
|
||||||
|
|
||||||
/* window title */
|
/* window title */
|
||||||
char* title;
|
char* title;
|
||||||
|
@ -69,7 +72,7 @@ struct rtgui_win
|
||||||
rtgui_type_t *rtgui_win_type_get(void);
|
rtgui_type_t *rtgui_win_type_get(void);
|
||||||
|
|
||||||
rtgui_win_t* rtgui_win_create(rtgui_toplevel_t* parent_toplevel, const char* title,
|
rtgui_win_t* rtgui_win_create(rtgui_toplevel_t* parent_toplevel, const char* title,
|
||||||
rtgui_rect_t *rect, rt_uint32_t flag);
|
rtgui_rect_t *rect, rt_uint8_t flag);
|
||||||
void rtgui_win_destroy(rtgui_win_t* win);
|
void rtgui_win_destroy(rtgui_win_t* win);
|
||||||
|
|
||||||
rtgui_modal_code_t rtgui_win_show(rtgui_win_t* win, rt_bool_t is_modal);
|
rtgui_modal_code_t rtgui_win_show(rtgui_win_t* win, rt_bool_t is_modal);
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
|
|
||||||
#define RTGUI_WORKBENCH_FLAG_DEFAULT RTGUI_WORKBENCH_FLAG_VISIBLE | RTGUI_WORKBENCH_FLAG_CLOSEBLE
|
#define RTGUI_WORKBENCH_FLAG_DEFAULT RTGUI_WORKBENCH_FLAG_VISIBLE | RTGUI_WORKBENCH_FLAG_CLOSEBLE
|
||||||
|
|
||||||
|
#define RTGUI_WORKBENCH_IS_MODAL_MODE(w) ((w)->flag & RTGUI_WORKBENCH_FLAG_MODAL_MODE)
|
||||||
|
|
||||||
/** Gets the type of a workbench */
|
/** Gets the type of a workbench */
|
||||||
#define RTGUI_WORKBENCH_TYPE (rtgui_workbench_type_get())
|
#define RTGUI_WORKBENCH_TYPE (rtgui_workbench_type_get())
|
||||||
/** Casts the object to an rtgui_workbench */
|
/** Casts the object to an rtgui_workbench */
|
||||||
|
@ -51,6 +53,7 @@ struct rtgui_workbench
|
||||||
/* workbench flag */
|
/* workbench flag */
|
||||||
rt_uint8_t flag;
|
rt_uint8_t flag;
|
||||||
rtgui_modal_code_t modal_code;
|
rtgui_modal_code_t modal_code;
|
||||||
|
rtgui_widget_t *modal_widget;
|
||||||
|
|
||||||
/* workbench title */
|
/* workbench title */
|
||||||
unsigned char* title;
|
unsigned char* title;
|
||||||
|
|
|
@ -483,7 +483,7 @@ static void rtgui_server_entry(void* parameter)
|
||||||
#ifdef RTGUI_USING_SMALL_SIZE
|
#ifdef RTGUI_USING_SMALL_SIZE
|
||||||
/* create rtgui server msgq */
|
/* create rtgui server msgq */
|
||||||
rtgui_server_mq = rt_mq_create("rtgui",
|
rtgui_server_mq = rt_mq_create("rtgui",
|
||||||
32, 8, RT_IPC_FLAG_FIFO);
|
32, 16, RT_IPC_FLAG_FIFO);
|
||||||
#else
|
#else
|
||||||
/* create rtgui server msgq */
|
/* create rtgui server msgq */
|
||||||
rtgui_server_mq = rt_mq_create("rtgui",
|
rtgui_server_mq = rt_mq_create("rtgui",
|
||||||
|
|
|
@ -224,7 +224,7 @@ void rtgui_topwin_activate_win(struct rtgui_topwin* win)
|
||||||
rtgui_theme_draw_win(win);
|
rtgui_theme_draw_win(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rtgui_server_focus_topwin != RT_NULL)
|
if ((rtgui_server_focus_topwin != RT_NULL) && (rtgui_server_focus_topwin != win))
|
||||||
{
|
{
|
||||||
/* deactivate the old focus win */
|
/* deactivate the old focus win */
|
||||||
RTGUI_EVENT_WIN_DEACTIVATE_INIT(&event);
|
RTGUI_EVENT_WIN_DEACTIVATE_INIT(&event);
|
||||||
|
@ -465,6 +465,11 @@ void rtgui_topwin_show(struct rtgui_event_win* event)
|
||||||
/* not the front window, raise it */
|
/* not the front window, raise it */
|
||||||
rtgui_topwin_raise(wid, sender);
|
rtgui_topwin_raise(wid, sender);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* just raise it */
|
||||||
|
rtgui_topwin_raise(wid, sender);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -415,6 +415,38 @@ rt_bool_t rtgui_filelist_view_event_handler(struct rtgui_widget* widget, struct
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RTGUI_EVENT_MOUSE_BUTTON:
|
||||||
|
{
|
||||||
|
rtgui_rect_t rect;
|
||||||
|
struct rtgui_event_mouse* emouse;
|
||||||
|
|
||||||
|
emouse = (struct rtgui_event_mouse*)event;
|
||||||
|
|
||||||
|
/* calculate selected item */
|
||||||
|
|
||||||
|
/* get physical extent information */
|
||||||
|
rtgui_widget_get_rect(widget, &rect);
|
||||||
|
rtgui_widget_rect_to_device(widget, &rect);
|
||||||
|
|
||||||
|
if (rtgui_rect_contains_point(&rect, emouse->x, emouse->y) == RT_EOK)
|
||||||
|
{
|
||||||
|
rt_uint16_t index;
|
||||||
|
index = (emouse->y - rect.y1) / (2 + rtgui_theme_get_selected_height());
|
||||||
|
|
||||||
|
if ((index < view->items_count) && (index < view->page_items))
|
||||||
|
{
|
||||||
|
rt_uint16_t old_item;
|
||||||
|
|
||||||
|
old_item = view->current_item;
|
||||||
|
|
||||||
|
/* set selected item */
|
||||||
|
view->current_item = (old_item/view->page_items) * view->page_items + index;
|
||||||
|
rtgui_filelist_view_update_current(view, old_item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case RTGUI_EVENT_KBD:
|
case RTGUI_EVENT_KBD:
|
||||||
{
|
{
|
||||||
struct rtgui_event_kbd* ekbd = (struct rtgui_event_kbd*)event;
|
struct rtgui_event_kbd* ekbd = (struct rtgui_event_kbd*)event;
|
||||||
|
@ -474,7 +506,11 @@ rt_bool_t rtgui_filelist_view_event_handler(struct rtgui_widget* widget, struct
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (view->current_item == 0 &&
|
else if (view->current_item == 0 &&
|
||||||
|
#ifdef _WIN32
|
||||||
|
(view->current_directory[1] == ':') && (view->current_directory[2] == '\\'))
|
||||||
|
#else
|
||||||
(view->current_directory[0] == '/') && (view->current_directory[1] == '\0'))
|
(view->current_directory[0] == '/') && (view->current_directory[1] == '\0'))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (RTGUI_VIEW(view)->modal_show == RT_TRUE)
|
if (RTGUI_VIEW(view)->modal_show == RT_TRUE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -182,6 +182,38 @@ rt_bool_t rtgui_list_view_event_handler(struct rtgui_widget* widget, struct rtgu
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RTGUI_EVENT_MOUSE_BUTTON:
|
||||||
|
{
|
||||||
|
rtgui_rect_t rect;
|
||||||
|
struct rtgui_event_mouse* emouse;
|
||||||
|
|
||||||
|
emouse = (struct rtgui_event_mouse*)event;
|
||||||
|
|
||||||
|
/* calculate selected item */
|
||||||
|
|
||||||
|
/* get physical extent information */
|
||||||
|
rtgui_widget_get_rect(widget, &rect);
|
||||||
|
rtgui_widget_rect_to_device(widget, &rect);
|
||||||
|
|
||||||
|
if (rtgui_rect_contains_point(&rect, emouse->x, emouse->y) == RT_EOK)
|
||||||
|
{
|
||||||
|
rt_uint16_t index;
|
||||||
|
index = (emouse->y - rect.y1) / (2 + rtgui_theme_get_selected_height());
|
||||||
|
|
||||||
|
if ((index < view->items_count) && (index < view->page_items))
|
||||||
|
{
|
||||||
|
rt_uint16_t old_item;
|
||||||
|
|
||||||
|
old_item = view->current_item;
|
||||||
|
|
||||||
|
/* set selected item */
|
||||||
|
view->current_item = view->current_item/view->page_items + index;
|
||||||
|
rtgui_list_view_update_current(view, old_item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case RTGUI_EVENT_KBD:
|
case RTGUI_EVENT_KBD:
|
||||||
{
|
{
|
||||||
struct rtgui_event_kbd* ekbd = (struct rtgui_event_kbd*)event;
|
struct rtgui_event_kbd* ekbd = (struct rtgui_event_kbd*)event;
|
||||||
|
|
|
@ -192,6 +192,9 @@ struct rtgui_radiobox* rtgui_radiobox_create(const char* label, int orient, char
|
||||||
radiobox->item_size = board_size + 3 + rtgui_rect_width(rect);
|
radiobox->item_size = board_size + 3 + rtgui_rect_width(rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (radiobox->item_size < RADIO_BOX_H + 2)
|
||||||
|
radiobox->item_size = RADIO_BOX_H + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return radiobox;
|
return radiobox;
|
||||||
|
|
|
@ -116,7 +116,10 @@ rtgui_view_t* rtgui_view_create(const char* title)
|
||||||
|
|
||||||
void rtgui_view_destroy(rtgui_view_t* view)
|
void rtgui_view_destroy(rtgui_view_t* view)
|
||||||
{
|
{
|
||||||
rtgui_widget_destroy(RTGUI_WIDGET(view));
|
if (view->modal_show == RT_TRUE)
|
||||||
|
rtgui_view_end_modal(view, RTGUI_MODAL_CANCEL);
|
||||||
|
else
|
||||||
|
rtgui_widget_destroy(RTGUI_WIDGET(view));
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtgui_view_set_box(rtgui_view_t* view, rtgui_box_t* box)
|
void rtgui_view_set_box(rtgui_view_t* view, rtgui_box_t* box)
|
||||||
|
@ -151,9 +154,12 @@ rtgui_modal_code_t rtgui_view_show(rtgui_view_t* view, rt_bool_t is_modal)
|
||||||
{
|
{
|
||||||
/* set modal mode */
|
/* set modal mode */
|
||||||
workbench->flag |= RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
workbench->flag |= RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
||||||
|
workbench->modal_widget = RTGUI_WIDGET(view);
|
||||||
|
|
||||||
/* perform workbench event loop */
|
/* perform workbench event loop */
|
||||||
rtgui_workbench_event_loop(workbench);
|
rtgui_workbench_event_loop(workbench);
|
||||||
|
|
||||||
|
workbench->modal_widget = RT_NULL;
|
||||||
return workbench->modal_code;
|
return workbench->modal_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,6 +177,9 @@ void rtgui_view_end_modal(rtgui_view_t* view, rtgui_modal_code_t modal_code)
|
||||||
workbench = RTGUI_WORKBENCH(RTGUI_WIDGET(view)->parent);
|
workbench = RTGUI_WORKBENCH(RTGUI_WIDGET(view)->parent);
|
||||||
workbench->modal_code = modal_code;
|
workbench->modal_code = modal_code;
|
||||||
workbench->flag &= ~RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
workbench->flag &= ~RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
||||||
|
|
||||||
|
/* remove modal mode */
|
||||||
|
view->modal_show = RT_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtgui_view_hide(rtgui_view_t* view)
|
void rtgui_view_hide(rtgui_view_t* view)
|
||||||
|
|
|
@ -37,10 +37,11 @@ static void _rtgui_widget_constructor(rtgui_widget_t *widget)
|
||||||
widget->toplevel = RT_NULL;
|
widget->toplevel = RT_NULL;
|
||||||
|
|
||||||
/* some common event handler */
|
/* some common event handler */
|
||||||
#ifndef RTGUI_USING_SMALL_SIZE
|
|
||||||
widget->on_draw = RT_NULL;
|
|
||||||
widget->on_focus_in = RT_NULL;
|
widget->on_focus_in = RT_NULL;
|
||||||
widget->on_focus_out = RT_NULL;
|
widget->on_focus_out = RT_NULL;
|
||||||
|
|
||||||
|
#ifndef RTGUI_USING_SMALL_SIZE
|
||||||
|
widget->on_draw = RT_NULL;
|
||||||
widget->on_mouseclick = RT_NULL;
|
widget->on_mouseclick = RT_NULL;
|
||||||
widget->on_key = RT_NULL;
|
widget->on_key = RT_NULL;
|
||||||
widget->on_size = RT_NULL;
|
widget->on_size = RT_NULL;
|
||||||
|
@ -276,11 +277,9 @@ void rtgui_widget_focus(rtgui_widget_t *widget)
|
||||||
if (RTGUI_WIDGET_IS_HIDE(RTGUI_WIDGET(parent))) break;
|
if (RTGUI_WIDGET_IS_HIDE(RTGUI_WIDGET(parent))) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef RTGUI_USING_SMALL_SIZE
|
|
||||||
/* invoke on focus in call back */
|
/* invoke on focus in call back */
|
||||||
if (widget->on_focus_in != RT_NULL)
|
if (widget->on_focus_in != RT_NULL)
|
||||||
widget->on_focus_in(widget, RT_NULL);
|
widget->on_focus_in(widget, RT_NULL);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -291,15 +290,16 @@ void rtgui_widget_unfocus(rtgui_widget_t *widget)
|
||||||
{
|
{
|
||||||
RT_ASSERT(widget != RT_NULL);
|
RT_ASSERT(widget != RT_NULL);
|
||||||
|
|
||||||
widget->flag &= ~RTGUI_WIDGET_FLAG_FOCUS;
|
|
||||||
|
|
||||||
if (!widget->toplevel || !RTGUI_WIDGET_IS_FOCUSED(widget))
|
if (!widget->toplevel || !RTGUI_WIDGET_IS_FOCUSED(widget))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifndef RTGUI_USING_SMALL_SIZE
|
widget->flag &= ~RTGUI_WIDGET_FLAG_FOCUS;
|
||||||
|
|
||||||
if (widget->on_focus_out != RT_NULL)
|
if (widget->on_focus_out != RT_NULL)
|
||||||
widget->on_focus_out(widget, RT_NULL);
|
widget->on_focus_out(widget, RT_NULL);
|
||||||
#endif
|
|
||||||
|
/* refresh widget */
|
||||||
|
rtgui_widget_update(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtgui_widget_point_to_device(rtgui_widget_t* widget, rtgui_point_t* point)
|
void rtgui_widget_point_to_device(rtgui_widget_t* widget, rtgui_point_t* point)
|
||||||
|
|
|
@ -113,7 +113,7 @@ rtgui_type_t *rtgui_win_type_get(void)
|
||||||
return win_type;
|
return win_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtgui_win_t* rtgui_win_create(rtgui_toplevel_t* parent_toplevel, const char* title, rtgui_rect_t *rect, rt_uint32_t style)
|
rtgui_win_t* rtgui_win_create(rtgui_toplevel_t* parent_toplevel, const char* title, rtgui_rect_t *rect, rt_uint8_t style)
|
||||||
{
|
{
|
||||||
struct rtgui_win* win;
|
struct rtgui_win* win;
|
||||||
|
|
||||||
|
@ -143,28 +143,14 @@ rtgui_win_t* rtgui_win_create(rtgui_toplevel_t* parent_toplevel, const char* tit
|
||||||
|
|
||||||
void rtgui_win_destroy(struct rtgui_win* win)
|
void rtgui_win_destroy(struct rtgui_win* win)
|
||||||
{
|
{
|
||||||
if (win->parent_toplevel != RT_NULL)
|
if (win->style & RTGUI_WIN_STYLE_MODAL)
|
||||||
{
|
{
|
||||||
if (win->style & RTGUI_WIN_STYLE_MODAL)
|
/* end modal */
|
||||||
{
|
rtgui_win_end_modal(win, RTGUI_MODAL_CANCEL);
|
||||||
/* exit modal mode */
|
|
||||||
win->style &= ~RTGUI_WIN_STYLE_MODAL;
|
|
||||||
/* set style to closed */
|
|
||||||
win->style |= RTGUI_WIN_STYLE_CLOSED;
|
|
||||||
}
|
|
||||||
else rtgui_widget_destroy(RTGUI_WIDGET(win));
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (win->style & RTGUI_WIN_STYLE_CLOSED)
|
|
||||||
{
|
|
||||||
rtgui_widget_destroy(RTGUI_WIDGET(win));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* exit modal mode */
|
rtgui_widget_destroy(RTGUI_WIDGET(win));
|
||||||
win->style &= ~RTGUI_WIN_STYLE_MODAL;
|
|
||||||
/* set style to closed */
|
|
||||||
win->style |= RTGUI_WIN_STYLE_CLOSED;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,15 +191,37 @@ rtgui_modal_code_t rtgui_win_show(struct rtgui_win* win, rt_bool_t is_modal)
|
||||||
{
|
{
|
||||||
if (win->parent_toplevel != RT_NULL)
|
if (win->parent_toplevel != RT_NULL)
|
||||||
{
|
{
|
||||||
rtgui_workbench_t* workbench;
|
rtgui_widget_t *parent_widget;
|
||||||
|
|
||||||
|
/* set style */
|
||||||
|
win->style |= RTGUI_WIN_STYLE_MODAL;
|
||||||
|
|
||||||
/* get root toplevel */
|
/* get root toplevel */
|
||||||
workbench = RTGUI_WORKBENCH(win->parent_toplevel);
|
parent_widget = RTGUI_WIDGET(win->parent_toplevel);
|
||||||
workbench->flag |= RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
if (RTGUI_IS_WORKBENCH(parent_widget))
|
||||||
|
{
|
||||||
|
rtgui_workbench_t* workbench;
|
||||||
|
workbench = RTGUI_WORKBENCH(win->parent_toplevel);
|
||||||
|
workbench->flag |= RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
||||||
|
workbench->modal_widget = RTGUI_WIDGET(win);
|
||||||
|
|
||||||
rtgui_workbench_event_loop(workbench);
|
rtgui_workbench_event_loop(workbench);
|
||||||
result = workbench->modal_code;
|
result = workbench->modal_code;
|
||||||
workbench->flag &= ~RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
workbench->flag &= ~RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
||||||
|
workbench->modal_widget = RT_NULL;
|
||||||
|
}
|
||||||
|
else if (RTGUI_IS_WIN(parent_widget))
|
||||||
|
{
|
||||||
|
rtgui_win_t* parent_win;
|
||||||
|
parent_win = RTGUI_WIN(win->parent_toplevel);
|
||||||
|
parent_win->flag |= RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
||||||
|
parent_win->modal_widget = RTGUI_WIDGET(win);
|
||||||
|
|
||||||
|
rtgui_win_event_loop(parent_win);
|
||||||
|
result = parent_win->modal_code;
|
||||||
|
parent_win->flag &= ~RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
||||||
|
parent_win->modal_widget = RT_NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -233,19 +241,33 @@ void rtgui_win_end_modal(struct rtgui_win* win, rtgui_modal_code_t modal_code)
|
||||||
{
|
{
|
||||||
if (win->parent_toplevel != RT_NULL)
|
if (win->parent_toplevel != RT_NULL)
|
||||||
{
|
{
|
||||||
rtgui_workbench_t* workbench;
|
if (RTGUI_IS_WORKBENCH(win->parent_toplevel))
|
||||||
|
{
|
||||||
|
rtgui_workbench_t* workbench;
|
||||||
|
|
||||||
/* which is shown under workbench */
|
/* which is shown under workbench */
|
||||||
workbench = RTGUI_WORKBENCH(win->parent_toplevel);
|
workbench = RTGUI_WORKBENCH(win->parent_toplevel);
|
||||||
workbench->modal_code = modal_code;
|
workbench->modal_code = modal_code;
|
||||||
workbench->flag &= ~RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
workbench->flag &= ~RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
||||||
|
}
|
||||||
|
else if (RTGUI_IS_WIN(win->parent_toplevel))
|
||||||
|
{
|
||||||
|
rtgui_win_t* parent_win;
|
||||||
|
|
||||||
|
/* which is shown under win */
|
||||||
|
parent_win = RTGUI_WIN(win->parent_toplevel);
|
||||||
|
parent_win->modal_code = modal_code;
|
||||||
|
parent_win->flag &= ~RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* which is a stand alone window */
|
/* which is a stand alone window */
|
||||||
win->modal_code = modal_code;
|
win->modal_code = modal_code;
|
||||||
win->style &= ~RTGUI_WIN_STYLE_MODAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* remove modal mode */
|
||||||
|
win->style &= ~RTGUI_WIN_STYLE_MODAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtgui_win_hiden(struct rtgui_win* win)
|
void rtgui_win_hiden(struct rtgui_win* win)
|
||||||
|
@ -359,8 +381,15 @@ rt_bool_t rtgui_win_event_handler(struct rtgui_widget* widget, struct rtgui_even
|
||||||
if (win->on_close(widget, event) == RT_FALSE) return RT_TRUE;
|
if (win->on_close(widget, event) == RT_FALSE) return RT_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* destroy window */
|
if (win->style & RTGUI_WIN_STYLE_MODAL)
|
||||||
rtgui_win_destroy(win);
|
{
|
||||||
|
rtgui_win_end_modal(win, RTGUI_MODAL_CANCEL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* destroy window */
|
||||||
|
rtgui_win_destroy(win);
|
||||||
|
}
|
||||||
|
|
||||||
/* exit event loop */
|
/* exit event loop */
|
||||||
return RT_TRUE;
|
return RT_TRUE;
|
||||||
|
@ -394,16 +423,29 @@ rt_bool_t rtgui_win_event_handler(struct rtgui_widget* widget, struct rtgui_even
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RTGUI_EVENT_WIN_DEACTIVATE:
|
case RTGUI_EVENT_WIN_DEACTIVATE:
|
||||||
win->style &= ~RTGUI_WIN_STYLE_ACTIVATE;
|
if (win->style & RTGUI_WIN_STYLE_MODAL)
|
||||||
#ifndef RTGUI_USING_SMALL_SIZE
|
|
||||||
if (widget->on_draw != RT_NULL) widget->on_draw(widget, event);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
rtgui_win_ondraw(win);
|
|
||||||
|
|
||||||
if (win->on_deactivate != RT_NULL)
|
|
||||||
{
|
{
|
||||||
win->on_deactivate(widget, event);
|
/* do not deactivate a modal win */
|
||||||
|
struct rtgui_event_win_show eshow;
|
||||||
|
RTGUI_EVENT_WIN_SHOW_INIT(&eshow);
|
||||||
|
eshow.wid = win;
|
||||||
|
|
||||||
|
rtgui_thread_send(RTGUI_TOPLEVEL(win)->server, RTGUI_EVENT(&eshow),
|
||||||
|
sizeof(struct rtgui_event_win_show));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
win->style &= ~RTGUI_WIN_STYLE_ACTIVATE;
|
||||||
|
#ifndef RTGUI_USING_SMALL_SIZE
|
||||||
|
if (widget->on_draw != RT_NULL) widget->on_draw(widget, event);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
rtgui_win_ondraw(win);
|
||||||
|
|
||||||
|
if (win->on_deactivate != RT_NULL)
|
||||||
|
{
|
||||||
|
win->on_deactivate(widget, event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -416,7 +458,13 @@ rt_bool_t rtgui_win_event_handler(struct rtgui_widget* widget, struct rtgui_even
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RTGUI_EVENT_MOUSE_BUTTON:
|
case RTGUI_EVENT_MOUSE_BUTTON:
|
||||||
if (rtgui_container_dispatch_mouse_event(RTGUI_CONTAINER(win), (struct rtgui_event_mouse*)event) == RT_FALSE)
|
if (win->flag & RTGUI_WORKBENCH_FLAG_MODAL_MODE)
|
||||||
|
{
|
||||||
|
if (win->modal_widget != RT_NULL)
|
||||||
|
return win->modal_widget->event_handler(win->modal_widget, event);
|
||||||
|
}
|
||||||
|
else if (rtgui_container_dispatch_mouse_event(RTGUI_CONTAINER(win),
|
||||||
|
(struct rtgui_event_mouse*)event) == RT_FALSE)
|
||||||
{
|
{
|
||||||
#ifndef RTGUI_USING_SMALL_SIZE
|
#ifndef RTGUI_USING_SMALL_SIZE
|
||||||
if (widget->on_mouseclick != RT_NULL)
|
if (widget->on_mouseclick != RT_NULL)
|
||||||
|
@ -445,7 +493,12 @@ rt_bool_t rtgui_win_event_handler(struct rtgui_widget* widget, struct rtgui_even
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RTGUI_EVENT_KBD:
|
case RTGUI_EVENT_KBD:
|
||||||
if (RTGUI_CONTAINER(win)->focused != widget)
|
if (win->flag & RTGUI_WORKBENCH_FLAG_MODAL_MODE)
|
||||||
|
{
|
||||||
|
if (win->modal_widget != RT_NULL)
|
||||||
|
return win->modal_widget->event_handler(win->modal_widget, event);
|
||||||
|
}
|
||||||
|
else if (RTGUI_CONTAINER(win)->focused != widget)
|
||||||
{
|
{
|
||||||
RTGUI_CONTAINER(win)->focused->event_handler(RTGUI_CONTAINER(win)->focused, event);
|
RTGUI_CONTAINER(win)->focused->event_handler(RTGUI_CONTAINER(win)->focused, event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,12 +294,24 @@ rt_bool_t rtgui_workbench_event_handler(rtgui_widget_t* widget, rtgui_event_t* e
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* let viewer to handle it */
|
if (RTGUI_WORKBENCH_IS_MODAL_MODE(workbench))
|
||||||
rtgui_view_t* view = workbench->current_view;
|
|
||||||
if (view != RT_NULL &&
|
|
||||||
RTGUI_WIDGET(view)->event_handler != RT_NULL)
|
|
||||||
{
|
{
|
||||||
RTGUI_WIDGET(view)->event_handler(RTGUI_WIDGET(view), event);
|
/* let modal widget to handle it */
|
||||||
|
if (workbench->modal_widget != RT_NULL &&
|
||||||
|
workbench->modal_widget->event_handler != RT_NULL)
|
||||||
|
{
|
||||||
|
workbench->modal_widget->event_handler(workbench->modal_widget, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* let viewer to handle it */
|
||||||
|
rtgui_view_t* view = workbench->current_view;
|
||||||
|
if (view != RT_NULL &&
|
||||||
|
RTGUI_WIDGET(view)->event_handler != RT_NULL)
|
||||||
|
{
|
||||||
|
RTGUI_WIDGET(view)->event_handler(RTGUI_WIDGET(view), event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,14 +329,26 @@ rt_bool_t rtgui_workbench_event_handler(rtgui_widget_t* widget, rtgui_event_t* e
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (RTGUI_CONTAINER(widget)->focused == widget)
|
if (RTGUI_WORKBENCH_IS_MODAL_MODE(workbench))
|
||||||
{
|
{
|
||||||
/* set focused widget to the current view */
|
/* let modal widget to handle it */
|
||||||
if (workbench->current_view != RT_NULL)
|
if (workbench->modal_widget != RT_NULL &&
|
||||||
rtgui_widget_focus(RTGUI_WIDGET(RTGUI_CONTAINER(workbench->current_view)->focused));
|
workbench->modal_widget->event_handler != RT_NULL)
|
||||||
|
{
|
||||||
|
workbench->modal_widget->event_handler(workbench->modal_widget, event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (RTGUI_CONTAINER(widget)->focused == widget)
|
||||||
|
{
|
||||||
|
/* set focused widget to the current view */
|
||||||
|
if (workbench->current_view != RT_NULL)
|
||||||
|
rtgui_widget_focus(RTGUI_WIDGET(RTGUI_CONTAINER(workbench->current_view)->focused));
|
||||||
|
}
|
||||||
|
|
||||||
return rtgui_toplevel_event_handler(widget, event);
|
return rtgui_toplevel_event_handler(widget, event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue