[UIEngine] move UI engine as a package

This commit is contained in:
Bernard Xiong 2018-03-03 16:34:01 +08:00
parent fa693c51fd
commit 8b36b57a11
928 changed files with 396 additions and 449881 deletions

View File

@ -166,7 +166,7 @@ CONFIG_RT_USING_POSIX=y
# #
# RT-Thread UI Engine # RT-Thread UI Engine
# #
# CONFIG_RT_USING_GUIENGINE is not set # CONFIG_PKG_USING_GUIENGINE is not set
# #
# VBUS(Virtual Software BUS) # VBUS(Virtual Software BUS)

View File

@ -150,7 +150,7 @@
/* RT-Thread UI Engine */ /* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */ /* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */ /* VBUS(Virtual Software BUS) */

View File

@ -138,7 +138,7 @@
/* RT-Thread UI Engine */ /* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */ /* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */ /* VBUS(Virtual Software BUS) */

View File

@ -120,7 +120,7 @@ CONFIG_RT_USING_LIBC=y
# #
# RT-Thread UI Engine # RT-Thread UI Engine
# #
# CONFIG_RT_USING_GUIENGINE is not set # CONFIG_PKG_USING_GUIENGINE is not set
# #
# RT-Thread online packages # RT-Thread online packages

View File

@ -106,7 +106,7 @@
/* RT-Thread UI Engine */ /* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */ /* PKG_USING_GUIENGINE is not set */
/* RT-Thread online packages */ /* RT-Thread online packages */

View File

@ -17,7 +17,7 @@
#include <rtthread.h> #include <rtthread.h>
#include <finsh.h> #include <finsh.h>
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
#include "rtgui_demo.h" #include "rtgui_demo.h"
#include <rtgui/driver.h> #include <rtgui/driver.h>
#endif #endif
@ -41,7 +41,7 @@ void rt_init_thread_entry(void* parameter)
rt_components_init(); rt_components_init();
#endif #endif
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
{ {
rt_device_t device; rt_device_t device;

View File

@ -23,7 +23,7 @@
#define DEBUG_PRINTF(...) #define DEBUG_PRINTF(...)
#endif #endif
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
#include <rtgui/rtgui.h> #include <rtgui/rtgui.h>
#include <rtgui/rtgui_system.h> #include <rtgui/rtgui_system.h>
@ -122,4 +122,4 @@ int rt_gui_demo_init(void)
return 0; return 0;
} }
#endif /* RT_USING_GUIENGINE */ #endif /* PKG_USING_GUIENGINE */

View File

@ -18,7 +18,7 @@ if GetDepend('RT_USING_LWIP'):
src += ['drv_enet.c', 'synopsys_emac.c'] src += ['drv_enet.c', 'synopsys_emac.c']
# add lcd drivers. # add lcd drivers.
if GetDepend('RT_USING_GUIENGINE'): if GetDepend('PKG_USING_GUIENGINE'):
src += ['drv_lcd.c', 'gd32f450z_lcd_eval.c'] src += ['drv_lcd.c', 'gd32f450z_lcd_eval.c']
# add spi flash drivers. # add spi flash drivers.

View File

@ -18,7 +18,7 @@
#include <board.h> #include <board.h>
#include <finsh.h> #include <finsh.h>
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
#define RT_HW_LCD_WIDTH ((uint16_t)320) /* LCD PIXEL WIDTH */ #define RT_HW_LCD_WIDTH ((uint16_t)320) /* LCD PIXEL WIDTH */

View File

@ -67,7 +67,7 @@
/* SECTION: RTGUI support */ /* SECTION: RTGUI support */
/* using RTGUI support */ /* using RTGUI support */
#define RT_USING_GUIENGINE // #define PKG_USING_GUIENGINE
/* name length of RTGUI object */ /* name length of RTGUI object */
#define RTGUI_NAME_MAX 16 #define RTGUI_NAME_MAX 16

View File

@ -60,6 +60,7 @@ CONFIG_ARCH_ARM_CORTEX_M7=y
# #
CONFIG_RT_USING_COMPONENTS_INIT=y CONFIG_RT_USING_COMPONENTS_INIT=y
CONFIG_RT_USING_USER_MAIN=y CONFIG_RT_USING_USER_MAIN=y
CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048
# #
# C++ features # C++ features
@ -197,34 +198,14 @@ CONFIG_SO_REUSE=1
CONFIG_LWIP_SO_RCVTIMEO=1 CONFIG_LWIP_SO_RCVTIMEO=1
CONFIG_LWIP_SO_SNDTIMEO=1 CONFIG_LWIP_SO_SNDTIMEO=1
CONFIG_LWIP_SO_RCVBUF=1 CONFIG_LWIP_SO_RCVBUF=1
# CONFIG_RT_LWIP_NETIF_LOOPBACK is not set
CONFIG_LWIP_NETIF_LOOPBACK=0
# #
# Modbus master and slave stack # Modbus master and slave stack
# #
# CONFIG_RT_USING_MODBUS is not set # CONFIG_RT_USING_MODBUS is not set
# CONFIG_LWIP_USING_DHCPD is not set # CONFIG_LWIP_USING_DHCPD is not set
# CONFIG_RT_USING_NETUTILS is not set
#
# RT-Thread UI Engine
#
CONFIG_RT_USING_GUIENGINE=y
CONFIG_RTGUI_NAME_MAX=16
CONFIG_RTGUI_USING_TTF=y
CONFIG_UTF8_TO_UNICODE=y
CONFIG_RTGUI_USING_FONT16=y
CONFIG_RTGUI_USING_FONT12=y
# CONFIG_RTGUI_USING_FONTHZ is not set
# CONFIG_RTGUI_IMAGE_XPM is not set
CONFIG_RTGUI_IMAGE_JPEG_NONE=y
# CONFIG_RTGUI_IMAGE_JPEG is not set
# CONFIG_RTGUI_IMAGE_TJPGD is not set
# CONFIG_RTGUI_IMAGE_PNG_NONE is not set
# CONFIG_RTGUI_IMAGE_PNG is not set
CONFIG_RTGUI_IMAGE_LODEPNG=y
# CONFIG_RTGUI_IMAGE_BMP is not set
CONFIG_RTGUI_IMAGE_CONTAINER=y
# CONFIG_RTGUI_USING_DEMO is not set
# #
# VBUS(Virtual Software BUS) # VBUS(Virtual Software BUS)
@ -250,8 +231,22 @@ CONFIG_RTGUI_IMAGE_CONTAINER=y
# #
# system packages # system packages
# #
# CONFIG_PKG_USING_PARTITION is not set
#
# RT-Thread GUI Engine
#
# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG is not set
# CONFIG_GUIENGINE_IMAGE_TJPGD is not set
# CONFIG_GUIENGINE_IMAGE_PNG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_PNG is not set
# CONFIG_GUIENGINE_IMAGE_LODEPNG is not set
# CONFIG_PKG_USING_GUIENGINE_V200 is not set
# CONFIG_PKG_USING_GUIENGINE_LATEST_VERSION is not set
# CONFIG_PKG_USING_PERSIMMON is not set # CONFIG_PKG_USING_PERSIMMON is not set
# CONFIG_PKG_USING_LWEXT4 is not set
# CONFIG_PKG_USING_PARTITION is not set
# CONFIG_PKG_USING_SQLITE is not set # CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set # CONFIG_PKG_USING_RTI is not set
@ -282,6 +277,7 @@ CONFIG_RTGUI_IMAGE_CONTAINER=y
# #
# CONFIG_PKG_USING_WLAN_WICED is not set # CONFIG_PKG_USING_WLAN_WICED is not set
# CONFIG_PKG_USING_COAP is not set # CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
# #
# security packages # security packages
@ -314,11 +310,13 @@ CONFIG_RTGUI_IMAGE_CONTAINER=y
# #
# CONFIG_PKG_USING_FASTLZ is not set # CONFIG_PKG_USING_FASTLZ is not set
# CONFIG_PKG_USING_MINILZO is not set # CONFIG_PKG_USING_MINILZO is not set
# CONFIG_PKG_USING_QUICKLZ is not set
# #
# example package: hello # example package: hello
# #
# CONFIG_PKG_USING_HELLO is not set # CONFIG_PKG_USING_HELLO is not set
# CONFIG_PKG_USING_MULTIBUTTON is not set
CONFIG_SOC_IMXRT1052=y CONFIG_SOC_IMXRT1052=y
CONFIG_RT_USING_UART=y CONFIG_RT_USING_UART=y
CONFIG_RT_USING_UART1=y CONFIG_RT_USING_UART1=y

View File

@ -1 +0,0 @@


View File

@ -22,7 +22,7 @@ if GetDepend('RT_USING_LWIP'):
if GetDepend('RT_USING_SDIO'): if GetDepend('RT_USING_SDIO'):
src += ['drv_sdio.c'] src += ['drv_sdio.c']
if GetDepend('RT_USING_RTGUI') or GetDepend('RT_USING_GUIENGINE'): if GetDepend('RT_USING_RTGUI') or GetDepend('PKG_USING_GUIENGINE'):
src += ['drv_lcd.c', 'drv_ft5406.c', 'drv_i2c.c'] src += ['drv_lcd.c', 'drv_ft5406.c', 'drv_i2c.c']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES) group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)

View File

@ -192,7 +192,7 @@ void rt_hw_board_init()
#endif #endif
} }
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
#include <rtgui/driver.h> #include <rtgui/driver.h>
#include "drv_lcd.h" #include "drv_lcd.h"

View File

@ -21,7 +21,7 @@
//#define LCD_DEBUG //#define LCD_DEBUG
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
#define APP_HSW 41 #define APP_HSW 41
#define APP_HFP 4 #define APP_HFP 4

View File

@ -56,6 +56,7 @@
#define RT_USING_COMPONENTS_INIT #define RT_USING_COMPONENTS_INIT
#define RT_USING_USER_MAIN #define RT_USING_USER_MAIN
#define RT_MAIN_THREAD_STACK_SIZE 2048
/* C++ features */ /* C++ features */
@ -182,32 +183,13 @@
#define LWIP_SO_RCVTIMEO 1 #define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_SNDTIMEO 1 #define LWIP_SO_SNDTIMEO 1
#define LWIP_SO_RCVBUF 1 #define LWIP_SO_RCVBUF 1
/* RT_LWIP_NETIF_LOOPBACK is not set */
#define LWIP_NETIF_LOOPBACK 0
/* Modbus master and slave stack */ /* Modbus master and slave stack */
/* RT_USING_MODBUS is not set */ /* RT_USING_MODBUS is not set */
/* LWIP_USING_DHCPD is not set */ /* LWIP_USING_DHCPD is not set */
/* RT_USING_NETUTILS is not set */
/* RT-Thread UI Engine */
#define RT_USING_GUIENGINE
#define RTGUI_NAME_MAX 16
#define RTGUI_USING_TTF
#define UTF8_TO_UNICODE
#define RTGUI_USING_FONT16
#define RTGUI_USING_FONT12
/* RTGUI_USING_FONTHZ is not set */
/* RTGUI_IMAGE_XPM is not set */
#define RTGUI_IMAGE_JPEG_NONE
/* RTGUI_IMAGE_JPEG is not set */
/* RTGUI_IMAGE_TJPGD is not set */
/* RTGUI_IMAGE_PNG_NONE is not set */
/* RTGUI_IMAGE_PNG is not set */
#define RTGUI_IMAGE_LODEPNG
/* RTGUI_IMAGE_BMP is not set */
#define RTGUI_IMAGE_CONTAINER
/* RTGUI_USING_DEMO is not set */
/* VBUS(Virtual Software BUS) */ /* VBUS(Virtual Software BUS) */
@ -227,8 +209,20 @@
/* system packages */ /* system packages */
/* PKG_USING_PARTITION is not set */ /* RT-Thread GUI Engine */
/* PKG_USING_GUIENGINE is not set */
/* GUIENGINE_IMAGE_JPEG_NONE is not set */
/* GUIENGINE_IMAGE_JPEG is not set */
/* GUIENGINE_IMAGE_TJPGD is not set */
/* GUIENGINE_IMAGE_PNG_NONE is not set */
/* GUIENGINE_IMAGE_PNG is not set */
/* GUIENGINE_IMAGE_LODEPNG is not set */
/* PKG_USING_GUIENGINE_V200 is not set */
/* PKG_USING_GUIENGINE_LATEST_VERSION is not set */
/* PKG_USING_PERSIMMON is not set */ /* PKG_USING_PERSIMMON is not set */
/* PKG_USING_LWEXT4 is not set */
/* PKG_USING_PARTITION is not set */
/* PKG_USING_SQLITE is not set */ /* PKG_USING_SQLITE is not set */
/* PKG_USING_RTI is not set */ /* PKG_USING_RTI is not set */
@ -254,6 +248,7 @@
/* PKG_USING_WLAN_WICED is not set */ /* PKG_USING_WLAN_WICED is not set */
/* PKG_USING_COAP is not set */ /* PKG_USING_COAP is not set */
/* PKG_USING_NOPOLL is not set */
/* security packages */ /* security packages */
@ -281,10 +276,12 @@
/* PKG_USING_FASTLZ is not set */ /* PKG_USING_FASTLZ is not set */
/* PKG_USING_MINILZO is not set */ /* PKG_USING_MINILZO is not set */
/* PKG_USING_QUICKLZ is not set */
/* example package: hello */ /* example package: hello */
/* PKG_USING_HELLO is not set */ /* PKG_USING_HELLO is not set */
/* PKG_USING_MULTIBUTTON is not set */
#define SOC_IMXRT1052 #define SOC_IMXRT1052
#define RT_USING_UART #define RT_USING_UART
#define RT_USING_UART1 #define RT_USING_UART1

View File

@ -203,7 +203,7 @@ CONFIG_LWIP_SO_RCVBUF=1
# #
# RT-Thread UI Engine # RT-Thread UI Engine
# #
# CONFIG_RT_USING_GUIENGINE is not set # CONFIG_PKG_USING_GUIENGINE is not set
# #
# VBUS(Virtual Software BUS) # VBUS(Virtual Software BUS)

View File

@ -80,7 +80,7 @@ void rt_hw_board_init()
#endif #endif
} }
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
#include <rtgui/driver.h> #include <rtgui/driver.h>
#include "drv_lcd.h" #include "drv_lcd.h"

View File

@ -187,7 +187,7 @@
/* RT-Thread UI Engine */ /* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */ /* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */ /* VBUS(Virtual Software BUS) */

View File

@ -18,8 +18,10 @@ CONFIG_RT_USING_OVERFLOW_CHECK=y
CONFIG_RT_DEBUG_INIT=0 CONFIG_RT_DEBUG_INIT=0
CONFIG_RT_DEBUG_THREAD=0 CONFIG_RT_DEBUG_THREAD=0
CONFIG_RT_USING_HOOK=y CONFIG_RT_USING_HOOK=y
CONFIG_IDLE_THREAD_STACK_SIZE=256 CONFIG_IDLE_THREAD_STACK_SIZE=512
# CONFIG_RT_USING_TIMER_SOFT is not set CONFIG_RT_USING_TIMER_SOFT=y
CONFIG_RT_TIMER_THREAD_PRIO=4
CONFIG_RT_TIMER_THREAD_STACK_SIZE=1024
# #
# Inter-Thread communication # Inter-Thread communication
@ -40,6 +42,7 @@ CONFIG_RT_USING_MEMHEAP=y
CONFIG_RT_USING_SMALL_MEM=y CONFIG_RT_USING_SMALL_MEM=y
# CONFIG_RT_USING_SLAB is not set # CONFIG_RT_USING_SLAB is not set
# CONFIG_RT_USING_MEMHEAP_AS_HEAP is not set # CONFIG_RT_USING_MEMHEAP_AS_HEAP is not set
CONFIG_RT_USING_MEMTRACE=y
CONFIG_RT_USING_HEAP=y CONFIG_RT_USING_HEAP=y
# #
@ -57,17 +60,20 @@ CONFIG_RT_CONSOLE_DEVICE_NAME="uart0"
# #
CONFIG_RT_USING_COMPONENTS_INIT=y CONFIG_RT_USING_COMPONENTS_INIT=y
CONFIG_RT_USING_USER_MAIN=y CONFIG_RT_USING_USER_MAIN=y
CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048
# #
# C++ features # C++ features
# #
# CONFIG_RT_USING_CPLUSPLUS is not set CONFIG_RT_USING_CPLUSPLUS=y
# #
# Command shell # Command shell
# #
CONFIG_RT_USING_FINSH=y CONFIG_RT_USING_FINSH=y
CONFIG_FINSH_THREAD_NAME="tshell"
CONFIG_FINSH_USING_HISTORY=y CONFIG_FINSH_USING_HISTORY=y
CONFIG_FINSH_HISTORY_LINES=5
CONFIG_FINSH_USING_SYMTAB=y CONFIG_FINSH_USING_SYMTAB=y
CONFIG_FINSH_USING_DESCRIPTION=y CONFIG_FINSH_USING_DESCRIPTION=y
CONFIG_FINSH_THREAD_PRIORITY=20 CONFIG_FINSH_THREAD_PRIORITY=20
@ -93,14 +99,14 @@ CONFIG_RT_USING_DFS_ELMFAT=y
# #
CONFIG_RT_DFS_ELM_CODE_PAGE=437 CONFIG_RT_DFS_ELM_CODE_PAGE=437
CONFIG_RT_DFS_ELM_WORD_ACCESS=y CONFIG_RT_DFS_ELM_WORD_ACCESS=y
CONFIG_RT_DFS_ELM_USE_LFN_0=y # CONFIG_RT_DFS_ELM_USE_LFN_0 is not set
# CONFIG_RT_DFS_ELM_USE_LFN_1 is not set # CONFIG_RT_DFS_ELM_USE_LFN_1 is not set
# CONFIG_RT_DFS_ELM_USE_LFN_2 is not set # CONFIG_RT_DFS_ELM_USE_LFN_2 is not set
# CONFIG_RT_DFS_ELM_USE_LFN_3 is not set CONFIG_RT_DFS_ELM_USE_LFN_3=y
CONFIG_RT_DFS_ELM_USE_LFN=0 CONFIG_RT_DFS_ELM_USE_LFN=3
CONFIG_RT_DFS_ELM_MAX_LFN=255 CONFIG_RT_DFS_ELM_MAX_LFN=255
CONFIG_RT_DFS_ELM_DRIVES=2 CONFIG_RT_DFS_ELM_DRIVES=2
CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512 CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=4096
# CONFIG_RT_DFS_ELM_USE_ERASE is not set # CONFIG_RT_DFS_ELM_USE_ERASE is not set
CONFIG_RT_DFS_ELM_REENTRANT=y CONFIG_RT_DFS_ELM_REENTRANT=y
CONFIG_RT_USING_DFS_DEVFS=y CONFIG_RT_USING_DFS_DEVFS=y
@ -110,6 +116,7 @@ CONFIG_HAVE_SYS_SELECT_H=y
CONFIG_RT_USING_DFS_ROMFS=y CONFIG_RT_USING_DFS_ROMFS=y
CONFIG_RT_USING_DFS_RAMFS=y CONFIG_RT_USING_DFS_RAMFS=y
# CONFIG_RT_USING_DFS_UFFS is not set # CONFIG_RT_USING_DFS_UFFS is not set
# CONFIG_RT_USING_DFS_JFFS2 is not set
# CONFIG_RT_USING_DFS_NFS is not set # CONFIG_RT_USING_DFS_NFS is not set
# #
@ -119,6 +126,7 @@ CONFIG_RT_USING_DEVICE_IPC=y
CONFIG_RT_USING_SERIAL=y CONFIG_RT_USING_SERIAL=y
# CONFIG_RT_USING_CAN is not set # CONFIG_RT_USING_CAN is not set
# CONFIG_RT_USING_HWTIMER is not set # CONFIG_RT_USING_HWTIMER is not set
# CONFIG_RT_USING_CPUTIME is not set
CONFIG_RT_USING_I2C=y CONFIG_RT_USING_I2C=y
CONFIG_RT_USING_I2C_BITOPS=y CONFIG_RT_USING_I2C_BITOPS=y
CONFIG_RT_USING_PIN=y CONFIG_RT_USING_PIN=y
@ -126,8 +134,11 @@ CONFIG_RT_USING_MTD_NOR=y
CONFIG_RT_USING_MTD_NAND=y CONFIG_RT_USING_MTD_NAND=y
CONFIG_RT_MTD_NAND_DEBUG=y CONFIG_RT_MTD_NAND_DEBUG=y
CONFIG_RT_USING_RTC=y CONFIG_RT_USING_RTC=y
# CONFIG_RT_USING_SOFT_RTC is not set
# CONFIG_RTC_SYNC_USING_NTP is not set
CONFIG_RT_USING_SDIO=y CONFIG_RT_USING_SDIO=y
CONFIG_RT_USING_SPI=y CONFIG_RT_USING_SPI=y
CONFIG_RT_USING_SPI_MSD=y
CONFIG_RT_USING_SFUD=y CONFIG_RT_USING_SFUD=y
CONFIG_RT_SFUD_USING_SFDP=y CONFIG_RT_SFUD_USING_SFDP=y
CONFIG_RT_SFUD_USING_FLASH_INFO_TABLE=y CONFIG_RT_SFUD_USING_FLASH_INFO_TABLE=y
@ -153,6 +164,7 @@ CONFIG_RT_USING_PTHREADS=y
CONFIG_RT_USING_POSIX=y CONFIG_RT_USING_POSIX=y
CONFIG_RT_USING_POSIX_MMAP=y CONFIG_RT_USING_POSIX_MMAP=y
CONFIG_RT_USING_POSIX_TERMIOS=y CONFIG_RT_USING_POSIX_TERMIOS=y
CONFIG_RT_USING_POSIX_AIO=y
# #
# Network stack # Network stack
@ -172,7 +184,6 @@ CONFIG_RT_LWIP_DNS=y
CONFIG_RT_LWIP_DHCP=y CONFIG_RT_LWIP_DHCP=y
CONFIG_IP_SOF_BROADCAST=1 CONFIG_IP_SOF_BROADCAST=1
CONFIG_IP_SOF_BROADCAST_RECV=1 CONFIG_IP_SOF_BROADCAST_RECV=1
# CONFIG_LWIP_USING_DHCPD is not set
# #
# Static IPv4 Address # Static IPv4 Address
@ -184,8 +195,7 @@ CONFIG_RT_LWIP_UDP=y
CONFIG_RT_LWIP_TCP=y CONFIG_RT_LWIP_TCP=y
# CONFIG_RT_LWIP_RAW is not set # CONFIG_RT_LWIP_RAW is not set
# CONFIG_RT_LWIP_PPP is not set # CONFIG_RT_LWIP_PPP is not set
# CONFIG_RT_LWIP_PPPOE is not set CONFIG_RT_MEMP_NUM_NETCONN=8
# CONFIG_RT_LWIP_PPPOS is not set
CONFIG_RT_LWIP_PBUF_NUM=16 CONFIG_RT_LWIP_PBUF_NUM=16
CONFIG_RT_LWIP_RAW_PCB_NUM=4 CONFIG_RT_LWIP_RAW_PCB_NUM=4
CONFIG_RT_LWIP_UDP_PCB_NUM=4 CONFIG_RT_LWIP_UDP_PCB_NUM=4
@ -205,37 +215,34 @@ CONFIG_SO_REUSE=1
CONFIG_LWIP_SO_RCVTIMEO=1 CONFIG_LWIP_SO_RCVTIMEO=1
CONFIG_LWIP_SO_SNDTIMEO=1 CONFIG_LWIP_SO_SNDTIMEO=1
CONFIG_LWIP_SO_RCVBUF=1 CONFIG_LWIP_SO_RCVBUF=1
# CONFIG_RT_LWIP_NETIF_LOOPBACK is not set
CONFIG_LWIP_NETIF_LOOPBACK=0
# #
# Modbus master and slave stack # Modbus master and slave stack
# #
# CONFIG_RT_USING_MODBUS is not set # CONFIG_RT_USING_MODBUS is not set
# CONFIG_RT_USING_NETUTILS is not set # CONFIG_LWIP_USING_DHCPD is not set
#
# RT-Thread UI Engine
#
CONFIG_RT_USING_GUIENGINE=y
CONFIG_RTGUI_NAME_MAX=16
CONFIG_RTGUI_USING_TTF=y
CONFIG_RTGUI_USING_FONT16=y
CONFIG_RTGUI_USING_FONT12=y
# CONFIG_RTGUI_USING_FONTHZ is not set
# CONFIG_RTGUI_IMAGE_XPM is not set
# CONFIG_RTGUI_IMAGE_JPEG_NONE is not set
# CONFIG_RTGUI_IMAGE_JPEG is not set
CONFIG_RTGUI_IMAGE_TJPGD=y
# CONFIG_RTGUI_IMAGE_PNG_NONE is not set
# CONFIG_RTGUI_IMAGE_PNG is not set
CONFIG_RTGUI_IMAGE_LODEPNG=y
# CONFIG_RTGUI_IMAGE_BMP is not set
CONFIG_RTGUI_IMAGE_CONTAINER=y
# #
# VBUS(Virtual Software BUS) # VBUS(Virtual Software BUS)
# #
# CONFIG_RT_USING_VBUS is not set # CONFIG_RT_USING_VBUS is not set
#
# Utilities
#
CONFIG_RT_USING_LOGTRACE=y
CONFIG_LOG_TRACE_MAX_SESSION=16
# CONFIG_LOG_TRACE_USING_LEVEL_NOTRACE is not set
# CONFIG_LOG_TRACE_USING_LEVEL_ERROR is not set
# CONFIG_LOG_TRACE_USING_LEVEL_WARNING is not set
CONFIG_LOG_TRACE_USING_LEVEL_INFO=y
# CONFIG_LOG_TRACE_USING_LEVEL_VERBOSE is not set
# CONFIG_LOG_TRACE_USING_LEVEL_DEBUG is not set
# CONFIG_LOG_TRACE_USING_MEMLOG is not set
# CONFIG_RT_USING_RYM is not set
# #
# RT-Thread online packages # RT-Thread online packages
# #
@ -243,6 +250,20 @@ CONFIG_RTGUI_IMAGE_CONTAINER=y
# #
# system packages # system packages
# #
#
# RT-Thread GUI Engine
#
# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG is not set
# CONFIG_GUIENGINE_IMAGE_TJPGD is not set
# CONFIG_GUIENGINE_IMAGE_PNG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_PNG is not set
# CONFIG_GUIENGINE_IMAGE_LODEPNG is not set
# CONFIG_PKG_USING_GUIENGINE_V200 is not set
# CONFIG_PKG_USING_GUIENGINE_LATEST_VERSION is not set
# CONFIG_PKG_USING_LWEXT4 is not set
# CONFIG_PKG_USING_PARTITION is not set # CONFIG_PKG_USING_PARTITION is not set
# CONFIG_PKG_USING_SQLITE is not set # CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set # CONFIG_PKG_USING_RTI is not set
@ -255,14 +276,33 @@ CONFIG_RTGUI_IMAGE_CONTAINER=y
# CONFIG_PKG_USING_MONGOOSE is not set # CONFIG_PKG_USING_MONGOOSE is not set
# CONFIG_PKG_USING_WEBTERMINAL is not set # CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_CJSON is not set # CONFIG_PKG_USING_CJSON is not set
# CONFIG_PKG_USING_LJSON is not set
# CONFIG_PKG_USING_EZXML is not set # CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set # CONFIG_PKG_USING_NANOPB is not set
# CONFIG_PKG_USING_GAGENT_CLOUD is not set
#
# Wi-Fi
#
#
# Marvell WiFi
#
# CONFIG_PKG_USING_WLANMARVELL is not set
#
# Wiced WiFi
#
# CONFIG_PKG_USING_WLAN_WICED is not set
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
# #
# security packages # security packages
# #
# CONFIG_PKG_USING_MBEDTLS is not set # CONFIG_PKG_USING_MBEDTLS is not set
# CONFIG_PKG_USING_libsodium is not set # CONFIG_PKG_USING_libsodium is not set
# CONFIG_PKG_USING_TINYCRYPT is not set
# #
# language packages # language packages
@ -273,6 +313,7 @@ CONFIG_RTGUI_IMAGE_CONTAINER=y
# #
# multimedia packages # multimedia packages
# #
# CONFIG_PKG_USING_OPENMV is not set
# #
# tools packages # tools packages
@ -280,30 +321,20 @@ CONFIG_RTGUI_IMAGE_CONTAINER=y
# CONFIG_PKG_USING_CMBACKTRACE is not set # CONFIG_PKG_USING_CMBACKTRACE is not set
# CONFIG_PKG_USING_EASYLOGGER is not set # CONFIG_PKG_USING_EASYLOGGER is not set
# CONFIG_PKG_USING_SYSTEMVIEW is not set # CONFIG_PKG_USING_SYSTEMVIEW is not set
# CONFIG_PKG_USING_IPERF is not set
# #
# miscellaneous packages # miscellaneous packages
# #
# CONFIG_PKG_USING_FASTLZ is not set # CONFIG_PKG_USING_FASTLZ is not set
# CONFIG_PKG_USING_MINILZO is not set # CONFIG_PKG_USING_MINILZO is not set
# CONFIG_PKG_USING_QUICKLZ is not set
# #
# example package: hello # example package: hello
# #
# CONFIG_PKG_USING_HELLO is not set # CONFIG_PKG_USING_HELLO is not set
# CONFIG_PKG_USING_MULTIBUTTON is not set
#
# Privated Packages of RealThread
#
# CONFIG_PKG_USING_CODEC is not set
# CONFIG_PKG_USING_PLAYER is not set
#
# Network Utilities
#
# CONFIG_PKG_USING_MDNS is not set
# CONFIG_PKG_USING_UPNP is not set
CONFIG_RT_USING_UART0=y CONFIG_RT_USING_UART0=y
CONFIG_RT_USING_UART1=y CONFIG_RT_USING_UART1=y
CONFIG_BSP_DRV_CLCD=y
CONFIG_BSP_DRV_EMAC=y CONFIG_BSP_DRV_EMAC=y

View File

@ -1,6 +1,6 @@
#include <rtthread.h> #include <rtthread.h>
#if defined(RT_USING_RTGUI) || defined(RT_USING_GUIENGINE) #if defined(RT_USING_RTGUI) || defined(PKG_USING_GUIENGINE)
#include <rtgui/driver.h> #include <rtgui/driver.h>
int lcd_init(void) int lcd_init(void)

View File

@ -8,7 +8,7 @@ config RT_USING_UART1
config BSP_DRV_CLCD config BSP_DRV_CLCD
bool "CLCD driver" bool "CLCD driver"
depends on RT_USING_GUIENGINE depends on PKG_USING_GUIENGINE
default y default y
config BSP_DRV_EMAC config BSP_DRV_EMAC

View File

@ -15,7 +15,7 @@
#define KEYBOARD_ADDRESS (0x10006000) #define KEYBOARD_ADDRESS (0x10006000)
#define KEYBOARD_IRQ_NUM (IRQ_VEXPRESS_A9_KBD) #define KEYBOARD_IRQ_NUM (IRQ_VEXPRESS_A9_KBD)
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
#include <rtgui/event.h> #include <rtgui/event.h>
#include <rtgui/rtgui_server.h> #include <rtgui/rtgui_server.h>

View File

@ -25,7 +25,7 @@
#define MOUSE_BUTTON_MOVE (0x40) #define MOUSE_BUTTON_MOVE (0x40)
#define MOUSE_BUTTON_WHELL (0x80) #define MOUSE_BUTTON_WHELL (0x80)
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
#include <rtgui/event.h> #include <rtgui/event.h>
#include <rtgui/rtgui_server.h> #include <rtgui/rtgui_server.h>

0
bsp/qemu-vexpress-a9/qemu.sh Normal file → Executable file
View File

View File

@ -18,8 +18,10 @@
#define RT_DEBUG_INIT 0 #define RT_DEBUG_INIT 0
#define RT_DEBUG_THREAD 0 #define RT_DEBUG_THREAD 0
#define RT_USING_HOOK #define RT_USING_HOOK
#define IDLE_THREAD_STACK_SIZE 256 #define IDLE_THREAD_STACK_SIZE 512
/* RT_USING_TIMER_SOFT is not set */ #define RT_USING_TIMER_SOFT
#define RT_TIMER_THREAD_PRIO 4
#define RT_TIMER_THREAD_STACK_SIZE 1024
/* Inter-Thread communication */ /* Inter-Thread communication */
@ -38,6 +40,7 @@
#define RT_USING_SMALL_MEM #define RT_USING_SMALL_MEM
/* RT_USING_SLAB is not set */ /* RT_USING_SLAB is not set */
/* RT_USING_MEMHEAP_AS_HEAP is not set */ /* RT_USING_MEMHEAP_AS_HEAP is not set */
#define RT_USING_MEMTRACE
#define RT_USING_HEAP #define RT_USING_HEAP
/* Kernel Device Object */ /* Kernel Device Object */
@ -53,15 +56,18 @@
#define RT_USING_COMPONENTS_INIT #define RT_USING_COMPONENTS_INIT
#define RT_USING_USER_MAIN #define RT_USING_USER_MAIN
#define RT_MAIN_THREAD_STACK_SIZE 2048
/* C++ features */ /* C++ features */
/* RT_USING_CPLUSPLUS is not set */ #define RT_USING_CPLUSPLUS
/* Command shell */ /* Command shell */
#define RT_USING_FINSH #define RT_USING_FINSH
#define FINSH_THREAD_NAME "tshell"
#define FINSH_USING_HISTORY #define FINSH_USING_HISTORY
#define FINSH_HISTORY_LINES 5
#define FINSH_USING_SYMTAB #define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION #define FINSH_USING_DESCRIPTION
#define FINSH_THREAD_PRIORITY 20 #define FINSH_THREAD_PRIORITY 20
@ -85,14 +91,14 @@
#define RT_DFS_ELM_CODE_PAGE 437 #define RT_DFS_ELM_CODE_PAGE 437
#define RT_DFS_ELM_WORD_ACCESS #define RT_DFS_ELM_WORD_ACCESS
#define RT_DFS_ELM_USE_LFN_0 /* RT_DFS_ELM_USE_LFN_0 is not set */
/* RT_DFS_ELM_USE_LFN_1 is not set */ /* RT_DFS_ELM_USE_LFN_1 is not set */
/* RT_DFS_ELM_USE_LFN_2 is not set */ /* RT_DFS_ELM_USE_LFN_2 is not set */
/* RT_DFS_ELM_USE_LFN_3 is not set */ #define RT_DFS_ELM_USE_LFN_3
#define RT_DFS_ELM_USE_LFN 0 #define RT_DFS_ELM_USE_LFN 3
#define RT_DFS_ELM_MAX_LFN 255 #define RT_DFS_ELM_MAX_LFN 255
#define RT_DFS_ELM_DRIVES 2 #define RT_DFS_ELM_DRIVES 2
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512 #define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
/* RT_DFS_ELM_USE_ERASE is not set */ /* RT_DFS_ELM_USE_ERASE is not set */
#define RT_DFS_ELM_REENTRANT #define RT_DFS_ELM_REENTRANT
#define RT_USING_DFS_DEVFS #define RT_USING_DFS_DEVFS
@ -102,6 +108,7 @@
#define RT_USING_DFS_ROMFS #define RT_USING_DFS_ROMFS
#define RT_USING_DFS_RAMFS #define RT_USING_DFS_RAMFS
/* RT_USING_DFS_UFFS is not set */ /* RT_USING_DFS_UFFS is not set */
/* RT_USING_DFS_JFFS2 is not set */
/* RT_USING_DFS_NFS is not set */ /* RT_USING_DFS_NFS is not set */
/* Device Drivers */ /* Device Drivers */
@ -110,6 +117,7 @@
#define RT_USING_SERIAL #define RT_USING_SERIAL
/* RT_USING_CAN is not set */ /* RT_USING_CAN is not set */
/* RT_USING_HWTIMER is not set */ /* RT_USING_HWTIMER is not set */
/* RT_USING_CPUTIME is not set */
#define RT_USING_I2C #define RT_USING_I2C
#define RT_USING_I2C_BITOPS #define RT_USING_I2C_BITOPS
#define RT_USING_PIN #define RT_USING_PIN
@ -117,8 +125,11 @@
#define RT_USING_MTD_NAND #define RT_USING_MTD_NAND
#define RT_MTD_NAND_DEBUG #define RT_MTD_NAND_DEBUG
#define RT_USING_RTC #define RT_USING_RTC
/* RT_USING_SOFT_RTC is not set */
/* RTC_SYNC_USING_NTP is not set */
#define RT_USING_SDIO #define RT_USING_SDIO
#define RT_USING_SPI #define RT_USING_SPI
#define RT_USING_SPI_MSD
#define RT_USING_SFUD #define RT_USING_SFUD
#define RT_SFUD_USING_SFDP #define RT_SFUD_USING_SFDP
#define RT_SFUD_USING_FLASH_INFO_TABLE #define RT_SFUD_USING_FLASH_INFO_TABLE
@ -142,6 +153,7 @@
#define RT_USING_POSIX #define RT_USING_POSIX
#define RT_USING_POSIX_MMAP #define RT_USING_POSIX_MMAP
#define RT_USING_POSIX_TERMIOS #define RT_USING_POSIX_TERMIOS
#define RT_USING_POSIX_AIO
/* Network stack */ /* Network stack */
@ -158,7 +170,6 @@
#define RT_LWIP_DHCP #define RT_LWIP_DHCP
#define IP_SOF_BROADCAST 1 #define IP_SOF_BROADCAST 1
#define IP_SOF_BROADCAST_RECV 1 #define IP_SOF_BROADCAST_RECV 1
/* LWIP_USING_DHCPD is not set */
/* Static IPv4 Address */ /* Static IPv4 Address */
@ -169,8 +180,7 @@
#define RT_LWIP_TCP #define RT_LWIP_TCP
/* RT_LWIP_RAW is not set */ /* RT_LWIP_RAW is not set */
/* RT_LWIP_PPP is not set */ /* RT_LWIP_PPP is not set */
/* RT_LWIP_PPPOE is not set */ #define RT_MEMP_NUM_NETCONN 8
/* RT_LWIP_PPPOS is not set */
#define RT_LWIP_PBUF_NUM 16 #define RT_LWIP_PBUF_NUM 16
#define RT_LWIP_RAW_PCB_NUM 4 #define RT_LWIP_RAW_PCB_NUM 4
#define RT_LWIP_UDP_PCB_NUM 4 #define RT_LWIP_UDP_PCB_NUM 4
@ -190,38 +200,47 @@
#define LWIP_SO_RCVTIMEO 1 #define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_SNDTIMEO 1 #define LWIP_SO_SNDTIMEO 1
#define LWIP_SO_RCVBUF 1 #define LWIP_SO_RCVBUF 1
/* RT_LWIP_NETIF_LOOPBACK is not set */
#define LWIP_NETIF_LOOPBACK 0
/* Modbus master and slave stack */ /* Modbus master and slave stack */
/* RT_USING_MODBUS is not set */ /* RT_USING_MODBUS is not set */
/* RT_USING_NETUTILS is not set */ /* LWIP_USING_DHCPD is not set */
/* RT-Thread UI Engine */
#define RT_USING_GUIENGINE
#define RTGUI_NAME_MAX 16
#define RTGUI_USING_TTF
#define RTGUI_USING_FONT16
#define RTGUI_USING_FONT12
/* RTGUI_USING_FONTHZ is not set */
/* RTGUI_IMAGE_XPM is not set */
/* RTGUI_IMAGE_JPEG_NONE is not set */
/* RTGUI_IMAGE_JPEG is not set */
#define RTGUI_IMAGE_TJPGD
/* RTGUI_IMAGE_PNG_NONE is not set */
/* RTGUI_IMAGE_PNG is not set */
#define RTGUI_IMAGE_LODEPNG
/* RTGUI_IMAGE_BMP is not set */
#define RTGUI_IMAGE_CONTAINER
/* VBUS(Virtual Software BUS) */ /* VBUS(Virtual Software BUS) */
/* RT_USING_VBUS is not set */ /* RT_USING_VBUS is not set */
/* Utilities */
#define RT_USING_LOGTRACE
#define LOG_TRACE_MAX_SESSION 16
/* LOG_TRACE_USING_LEVEL_NOTRACE is not set */
/* LOG_TRACE_USING_LEVEL_ERROR is not set */
/* LOG_TRACE_USING_LEVEL_WARNING is not set */
#define LOG_TRACE_USING_LEVEL_INFO
/* LOG_TRACE_USING_LEVEL_VERBOSE is not set */
/* LOG_TRACE_USING_LEVEL_DEBUG is not set */
/* LOG_TRACE_USING_MEMLOG is not set */
/* RT_USING_RYM is not set */
/* RT-Thread online packages */ /* RT-Thread online packages */
/* system packages */ /* system packages */
/* RT-Thread GUI Engine */
/* PKG_USING_GUIENGINE is not set */
/* GUIENGINE_IMAGE_JPEG_NONE is not set */
/* GUIENGINE_IMAGE_JPEG is not set */
/* GUIENGINE_IMAGE_TJPGD is not set */
/* GUIENGINE_IMAGE_PNG_NONE is not set */
/* GUIENGINE_IMAGE_PNG is not set */
/* GUIENGINE_IMAGE_LODEPNG is not set */
/* PKG_USING_GUIENGINE_V200 is not set */
/* PKG_USING_GUIENGINE_LATEST_VERSION is not set */
/* PKG_USING_LWEXT4 is not set */
/* PKG_USING_PARTITION is not set */ /* PKG_USING_PARTITION is not set */
/* PKG_USING_SQLITE is not set */ /* PKG_USING_SQLITE is not set */
/* PKG_USING_RTI is not set */ /* PKG_USING_RTI is not set */
@ -233,13 +252,28 @@
/* PKG_USING_MONGOOSE is not set */ /* PKG_USING_MONGOOSE is not set */
/* PKG_USING_WEBTERMINAL is not set */ /* PKG_USING_WEBTERMINAL is not set */
/* PKG_USING_CJSON is not set */ /* PKG_USING_CJSON is not set */
/* PKG_USING_LJSON is not set */
/* PKG_USING_EZXML is not set */ /* PKG_USING_EZXML is not set */
/* PKG_USING_NANOPB is not set */ /* PKG_USING_NANOPB is not set */
/* PKG_USING_GAGENT_CLOUD is not set */
/* Wi-Fi */
/* Marvell WiFi */
/* PKG_USING_WLANMARVELL is not set */
/* Wiced WiFi */
/* PKG_USING_WLAN_WICED is not set */
/* PKG_USING_COAP is not set */
/* PKG_USING_NOPOLL is not set */
/* security packages */ /* security packages */
/* PKG_USING_MBEDTLS is not set */ /* PKG_USING_MBEDTLS is not set */
/* PKG_USING_libsodium is not set */ /* PKG_USING_libsodium is not set */
/* PKG_USING_TINYCRYPT is not set */
/* language packages */ /* language packages */
@ -248,33 +282,27 @@
/* multimedia packages */ /* multimedia packages */
/* PKG_USING_OPENMV is not set */
/* tools packages */ /* tools packages */
/* PKG_USING_CMBACKTRACE is not set */ /* PKG_USING_CMBACKTRACE is not set */
/* PKG_USING_EASYLOGGER is not set */ /* PKG_USING_EASYLOGGER is not set */
/* PKG_USING_SYSTEMVIEW is not set */ /* PKG_USING_SYSTEMVIEW is not set */
/* PKG_USING_IPERF is not set */
/* miscellaneous packages */ /* miscellaneous packages */
/* PKG_USING_FASTLZ is not set */ /* PKG_USING_FASTLZ is not set */
/* PKG_USING_MINILZO is not set */ /* PKG_USING_MINILZO is not set */
/* PKG_USING_QUICKLZ is not set */
/* example package: hello */ /* example package: hello */
/* PKG_USING_HELLO is not set */ /* PKG_USING_HELLO is not set */
/* PKG_USING_MULTIBUTTON is not set */
/* Privated Packages of RealThread */
/* PKG_USING_CODEC is not set */
/* PKG_USING_PLAYER is not set */
/* Network Utilities */
/* PKG_USING_MDNS is not set */
/* PKG_USING_UPNP is not set */
#define RT_USING_UART0 #define RT_USING_UART0
#define RT_USING_UART1 #define RT_USING_UART1
#define BSP_DRV_CLCD
#define BSP_DRV_EMAC #define BSP_DRV_EMAC
#endif #endif

View File

@ -39,6 +39,7 @@ CONFIG_RT_USING_MEMPOOL=y
# CONFIG_RT_USING_NOHEAP is not set # CONFIG_RT_USING_NOHEAP is not set
CONFIG_RT_USING_SMALL_MEM=y CONFIG_RT_USING_SMALL_MEM=y
# CONFIG_RT_USING_SLAB is not set # CONFIG_RT_USING_SLAB is not set
# CONFIG_RT_USING_MEMTRACE is not set
CONFIG_RT_USING_HEAP=y CONFIG_RT_USING_HEAP=y
# #
@ -65,7 +66,9 @@ CONFIG_RT_CONSOLE_DEVICE_NAME="console"
# Command shell # Command shell
# #
CONFIG_RT_USING_FINSH=y CONFIG_RT_USING_FINSH=y
CONFIG_FINSH_THREAD_NAME="tshell"
CONFIG_FINSH_USING_HISTORY=y CONFIG_FINSH_USING_HISTORY=y
CONFIG_FINSH_HISTORY_LINES=5
CONFIG_FINSH_USING_SYMTAB=y CONFIG_FINSH_USING_SYMTAB=y
CONFIG_FINSH_USING_DESCRIPTION=y CONFIG_FINSH_USING_DESCRIPTION=y
CONFIG_FINSH_THREAD_PRIORITY=20 CONFIG_FINSH_THREAD_PRIORITY=20
@ -106,6 +109,8 @@ CONFIG_RT_USING_DFS_DEVFS=y
# CONFIG_RT_USING_DFS_ROMFS is not set # CONFIG_RT_USING_DFS_ROMFS is not set
# CONFIG_RT_USING_DFS_RAMFS is not set # CONFIG_RT_USING_DFS_RAMFS is not set
# CONFIG_RT_USING_DFS_UFFS is not set # CONFIG_RT_USING_DFS_UFFS is not set
# CONFIG_RT_USING_DFS_JFFS2 is not set
# CONFIG_RT_USING_DFS_NFS is not set
# #
# Device Drivers # Device Drivers
@ -114,6 +119,7 @@ CONFIG_RT_USING_DEVICE_IPC=y
CONFIG_RT_USING_SERIAL=y CONFIG_RT_USING_SERIAL=y
# CONFIG_RT_USING_CAN is not set # CONFIG_RT_USING_CAN is not set
# CONFIG_RT_USING_HWTIMER is not set # CONFIG_RT_USING_HWTIMER is not set
# CONFIG_RT_USING_CPUTIME is not set
# CONFIG_RT_USING_I2C is not set # CONFIG_RT_USING_I2C is not set
# CONFIG_RT_USING_PIN is not set # CONFIG_RT_USING_PIN is not set
# CONFIG_RT_USING_MTD_NOR is not set # CONFIG_RT_USING_MTD_NOR is not set
@ -150,26 +156,6 @@ CONFIG_RT_USING_SERIAL=y
# #
# CONFIG_RT_USING_MODBUS is not set # CONFIG_RT_USING_MODBUS is not set
#
# RT-Thread UI Engine
#
CONFIG_RT_USING_GUIENGINE=y
CONFIG_RTGUI_NAME_MAX=16
# CONFIG_RTGUI_USING_TTF is not set
CONFIG_RTGUI_USING_FONT16=y
CONFIG_RTGUI_USING_FONT12=y
# CONFIG_RTGUI_USING_FONTHZ is not set
# CONFIG_RTGUI_IMAGE_XPM is not set
CONFIG_RTGUI_IMAGE_JPEG_NONE=y
# CONFIG_RTGUI_IMAGE_JPEG is not set
# CONFIG_RTGUI_IMAGE_TJPGD is not set
# CONFIG_RTGUI_IMAGE_PNG_NONE is not set
# CONFIG_RTGUI_IMAGE_PNG is not set
CONFIG_RTGUI_IMAGE_LODEPNG=y
# CONFIG_RTGUI_IMAGE_BMP is not set
CONFIG_RTGUI_IMAGE_CONTAINER=y
CONFIG_RTGUI_USING_DEMO=y
# #
# VBUS(Virtual Software BUS) # VBUS(Virtual Software BUS)
# #
@ -188,8 +174,21 @@ CONFIG_RTGUI_USING_DEMO=y
# #
# system packages # system packages
# #
#
# RT-Thread GUI Engine
#
# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG is not set
# CONFIG_GUIENGINE_IMAGE_TJPGD is not set
# CONFIG_GUIENGINE_IMAGE_PNG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_PNG is not set
# CONFIG_GUIENGINE_IMAGE_LODEPNG is not set
# CONFIG_PKG_USING_GUIENGINE_V200 is not set
# CONFIG_PKG_USING_GUIENGINE_LATEST_VERSION is not set
# CONFIG_PKG_USING_LWEXT4 is not set
# CONFIG_PKG_USING_PARTITION is not set # CONFIG_PKG_USING_PARTITION is not set
CONFIG_RT_USING_PERSIMMON_EXAMPLE=y
# CONFIG_PKG_USING_SQLITE is not set # CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set # CONFIG_PKG_USING_RTI is not set
@ -201,8 +200,26 @@ CONFIG_RT_USING_PERSIMMON_EXAMPLE=y
# CONFIG_PKG_USING_MONGOOSE is not set # CONFIG_PKG_USING_MONGOOSE is not set
# CONFIG_PKG_USING_WEBTERMINAL is not set # CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_CJSON is not set # CONFIG_PKG_USING_CJSON is not set
# CONFIG_PKG_USING_LJSON is not set
# CONFIG_PKG_USING_EZXML is not set # CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set # CONFIG_PKG_USING_NANOPB is not set
# CONFIG_PKG_USING_GAGENT_CLOUD is not set
#
# Wi-Fi
#
#
# Marvell WiFi
#
# CONFIG_PKG_USING_WLANMARVELL is not set
#
# Wiced WiFi
#
# CONFIG_PKG_USING_WLAN_WICED is not set
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
# #
# security packages # security packages
@ -237,24 +254,11 @@ CONFIG_PKG_USING_FASTLZ=y
CONFIG_PKG_FASTLZ_PATH="/packages/misc/fastlz" CONFIG_PKG_FASTLZ_PATH="/packages/misc/fastlz"
CONFIG_PKG_FASTLZ_VER="v1.0.0" CONFIG_PKG_FASTLZ_VER="v1.0.0"
# CONFIG_PKG_USING_MINILZO is not set # CONFIG_PKG_USING_MINILZO is not set
# CONFIG_PKG_USING_QUICKLZ is not set
# #
# example package: hello # example package: hello
# #
# CONFIG_PKG_USING_HELLO is not set # CONFIG_PKG_USING_HELLO is not set
# CONFIG_PKG_USING_MULTIBUTTON is not set
#
# Privated Packages of RealThread
#
# CONFIG_PKG_USING_CODEC is not set
# CONFIG_PKG_USING_PLAYER is not set
CONFIG_PKG_USING_PERSIMMON_SRC=y
CONFIG_PKG_PERSIMMON_SRC_PATH="/realthread-packages/persimmon-src"
# CONFIG_PKG_USING_PERSIMMON_SRC_v1_0_0 is not set
CONFIG_PKG_USING_PERSIMMON_LATEST_VERSION=y
CONFIG_PKG_PERSIMMON_SRC_VER="latest_version"
#
# Network Utilities
#
CONFIG_RT_USING_DFS_WINSHAREDIR=y CONFIG_RT_USING_DFS_WINSHAREDIR=y

View File

@ -36,7 +36,7 @@ void rt_init_thread_entry(void *parameter)
platform_init(); platform_init();
mnt_init(); mnt_init();
#if defined(RT_USING_GUIENGINE) && defined(RTGUI_USING_DEMO) #if defined(PKG_USING_GUIENGINE) && defined(RTGUI_USING_DEMO)
{ {
extern int rt_gui_demo_init(void); extern int rt_gui_demo_init(void);
rt_gui_demo_init(); rt_gui_demo_init();

View File

@ -29,7 +29,7 @@ int platform_init(void)
#endif /* RT_USING_DFS */ #endif /* RT_USING_DFS */
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
{ {
extern void rt_hw_sdl_start(void); extern void rt_hw_sdl_start(void);
extern int rtgui_system_server_init(void); extern int rtgui_system_server_init(void);

View File

@ -8,7 +8,7 @@ LIBPATH = []
CPPPATH = [cwd] CPPPATH = [cwd]
# remove no need file. # remove no need file.
if GetDepend('RT_USING_GUIENGINE') == False: if GetDepend('PKG_USING_GUIENGINE') == False:
SrcRemove(src, 'sdl_fb.c') SrcRemove(src, 'sdl_fb.c')
else: else:
LIBS.append('SDL2') LIBS.append('SDL2')

View File

@ -37,6 +37,7 @@
/* RT_USING_NOHEAP is not set */ /* RT_USING_NOHEAP is not set */
#define RT_USING_SMALL_MEM #define RT_USING_SMALL_MEM
/* RT_USING_SLAB is not set */ /* RT_USING_SLAB is not set */
/* RT_USING_MEMTRACE is not set */
#define RT_USING_HEAP #define RT_USING_HEAP
/* Kernel Device Object */ /* Kernel Device Object */
@ -59,7 +60,9 @@
/* Command shell */ /* Command shell */
#define RT_USING_FINSH #define RT_USING_FINSH
#define FINSH_THREAD_NAME "tshell"
#define FINSH_USING_HISTORY #define FINSH_USING_HISTORY
#define FINSH_HISTORY_LINES 5
#define FINSH_USING_SYMTAB #define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION #define FINSH_USING_DESCRIPTION
#define FINSH_THREAD_PRIORITY 20 #define FINSH_THREAD_PRIORITY 20
@ -98,6 +101,8 @@
/* RT_USING_DFS_ROMFS is not set */ /* RT_USING_DFS_ROMFS is not set */
/* RT_USING_DFS_RAMFS is not set */ /* RT_USING_DFS_RAMFS is not set */
/* RT_USING_DFS_UFFS is not set */ /* RT_USING_DFS_UFFS is not set */
/* RT_USING_DFS_JFFS2 is not set */
/* RT_USING_DFS_NFS is not set */
/* Device Drivers */ /* Device Drivers */
@ -105,6 +110,7 @@
#define RT_USING_SERIAL #define RT_USING_SERIAL
/* RT_USING_CAN is not set */ /* RT_USING_CAN is not set */
/* RT_USING_HWTIMER is not set */ /* RT_USING_HWTIMER is not set */
/* RT_USING_CPUTIME is not set */
/* RT_USING_I2C is not set */ /* RT_USING_I2C is not set */
/* RT_USING_PIN is not set */ /* RT_USING_PIN is not set */
/* RT_USING_MTD_NOR is not set */ /* RT_USING_MTD_NOR is not set */
@ -135,25 +141,6 @@
/* RT_USING_MODBUS is not set */ /* RT_USING_MODBUS is not set */
/* RT-Thread UI Engine */
#define RT_USING_GUIENGINE
#define RTGUI_NAME_MAX 16
/* RTGUI_USING_TTF is not set */
#define RTGUI_USING_FONT16
#define RTGUI_USING_FONT12
/* RTGUI_USING_FONTHZ is not set */
/* RTGUI_IMAGE_XPM is not set */
#define RTGUI_IMAGE_JPEG_NONE
/* RTGUI_IMAGE_JPEG is not set */
/* RTGUI_IMAGE_TJPGD is not set */
/* RTGUI_IMAGE_PNG_NONE is not set */
/* RTGUI_IMAGE_PNG is not set */
#define RTGUI_IMAGE_LODEPNG
/* RTGUI_IMAGE_BMP is not set */
#define RTGUI_IMAGE_CONTAINER
#define RTGUI_USING_DEMO
/* VBUS(Virtual Software BUS) */ /* VBUS(Virtual Software BUS) */
/* RT_USING_VBUS is not set */ /* RT_USING_VBUS is not set */
@ -167,8 +154,19 @@
/* system packages */ /* system packages */
/* RT-Thread GUI Engine */
/* PKG_USING_GUIENGINE is not set */
/* GUIENGINE_IMAGE_JPEG_NONE is not set */
/* GUIENGINE_IMAGE_JPEG is not set */
/* GUIENGINE_IMAGE_TJPGD is not set */
/* GUIENGINE_IMAGE_PNG_NONE is not set */
/* GUIENGINE_IMAGE_PNG is not set */
/* GUIENGINE_IMAGE_LODEPNG is not set */
/* PKG_USING_GUIENGINE_V200 is not set */
/* PKG_USING_GUIENGINE_LATEST_VERSION is not set */
/* PKG_USING_LWEXT4 is not set */
/* PKG_USING_PARTITION is not set */ /* PKG_USING_PARTITION is not set */
#define RT_USING_PERSIMMON_EXAMPLE
/* PKG_USING_SQLITE is not set */ /* PKG_USING_SQLITE is not set */
/* PKG_USING_RTI is not set */ /* PKG_USING_RTI is not set */
@ -179,8 +177,22 @@
/* PKG_USING_MONGOOSE is not set */ /* PKG_USING_MONGOOSE is not set */
/* PKG_USING_WEBTERMINAL is not set */ /* PKG_USING_WEBTERMINAL is not set */
/* PKG_USING_CJSON is not set */ /* PKG_USING_CJSON is not set */
/* PKG_USING_LJSON is not set */
/* PKG_USING_EZXML is not set */ /* PKG_USING_EZXML is not set */
/* PKG_USING_NANOPB is not set */ /* PKG_USING_NANOPB is not set */
/* PKG_USING_GAGENT_CLOUD is not set */
/* Wi-Fi */
/* Marvell WiFi */
/* PKG_USING_WLANMARVELL is not set */
/* Wiced WiFi */
/* PKG_USING_WLAN_WICED is not set */
/* PKG_USING_COAP is not set */
/* PKG_USING_NOPOLL is not set */
/* security packages */ /* security packages */
@ -208,21 +220,12 @@
#define PKG_USING_FASTLZ #define PKG_USING_FASTLZ
/* PKG_USING_MINILZO is not set */ /* PKG_USING_MINILZO is not set */
/* PKG_USING_QUICKLZ is not set */
/* example package: hello */ /* example package: hello */
/* PKG_USING_HELLO is not set */ /* PKG_USING_HELLO is not set */
/* PKG_USING_MULTIBUTTON is not set */
/* Privated Packages of RealThread */
/* PKG_USING_CODEC is not set */
/* PKG_USING_PLAYER is not set */
#define PKG_USING_PERSIMMON_SRC
/* PKG_USING_PERSIMMON_SRC_v1_0_0 is not set */
#define PKG_USING_PERSIMMON_LATEST_VERSION
/* Network Utilities */
#define RT_USING_DFS_WINSHAREDIR #define RT_USING_DFS_WINSHAREDIR
#include "rtconfig_project.h" #include "rtconfig_project.h"

View File

@ -50,7 +50,7 @@ if PLATFORM == 'gcc':
DEVICE = ' -ffunction-sections -fdata-sections' DEVICE = ' -ffunction-sections -fdata-sections'
DEVICE = ' ' DEVICE = ' '
CFLAGS = DEVICE + ' -I/usr/include -w -D_REENTRANT' CFLAGS = DEVICE + ' -I/usr/include -w -D_REENTRANT -D_LINUX -DHAVE_SYS_SIGNALS'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
#LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-linux.map -lpthread' #LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-linux.map -lpthread'
LFLAGS = DEVICE + ' -Wl,-Map=rtthread-linux.map -pthread -T gcc.ld' LFLAGS = DEVICE + ' -Wl,-Map=rtthread-linux.map -pthread -T gcc.ld'

View File

@ -133,7 +133,7 @@ CONFIG_RT_USING_LIBC=y
# #
# RT-Thread UI Engine # RT-Thread UI Engine
# #
# CONFIG_RT_USING_GUIENGINE is not set # CONFIG_PKG_USING_GUIENGINE is not set
# #
# VBUS(Virtual Software BUS) # VBUS(Virtual Software BUS)

View File

@ -118,7 +118,7 @@
/* RT-Thread UI Engine */ /* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */ /* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */ /* VBUS(Virtual Software BUS) */

View File

@ -118,7 +118,7 @@ CONFIG_RT_USING_SERIAL=y
# #
# RT-Thread UI Engine # RT-Thread UI Engine
# #
# CONFIG_RT_USING_GUIENGINE is not set # CONFIG_PKG_USING_GUIENGINE is not set
# #
# RT-Thread online packages # RT-Thread online packages

View File

@ -104,7 +104,7 @@
/* RT-Thread UI Engine */ /* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */ /* PKG_USING_GUIENGINE is not set */
/* RT-Thread online packages */ /* RT-Thread online packages */

View File

@ -216,7 +216,7 @@ CONFIG_LWIP_SO_RCVBUF=1
# #
# RT-Thread UI Engine # RT-Thread UI Engine
# #
# CONFIG_RT_USING_GUIENGINE is not set # CONFIG_PKG_USING_GUIENGINE is not set
# #
# VBUS(Virtual Software BUS) # VBUS(Virtual Software BUS)

View File

@ -9,7 +9,7 @@ startup.c
""") """)
# add UI engine demo. # add UI engine demo.
if GetDepend('RT_USING_GUIENGINE'): if GetDepend('PKG_USING_GUIENGINE'):
src += ['rtgui_demo.c'] src += ['rtgui_demo.c']
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)

View File

@ -41,7 +41,7 @@
#include <gdb_stub.h> #include <gdb_stub.h>
#endif #endif
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
#include "rtgui_demo.h" #include "rtgui_demo.h"
#include <rtgui/driver.h> #include <rtgui/driver.h>
#endif #endif
@ -123,7 +123,7 @@ void rt_init_thread_entry(void* parameter)
#endif /* DFS */ #endif /* DFS */
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
{ {
rt_device_t device; rt_device_t device;

View File

@ -30,7 +30,7 @@
#define DEBUG_PRINTF(...) #define DEBUG_PRINTF(...)
#endif #endif
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
struct rtgui_win *main_win; struct rtgui_win *main_win;
rt_bool_t dc_event_handler(struct rtgui_object *object, rtgui_event_t *event); rt_bool_t dc_event_handler(struct rtgui_object *object, rtgui_event_t *event);
@ -125,4 +125,4 @@ int rt_gui_demo_init(void)
return 0; return 0;
} }
#endif /* RT_USING_GUIENGINE */ #endif /* PKG_USING_GUIENGINE */

View File

@ -36,7 +36,7 @@ if GetDepend('RT_USING_SFUD'):
src += ['drv_spi_flash.c'] src += ['drv_spi_flash.c']
# add lcd drivers. # add lcd drivers.
if GetDepend('RT_USING_GUIENGINE'): if GetDepend('PKG_USING_GUIENGINE'):
src += ['drv_lcd.c'] src += ['drv_lcd.c']
CPPPATH = [cwd] CPPPATH = [cwd]

View File

@ -200,7 +200,7 @@
/* RT-Thread UI Engine */ /* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */ /* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */ /* VBUS(Virtual Software BUS) */

View File

@ -26,7 +26,7 @@
#include <dfs_posix.h> #include <dfs_posix.h>
#endif #endif
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
#include "rtgui_demo.h" #include "rtgui_demo.h"
#include <rtgui/driver.h> #include <rtgui/driver.h>
#endif #endif
@ -63,7 +63,7 @@ void rt_init_thread_entry(void* parameter)
#endif /* DFS */ #endif /* DFS */
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
{ {
rt_device_t device; rt_device_t device;

View File

@ -24,7 +24,7 @@
#define DEBUG_PRINTF(...) #define DEBUG_PRINTF(...)
#endif #endif
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
#include <rtgui/rtgui.h> #include <rtgui/rtgui.h>
#include <rtgui/rtgui_system.h> #include <rtgui/rtgui_system.h>
#include <rtgui/rtgui_app.h> #include <rtgui/rtgui_app.h>
@ -123,4 +123,4 @@ int rt_gui_demo_init(void)
return 0; return 0;
} }
#endif /* RT_USING_GUIENGINE */ #endif /* PKG_USING_GUIENGINE */

View File

@ -69,7 +69,7 @@
/* SECTION: RTGUI support */ /* SECTION: RTGUI support */
/* using RTGUI support */ /* using RTGUI support */
#define RT_USING_GUIENGINE // #define PKG_USING_GUIENGINE
/* name length of RTGUI object */ /* name length of RTGUI object */
#define RTGUI_NAME_MAX 16 #define RTGUI_NAME_MAX 16

View File

@ -104,7 +104,7 @@
/* RT-Thread UI Engine */ /* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */ /* PKG_USING_GUIENGINE is not set */
/* RT-Thread online packages */ /* RT-Thread online packages */

View File

@ -129,7 +129,7 @@ CONFIG_RT_USING_PIN=y
# #
# RT-Thread UI Engine # RT-Thread UI Engine
# #
# CONFIG_RT_USING_GUIENGINE is not set # CONFIG_PKG_USING_GUIENGINE is not set
# #
# VBUS(Virtual Software BUS) # VBUS(Virtual Software BUS)

View File

@ -114,7 +114,7 @@
/* RT-Thread UI Engine */ /* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */ /* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */ /* VBUS(Virtual Software BUS) */

View File

@ -39,7 +39,7 @@
#include <gdb_stub.h> #include <gdb_stub.h>
#endif #endif
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
#include "rtgui_demo.h" #include "rtgui_demo.h"
#include <rtgui/driver.h> #include <rtgui/driver.h>
#endif #endif

View File

@ -123,7 +123,7 @@ CONFIG_RT_USING_PIN=y
# #
# RT-Thread UI Engine # RT-Thread UI Engine
# #
# CONFIG_RT_USING_GUIENGINE is not set # CONFIG_PKG_USING_GUIENGINE is not set
# #
# VBUS(Virtual Software BUS) # VBUS(Virtual Software BUS)

View File

@ -48,7 +48,7 @@
#include <gdb_stub.h> #include <gdb_stub.h>
#endif #endif
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
#include "rtgui_demo.h" #include "rtgui_demo.h"
#include <rtgui/driver.h> #include <rtgui/driver.h>
#endif #endif

View File

@ -109,7 +109,7 @@
/* RT-Thread UI Engine */ /* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */ /* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */ /* VBUS(Virtual Software BUS) */

View File

@ -161,7 +161,7 @@ CONFIG_LWIP_SO_RCVBUF=1
# #
# RT-Thread UI Engine # RT-Thread UI Engine
# #
# CONFIG_RT_USING_GUIENGINE is not set # CONFIG_PKG_USING_GUIENGINE is not set
# #
# RT-Thread online packages # RT-Thread online packages

View File

@ -146,7 +146,7 @@
/* RT-Thread UI Engine */ /* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */ /* PKG_USING_GUIENGINE is not set */
/* RT-Thread online packages */ /* RT-Thread online packages */

View File

@ -136,7 +136,7 @@ CONFIG_RT_USING_LIBC=y
# #
# RT-Thread UI Engine # RT-Thread UI Engine
# #
# CONFIG_RT_USING_GUIENGINE is not set # CONFIG_PKG_USING_GUIENGINE is not set
# #
# VBUS(Virtual Software BUS) # VBUS(Virtual Software BUS)

View File

@ -121,7 +121,7 @@
/* RT-Thread UI Engine */ /* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */ /* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */ /* VBUS(Virtual Software BUS) */

View File

@ -39,6 +39,7 @@ CONFIG_RT_USING_MEMPOOL=y
# CONFIG_RT_USING_NOHEAP is not set # CONFIG_RT_USING_NOHEAP is not set
CONFIG_RT_USING_SMALL_MEM=y CONFIG_RT_USING_SMALL_MEM=y
# CONFIG_RT_USING_SLAB is not set # CONFIG_RT_USING_SLAB is not set
# CONFIG_RT_USING_MEMTRACE is not set
CONFIG_RT_USING_HEAP=y CONFIG_RT_USING_HEAP=y
# #
@ -58,6 +59,7 @@ CONFIG_ARCH_MIPS_XBURST=y
# #
CONFIG_RT_USING_COMPONENTS_INIT=y CONFIG_RT_USING_COMPONENTS_INIT=y
CONFIG_RT_USING_USER_MAIN=y CONFIG_RT_USING_USER_MAIN=y
CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048
# #
# C++ features # C++ features
@ -68,7 +70,9 @@ CONFIG_RT_USING_USER_MAIN=y
# Command shell # Command shell
# #
CONFIG_RT_USING_FINSH=y CONFIG_RT_USING_FINSH=y
CONFIG_FINSH_THREAD_NAME="tshell"
CONFIG_FINSH_USING_HISTORY=y CONFIG_FINSH_USING_HISTORY=y
CONFIG_FINSH_HISTORY_LINES=5
CONFIG_FINSH_USING_SYMTAB=y CONFIG_FINSH_USING_SYMTAB=y
CONFIG_FINSH_USING_DESCRIPTION=y CONFIG_FINSH_USING_DESCRIPTION=y
CONFIG_FINSH_THREAD_PRIORITY=20 CONFIG_FINSH_THREAD_PRIORITY=20
@ -109,6 +113,7 @@ CONFIG_RT_USING_DFS_DEVFS=y
# CONFIG_RT_USING_DFS_ROMFS is not set # CONFIG_RT_USING_DFS_ROMFS is not set
# CONFIG_RT_USING_DFS_RAMFS is not set # CONFIG_RT_USING_DFS_RAMFS is not set
# CONFIG_RT_USING_DFS_UFFS is not set # CONFIG_RT_USING_DFS_UFFS is not set
# CONFIG_RT_USING_DFS_JFFS2 is not set
# CONFIG_RT_USING_DFS_NFS is not set # CONFIG_RT_USING_DFS_NFS is not set
# #
@ -118,6 +123,7 @@ CONFIG_RT_USING_DEVICE_IPC=y
CONFIG_RT_USING_SERIAL=y CONFIG_RT_USING_SERIAL=y
# CONFIG_RT_USING_CAN is not set # CONFIG_RT_USING_CAN is not set
# CONFIG_RT_USING_HWTIMER is not set # CONFIG_RT_USING_HWTIMER is not set
# CONFIG_RT_USING_CPUTIME is not set
CONFIG_RT_USING_I2C=y CONFIG_RT_USING_I2C=y
CONFIG_RT_USING_I2C_BITOPS=y CONFIG_RT_USING_I2C_BITOPS=y
CONFIG_RT_USING_PIN=y CONFIG_RT_USING_PIN=y
@ -191,33 +197,14 @@ CONFIG_SO_REUSE=1
CONFIG_LWIP_SO_RCVTIMEO=1 CONFIG_LWIP_SO_RCVTIMEO=1
CONFIG_LWIP_SO_SNDTIMEO=1 CONFIG_LWIP_SO_SNDTIMEO=1
CONFIG_LWIP_SO_RCVBUF=1 CONFIG_LWIP_SO_RCVBUF=1
# CONFIG_RT_LWIP_NETIF_LOOPBACK is not set
CONFIG_LWIP_NETIF_LOOPBACK=0
# #
# Modbus master and slave stack # Modbus master and slave stack
# #
# CONFIG_RT_USING_MODBUS is not set # CONFIG_RT_USING_MODBUS is not set
# CONFIG_LWIP_USING_DHCPD is not set # CONFIG_LWIP_USING_DHCPD is not set
# CONFIG_RT_USING_NETUTILS is not set
#
# RT-Thread UI Engine
#
CONFIG_RT_USING_GUIENGINE=y
CONFIG_RTGUI_NAME_MAX=16
# CONFIG_RTGUI_USING_TTF is not set
CONFIG_RTGUI_USING_FONT16=y
CONFIG_RTGUI_USING_FONT12=y
# CONFIG_RTGUI_USING_FONTHZ is not set
# CONFIG_RTGUI_IMAGE_XPM is not set
CONFIG_RTGUI_IMAGE_JPEG_NONE=y
# CONFIG_RTGUI_IMAGE_JPEG is not set
# CONFIG_RTGUI_IMAGE_TJPGD is not set
# CONFIG_RTGUI_IMAGE_PNG_NONE is not set
# CONFIG_RTGUI_IMAGE_PNG is not set
CONFIG_RTGUI_IMAGE_LODEPNG=y
# CONFIG_RTGUI_IMAGE_BMP is not set
CONFIG_RTGUI_IMAGE_CONTAINER=y
CONFIG_RTGUI_USING_DEMO=y
# #
# VBUS(Virtual Software BUS) # VBUS(Virtual Software BUS)
@ -230,15 +217,6 @@ CONFIG_RTGUI_USING_DEMO=y
# CONFIG_RT_USING_LOGTRACE is not set # CONFIG_RT_USING_LOGTRACE is not set
# CONFIG_RT_USING_RYM is not set # CONFIG_RT_USING_RYM is not set
#
# RT-Thread Senior Membership Packages
#
#
# system packages
#
# CONFIG_PKG_USING_FTL_SRC is not set
# #
# RT-Thread online packages # RT-Thread online packages
# #
@ -246,8 +224,22 @@ CONFIG_RTGUI_USING_DEMO=y
# #
# system packages # system packages
# #
# CONFIG_PKG_USING_PARTITION is not set
#
# RT-Thread GUI Engine
#
# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG is not set
# CONFIG_GUIENGINE_IMAGE_TJPGD is not set
# CONFIG_GUIENGINE_IMAGE_PNG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_PNG is not set
# CONFIG_GUIENGINE_IMAGE_LODEPNG is not set
# CONFIG_PKG_USING_GUIENGINE_V200 is not set
# CONFIG_PKG_USING_GUIENGINE_LATEST_VERSION is not set
# CONFIG_PKG_USING_PERSIMMON is not set # CONFIG_PKG_USING_PERSIMMON is not set
# CONFIG_PKG_USING_LWEXT4 is not set
# CONFIG_PKG_USING_PARTITION is not set
# CONFIG_PKG_USING_SQLITE is not set # CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set # CONFIG_PKG_USING_RTI is not set
@ -259,8 +251,26 @@ CONFIG_RTGUI_USING_DEMO=y
# CONFIG_PKG_USING_MONGOOSE is not set # CONFIG_PKG_USING_MONGOOSE is not set
# CONFIG_PKG_USING_WEBTERMINAL is not set # CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_CJSON is not set # CONFIG_PKG_USING_CJSON is not set
# CONFIG_PKG_USING_LJSON is not set
# CONFIG_PKG_USING_EZXML is not set # CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set # CONFIG_PKG_USING_NANOPB is not set
# CONFIG_PKG_USING_GAGENT_CLOUD is not set
#
# Wi-Fi
#
#
# Marvell WiFi
#
# CONFIG_PKG_USING_WLANMARVELL is not set
#
# Wiced WiFi
#
# CONFIG_PKG_USING_WLAN_WICED is not set
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
# #
# security packages # security packages
@ -293,11 +303,13 @@ CONFIG_RTGUI_USING_DEMO=y
# #
# CONFIG_PKG_USING_FASTLZ is not set # CONFIG_PKG_USING_FASTLZ is not set
# CONFIG_PKG_USING_MINILZO is not set # CONFIG_PKG_USING_MINILZO is not set
# CONFIG_PKG_USING_QUICKLZ is not set
# #
# example package: hello # example package: hello
# #
# CONFIG_PKG_USING_HELLO is not set # CONFIG_PKG_USING_HELLO is not set
# CONFIG_PKG_USING_MULTIBUTTON is not set
CONFIG_BOARD_X1000_REALBOARD=y CONFIG_BOARD_X1000_REALBOARD=y
# CONFIG_RT_USING_HARD_FLOAT is not set # CONFIG_RT_USING_HARD_FLOAT is not set
# CONFIG_BOARD_PHOENIX is not set # CONFIG_BOARD_PHOENIX is not set
@ -314,17 +326,12 @@ CONFIG_RT_MMCSD_STACK_SIZE=2048
CONFIG_RT_USING_I2C0=y CONFIG_RT_USING_I2C0=y
# CONFIG_RT_USING_I2C1 is not set # CONFIG_RT_USING_I2C1 is not set
# CONFIG_RT_USING_I2C2 is not set # CONFIG_RT_USING_I2C2 is not set
CONFIG_RT_USING_SLCD=y # CONFIG_RT_USING_ILI9488 is not set
CONFIG_RT_USING_ILI9488=y
# CONFIG_RT_USING_ILI9341 is not set # CONFIG_RT_USING_ILI9341 is not set
# CONFIG_RT_USING_OTM4802 is not set # CONFIG_RT_USING_OTM4802 is not set
# CONFIG_RT_USING_TRULY_TFT240240 is not set # CONFIG_RT_USING_TRULY_TFT240240 is not set
CONFIG_RT_USING_TOUCH=y # CONFIG_RT_USING_GT9XX is not set
CONFIG_RT_USING_GT9XX=y
# CONFIG_RT_USING_FT6x06 is not set # CONFIG_RT_USING_FT6x06 is not set
CONFIG_RT_TOUCH_THREAD_PRIORITY=10
CONFIG_RT_USING_AUDIO=y CONFIG_RT_USING_AUDIO=y
CONFIG_RT_USING_ICODEC=y CONFIG_RT_USING_ICODEC=y
CONFIG_RT_USING_CPU_FFS=y CONFIG_RT_USING_CPU_FFS=y
# CONFIG_WIFI_USING_AP6212 is not set
# CONFIG_WIFI_USING_AP6181 is not set

View File

@ -60,7 +60,7 @@ if RT_USING_I2C
default n default n
endif endif
if RT_USING_GUIENGINE if PKG_USING_GUIENGINE
config RT_USING_SLCD config RT_USING_SLCD
bool "Using LCD display" bool "Using LCD display"
default y default y

View File

@ -53,7 +53,7 @@ int cplusplus_system_init(void)
} }
#endif #endif
#ifdef RT_USING_GUIENGINE #ifdef PKG_USING_GUIENGINE
#include <rtgui/driver.h> #include <rtgui/driver.h>
int lcd_hw_init(void) int lcd_hw_init(void)
{ {

View File

@ -37,6 +37,7 @@
/* RT_USING_NOHEAP is not set */ /* RT_USING_NOHEAP is not set */
#define RT_USING_SMALL_MEM #define RT_USING_SMALL_MEM
/* RT_USING_SLAB is not set */ /* RT_USING_SLAB is not set */
/* RT_USING_MEMTRACE is not set */
#define RT_USING_HEAP #define RT_USING_HEAP
/* Kernel Device Object */ /* Kernel Device Object */
@ -54,6 +55,7 @@
#define RT_USING_COMPONENTS_INIT #define RT_USING_COMPONENTS_INIT
#define RT_USING_USER_MAIN #define RT_USING_USER_MAIN
#define RT_MAIN_THREAD_STACK_SIZE 2048
/* C++ features */ /* C++ features */
@ -62,7 +64,9 @@
/* Command shell */ /* Command shell */
#define RT_USING_FINSH #define RT_USING_FINSH
#define FINSH_THREAD_NAME "tshell"
#define FINSH_USING_HISTORY #define FINSH_USING_HISTORY
#define FINSH_HISTORY_LINES 5
#define FINSH_USING_SYMTAB #define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION #define FINSH_USING_DESCRIPTION
#define FINSH_THREAD_PRIORITY 20 #define FINSH_THREAD_PRIORITY 20
@ -101,6 +105,7 @@
/* RT_USING_DFS_ROMFS is not set */ /* RT_USING_DFS_ROMFS is not set */
/* RT_USING_DFS_RAMFS is not set */ /* RT_USING_DFS_RAMFS is not set */
/* RT_USING_DFS_UFFS is not set */ /* RT_USING_DFS_UFFS is not set */
/* RT_USING_DFS_JFFS2 is not set */
/* RT_USING_DFS_NFS is not set */ /* RT_USING_DFS_NFS is not set */
/* Device Drivers */ /* Device Drivers */
@ -109,6 +114,7 @@
#define RT_USING_SERIAL #define RT_USING_SERIAL
/* RT_USING_CAN is not set */ /* RT_USING_CAN is not set */
/* RT_USING_HWTIMER is not set */ /* RT_USING_HWTIMER is not set */
/* RT_USING_CPUTIME is not set */
#define RT_USING_I2C #define RT_USING_I2C
#define RT_USING_I2C_BITOPS #define RT_USING_I2C_BITOPS
#define RT_USING_PIN #define RT_USING_PIN
@ -176,31 +182,13 @@
#define LWIP_SO_RCVTIMEO 1 #define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_SNDTIMEO 1 #define LWIP_SO_SNDTIMEO 1
#define LWIP_SO_RCVBUF 1 #define LWIP_SO_RCVBUF 1
/* RT_LWIP_NETIF_LOOPBACK is not set */
#define LWIP_NETIF_LOOPBACK 0
/* Modbus master and slave stack */ /* Modbus master and slave stack */
/* RT_USING_MODBUS is not set */ /* RT_USING_MODBUS is not set */
/* LWIP_USING_DHCPD is not set */ /* LWIP_USING_DHCPD is not set */
/* RT_USING_NETUTILS is not set */
/* RT-Thread UI Engine */
#define RT_USING_GUIENGINE
#define RTGUI_NAME_MAX 16
/* RTGUI_USING_TTF is not set */
#define RTGUI_USING_FONT16
#define RTGUI_USING_FONT12
/* RTGUI_USING_FONTHZ is not set */
/* RTGUI_IMAGE_XPM is not set */
#define RTGUI_IMAGE_JPEG_NONE
/* RTGUI_IMAGE_JPEG is not set */
/* RTGUI_IMAGE_TJPGD is not set */
/* RTGUI_IMAGE_PNG_NONE is not set */
/* RTGUI_IMAGE_PNG is not set */
#define RTGUI_IMAGE_LODEPNG
/* RTGUI_IMAGE_BMP is not set */
#define RTGUI_IMAGE_CONTAINER
#define RTGUI_USING_DEMO
/* VBUS(Virtual Software BUS) */ /* VBUS(Virtual Software BUS) */
@ -211,18 +199,24 @@
/* RT_USING_LOGTRACE is not set */ /* RT_USING_LOGTRACE is not set */
/* RT_USING_RYM is not set */ /* RT_USING_RYM is not set */
/* RT-Thread Senior Membership Packages */
/* system packages */
/* PKG_USING_FTL_SRC is not set */
/* RT-Thread online packages */ /* RT-Thread online packages */
/* system packages */ /* system packages */
/* PKG_USING_PARTITION is not set */ /* RT-Thread GUI Engine */
/* PKG_USING_GUIENGINE is not set */
/* GUIENGINE_IMAGE_JPEG_NONE is not set */
/* GUIENGINE_IMAGE_JPEG is not set */
/* GUIENGINE_IMAGE_TJPGD is not set */
/* GUIENGINE_IMAGE_PNG_NONE is not set */
/* GUIENGINE_IMAGE_PNG is not set */
/* GUIENGINE_IMAGE_LODEPNG is not set */
/* PKG_USING_GUIENGINE_V200 is not set */
/* PKG_USING_GUIENGINE_LATEST_VERSION is not set */
/* PKG_USING_PERSIMMON is not set */ /* PKG_USING_PERSIMMON is not set */
/* PKG_USING_LWEXT4 is not set */
/* PKG_USING_PARTITION is not set */
/* PKG_USING_SQLITE is not set */ /* PKG_USING_SQLITE is not set */
/* PKG_USING_RTI is not set */ /* PKG_USING_RTI is not set */
@ -233,8 +227,22 @@
/* PKG_USING_MONGOOSE is not set */ /* PKG_USING_MONGOOSE is not set */
/* PKG_USING_WEBTERMINAL is not set */ /* PKG_USING_WEBTERMINAL is not set */
/* PKG_USING_CJSON is not set */ /* PKG_USING_CJSON is not set */
/* PKG_USING_LJSON is not set */
/* PKG_USING_EZXML is not set */ /* PKG_USING_EZXML is not set */
/* PKG_USING_NANOPB is not set */ /* PKG_USING_NANOPB is not set */
/* PKG_USING_GAGENT_CLOUD is not set */
/* Wi-Fi */
/* Marvell WiFi */
/* PKG_USING_WLANMARVELL is not set */
/* Wiced WiFi */
/* PKG_USING_WLAN_WICED is not set */
/* PKG_USING_COAP is not set */
/* PKG_USING_NOPOLL is not set */
/* security packages */ /* security packages */
@ -262,10 +270,12 @@
/* PKG_USING_FASTLZ is not set */ /* PKG_USING_FASTLZ is not set */
/* PKG_USING_MINILZO is not set */ /* PKG_USING_MINILZO is not set */
/* PKG_USING_QUICKLZ is not set */
/* example package: hello */ /* example package: hello */
/* PKG_USING_HELLO is not set */ /* PKG_USING_HELLO is not set */
/* PKG_USING_MULTIBUTTON is not set */
#define BOARD_X1000_REALBOARD #define BOARD_X1000_REALBOARD
/* RT_USING_HARD_FLOAT is not set */ /* RT_USING_HARD_FLOAT is not set */
/* BOARD_PHOENIX is not set */ /* BOARD_PHOENIX is not set */
@ -282,19 +292,14 @@
#define RT_USING_I2C0 #define RT_USING_I2C0
/* RT_USING_I2C1 is not set */ /* RT_USING_I2C1 is not set */
/* RT_USING_I2C2 is not set */ /* RT_USING_I2C2 is not set */
#define RT_USING_SLCD /* RT_USING_ILI9488 is not set */
#define RT_USING_ILI9488
/* RT_USING_ILI9341 is not set */ /* RT_USING_ILI9341 is not set */
/* RT_USING_OTM4802 is not set */ /* RT_USING_OTM4802 is not set */
/* RT_USING_TRULY_TFT240240 is not set */ /* RT_USING_TRULY_TFT240240 is not set */
#define RT_USING_TOUCH /* RT_USING_GT9XX is not set */
#define RT_USING_GT9XX
/* RT_USING_FT6x06 is not set */ /* RT_USING_FT6x06 is not set */
#define RT_TOUCH_THREAD_PRIORITY 10
#define RT_USING_AUDIO #define RT_USING_AUDIO
#define RT_USING_ICODEC #define RT_USING_ICODEC
#define RT_USING_CPU_FFS #define RT_USING_CPU_FFS
/* WIFI_USING_AP6212 is not set */
/* WIFI_USING_AP6181 is not set */
#endif #endif

View File

@ -28,8 +28,6 @@ source "$RTT_DIR/components/libc/Kconfig"
source "$RTT_DIR/components/net/Kconfig" source "$RTT_DIR/components/net/Kconfig"
source "$RTT_DIR/components/gui/Kconfig"
source "$RTT_DIR/components/vbus/Kconfig" source "$RTT_DIR/components/vbus/Kconfig"
source "$RTT_DIR/components/utilities/Kconfig" source "$RTT_DIR/components/utilities/Kconfig"

View File

@ -1,87 +0,0 @@
menu "RT-Thread UI Engine"
config RT_USING_GUIENGINE
bool "Enable UI Engine"
default n
if RT_USING_GUIENGINE
config RTGUI_NAME_MAX
int "The maximal size of name in GUI engine"
default 16
config RTGUI_USING_TTF
bool "Support TrueType font"
default n
if RTGUI_USING_TTF
config UTF8_TO_UNICODE
bool "Support UTF8 to UNICODE"
default n
endif
config RTGUI_USING_FONT16
bool "Support 16 height font"
default y
config RTGUI_USING_FONT12
bool "Support 12 height font"
default y
config RTGUI_USING_FONTHZ
bool "Support Chinese font"
default n
if RTGUI_USING_FONTHZ
config RTGUI_USING_HZ_BMP
bool "Use bitmap Chinese font"
default n
endif
config RTGUI_IMAGE_XPM
bool "Support XPM image format"
default n
choice
prompt "JPEG image format"
default RTGUI_IMAGE_JPEG_NONE
config RTGUI_IMAGE_JPEG_NONE
bool "No"
config RTGUI_IMAGE_JPEG
bool "with libjpeg"
config RTGUI_IMAGE_TJPGD
bool "with TJpgDec(Tiny JPEG Decompressor)"
endchoice
choice
prompt "PNG image format"
default RTGUI_IMAGE_LODEPNG
config RTGUI_IMAGE_PNG_NONE
bool "No"
config RTGUI_IMAGE_PNG
bool "with libpng"
config RTGUI_IMAGE_LODEPNG
bool "with LodePNG"
endchoice
config RTGUI_IMAGE_BMP
bool "Support BMP image format"
default n
config RTGUI_IMAGE_CONTAINER
bool "Use image container"
default y
config RTGUI_USING_DEMO
bool "Enable the example of UI Engine"
default n
endif
endmenu

View File

@ -1,3 +0,0 @@
# RT-Thread GUI Engine

View File

@ -1,16 +0,0 @@
# RT-Thread building script for bridge
import os
from building import *
cwd = GetCurrentDir()
objs = []
list = os.listdir(cwd)
if GetDepend('RT_USING_GUIENGINE'):
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')

View File

@ -1,10 +0,0 @@
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd]
group = DefineGroup('gui_demo', src, depend = ['RT_USING_GUIENGINE', 'RTGUI_USING_DEMO'], CPPPATH = CPPPATH)
Return('group')

View File

@ -1,126 +0,0 @@
#include <rtthread.h>
#if defined(RT_USING_GUIENGINE) && defined(RTGUI_USING_DEMO)
#include <rtgui/rtgui.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/rtgui_app.h>
#include <rtgui/image.h>
#include <rtgui/widgets/window.h>
#include <rtgui/dc.h>
extern const unsigned char _picture_png[];
extern int _picture_png_length_get(void);
static rt_bool_t show_demo(struct rtgui_win *win)
{
struct rtgui_dc *dc;
rtgui_rect_t rect;
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(win));
if (dc == RT_NULL)
{
rt_kprintf("dc is null \n");
return RT_FALSE;
}
rtgui_dc_get_rect(dc, &rect);
/* draw circular */
{
rt_int16_t x, y, r;
x = rect.x2 / 2 / 2;
y = rect.y2 / 2 / 2;
r = x > y ? y : x;
r -= y / 10;
rtgui_dc_draw_circle(dc, x, y, r);
}
/* draw image */
{
rtgui_rect_t draw_rect;
struct rtgui_image *img;
img = rtgui_image_create_from_mem("png", _picture_png, _picture_png_length_get(), RT_TRUE);
if (img != RT_NULL)
{
draw_rect.x1 = rect.x2 / 2 + (rect.x2 / 2 - img->w) / 2;
draw_rect.y1 = (rect.y2 / 2 - img->h) / 2;
draw_rect.x2 = draw_rect.x1 + img->w;
draw_rect.y2 = draw_rect.y1 + img->h;
rtgui_image_blit(img, dc, &draw_rect);
}
}
/* draw text */
{
rtgui_color_t fc;
rtgui_rect_t draw_rect;
char *text_buf = "Hello RT-thread!";
fc = RTGUI_DC_FC(dc);
RTGUI_DC_FC(dc) = RED;
draw_rect.x1 = rect.x2 * 2 / 5;
draw_rect.y1 = rect.y2 * 3 / 4;
draw_rect.x2 = rect.x2;
draw_rect.y2 = rect.y2;
rtgui_dc_draw_text(dc, text_buf, &draw_rect);
RTGUI_DC_FC(dc) = fc;
}
rtgui_dc_end_drawing(dc, RT_TRUE);
return RT_TRUE;
}
rt_bool_t dc_event_handler(struct rtgui_object *object, rtgui_event_t *event)
{
rt_bool_t err;
struct rtgui_win *win = RTGUI_WIN(object);
err = rtgui_win_event_handler(RTGUI_OBJECT(win), event);
if (event->type == RTGUI_EVENT_PAINT)
show_demo(win);
return err;
}
static void rt_gui_demo_entry(void *parameter)
{
struct rtgui_win *main_win;
struct rtgui_app *app;
/* create gui app */
app = rtgui_app_create("gui_demo");
if (app == RT_NULL)
return;
main_win = rtgui_mainwin_create(RT_NULL, "UiWindow", RTGUI_WIN_STYLE_NO_TITLE);
if (main_win == RT_NULL)
{
rtgui_app_destroy(app);
return;
}
rtgui_object_set_event_handler(RTGUI_OBJECT(main_win), dc_event_handler);
rtgui_win_show(main_win, RT_FALSE);
rtgui_app_run(app);
rtgui_win_destroy(main_win);
rtgui_app_destroy(app);
}
int rt_gui_demo_init(void)
{
rt_thread_t tid;
tid = rt_thread_create("mygui",
rt_gui_demo_entry, RT_NULL,
2048, 25, 10);
if (tid != RT_NULL)
rt_thread_startup(tid);
return 0;
}
INIT_APP_EXPORT(rt_gui_demo_init);
#endif /* RT_USING_RTGUI */

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +0,0 @@
# RT-Thread building script for gui
from building import *
cwd = GetCurrentDir()
src = Glob('*.c') + Glob('*.cpp')
CPPPATH = [ cwd,
cwd + '/rtgui',
cwd + '/rtgui/widgets']
group = DefineGroup('GuiEngine', src, depend = [''], CPPPATH = CPPPATH)
Return('group')

View File

@ -1,224 +0,0 @@
/*
* File : blit.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2013-10-04 Bernard porting SDL software render to RT-Thread GUI
*/
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef __RTGUI_BLIT_H__
#define __RTGUI_BLIT_H__
#include <rtgui/rtgui.h>
#include <rtgui/dc.h>
/* Assemble R-G-B values into a specified pixel format and store them */
#define RGB565_FROM_RGB(Pixel, r, g, b) \
{ \
Pixel = ((r>>3)<<11)|((g>>2)<<5)|(b>>3); \
}
#define BGR565_FROM_RGB(Pixel, r, g, b) \
{ \
Pixel = ((b>>3)<<11)|((g>>2)<<5)|(r>>3); \
}
#define RGB555_FROM_RGB(Pixel, r, g, b) \
{ \
Pixel = ((r>>3)<<10)|((g>>3)<<5)|(b>>3); \
}
#define RGB888_FROM_RGB(Pixel, r, g, b) \
{ \
Pixel = (r<<16)|(g<<8)|b; \
}
#define ARGB8888_FROM_RGBA(Pixel, r, g, b, a) \
{ \
Pixel = (a<<24)|(r<<16)|(g<<8)|b; \
}
#define RGBA8888_FROM_RGBA(Pixel, r, g, b, a) \
{ \
Pixel = (r<<24)|(g<<16)|(b<<8)|a; \
}
#define ABGR8888_FROM_RGBA(Pixel, r, g, b, a) \
{ \
Pixel = (a<<24)|(b<<16)|(g<<8)|r; \
}
#define BGRA8888_FROM_RGBA(Pixel, r, g, b, a) \
{ \
Pixel = (b<<24)|(g<<16)|(r<<8)|a; \
}
#define ARGB2101010_FROM_RGBA(Pixel, r, g, b, a) \
{ \
r = r ? ((r << 2) | 0x3) : 0; \
g = g ? ((g << 2) | 0x3) : 0; \
b = b ? ((b << 2) | 0x3) : 0; \
a = (a * 3) / 255; \
Pixel = (a<<30)|(r<<20)|(g<<10)|b; \
}
/* Load pixel of the specified format from a buffer and get its R-G-B values */
#define RGB_FROM_RGB565(Pixel, r, g, b) \
{ \
r = rtgui_blit_expand_byte[3][((Pixel&0xF800)>>11)]; \
g = rtgui_blit_expand_byte[2][((Pixel&0x07E0)>>5)]; \
b = rtgui_blit_expand_byte[3][(Pixel&0x001F)]; \
}
#define RGB_FROM_BGR565(Pixel, r, g, b) \
{ \
b = rtgui_blit_expand_byte[3][((Pixel&0xF800)>>11)]; \
g = rtgui_blit_expand_byte[2][((Pixel&0x07E0)>>5)]; \
r = rtgui_blit_expand_byte[3][(Pixel&0x001F)]; \
}
#define RGB_FROM_RGB555(Pixel, r, g, b) \
{ \
r = rtgui_blit_expand_byte[3][((Pixel&0x7C00)>>10)]; \
g = rtgui_blit_expand_byte[3][((Pixel&0x03E0)>>5)]; \
b = rtgui_blit_expand_byte[3][(Pixel&0x001F)]; \
}
#define RGB_FROM_RGB888(Pixel, r, g, b) \
{ \
r = ((Pixel&0xFF0000)>>16); \
g = ((Pixel&0xFF00)>>8); \
b = (Pixel&0xFF); \
}
#define RGBA_FROM_RGBA8888(Pixel, r, g, b, a) \
{ \
r = (Pixel>>24); \
g = ((Pixel>>16)&0xFF); \
b = ((Pixel>>8)&0xFF); \
a = (Pixel&0xFF); \
}
#define RGBA_FROM_ARGB8888(Pixel, r, g, b, a) \
{ \
r = ((Pixel>>16)&0xFF); \
g = ((Pixel>>8)&0xFF); \
b = (Pixel&0xFF); \
a = (Pixel>>24); \
}
#define RGBA_FROM_ABGR8888(Pixel, r, g, b, a) \
{ \
r = (Pixel&0xFF); \
g = ((Pixel>>8)&0xFF); \
b = ((Pixel>>16)&0xFF); \
a = (Pixel>>24); \
}
#define RGBA_FROM_BGRA8888(Pixel, r, g, b, a) \
{ \
r = ((Pixel>>8)&0xFF); \
g = ((Pixel>>16)&0xFF); \
b = (Pixel>>24); \
a = (Pixel&0xFF); \
}
#define RGBA_FROM_ARGB2101010(Pixel, r, g, b, a) \
{ \
r = ((Pixel>>22)&0xFF); \
g = ((Pixel>>12)&0xFF); \
b = ((Pixel>>2)&0xFF); \
a = rtgui_blit_expand_byte[6][(Pixel>>30)]; \
}
/* 4-times unrolled loop */
#define DUFFS_LOOP4(pixel_copy_increment, width) \
{ int n = (width+3)/4; \
switch (width & 3) { \
case 0: do { pixel_copy_increment; \
case 3: pixel_copy_increment; \
case 2: pixel_copy_increment; \
case 1: pixel_copy_increment; \
} while (--n > 0); \
} \
}
/* 8-times unrolled loop */
#define DUFFS_LOOP8(pixel_copy_increment, width) \
{ int n = (width+7)/8; \
switch (width & 7) { \
case 0: do { pixel_copy_increment; \
case 7: pixel_copy_increment; \
case 6: pixel_copy_increment; \
case 5: pixel_copy_increment; \
case 4: pixel_copy_increment; \
case 3: pixel_copy_increment; \
case 2: pixel_copy_increment; \
case 1: pixel_copy_increment; \
} while ( --n > 0 ); \
} \
}
/* Use the 8-times version of the loop by default */
#define DUFFS_LOOP(pixel_copy_increment, width) \
DUFFS_LOOP8(pixel_copy_increment, width)
struct rtgui_blit_info
{
rt_uint8_t *src;
int src_w, src_h;
int src_pitch;
int src_skip;
rt_uint8_t *dst;
int dst_w, dst_h;
int dst_pitch;
int dst_skip;
rt_uint8_t src_fmt;
rt_uint8_t dst_fmt;
rt_uint8_t r, g, b, a;
};
struct rtgui_image_info
{
rt_uint8_t *pixels;
int src_pitch;
rt_uint8_t src_fmt;
rt_uint8_t a;
};
extern const rt_uint8_t* rtgui_blit_expand_byte[9];
typedef void (*rtgui_blit_line_func)(rt_uint8_t *dst, rt_uint8_t *src, int line);
rtgui_blit_line_func rtgui_blit_line_get(int dst_bpp, int src_bpp);
rtgui_blit_line_func rtgui_blit_line_get_inv(int dst_bpp, int src_bpp);
void rtgui_blit(struct rtgui_blit_info * info);
void rtgui_image_info_blit(struct rtgui_image_info* image, struct rtgui_dc* dc, struct rtgui_rect *dc_rect);
#endif

View File

@ -1,192 +0,0 @@
/*
* File : color.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
* 2012-01-24 onelife add mono color support
*/
#ifndef __RTGUI_COLOR_H__
#define __RTGUI_COLOR_H__
#include <rtgui/rtgui.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The color used in the GUI:
*
* bit bit
* RGB565 15 R,G,B 0
* BGR565 15 B,G,R 0
* RGB888 23 R,G,B 0
* ARGB888 31 A,R,G,B 0
* RGBA888 31 R,G,B,A 0
* ABGR888 31 A,B,G,R 0
*
* The rtgui_color is defined as ARGB888.
* bit31 A,R,G,B bit0
*/
#define RTGUI_ARGB(a, r, g, b) \
((rtgui_color_t)(((rt_uint8_t)(b)|\
(((unsigned long)(rt_uint8_t)(g))<<8))|\
(((unsigned long)(rt_uint8_t)(r))<<16)|\
(((unsigned long)(rt_uint8_t)(a))<<24)))
#define RTGUI_RGB(r, g, b) RTGUI_ARGB(255, (r), (g), (b))
#define RTGUI_RGB_B(c) ((c) & 0xff)
#define RTGUI_RGB_G(c) (((c) >> 8) & 0xff)
#define RTGUI_RGB_R(c) (((c) >> 16) & 0xff)
#define RTGUI_RGB_A(c) (((c) >> 24) & 0xff)
extern const rtgui_color_t default_foreground;
extern const rtgui_color_t default_background;
/* it's better use these color definitions */
#define RED RTGUI_RGB(0xff, 0x00, 0x00)
#define GREEN RTGUI_RGB(0x00, 0xff, 0x00)
#define BLUE RTGUI_RGB(0x00, 0x00, 0xff)
#define BLACK RTGUI_RGB(0x00, 0x00, 0x00)
#define WHITE RTGUI_RGB(0xff, 0xff, 0xff)
#define HIGH_LIGHT RTGUI_RGB(0xfc, 0xfc, 0xfc)
#define DARK_GREY RTGUI_RGB(0x7f, 0x7f, 0x7f)
#define LIGHT_GREY RTGUI_RGB(0xc0, 0xc0, 0xc0)
#ifdef TRANSPARENT
#undef TRANSPARENT
#endif
#define TRANSPARENT RTGUI_ARGB(0, 0, 0, 0)
extern const rtgui_color_t red;
extern const rtgui_color_t green;
extern const rtgui_color_t blue;
extern const rtgui_color_t black;
extern const rtgui_color_t white;
extern const rtgui_color_t high_light;
extern const rtgui_color_t dark_grey;
extern const rtgui_color_t light_grey;
/*
* RTGUI default color format: ARGB
* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB
* 31 0
*/
/* convert rtgui color to mono */
rt_inline rt_uint8_t rtgui_color_to_mono(rtgui_color_t c)
{
rt_uint8_t pixel;
pixel = (RTGUI_RGB_R(c) | RTGUI_RGB_G(c) | RTGUI_RGB_B(c)) ? 0x01 : 0x00;
return pixel;
}
rt_inline rtgui_color_t rtgui_color_from_mono(rt_uint8_t pixel)
{
rtgui_color_t color;
if (pixel)
{
color = white;
}
else
{
color = black;
}
return color;
}
/* convert rtgui color to RRRRRGGGGGGBBBBB */
rt_inline rt_uint16_t rtgui_color_to_565(rtgui_color_t c)
{
rt_uint16_t pixel;
pixel = (rt_uint16_t)(((RTGUI_RGB_R(c) >> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_B(c) >> 3));
return pixel;
}
rt_inline rtgui_color_t rtgui_color_from_565(rt_uint16_t pixel)
{
rt_uint16_t r, g, b;
rtgui_color_t color;
r = (pixel >> 11) & 0x1f;
g = (pixel >> 5) & 0x3f;
b = pixel & 0x1f;
color = b * 255 / 31 + ((g * 255 / 63) << 8) + ((r * 255 / 31) << 16);
return color;
}
/* convert rtgui color to BBBBBGGGGGGRRRRR */
rt_inline rt_uint16_t rtgui_color_to_565p(rtgui_color_t c)
{
rt_uint16_t pixel;
pixel = (rt_uint16_t)(((RTGUI_RGB_B(c) >> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_R(c) >> 3));
return pixel;
}
rt_inline rtgui_color_t rtgui_color_from_565p(rt_uint16_t pixel)
{
rt_uint8_t r, g, b;
rtgui_color_t color;
r = pixel & 0x1f;
g = (pixel >> 5) & 0x3f;
b = (pixel >> 11) & 0x1f;
color = b * 255 / 31 + ((g * 255 / 63) << 8) + ((r * 255 / 31) << 16);
return color;
}
/* convert rtgui color to RGB */
rt_inline rt_uint32_t rtgui_color_to_888(rtgui_color_t c)
{
rt_uint32_t pixel;
pixel = RTGUI_RGB_R(c) << 16 | RTGUI_RGB_G(c) << 8 | RTGUI_RGB_B(c);
return pixel;
}
rt_inline rtgui_color_t rtgui_color_from_888(rt_uint32_t pixel)
{
rtgui_color_t color;
color = RTGUI_RGB(((pixel >> 16) & 0xff), ((pixel >> 8) & 0xff), pixel & 0xff);
return color;
}
/* get the bits of specified pixle format */
rt_uint8_t rtgui_color_get_bits(rt_uint8_t pixel_format) RTGUI_PURE;
/* get the bytes of specified pixle format */
rt_uint8_t rtgui_color_get_bpp(rt_uint8_t pixel_format) RTGUI_PURE;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,299 +0,0 @@
/*
* File : dc.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __RTGUI_DC_H__
#define __RTGUI_DC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <rtgui/rtgui.h>
#include <rtgui/font.h>
#include <rtgui/driver.h>
#include <rtgui/widgets/widget.h>
#define RTGUI_DC(dc) ((struct rtgui_dc*)(dc))
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
enum rtgui_dc_type
{
RTGUI_DC_HW,
RTGUI_DC_CLIENT,
RTGUI_DC_BUFFER,
};
struct rtgui_dc_engine
{
/* interface */
void (*draw_point)(struct rtgui_dc *dc, int x, int y);
void (*draw_color_point)(struct rtgui_dc *dc, int x, int y, rtgui_color_t color);
void (*draw_vline)(struct rtgui_dc *dc, int x, int y1, int y2);
void (*draw_hline)(struct rtgui_dc *dc, int x1, int x2, int y);
void (*fill_rect)(struct rtgui_dc *dc, rtgui_rect_t *rect);
void (*blit_line)(struct rtgui_dc *dc, int x1, int x2, int y, rt_uint8_t *line_data);
void (*blit)(struct rtgui_dc *dc, struct rtgui_point *dc_point, struct rtgui_dc *dest, rtgui_rect_t *rect);
rt_bool_t (*fini)(struct rtgui_dc *dc);
};
/*
* The abstract device context
*
* Normally, a DC is a drawable canvas, user can draw point/line/cycle etc
* on the DC.
*
* There are several kinds of DC:
* - Hardware DC;
* - Client DC;
* - Buffer DC;
*/
struct rtgui_dc
{
/* type of device context */
rt_uint32_t type;
/* dc engine */
const struct rtgui_dc_engine *engine;
};
/*
* The hardware device context
*
* The hardware DC is a context based on hardware device, for examle the
* LCD device. The operations on the hardware DC are reflected to the real
* hardware.
*
*/
struct rtgui_dc_hw
{
struct rtgui_dc parent;
rtgui_widget_t *owner;
const struct rtgui_graphic_driver *hw_driver;
};
/**
* The buffer dc is a device context with memory buffer.
*
* All the operations on this device context is reflected to the memory buffer.
*/
struct rtgui_dc_buffer
{
struct rtgui_dc parent;
/* graphic context */
rtgui_gc_t gc;
/* pixel format */
rt_uint8_t pixel_format;
rt_uint8_t blend_mode; /* RTGUI_BLENDMODE: None/Blend/Add/Mod */
/* width and height */
rt_uint16_t width, height;
/* pitch */
rt_uint16_t pitch;
#ifdef RTGUI_IMAGE_CONTAINER
/* image dc */
struct rtgui_image_item *image_item;
#endif
/* pixel alpha */
rt_uint8_t pixel_alpha;
/* pixel data */
rt_uint8_t *pixel;
};
#define RTGUI_DC_FC(dc) (rtgui_dc_get_gc(RTGUI_DC(dc))->foreground)
#define RTGUI_DC_BC(dc) (rtgui_dc_get_gc(RTGUI_DC(dc))->background)
#define RTGUI_DC_FONT(dc) (rtgui_dc_get_gc(RTGUI_DC(dc))->font)
#define RTGUI_DC_TEXTALIGN(dc) (rtgui_dc_get_gc(RTGUI_DC(dc))->textalign)
/* create a buffer dc */
struct rtgui_dc *rtgui_dc_buffer_create(int width, int height);
struct rtgui_dc *rtgui_dc_buffer_create_pixformat(rt_uint8_t pixel_format, int w, int h);
#ifdef RTGUI_IMAGE_CONTAINER
struct rtgui_dc *rtgui_img_dc_create_pixformat(rt_uint8_t pixel_format, rt_uint8_t *pixel,
struct rtgui_image_item *image_item);
#endif
struct rtgui_dc *rtgui_dc_buffer_create_from_dc(struct rtgui_dc* dc);
void rtgui_dc_buffer_set_alpha(struct rtgui_dc* dc, rt_uint8_t pixel_alpha);
/* create a widget dc */
struct rtgui_dc *rtgui_dc_widget_create(struct rtgui_widget * owner);
/* begin and end a drawing */
struct rtgui_dc *rtgui_dc_begin_drawing(rtgui_widget_t *owner);
void rtgui_dc_end_drawing(struct rtgui_dc *dc, rt_bool_t update);
/* destroy a dc */
void rtgui_dc_destory(struct rtgui_dc *dc);
/* create a hardware dc */
struct rtgui_dc *rtgui_dc_hw_create(rtgui_widget_t *owner);
/* create a client dc */
struct rtgui_dc *rtgui_dc_client_create(rtgui_widget_t *owner);
void rtgui_dc_client_init(rtgui_widget_t *owner);
rt_uint8_t *rtgui_dc_buffer_get_pixel(struct rtgui_dc *dc);
void rtgui_dc_draw_line(struct rtgui_dc *dc, int x1, int y1, int x2, int y2);
void rtgui_dc_draw_rect(struct rtgui_dc *dc, struct rtgui_rect *rect);
void rtgui_dc_fill_rect_forecolor(struct rtgui_dc *dc, struct rtgui_rect *rect);
void rtgui_dc_draw_round_rect(struct rtgui_dc *dc, struct rtgui_rect *rect, int r);
void rtgui_dc_fill_round_rect(struct rtgui_dc *dc, struct rtgui_rect *rect, int r);
/** Fill a vertical gradient rect from @c1 to @c2 */
void rtgui_dc_fill_gradient_rectv(struct rtgui_dc *dc, rtgui_rect_t *rect,
rtgui_color_t c1, rtgui_color_t c2);
void rtgui_dc_draw_annulus(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t r1, rt_int16_t r2, rt_int16_t start, rt_int16_t end);
void rtgui_dc_draw_pie(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t r, rt_int16_t start, rt_int16_t end);
void rtgui_dc_fill_pie(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t r, rt_int16_t start, rt_int16_t end);
void rtgui_dc_draw_text(struct rtgui_dc *dc, const char *text, struct rtgui_rect *rect);
void rtgui_dc_draw_text_stroke(struct rtgui_dc *dc, const char *text, struct rtgui_rect *rect,
rtgui_color_t color_stroke, rtgui_color_t color_core);
void rtgui_dc_draw_mono_bmp(struct rtgui_dc *dc, int x, int y, int w, 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);
void rtgui_dc_draw_word(struct rtgui_dc *dc, int x, int y, int h, const rt_uint8_t *data);
void rtgui_dc_draw_border(struct rtgui_dc *dc, rtgui_rect_t *rect, int flag);
void rtgui_dc_draw_horizontal_line(struct rtgui_dc *dc, int x1, int x2, int y);
void rtgui_dc_draw_vertical_line(struct rtgui_dc *dc, int x, int y1, int y2);
void rtgui_dc_draw_focus_rect(struct rtgui_dc *dc, rtgui_rect_t *rect);
void rtgui_dc_draw_polygon(struct rtgui_dc *dc, const int *vx, const int *vy, int count);
void rtgui_dc_fill_polygon(struct rtgui_dc *dc, const int *vx, const int *vy, int count);
void rtgui_dc_draw_circle(struct rtgui_dc *dc, int x, int y, int r);
void rtgui_dc_fill_circle(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t r);
void rtgui_dc_draw_arc(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t r, rt_int16_t start, rt_int16_t end);
void rtgui_dc_draw_ellipse(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t rx, rt_int16_t ry);
void rtgui_dc_fill_ellipse(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t rx, rt_int16_t ry);
/* alpha blending functions */
void rtgui_dc_draw_aa_line(struct rtgui_dc * dst,int x1,int y1,int x2,int y2);
void rtgui_dc_draw_aa_lines(struct rtgui_dc * dst,const struct rtgui_point * points,int count);
void rtgui_dc_blend_point(struct rtgui_dc * dst,int x,int y,enum RTGUI_BLENDMODE blendMode,rt_uint8_t r,rt_uint8_t g,rt_uint8_t b,rt_uint8_t a);
void rtgui_dc_blend_points(struct rtgui_dc * dst,const rtgui_point_t * points,int count,enum RTGUI_BLENDMODE blendMode,rt_uint8_t r,rt_uint8_t g,rt_uint8_t b,rt_uint8_t a);
void rtgui_dc_blend_line(struct rtgui_dc * dst,int x1,int y1,int x2,int y2,enum RTGUI_BLENDMODE blendMode,rtgui_color_t color);
void rtgui_dc_blend_lines(struct rtgui_dc * dst,const rtgui_point_t * points,int count,enum RTGUI_BLENDMODE blendMode,rtgui_color_t color);
void rtgui_dc_blend_fill_rect(struct rtgui_dc * dst,const rtgui_rect_t * rect,enum RTGUI_BLENDMODE blendMode,rtgui_color_t color);
void rtgui_dc_blend_fill_rects(struct rtgui_dc * dst,const rtgui_rect_t * rects,int count,enum RTGUI_BLENDMODE blendMode,rtgui_color_t color);
void rtgui_dc_draw_aa_circle(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t r);
void rtgui_dc_draw_aa_ellipse(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t rx, rt_int16_t ry);
int rtgui_dc_draw_thick_line(struct rtgui_dc * dst, rt_int16_t x1, rt_int16_t y1, rt_int16_t x2, rt_int16_t y2, rt_uint8_t width);
/*
* dc inline function
*
* Note:
* In order to improve drawing speed, put most of common function of dc to inline
*/
/*
* draw a point on dc
*/
rt_inline void rtgui_dc_draw_point(struct rtgui_dc *dc, int x, int y)
{
dc->engine->draw_point(dc, x, y);
}
/*
* draw a color point on dc
*/
rt_inline void rtgui_dc_draw_color_point(struct rtgui_dc *dc, int x, int y, rtgui_color_t color)
{
dc->engine->draw_color_point(dc, x, y, color);
}
/*
* draw a vertical line on dc
*/
rt_inline void rtgui_dc_draw_vline(struct rtgui_dc *dc, int x, int y1, int y2)
{
dc->engine->draw_vline(dc, x, y1, y2);
}
/*
* draw a horizontal line on dc
*/
rt_inline void rtgui_dc_draw_hline(struct rtgui_dc *dc, int x1, int x2, int y)
{
dc->engine->draw_hline(dc, x1, x2, y);
}
/*
* fill a rect with background color
*/
rt_inline void rtgui_dc_fill_rect(struct rtgui_dc *dc, struct rtgui_rect *rect)
{
dc->engine->fill_rect(dc, rect);
}
/*
* blit a dc (x, y) on another dc(rect)
*/
rt_inline void rtgui_dc_blit(struct rtgui_dc *dc, struct rtgui_point *dc_point, struct rtgui_dc *dest, rtgui_rect_t *rect)
{
dc->engine->blit(dc, dc_point, dest, rect);
}
/* set gc of dc */
void rtgui_dc_set_gc(struct rtgui_dc *dc, rtgui_gc_t *gc);
/* get gc of dc */
rtgui_gc_t *rtgui_dc_get_gc(struct rtgui_dc *dc);
/* get visible status of dc */
rt_bool_t rtgui_dc_get_visible(struct rtgui_dc *dc);
/* get rect of dc */
void rtgui_dc_get_rect(struct rtgui_dc *dc, rtgui_rect_t *rect);
/* get pixel format */
rt_uint8_t rtgui_dc_get_pixel_format(struct rtgui_dc *dc);
/* coordinate conversion */
void rtgui_dc_logic_to_device(struct rtgui_dc* dc, struct rtgui_point *point);
void rtgui_dc_rect_to_device(struct rtgui_dc* dc, struct rtgui_rect* rect);
/* dc rotation and zoom operations */
struct rtgui_dc *rtgui_dc_shrink(struct rtgui_dc *dc, int factorx, int factory);
struct rtgui_dc *rtgui_dc_zoom(struct rtgui_dc *dc, double zoomx, double zoomy, int smooth);
struct rtgui_dc *rtgui_dc_rotozoom(struct rtgui_dc *dc, double angle, double zoomx, double zoomy, int smooth);
/* dc buffer dump to file */
void rtgui_dc_buffer_dump(struct rtgui_dc *self, char *fn);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,551 +0,0 @@
/*
* File : dc_draw.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2013-10-04 Bernard porting SDL software render to RT-Thread GUI
*/
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef __DC_DRAW_H__
#define __DC_DRAW_H__
#include <rtgui/blit.h>
/* This code assumes that r, g, b, a are the source color,
* and in the blend and add case, the RGB values are premultiplied by a.
*/
#define DRAW_MUL(_a, _b) (((unsigned)(_a)*(_b))/256)
#define DRAW_FASTSETPIXEL(type) \
*pixel = (type) color
#define DRAW_FASTSETPIXEL1 DRAW_FASTSETPIXEL(rt_uint8_t)
#define DRAW_FASTSETPIXEL2 DRAW_FASTSETPIXEL(rt_uint16_t)
#define DRAW_FASTSETPIXEL4 DRAW_FASTSETPIXEL(rt_uint32_t)
#define DRAW_FASTSETPIXELXY(x, y, type, bpp, color) \
*(type *)(_dc_get_pixel(dst, x, y))= (type) color
#define DRAW_FASTSETPIXELXY1(x, y) DRAW_FASTSETPIXELXY(x, y, rt_uint8_t, 1, color)
#define DRAW_FASTSETPIXELXY2(x, y) DRAW_FASTSETPIXELXY(x, y, rt_uint16_t, 2, color)
#define DRAW_FASTSETPIXELXY4(x, y) DRAW_FASTSETPIXELXY(x, y, rt_uint32_t, 4, color)
#define DRAW_SETPIXEL(setpixel) \
do { \
unsigned sr = r, sg = g, sb = b, sa = a; (void) sa; \
setpixel; \
} while (0)
#define DRAW_SETPIXEL_BLEND(getpixel, setpixel) \
do { \
unsigned sr, sg, sb, sa; (void) sa; \
getpixel; \
sr = DRAW_MUL(inva, sr) + r; \
sg = DRAW_MUL(inva, sg) + g; \
sb = DRAW_MUL(inva, sb) + b; \
setpixel; \
} while (0)
#define DRAW_SETPIXEL_ADD(getpixel, setpixel) \
do { \
unsigned sr, sg, sb, sa; (void) sa; \
getpixel; \
sr += r; if (sr > 0xff) sr = 0xff; \
sg += g; if (sg > 0xff) sg = 0xff; \
sb += b; if (sb > 0xff) sb = 0xff; \
setpixel; \
} while (0)
#define DRAW_SETPIXEL_MOD(getpixel, setpixel) \
do { \
unsigned sr, sg, sb, sa; (void) sa; \
getpixel; \
sr = DRAW_MUL(sr, r); \
sg = DRAW_MUL(sg, g); \
sb = DRAW_MUL(sb, b); \
setpixel; \
} while (0)
#define DRAW_SETPIXELXY(x, y, type, bpp, op) \
do { \
type *pixel = (type *)(_dc_get_pixel(dst, x, y));\
op; \
} while (0)
/*
* Define draw operators for RGB555
*/
#define DRAW_SETPIXEL_RGB555 \
DRAW_SETPIXEL(RGB555_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_BLEND_RGB555 \
DRAW_SETPIXEL_BLEND(RGB_FROM_RGB555(*pixel, sr, sg, sb), \
RGB555_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_ADD_RGB555 \
DRAW_SETPIXEL_ADD(RGB_FROM_RGB555(*pixel, sr, sg, sb), \
RGB555_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_MOD_RGB555 \
DRAW_SETPIXEL_MOD(RGB_FROM_RGB555(*pixel, sr, sg, sb), \
RGB555_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXELXY_RGB555(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_RGB555)
#define DRAW_SETPIXELXY_BLEND_RGB555(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_BLEND_RGB555)
#define DRAW_SETPIXELXY_ADD_RGB555(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_ADD_RGB555)
#define DRAW_SETPIXELXY_MOD_RGB555(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_MOD_RGB555)
/*
* Define draw operators for RGB565
*/
#define DRAW_SETPIXEL_RGB565 \
DRAW_SETPIXEL(RGB565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_BLEND_RGB565 \
DRAW_SETPIXEL_BLEND(RGB_FROM_RGB565(*pixel, sr, sg, sb), \
RGB565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_ADD_RGB565 \
DRAW_SETPIXEL_ADD(RGB_FROM_RGB565(*pixel, sr, sg, sb), \
RGB565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_MOD_RGB565 \
DRAW_SETPIXEL_MOD(RGB_FROM_RGB565(*pixel, sr, sg, sb), \
RGB565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXELXY_RGB565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_RGB565)
#define DRAW_SETPIXELXY_BLEND_RGB565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_BLEND_RGB565)
#define DRAW_SETPIXELXY_ADD_RGB565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_ADD_RGB565)
#define DRAW_SETPIXELXY_MOD_RGB565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_MOD_RGB565)
/*
* Define draw operators for BGR565
*/
#define DRAW_SETPIXEL_BGR565 \
DRAW_SETPIXEL(BGR565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_BLEND_BGR565 \
DRAW_SETPIXEL_BLEND(RGB_FROM_BGR565(*pixel, sr, sg, sb), \
BGR565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_ADD_BGR565 \
DRAW_SETPIXEL_ADD(RGB_FROM_BGR565(*pixel, sr, sg, sb), \
BGR565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_MOD_BGR565 \
DRAW_SETPIXEL_MOD(RGB_FROM_BGR565(*pixel, sr, sg, sb), \
BGR565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXELXY_BGR565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_BGR565)
#define DRAW_SETPIXELXY_BLEND_BGR565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_BLEND_BGR565)
#define DRAW_SETPIXELXY_ADD_BGR565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_ADD_BGR565)
#define DRAW_SETPIXELXY_MOD_BGR565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_MOD_BGR565)
/*
* Define draw operators for RGB888
*/
#define DRAW_SETPIXEL_RGB888 \
DRAW_SETPIXEL(RGB888_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_BLEND_RGB888 \
DRAW_SETPIXEL_BLEND(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
RGB888_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_ADD_RGB888 \
DRAW_SETPIXEL_ADD(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
RGB888_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_MOD_RGB888 \
DRAW_SETPIXEL_MOD(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
RGB888_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXELXY_RGB888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_RGB888)
#define DRAW_SETPIXELXY_BLEND_RGB888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_BLEND_RGB888)
#define DRAW_SETPIXELXY_ADD_RGB888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_ADD_RGB888)
#define DRAW_SETPIXELXY_MOD_RGB888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_MOD_RGB888)
/*
* Define draw operators for ARGB8888
*/
#define DRAW_SETPIXEL_ARGB8888 \
DRAW_SETPIXEL(ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
#define DRAW_SETPIXEL_BLEND_ARGB8888 \
DRAW_SETPIXEL_BLEND(RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa), \
ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
#define DRAW_SETPIXEL_ADD_ARGB8888 \
DRAW_SETPIXEL_ADD(RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa), \
ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
#define DRAW_SETPIXEL_MOD_ARGB8888 \
DRAW_SETPIXEL_MOD(RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa), \
ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
#define DRAW_SETPIXELXY_ARGB8888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_ARGB8888)
#define DRAW_SETPIXELXY_BLEND_ARGB8888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_BLEND_ARGB8888)
#define DRAW_SETPIXELXY_ADD_ARGB8888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_ADD_ARGB8888)
#define DRAW_SETPIXELXY_MOD_ARGB8888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_MOD_ARGB8888)
/*
* Define line drawing macro
*/
#define ABS(_x) ((_x) < 0 ? -(_x) : (_x))
/* Horizontal line */
#define HLINE(type, op, draw_end) \
{ \
int length; \
type *pixel; \
if (x1 <= x2) { \
pixel = (type *)_dc_get_pixel(dst, x1, y1); \
length = draw_end ? (x2-x1+1) : (x2-x1); \
} else { \
pixel = (type *)_dc_get_pixel(dst, x2, y1); \
if (!draw_end) { \
++pixel; \
} \
length = draw_end ? (x1-x2+1) : (x1-x2); \
} \
while (length--) { \
op; \
++pixel; \
} \
}
/* Vertical line */
#define VLINE(type, op, draw_end) \
{ \
int length; \
int pitch = _dc_get_pitch(dst)/(_UI_BITBYTES(_dc_get_bits_per_pixel(dst))); \
type *pixel; \
if (y1 <= y2) { \
pixel = (type *)_dc_get_pixel(dst, x1, y1); \
length = draw_end ? (y2-y1+1) : (y2-y1); \
} else { \
pixel = (type *)_dc_get_pixel(dst, x1, y2); \
if (!draw_end) { \
pixel += pitch; \
} \
length = draw_end ? (y1-y2+1) : (y1-y2); \
} \
while (length--) { \
op; \
pixel += pitch; \
} \
}
/* Diagonal line */
#define DLINE(type, op, draw_end) \
{ \
int length; \
int pitch = _dc_get_pitch(dst)/(_UI_BITBYTES(_dc_get_bits_per_pixel(dst))); \
type *pixel; \
if (y1 <= y2) { \
pixel = (type *)_dc_get_pixel(dst, x1, y1); \
if (x1 <= x2) { \
++pitch; \
} else { \
--pitch; \
} \
length = (y2-y1); \
} else { \
pixel = (type *)_dc_get_pixel(dst, x2, y2); \
if (x2 <= x1) { \
++pitch; \
} else { \
--pitch; \
} \
if (!draw_end) { \
pixel += pitch; \
} \
length = (y1-y2); \
} \
if (draw_end) { \
++length; \
} \
while (length--) { \
op; \
pixel += pitch; \
} \
}
/* Bresenham's line algorithm */
#define BLINE(x1, y1, x2, y2, op, draw_end) \
{ \
int i, deltax, deltay, numpixels; \
int d, dinc1, dinc2; \
int x, xinc1, xinc2; \
int y, yinc1, yinc2; \
\
deltax = ABS(x2 - x1); \
deltay = ABS(y2 - y1); \
\
if (deltax >= deltay) { \
numpixels = deltax + 1; \
d = (2 * deltay) - deltax; \
dinc1 = deltay * 2; \
dinc2 = (deltay - deltax) * 2; \
xinc1 = 1; \
xinc2 = 1; \
yinc1 = 0; \
yinc2 = 1; \
} else { \
numpixels = deltay + 1; \
d = (2 * deltax) - deltay; \
dinc1 = deltax * 2; \
dinc2 = (deltax - deltay) * 2; \
xinc1 = 0; \
xinc2 = 1; \
yinc1 = 1; \
yinc2 = 1; \
} \
\
if (x1 > x2) { \
xinc1 = -xinc1; \
xinc2 = -xinc2; \
} \
if (y1 > y2) { \
yinc1 = -yinc1; \
yinc2 = -yinc2; \
} \
\
x = x1; \
y = y1; \
\
if (!draw_end) { \
--numpixels; \
} \
for (i = 0; i < numpixels; ++i) { \
op(x, y); \
if (d < 0) { \
d += dinc1; \
x += xinc1; \
y += yinc1; \
} else { \
d += dinc2; \
x += xinc2; \
y += yinc2; \
} \
} \
}
/* Xiaolin Wu's line algorithm, based on Michael Abrash's implementation */
#define WULINE(x1, y1, x2, y2, opaque_op, blend_op, draw_end) \
{ \
rt_uint16_t ErrorAdj, ErrorAcc; \
rt_uint16_t ErrorAccTemp, Weighting; \
int DeltaX, DeltaY, Temp, XDir; \
unsigned r, g, b, a, inva; \
\
/* remove compiling warning */ \
r = 0; g = 0; b = 0; a = 0; \
inva = 0; inva = inva; \
/* Draw the initial pixel, which is always exactly intersected by \
the line and so needs no weighting */ \
opaque_op(x1, y1); \
\
/* Draw the final pixel, which is always exactly intersected by the line \
and so needs no weighting */ \
if (draw_end) { \
opaque_op(x2, y2); \
} \
\
/* Make sure the line runs top to bottom */ \
if (y1 > y2) { \
Temp = y1; y1 = y2; y2 = Temp; \
Temp = x1; x1 = x2; x2 = Temp; \
} \
DeltaY = y2 - y1; \
\
if ((DeltaX = x2 - x1) >= 0) { \
XDir = 1; \
} else { \
XDir = -1; \
DeltaX = -DeltaX; /* make DeltaX positive */ \
} \
\
/* line is not horizontal, diagonal, or vertical */ \
ErrorAcc = 0; /* initialize the line error accumulator to 0 */ \
\
/* Is this an X-major or Y-major line? */ \
if (DeltaY > DeltaX) { \
/* Y-major line; calculate 16-bit fixed-point fractional part of a \
pixel that X advances each time Y advances 1 pixel, truncating the \
result so that we won't overrun the endpoint along the X axis */ \
ErrorAdj = ((unsigned long) DeltaX << 16) / (unsigned long) DeltaY; \
/* Draw all pixels other than the first and last */ \
while (--DeltaY) { \
ErrorAccTemp = ErrorAcc; /* remember current accumulated error */ \
ErrorAcc += ErrorAdj; /* calculate error for next pixel */ \
if (ErrorAcc <= ErrorAccTemp) { \
/* The error accumulator turned over, so advance the X coord */ \
x1 += XDir; \
} \
y1++; /* Y-major, so always advance Y */ \
/* The IntensityBits most significant bits of ErrorAcc give us the \
intensity weighting for this pixel, and the complement of the \
weighting for the paired pixel */ \
Weighting = ErrorAcc >> 8; \
{ \
a = DRAW_MUL(_a, (Weighting ^ 255)); \
r = DRAW_MUL(_r, a); \
g = DRAW_MUL(_g, a); \
b = DRAW_MUL(_b, a); \
inva = (a ^ 0xFF); \
blend_op(x1, y1); \
} \
{ \
a = DRAW_MUL(_a, Weighting); \
r = DRAW_MUL(_r, a); \
g = DRAW_MUL(_g, a); \
b = DRAW_MUL(_b, a); \
inva = (a ^ 0xFF); \
blend_op(x1 + XDir, y1); \
} \
} \
} else { \
/* X-major line; calculate 16-bit fixed-point fractional part of a \
pixel that Y advances each time X advances 1 pixel, truncating the \
result to avoid overrunning the endpoint along the X axis */ \
ErrorAdj = ((unsigned long) DeltaY << 16) / (unsigned long) DeltaX; \
/* Draw all pixels other than the first and last */ \
while (--DeltaX) { \
ErrorAccTemp = ErrorAcc; /* remember currrent accumulated error */ \
ErrorAcc += ErrorAdj; /* calculate error for next pixel */ \
if (ErrorAcc <= ErrorAccTemp) { \
/* The error accumulator turned over, so advance the Y coord */ \
y1++; \
} \
x1 += XDir; /* X-major, so always advance X */ \
/* The IntensityBits most significant bits of ErrorAcc give us the \
intensity weighting for this pixel, and the complement of the \
weighting for the paired pixel */ \
Weighting = ErrorAcc >> 8; \
{ \
a = DRAW_MUL(_a, (Weighting ^ 255)); \
r = DRAW_MUL(_r, a); \
g = DRAW_MUL(_g, a); \
b = DRAW_MUL(_b, a); \
inva = (a ^ 0xFF); \
blend_op(x1, y1); \
} \
{ \
a = DRAW_MUL(_a, Weighting); \
r = DRAW_MUL(_r, a); \
g = DRAW_MUL(_g, a); \
b = DRAW_MUL(_b, a); \
inva = (a ^ 0xFF); \
blend_op(x1, y1 + 1); \
} \
} \
} \
}
#define AALINE(x1, y1, x2, y2, opaque_op, blend_op, draw_end) \
WULINE(x1, y1, x2, y2, opaque_op, blend_op, draw_end)
/*
* Define fill rect macro
*/
#define FILLRECT(type, op) \
do { \
int width = rect->x2 - rect->x1; \
int height = rect->y2 - rect->y1; \
int pitch = _dc_get_pitch(dst)/(_UI_BITBYTES(_dc_get_bits_per_pixel(dst))); \
int skip = pitch - width; \
type *pixel = (type *)_dc_get_pixel(dst, rect->x1, rect->y1); \
while (height--) { \
{ int n = (width+3)/4; \
switch (width & 3) { \
case 0: do { op; pixel++; \
case 3: op; pixel++; \
case 2: op; pixel++; \
case 1: op; pixel++; \
} while ( --n > 0 ); \
} \
} \
pixel += skip; \
} \
} while (0)
#endif

View File

@ -1,64 +0,0 @@
/*
* File : dc_trans.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2010-04-10 Bernard first version
*/
#ifndef __RTGUI_DC_TRANS_H__
#define __RTGUI_DC_TRANS_H__
#include <rtgui/dc.h>
#include <rtgui/matrix.h>
struct rtgui_dc_trans;
/** Create a dc translator on the dc @owner
*
* @return RT_NULL is there is no memory.
*/
struct rtgui_dc_trans* rtgui_dc_trans_create(struct rtgui_dc *owner);
/** Rotate the dc clockwise.
*
* @param degree the degree to rotate.
*/
void rtgui_dc_trans_rotate(struct rtgui_dc_trans *dct, double degree);
void rtgui_dc_trans_set_aa(struct rtgui_dc_trans *dct, int use_aa);
void rtgui_dc_trans_scale(struct rtgui_dc_trans *dct, double sx, double sy);
/** Move the dc
*
* The unit of @dx and @dy is pixel.
*/
void rtgui_dc_trans_move(struct rtgui_dc_trans *dct, int dx, int dy);
void rtgui_dc_trans_get_new_wh(struct rtgui_dc_trans *dct, int *new_w, int *new_h);
void rtgui_dc_trans_blit(struct rtgui_dc_trans *dct,
struct rtgui_point *dc_point,
struct rtgui_dc *dest,
struct rtgui_rect *rect);
void rtgui_dc_trans_destroy(struct rtgui_dc_trans *dct);
#endif

View File

@ -1,117 +0,0 @@
/*
* File : driver.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-04 Bernard first version
*/
#ifndef __RTGUI_DRIVER_H__
#define __RTGUI_DRIVER_H__
#include <rtgui/list.h>
#include <rtgui/color.h>
/* graphic driver operations */
struct rtgui_graphic_driver_ops
{
/* set and get pixel in (x, y) */
void (*set_pixel)(rtgui_color_t *c, int x, int y);
void (*get_pixel)(rtgui_color_t *c, int x, int y);
void (*draw_hline)(rtgui_color_t *c, int x1, int x2, int y);
void (*draw_vline)(rtgui_color_t *c, int x , int y1, int y2);
/* draw raw hline */
void (*draw_raw_hline)(rt_uint8_t *pixels, int x1, int x2, int y);
};
/* graphic extension operations */
struct rtgui_graphic_ext_ops
{
/* some 2D operations */
void (*draw_line)(rtgui_color_t *c, int x1, int y1, int x2, int y2);
void (*draw_rect)(rtgui_color_t *c, int x1, int y1, int x2, int y2);
void (*fill_rect)(rtgui_color_t *c, int x1, int y1, int x2, int y2);
void (*draw_circle)(rtgui_color_t *c, int x, int y, int r);
void (*fill_circle)(rtgui_color_t *c, int x, int y, int r);
void (*draw_ellipse)(rtgui_color_t *c, int x, int y, int rx, int ry);
void (*fill_ellipse)(rtgui_color_t *c, int x, int y, int rx, int ry);
};
struct rtgui_graphic_driver
{
/* pixel format and byte per pixel */
rt_uint8_t pixel_format;
rt_uint8_t bits_per_pixel;
rt_uint16_t pitch;
/* screen width and height */
rt_uint16_t width;
rt_uint16_t height;
/* framebuffer address and ops */
rt_uint8_t *framebuffer;
struct rt_device* device;
const struct rtgui_graphic_driver_ops *ops;
const struct rtgui_graphic_ext_ops *ext_ops;
};
struct rtgui_graphic_driver *rtgui_graphic_driver_get_default(void);
void rtgui_graphic_driver_get_rect(const struct rtgui_graphic_driver *driver, rtgui_rect_t *rect);
void rtgui_graphic_driver_screen_update(const struct rtgui_graphic_driver *driver, rtgui_rect_t *rect);
rt_uint8_t *rtgui_graphic_driver_get_framebuffer(const struct rtgui_graphic_driver *driver);
rt_err_t rtgui_graphic_set_device(rt_device_t device);
void rtgui_graphic_driver_set_framebuffer(void *fb);
rt_inline struct rtgui_graphic_driver *rtgui_graphic_get_device()
{
return rtgui_graphic_driver_get_default();
}
#ifdef RTGUI_USING_HW_CURSOR
/*
* hardware cursor
*/
enum rtgui_cursor_type
{
RTGUI_CURSOR_ARROW,
RTGUI_CURSOR_HAND,
};
void rtgui_cursor_set_device(const char* device_name);
void rtgui_cursor_set_position(rt_uint16_t x, rt_uint16_t y);
void rtgui_cursor_set_image(enum rtgui_cursor_type type);
#endif
#ifdef RTGUI_USING_VFRAMEBUFFER
void rtgui_graphic_driver_vmode_enter(void);
void rtgui_graphic_driver_vmode_exit(void);
struct rtgui_dc* rtgui_graphic_driver_get_rect_buffer(const struct rtgui_graphic_driver *driver, struct rtgui_rect *rect);
#endif
rt_bool_t rtgui_graphic_driver_is_vmode(void);
#endif

View File

@ -1,580 +0,0 @@
/*
* File : event.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-04 Bernard first version
*/
#ifndef __RTGUI_EVENT_H__
#define __RTGUI_EVENT_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <rtdevice.h>
#include <rtgui/rtgui.h>
#include <rtgui/kbddef.h>
/* NOTE: if you create a new event type, remember to add it into the union
* rtgui_event_generic */
enum _rtgui_event_type
{
/* applications event */
RTGUI_EVENT_APP_CREATE, /* create an application */
RTGUI_EVENT_APP_DESTROY, /* destroy an application */
RTGUI_EVENT_APP_ACTIVATE, /* activate an application */
/* window event */
RTGUI_EVENT_WIN_CREATE, /* create a window */
RTGUI_EVENT_WIN_DESTROY, /* destroy a window */
RTGUI_EVENT_WIN_SHOW, /* show a window */
RTGUI_EVENT_WIN_HIDE, /* hide a window */
RTGUI_EVENT_WIN_ACTIVATE, /* activate a window */
RTGUI_EVENT_WIN_DEACTIVATE, /* deactivate a window */
RTGUI_EVENT_WIN_CLOSE, /* close a window */
RTGUI_EVENT_WIN_MOVE, /* move a window */
RTGUI_EVENT_WIN_RESIZE, /* resize a window */
RTGUI_EVENT_WIN_UPDATE_END, /* update done for window */
RTGUI_EVENT_WIN_MODAL_ENTER, /* the window is entering modal mode.
This event should be sent after the
window got setup and before the
application got setup. */
/* WM event */
RTGUI_EVENT_SET_WM, /* set window manager */
RTGUI_EVENT_UPDATE_BEGIN, /* update a rect */
RTGUI_EVENT_UPDATE_END, /* update a rect */
RTGUI_EVENT_MONITOR_ADD, /* add a monitor rect */
RTGUI_EVENT_MONITOR_REMOVE, /* remove a monitor rect */
RTGUI_EVENT_SHOW, /* the widget is going to be shown */
RTGUI_EVENT_HIDE, /* the widget is going to be hidden */
RTGUI_EVENT_PAINT, /* paint on screen */
RTGUI_EVENT_TIMER, /* timer */
RTGUI_EVENT_UPDATE_TOPLVL, /* update the toplevel */
/* virtual paint event */
RTGUI_EVENT_VPAINT_REQ, /* virtual paint request (server -> client) */
/* clip rect information */
RTGUI_EVENT_CLIP_INFO, /* clip rect info */
/* mouse and keyboard event */
RTGUI_EVENT_MOUSE_MOTION, /* mouse motion */
RTGUI_EVENT_MOUSE_BUTTON, /* mouse button info */
RTGUI_EVENT_KBD, /* keyboard info */
RTGUI_EVENT_TOUCH, /* touch event to server */
RTGUI_EVENT_GESTURE, /* gesture event */
/* widget event */
RTGUI_EVENT_FOCUSED, /* widget focused */
RTGUI_EVENT_SCROLLED, /* scroll bar scrolled */
RTGUI_EVENT_RESIZE, /* widget resize */
RTGUI_EVENT_SELECTED, /* widget selected */
RTGUI_EVENT_UNSELECTED, /* widget un-selected */
RTGUI_EVENT_MV_MODEL, /* data of a model has been changed */
WBUS_NOTIFY_EVENT,
/* user command event. It should always be the last command type. */
RTGUI_EVENT_COMMAND = 0x0100, /* user command */
};
typedef enum _rtgui_event_type rtgui_event_type;
enum
{
RTGUI_STATUS_OK = 0, /* status ok */
RTGUI_STATUS_ERROR, /* generic error */
RTGUI_STATUS_NRC, /* no resource */
};
struct rtgui_event
{
/* the event type */
enum _rtgui_event_type type;
/* user field of event */
rt_uint16_t user;
/* the event sender */
struct rtgui_app *sender;
/* mailbox to acknowledge request */
rt_mailbox_t ack;
};
typedef struct rtgui_event rtgui_event_t;
#define RTGUI_EVENT(e) ((struct rtgui_event*)(e))
extern struct rtgui_app* rtgui_app_self(void);
#define RTGUI_EVENT_INIT(e, t) do \
{ \
(e)->type = (t); \
(e)->user = 0; \
(e)->sender = rtgui_app_self(); \
(e)->ack = RT_NULL; \
} while (0)
/*
* RTGUI Application Event
*/
struct rtgui_event_application
{
struct rtgui_event parent;
struct rtgui_app *app;
};
/* gui application init */
#define RTGUI_EVENT_APP_CREATE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_APP_CREATE)
#define RTGUI_EVENT_APP_DESTROY_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_APP_DESTROY)
#define RTGUI_EVENT_APP_ACTIVATE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_APP_ACTIVATE)
/*
* RTGUI Window Event
*/
#define _RTGUI_EVENT_WIN_ELEMENTS \
struct rtgui_event parent; \
struct rtgui_win *wid;
/*
* RTGUI Window Event
*/
struct rtgui_event_win
{
_RTGUI_EVENT_WIN_ELEMENTS
};
struct rtgui_event_win_create
{
_RTGUI_EVENT_WIN_ELEMENTS
struct rtgui_win *parent_window;
};
struct rtgui_event_win_move
{
_RTGUI_EVENT_WIN_ELEMENTS
rt_int16_t x, y;
};
struct rtgui_event_win_resize
{
_RTGUI_EVENT_WIN_ELEMENTS
rtgui_rect_t rect;
};
struct rtgui_event_win_update_end
{
_RTGUI_EVENT_WIN_ELEMENTS
rtgui_rect_t rect;
};
#define rtgui_event_win_destroy rtgui_event_win
#define rtgui_event_win_show rtgui_event_win
#define rtgui_event_win_hide rtgui_event_win
#define rtgui_event_win_activate rtgui_event_win
#define rtgui_event_win_deactivate rtgui_event_win
#define rtgui_event_win_close rtgui_event_win
#define rtgui_event_win_modal_enter rtgui_event_win
/* window event init */
#define RTGUI_EVENT_WIN_CREATE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_CREATE)
#define RTGUI_EVENT_WIN_DESTROY_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_DESTROY)
#define RTGUI_EVENT_WIN_SHOW_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_SHOW)
#define RTGUI_EVENT_WIN_HIDE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_HIDE)
#define RTGUI_EVENT_WIN_ACTIVATE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_ACTIVATE)
#define RTGUI_EVENT_WIN_DEACTIVATE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_DEACTIVATE)
#define RTGUI_EVENT_WIN_CLOSE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_CLOSE)
#define RTGUI_EVENT_WIN_MOVE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_MOVE)
#define RTGUI_EVENT_WIN_RESIZE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_RESIZE)
#define RTGUI_EVENT_WIN_UPDATE_END_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_UPDATE_END)
#define RTGUI_EVENT_WIN_MODAL_ENTER_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_MODAL_ENTER)
/*
* RTGUI set window manager
*/
struct rtgui_event_set_wm
{
struct rtgui_event parent;
struct rtgui_app *app;
};
#define RTGUI_EVENT_SET_WM_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_SET_WM);
/*
* RTGUI Other Event
*/
struct rtgui_event_update_begin
{
struct rtgui_event parent;
/* the update rect */
rtgui_rect_t rect;
};
struct rtgui_event_update_end
{
struct rtgui_event parent;
/* the update rect */
rtgui_rect_t rect;
};
struct rtgui_event_monitor
{
_RTGUI_EVENT_WIN_ELEMENTS
/* the monitor rect */
rtgui_rect_t rect;
};
struct rtgui_event_paint
{
_RTGUI_EVENT_WIN_ELEMENTS
rtgui_rect_t rect; /* rect to be updated */
};
struct rtgui_timer;
struct rtgui_event_timer
{
struct rtgui_event parent;
struct rtgui_timer *timer;
};
typedef struct rtgui_event_timer rtgui_event_timer_t;
struct rtgui_event_clip_info
{
_RTGUI_EVENT_WIN_ELEMENTS
/* the number of rects */
//rt_uint32_t num_rect;
/* rtgui_rect_t *rects */
};
#define RTGUI_EVENT_GET_RECT(e, i) &(((rtgui_rect_t*)(e + 1))[i])
#define RTGUI_EVENT_UPDATE_BEGIN_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_UPDATE_BEGIN)
#define RTGUI_EVENT_UPDATE_END_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_UPDATE_END)
#define RTGUI_EVENT_MONITOR_ADD_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_MONITOR_ADD)
#define RTGUI_EVENT_MONITOR_REMOVE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_MONITOR_REMOVE)
#define RTGUI_EVENT_CLIP_INFO_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_CLIP_INFO)
#define RTGUI_EVENT_PAINT_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_PAINT)
#define RTGUI_EVENT_TIMER_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_TIMER)
#define rtgui_event_show rtgui_event
#define rtgui_event_hide rtgui_event
#define RTGUI_EVENT_SHOW_INIT(e) RTGUI_EVENT_INIT((e), RTGUI_EVENT_SHOW)
#define RTGUI_EVENT_HIDE_INIT(e) RTGUI_EVENT_INIT((e), RTGUI_EVENT_HIDE)
struct rtgui_event_update_toplvl
{
struct rtgui_event parent;
struct rtgui_win *toplvl;
};
#define RTGUI_EVENT_UPDATE_TOPLVL_INIT(e) \
do { \
RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_UPDATE_TOPLVL); \
(e)->toplvl = RT_NULL; \
} while (0)
struct rtgui_event_vpaint_req
{
_RTGUI_EVENT_WIN_ELEMENTS
struct rtgui_event_vpaint_req *sender;
struct rt_completion *cmp;
struct rtgui_dc* buffer;
};
#define RTGUI_EVENT_VPAINT_REQ_INIT(e, win, cm) \
do { \
RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_VPAINT_REQ); \
(e)->wid = win; \
(e)->cmp = cm; \
(e)->sender = (e); \
(e)->buffer = RT_NULL; \
rt_completion_init((e)->cmp); \
} while (0)
/**
* RTGUI Gesture Event
*/
enum rtgui_gesture_type
{
RTGUI_GESTURE_NONE = 0x0000,
RTGUI_GESTURE_TAP = 0x0001,
/* Usually used to zoom in and out. */
RTGUI_GESTURE_PINCH = 0x0002,
RTGUI_GESTURE_DRAG = 0x0004,
RTGUI_GESTURE_LONGPRESS = 0x0008,
RTGUI_GESTURE_DRAGGED = 0x0001 | 0x0004 | 0x0008,
/* PINCH, DRAG finished. */
RTGUI_GESTURE_FINISH = 0x8000,
/* The corresponding gesture should be canceled. */
RTGUI_GESTURE_CANCEL = 0x4000,
RTGUI_GESTURE_TYPE_MASK = 0x0FFF,
};
struct rtgui_event_gesture
{
_RTGUI_EVENT_WIN_ELEMENTS
enum rtgui_gesture_type type;
rt_uint32_t win_acti_cnt; /* window activate count */
};
/*
* RTGUI Mouse and Keyboard Event
*/
struct rtgui_event_mouse
{
_RTGUI_EVENT_WIN_ELEMENTS
rt_uint16_t x, y;
rt_uint16_t button;
/* Timestamp of this event sampled in driver. */
rt_tick_t ts;
/* id of touch session(from down to up). Different session should have
* different id. id should never be 0. */
rt_uint32_t id;
rt_uint32_t win_acti_cnt; /* window activate count */
};
#define RTGUI_MOUSE_BUTTON_LEFT 0x01
#define RTGUI_MOUSE_BUTTON_RIGHT 0x02
#define RTGUI_MOUSE_BUTTON_MIDDLE 0x03
#define RTGUI_MOUSE_BUTTON_WHEELUP 0x04
#define RTGUI_MOUSE_BUTTON_WHEELDOWN 0x08
#define RTGUI_MOUSE_BUTTON_DOWN 0x10
#define RTGUI_MOUSE_BUTTON_UP 0x20
#define RTGUI_EVENT_GESTURE_INIT(e, gtype) \
do { \
RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_GESTURE); \
(e)->type = gtype; \
} while (0)
struct rtgui_event_kbd
{
_RTGUI_EVENT_WIN_ELEMENTS
rt_uint32_t win_acti_cnt; /* window activate count */
rt_uint16_t type; /* key down or up */
rt_uint16_t key; /* current key */
rt_uint16_t mod; /* current key modifiers */
rt_uint16_t unicode; /* translated character */
};
#define RTGUI_KBD_IS_SET_CTRL(e) ((e)->mod & (RTGUI_KMOD_LCTRL | RTGUI_KMOD_RCTRL))
#define RTGUI_KBD_IS_SET_ALT(e) ((e)->mod & (RTGUI_KMOD_LALT | RTGUI_KMOD_RALT))
#define RTGUI_KBD_IS_SET_SHIFT(e) ((e)->mod & (RTGUI_KMOD_LSHIFT| RTGUI_KMOD_RSHIFT))
#define RTGUI_KBD_IS_UP(e) ((e)->type == RTGUI_KEYUP)
#define RTGUI_KBD_IS_DOWN(e) ((e)->type == RTGUI_KEYDOWN)
#define RTGUI_EVENT_MOUSE_MOTION_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_MOUSE_MOTION)
#define RTGUI_EVENT_MOUSE_BUTTON_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_MOUSE_BUTTON)
#define RTGUI_EVENT_KBD_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_KBD)
/**
* RTGUI Touch Event
* NOTE: There is not touch event to user applications, it's handled by server.
*/
struct rtgui_event_touch
{
struct rtgui_event parent;
rt_uint16_t x, y;
rt_uint16_t up_down;
rt_uint16_t resv;
};
#define RTGUI_TOUCH_UP 0x01
#define RTGUI_TOUCH_DOWN 0x02
#define RTGUI_TOUCH_MOTION 0x03
#define RTGUI_EVENT_TOUCH_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_TOUCH)
struct rtgui_event_command
{
_RTGUI_EVENT_WIN_ELEMENTS
/* command type */
rt_int32_t type;
/* command id */
rt_int32_t command_id;
/* command string */
char command_string[RTGUI_NAME_MAX];
};
#define RTGUI_EVENT_COMMAND_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_COMMAND)
#define RTGUI_CMD_UNKNOWN 0x00
#define RTGUI_CMD_WM_CLOSE 0x10
#define RTGUI_CMD_USER_INT 0x20
#define RTGUI_CMD_USER_STRING 0x21
/************************************************************************/
/* Widget Event */
/************************************************************************/
#define RTGUI_WIDGET_EVENT_INIT(e, t) do \
{ \
(e)->type = (t); \
(e)->sender = RT_NULL; \
(e)->ack = RT_NULL; \
} while (0)
/*
* RTGUI Scrollbar Event
*/
struct rtgui_event_scrollbar
{
struct rtgui_event parent;
rt_uint8_t event;
};
#define RTGUI_SCROLL_LINEUP 0x01
#define RTGUI_SCROLL_LINEDOWN 0x02
#define RTGUI_SCROLL_PAGEUP 0x03
#define RTGUI_SCROLL_PAGEDOWN 0x04
#define RTGUI_EVENT_SCROLLED_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_SCROLLED)
/*
* RTGUI Widget Focused Event
*/
struct rtgui_event_focused
{
struct rtgui_event parent;
struct rtgui_widget *widget;
};
#define RTGUI_EVENT_FOCUSED_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_FOCUSED)
/*
* RTGUI Widget Resize Event
*/
struct rtgui_event_resize
{
struct rtgui_event parent;
rt_int16_t x, y;
rt_int16_t w, h;
};
#define RTGUI_EVENT_RESIZE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_RESIZE)
/*
* RTGUI Model/View Event
*/
enum rtgui_event_model_mode
{
RTGUI_MV_DATA_ADDED,
RTGUI_MV_DATA_CHANGED,
RTGUI_MV_DATA_DELETED,
};
struct rtgui_event_mv_model
{
struct rtgui_event parent;
struct rtgui_mv_model *model;
struct rtgui_mv_view *view;
rt_size_t first_data_changed_idx;
rt_size_t last_data_changed_idx;
};
#define _RTGUI_EVENT_MV_INIT_TYPE(T) \
rt_inline void RTGUI_EVENT_MV_MODEL_##T##_INIT(struct rtgui_event_mv_model *e) \
{ \
RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_MV_MODEL); \
(e)->parent.user = RTGUI_MV_DATA_##T; \
} \
/* useless struct to allow trailing semicolon */ \
struct dummy
_RTGUI_EVENT_MV_INIT_TYPE(ADDED);
_RTGUI_EVENT_MV_INIT_TYPE(CHANGED);
_RTGUI_EVENT_MV_INIT_TYPE(DELETED);
#undef _RTGUI_EVENT_MV_INIT_TYPE
#define _RTGUI_EVENT_MV_IS_TYPE(T) \
rt_inline rt_bool_t RTGUI_EVENT_MV_MODEL_IS_##T(struct rtgui_event_mv_model *e) \
{ \
return e->parent.user == RTGUI_MV_DATA_##T; \
} \
/* useless struct to allow trailing semicolon */ \
struct dummy
_RTGUI_EVENT_MV_IS_TYPE(ADDED);
_RTGUI_EVENT_MV_IS_TYPE(CHANGED);
_RTGUI_EVENT_MV_IS_TYPE(DELETED);
#undef _RTGUI_EVENT_MV_IS_TYPE
#undef _RTGUI_EVENT_WIN_ELEMENTS
union rtgui_event_generic
{
struct rtgui_event base;
struct rtgui_event_application app_create;
struct rtgui_event_application app_destroy;
struct rtgui_event_application app_activate;
struct rtgui_event_set_wm set_wm;
struct rtgui_event_win win_base;
struct rtgui_event_win_create win_create;
struct rtgui_event_win_move win_move;
struct rtgui_event_win_resize win_resize;
struct rtgui_event_win_destroy win_destroy;
struct rtgui_event_win_show win_show;
struct rtgui_event_win_hide win_hide;
struct rtgui_event_win_activate win_activate;
struct rtgui_event_win_deactivate win_deactivate;
struct rtgui_event_win_close win_close;
struct rtgui_event_win_modal_enter win_modal_enter;
struct rtgui_event_update_begin update_begin;
struct rtgui_event_update_end update_end;
struct rtgui_event_monitor monitor;
struct rtgui_event_paint paint;
struct rtgui_event_timer timer;
struct rtgui_event_update_toplvl update_toplvl;
struct rtgui_event_vpaint_req vpaint_req;
struct rtgui_event_clip_info clip_info;
struct rtgui_event_mouse mouse;
struct rtgui_event_kbd kbd;
struct rtgui_event_touch touch;
struct rtgui_event_gesture gesture;
struct rtgui_event_scrollbar scrollbar;
struct rtgui_event_focused focused;
struct rtgui_event_resize resize;
struct rtgui_event_mv_model model;
struct rtgui_event_command command;
};
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,78 +0,0 @@
/*
* File : filerw.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __RTGUI_FILERW_H__
#define __RTGUI_FILERW_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef RTGUI_USING_DFS_FILERW
#ifdef _WIN32_NATIVE
#pragma warning(disable: 4996)
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <io.h>
#else
#include <dfs_posix.h>
#endif
#endif
#include <rtgui/rtgui.h>
#define RTGUI_FILE_SEEK_SET 0
#define RTGUI_FILE_SEEK_CUR 1
#define RTGUI_FILE_SEEK_END 2
struct rtgui_filerw
{
int (*seek)(struct rtgui_filerw *context, rt_off_t offset, int whence);
int (*read)(struct rtgui_filerw *context, void *buffer, rt_size_t size, rt_size_t count);
int (*write)(struct rtgui_filerw *context, const void *buffer, rt_size_t size, rt_size_t count);
int (*tell)(struct rtgui_filerw *context);
int (*eof)(struct rtgui_filerw *context);
int (*close)(struct rtgui_filerw *context);
};
typedef struct rtgui_filerw rtgui_filerw_t;
struct rtgui_filerw *rtgui_filerw_create_file(const char *filename, const char *mode);
struct rtgui_filerw *rtgui_filerw_create_mem(const rt_uint8_t *mem, rt_size_t size);
int rtgui_filerw_seek(struct rtgui_filerw *context, rt_off_t offset, int whence);
int rtgui_filerw_read(struct rtgui_filerw *context, void *buffer, rt_size_t size, rt_size_t count);
int rtgui_filerw_write(struct rtgui_filerw *context, const void *buffer, rt_size_t size, rt_size_t count);
int rtgui_filerw_tell(struct rtgui_filerw *context);
int rtgui_filerw_eof(struct rtgui_filerw *context);
int rtgui_filerw_close(struct rtgui_filerw *context);
int rtgui_filerw_unlink(const char *filename);
/* get memory data from filerw memory object */
const rt_uint8_t *rtgui_filerw_mem_getdata(struct rtgui_filerw *context);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,154 +0,0 @@
/*
* File : font.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __RTGUI_FONT_H__
#define __RTGUI_FONT_H__
#include <rtgui/rtgui.h>
#include <rtgui/list.h>
#ifdef __cplusplus
extern "C" {
#endif
struct rtgui_font;
struct rtgui_dc;
struct rtgui_rect;
struct rtgui_font_engine
{
/* font engine function */
void (*font_init)(struct rtgui_font *font);
void (*font_load)(struct rtgui_font *font);
void (*font_draw_text)(struct rtgui_font *font, struct rtgui_dc *dc, const char *text,
rt_ubase_t len, struct rtgui_rect *rect);
void (*font_get_metrics)(struct rtgui_font *font, const char *text, struct rtgui_rect *rect);
};
/*
* bitmap font engine
*/
struct rtgui_font_bitmap
{
const rt_uint8_t *bmp; /* bitmap font data */
const rt_uint8_t *char_width; /* each character width, NULL for fixed font */
const rt_uint32_t *offset; /* offset for each character */
rt_uint16_t width; /* font width */
rt_uint16_t height; /* font height */
rt_uint8_t first_char;
rt_uint8_t last_char;
};
extern const struct rtgui_font_engine bmp_font_engine;
#include <rtgui/tree.h>
SPLAY_HEAD(cache_tree, hz_cache);
struct hz_cache
{
SPLAY_ENTRY(hz_cache) hz_node;
rt_uint16_t hz_id;
};
struct rtgui_hz_file_font
{
struct cache_tree cache_root;
rt_uint16_t cache_size;
/* font size */
rt_uint16_t font_size;
rt_uint16_t font_data_size;
/* file descriptor */
int fd;
/* font file name */
const char *font_fn;
};
extern const struct rtgui_font_engine rtgui_hz_file_font_engine;
struct rtgui_font
{
/* font name */
char *family;
/* font height */
rt_uint16_t height;
/* refer count */
rt_uint32_t refer_count;
/* font engine */
const struct rtgui_font_engine *engine;
/* font private data */
void *data;
/* the font list */
rtgui_list_t list;
};
typedef struct rtgui_font rtgui_font_t;
void rtgui_font_system_init(void);
void rtgui_font_system_add_font(struct rtgui_font *font);
void rtgui_font_system_remove_font(struct rtgui_font *font);
struct rtgui_font *rtgui_font_default(void);
void rtgui_font_set_defaut(struct rtgui_font *font);
struct rtgui_font *rtgui_font_refer(const char *family, rt_uint16_t height);
void rtgui_font_derefer(struct rtgui_font *font);
/* draw a text */
void rtgui_font_draw(struct rtgui_font *font, struct rtgui_dc *dc, const char *text, rt_ubase_t len, struct rtgui_rect *rect);
int rtgui_font_get_string_width(struct rtgui_font *font, const char *text);
void rtgui_font_get_metrics(struct rtgui_font *font, const char *text, struct rtgui_rect *rect);
/* used by stract font */
#define FONT_BMP_DATA_BEGIN
#define FONT_BMP_DATA_END
struct rtgui_char_position
{
/* Keep the size of this struct within 4 bytes so it can be passed by
* value. */
/* How long this char is. */
rt_uint16_t char_width;
/* How many bytes remaining from current pointer. At least, it will be 1. */
rt_uint16_t remain;
};
/*
* @len the length of @str.
* @offset the char offset on the string to check with.
*/
struct rtgui_char_position _string_char_width(char *str, rt_size_t len, rt_size_t offset);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,62 +0,0 @@
/*
* File : font_fnt.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2010-04-10 Bernard first version
*/
#ifndef __FONT_FNT_H__
#define __FONT_FNT_H__
#include <rtgui/font.h>
#include <rtgui/dc.h>
/* fnt font header */
struct fnt_header
{
rt_uint8_t version[4];
rt_uint16_t max_width;
rt_uint16_t height;
rt_uint16_t ascent;
rt_uint16_t depth;
rt_uint32_t first_char;
rt_uint32_t default_char;
rt_uint32_t size;
rt_uint32_t nbits;
rt_uint32_t noffset;
rt_uint32_t nwidth;
};
typedef rt_uint8_t MWIMAGEBITS;
struct fnt_font
{
struct fnt_header header;
const MWIMAGEBITS *bits; /* nbits */
const rt_uint16_t *offset; /* noffset */
const rt_uint8_t *width; /* nwidth */
};
extern const struct rtgui_font_engine fnt_font_engine;
struct rtgui_font *fnt_font_create(const char* filename);
#endif

View File

@ -1,44 +0,0 @@
/*
* File : font_freetype.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2010-04-10 Bernard first version
*/
#ifndef __RTGUI_FONT_TTF_H__
#define __RTGUI_FONT_TTF_H__
#include <rtgui/dc.h>
#include <rtgui/font.h>
#include <rtgui/filerw.h>
#ifdef __cplusplus
extern "C" {
#endif
void rtgui_ttf_system_init(void);
rtgui_font_t *rtgui_freetype_font_create(const char *filename, rt_size_t size);
void rtgui_freetype_font_destroy(rtgui_font_t *font);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,100 +0,0 @@
/*
* File : image.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __RTGUI_IMAGE_H__
#define __RTGUI_IMAGE_H__
#include <rtgui/dc.h>
#include <rtgui/filerw.h>
#include <rtgui/region.h>
#ifdef __cplusplus
extern "C" {
#endif
struct rtgui_image;
struct rtgui_image_engine
{
const char *name;
struct rtgui_list_node list;
/* image engine function */
rt_bool_t (*image_check)(struct rtgui_filerw *file);
rt_bool_t (*image_load)(struct rtgui_image *image, struct rtgui_filerw *file, rt_bool_t load);
void (*image_unload)(struct rtgui_image *image);
void (*image_blit)(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *rect);
};
struct rtgui_image_palette
{
rtgui_color_t *colors;
rt_uint32_t ncolors;
};
typedef struct rtgui_image_palette rtgui_image_palette_t;
struct rtgui_image
{
/* image metrics */
rt_uint16_t w, h;
/* image engine */
const struct rtgui_image_engine *engine;
/* image palette */
rtgui_image_palette_t *palette;
/* image private data */
void *data;
};
typedef struct rtgui_image rtgui_image_t;
/* init rtgui image system */
void rtgui_system_image_init(void);
#if defined(RTGUI_USING_DFS_FILERW)
struct rtgui_image_engine *rtgui_image_get_engine_by_filename(const char *fn);
struct rtgui_image *rtgui_image_create_from_file(const char *type, const char *filename, rt_bool_t load);
struct rtgui_image *rtgui_image_create(const char *filename, rt_bool_t load);
#endif
struct rtgui_image *rtgui_image_create_from_mem(const char *type, const rt_uint8_t *data, rt_size_t length, rt_bool_t load);
void rtgui_image_destroy(struct rtgui_image *image);
/* get image's rect */
void rtgui_image_get_rect(struct rtgui_image *image, struct rtgui_rect *rect);
/* register an image engine */
void rtgui_image_register_engine(struct rtgui_image_engine *engine);
/* blit an image on DC */
void rtgui_image_blit(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *rect);
struct rtgui_image_palette *rtgui_image_palette_create(rt_uint32_t ncolors);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,56 +0,0 @@
/*
* File : image_bmp.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2010-08-10 Bernard first version
*/
#ifndef __RTGUI_IMAGE_BMP_H__
#define __RTGUI_IMAGE_BMP_H__
#pragma pack(push)
#pragma pack(2)
struct rtgui_image_bmp_header
{
/* The Win32 BMP file header (14 bytes) */
rt_uint16_t bfType;
rt_uint32_t bfSize;
rt_uint16_t bfReserved1;
rt_uint16_t bfReserved2;
rt_uint32_t bfOffBits;
/* The Win32 BITMAPINFOHEADER struct (40 bytes) */
rt_uint32_t biSize;
rt_int32_t biWidth;
rt_int32_t biHeight;
rt_uint16_t biPlanes;
rt_uint16_t biBitCount;
rt_uint32_t biCompression;
rt_uint32_t biSizeImage;
rt_int32_t biXPelsPerMeter;
rt_int32_t biYPelsPerMeter;
rt_uint32_t biClrUsed;
rt_uint32_t biClrImportant;
};
#pragma pack(pop)
void rtgui_image_bmp_init(void);
#endif

View File

@ -1,58 +0,0 @@
/*
* File : image_container.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2010-04-10 Bernard first version
*/
#ifndef __RTGUI_IMAGE_CONTAINER_H__
#define __RTGUI_IMAGE_CONTAINER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <rtgui/rtgui.h>
#include <rtgui/image.h>
#if defined(RTGUI_IMAGE_CONTAINER)
/* image item in image container */
struct rtgui_image_item
{
rtgui_image_t *image;
char *filename;
rt_uint32_t refcount;
};
typedef struct rtgui_image_item rtgui_image_item_t;
void rtgui_system_image_container_init(void);
struct rtgui_image_item *rtgui_image_container_get(const char *filename);
void rtgui_image_container_put(struct rtgui_image_item *item);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,62 +0,0 @@
/*
* File : image_hdc.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __RTGUI_IMAGE_HDC_H__
#define __RTGUI_IMAGE_HDC_H__
#include <rtgui/image.h>
struct rtgui_image_hdcmm
{
struct rtgui_image parent;
/* hdc image information */
rt_uint16_t byte_per_pixel;
rt_uint16_t pitch;
rt_uint8_t *pixels;
};
struct rtgui_image_hdc
{
rt_bool_t is_loaded;
/* hdc image information */
rt_uint16_t byte_per_pixel;
rt_uint16_t pitch;
rt_uint8_t pixel_format;
rt_size_t pixel_offset;
rt_uint8_t *pixels;
struct rtgui_filerw *filerw;
};
void rtgui_image_hdc_init(void);
extern const struct rtgui_image_engine rtgui_image_hdcmm_engine;
#define HDC_HEADER_SIZE (5 * 4)
#define RTGUI_IMAGE_HDC_DEF(bpp, w, h, pixels) \
{{w, h, &rtgui_image_hdcmm_engine, RT_NULL}, bpp, (bpp * w), ((rt_uint8_t*)pixels + HDC_HEADER_SIZE)}
#endif

View File

@ -1,305 +0,0 @@
/*
* File : kbddef.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __KBD_DEF_H__
#define __KBD_DEF_H__
/* The keyboard key have been cleverly chosen to map to ASCII */
typedef enum
{
RTGUIK_UNKNOWN = 0,
RTGUIK_FIRST = 0,
RTGUIK_BACKSPACE = 8,
RTGUIK_TAB = 9,
RTGUIK_CLEAR = 12,
RTGUIK_RETURN = 13,
RTGUIK_PAUSE = 19,
RTGUIK_ESCAPE = 27,
RTGUIK_SPACE = 32,
RTGUIK_EXCLAIM = 33,
RTGUIK_QUOTEDBL = 34,
RTGUIK_HASH = 35,
RTGUIK_DOLLAR = 36,
RTGUIK_AMPERSAND = 38,
RTGUIK_QUOTE = 39,
RTGUIK_LEFTPAREN = 40,
RTGUIK_RIGHTPAREN = 41,
RTGUIK_ASTERISK = 42,
RTGUIK_PLUS = 43,
RTGUIK_COMMA = 44,
RTGUIK_MINUS = 45,
RTGUIK_PERIOD = 46,
RTGUIK_SLASH = 47,
RTGUIK_0 = 48,
RTGUIK_1 = 49,
RTGUIK_2 = 50,
RTGUIK_3 = 51,
RTGUIK_4 = 52,
RTGUIK_5 = 53,
RTGUIK_6 = 54,
RTGUIK_7 = 55,
RTGUIK_8 = 56,
RTGUIK_9 = 57,
RTGUIK_COLON = 58,
RTGUIK_SEMICOLON = 59,
RTGUIK_LESS = 60,
RTGUIK_EQUALS = 61,
RTGUIK_GREATER = 62,
RTGUIK_QUESTION = 63,
RTGUIK_AT = 64,
/*
Skip uppercase letters
*/
RTGUIK_LEFTBRACKET = 91,
RTGUIK_BACKSLASH = 92,
RTGUIK_RIGHTBRACKET = 93,
RTGUIK_CARET = 94,
RTGUIK_UNDERSCORE = 95,
RTGUIK_BACKQUOTE = 96,
RTGUIK_a = 97,
RTGUIK_b = 98,
RTGUIK_c = 99,
RTGUIK_d = 100,
RTGUIK_e = 101,
RTGUIK_f = 102,
RTGUIK_g = 103,
RTGUIK_h = 104,
RTGUIK_i = 105,
RTGUIK_j = 106,
RTGUIK_k = 107,
RTGUIK_l = 108,
RTGUIK_m = 109,
RTGUIK_n = 110,
RTGUIK_o = 111,
RTGUIK_p = 112,
RTGUIK_q = 113,
RTGUIK_r = 114,
RTGUIK_s = 115,
RTGUIK_t = 116,
RTGUIK_u = 117,
RTGUIK_v = 118,
RTGUIK_w = 119,
RTGUIK_x = 120,
RTGUIK_y = 121,
RTGUIK_z = 122,
RTGUIK_DELETE = 127,
/* International keyboard */
RTGUIK_WORLD_0 = 160, /* 0xA0 */
RTGUIK_WORLD_1 = 161,
RTGUIK_WORLD_2 = 162,
RTGUIK_WORLD_3 = 163,
RTGUIK_WORLD_4 = 164,
RTGUIK_WORLD_5 = 165,
RTGUIK_WORLD_6 = 166,
RTGUIK_WORLD_7 = 167,
RTGUIK_WORLD_8 = 168,
RTGUIK_WORLD_9 = 169,
RTGUIK_WORLD_10 = 170,
RTGUIK_WORLD_11 = 171,
RTGUIK_WORLD_12 = 172,
RTGUIK_WORLD_13 = 173,
RTGUIK_WORLD_14 = 174,
RTGUIK_WORLD_15 = 175,
RTGUIK_WORLD_16 = 176,
RTGUIK_WORLD_17 = 177,
RTGUIK_WORLD_18 = 178,
RTGUIK_WORLD_19 = 179,
RTGUIK_WORLD_20 = 180,
RTGUIK_WORLD_21 = 181,
RTGUIK_WORLD_22 = 182,
RTGUIK_WORLD_23 = 183,
RTGUIK_WORLD_24 = 184,
RTGUIK_WORLD_25 = 185,
RTGUIK_WORLD_26 = 186,
RTGUIK_WORLD_27 = 187,
RTGUIK_WORLD_28 = 188,
RTGUIK_WORLD_29 = 189,
RTGUIK_WORLD_30 = 190,
RTGUIK_WORLD_31 = 191,
RTGUIK_WORLD_32 = 192,
RTGUIK_WORLD_33 = 193,
RTGUIK_WORLD_34 = 194,
RTGUIK_WORLD_35 = 195,
RTGUIK_WORLD_36 = 196,
RTGUIK_WORLD_37 = 197,
RTGUIK_WORLD_38 = 198,
RTGUIK_WORLD_39 = 199,
RTGUIK_WORLD_40 = 200,
RTGUIK_WORLD_41 = 201,
RTGUIK_WORLD_42 = 202,
RTGUIK_WORLD_43 = 203,
RTGUIK_WORLD_44 = 204,
RTGUIK_WORLD_45 = 205,
RTGUIK_WORLD_46 = 206,
RTGUIK_WORLD_47 = 207,
RTGUIK_WORLD_48 = 208,
RTGUIK_WORLD_49 = 209,
RTGUIK_WORLD_50 = 210,
RTGUIK_WORLD_51 = 211,
RTGUIK_WORLD_52 = 212,
RTGUIK_WORLD_53 = 213,
RTGUIK_WORLD_54 = 214,
RTGUIK_WORLD_55 = 215,
RTGUIK_WORLD_56 = 216,
RTGUIK_WORLD_57 = 217,
RTGUIK_WORLD_58 = 218,
RTGUIK_WORLD_59 = 219,
RTGUIK_WORLD_60 = 220,
RTGUIK_WORLD_61 = 221,
RTGUIK_WORLD_62 = 222,
RTGUIK_WORLD_63 = 223,
RTGUIK_WORLD_64 = 224,
RTGUIK_WORLD_65 = 225,
RTGUIK_WORLD_66 = 226,
RTGUIK_WORLD_67 = 227,
RTGUIK_WORLD_68 = 228,
RTGUIK_WORLD_69 = 229,
RTGUIK_WORLD_70 = 230,
RTGUIK_WORLD_71 = 231,
RTGUIK_WORLD_72 = 232,
RTGUIK_WORLD_73 = 233,
RTGUIK_WORLD_74 = 234,
RTGUIK_WORLD_75 = 235,
RTGUIK_WORLD_76 = 236,
RTGUIK_WORLD_77 = 237,
RTGUIK_WORLD_78 = 238,
RTGUIK_WORLD_79 = 239,
RTGUIK_WORLD_80 = 240,
RTGUIK_WORLD_81 = 241,
RTGUIK_WORLD_82 = 242,
RTGUIK_WORLD_83 = 243,
RTGUIK_WORLD_84 = 244,
RTGUIK_WORLD_85 = 245,
RTGUIK_WORLD_86 = 246,
RTGUIK_WORLD_87 = 247,
RTGUIK_WORLD_88 = 248,
RTGUIK_WORLD_89 = 249,
RTGUIK_WORLD_90 = 250,
RTGUIK_WORLD_91 = 251,
RTGUIK_WORLD_92 = 252,
RTGUIK_WORLD_93 = 253,
RTGUIK_WORLD_94 = 254,
RTGUIK_WORLD_95 = 255, /* 0xFF */
/* Numeric keypad */
RTGUIK_KP0 = 256,
RTGUIK_KP1 = 257,
RTGUIK_KP2 = 258,
RTGUIK_KP3 = 259,
RTGUIK_KP4 = 260,
RTGUIK_KP5 = 261,
RTGUIK_KP6 = 262,
RTGUIK_KP7 = 263,
RTGUIK_KP8 = 264,
RTGUIK_KP9 = 265,
RTGUIK_KP_PERIOD = 266,
RTGUIK_KP_DIVIDE = 267,
RTGUIK_KP_MULTIPLY = 268,
RTGUIK_KP_MINUS = 269,
RTGUIK_KP_PLUS = 270,
RTGUIK_KP_ENTER = 271,
RTGUIK_KP_EQUALS = 272,
/* Arrows + Home/End pad */
RTGUIK_UP = 273,
RTGUIK_DOWN = 274,
RTGUIK_RIGHT = 275,
RTGUIK_LEFT = 276,
RTGUIK_INSERT = 277,
RTGUIK_HOME = 278,
RTGUIK_END = 279,
RTGUIK_PAGEUP = 280,
RTGUIK_PAGEDOWN = 281,
/* Function keys */
RTGUIK_F1 = 282,
RTGUIK_F2 = 283,
RTGUIK_F3 = 284,
RTGUIK_F4 = 285,
RTGUIK_F5 = 286,
RTGUIK_F6 = 287,
RTGUIK_F7 = 288,
RTGUIK_F8 = 289,
RTGUIK_F9 = 290,
RTGUIK_F10 = 291,
RTGUIK_F11 = 292,
RTGUIK_F12 = 293,
RTGUIK_F13 = 294,
RTGUIK_F14 = 295,
RTGUIK_F15 = 296,
/* Key state modifier keys */
RTGUIK_NUMLOCK = 300,
RTGUIK_CAPSLOCK = 301,
RTGUIK_SCROLLOCK = 302,
RTGUIK_RSHIFT = 303,
RTGUIK_LSHIFT = 304,
RTGUIK_RCTRL = 305,
RTGUIK_LCTRL = 306,
RTGUIK_RALT = 307,
RTGUIK_LALT = 308,
RTGUIK_RMETA = 309,
RTGUIK_LMETA = 310,
RTGUIK_LSUPER = 311, /* Left "Windows" key */
RTGUIK_RSUPER = 312, /* Right "Windows" key */
RTGUIK_MODE = 313, /* "Alt Gr" key */
RTGUIK_COMPOSE = 314, /* Multi-key compose key */
/* Miscellaneous function keys */
RTGUIK_HELP = 315,
RTGUIK_PRINT = 316,
RTGUIK_SYSREQ = 317,
RTGUIK_BREAK = 318,
RTGUIK_MENU = 319,
RTGUIK_POWER = 320, /* Power key */
RTGUIK_LAST
} RTGUI_KBD_KEY;
/* Enumeration of valid key mods (possibly OR'd together) */
typedef enum
{
RTGUI_KMOD_NONE = 0x0000,
RTGUI_KMOD_LSHIFT = 0x0001,
RTGUI_KMOD_RSHIFT = 0x0002,
RTGUI_KMOD_LCTRL = 0x0040,
RTGUI_KMOD_RCTRL = 0x0080,
RTGUI_KMOD_LALT = 0x0100,
RTGUI_KMOD_RALT = 0x0200,
RTGUI_KMOD_LMETA = 0x0400,
RTGUI_KMOD_RMETA = 0x0800,
RTGUI_KMOD_NUM = 0x1000,
RTGUI_KMOD_CAPS = 0x2000,
RTGUI_KMOD_MODE = 0x4000,
RTGUI_KMOD_RESERVED = 0x8000
} RTGUI_KBD_MOD;
typedef enum
{
RTGUI_KEYDOWN, /* Keys pressed */
RTGUI_KEYUP, /* Keys released */
} RTGUI_KBD_TYPE;
#endif

View File

@ -1,76 +0,0 @@
/*
* File : list.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __RTGUI_LIST_H__
#define __RTGUI_LIST_H__
#include <rtgui/rtgui.h>
struct rtgui_list_node
{
struct rtgui_list_node *next;
};
typedef struct rtgui_list_node rtgui_list_t;
rt_inline void rtgui_list_init(rtgui_list_t *l)
{
l->next = (struct rtgui_list_node *)0;
}
rt_inline void rtgui_list_append(rtgui_list_t *l, rtgui_list_t *n)
{
struct rtgui_list_node *node;
node = l;
while (node->next) node = node->next;
/* append the node to the tail */
node->next = n;
n->next = (struct rtgui_list_node *) 0;
}
rt_inline void rtgui_list_insert(rtgui_list_t *l, rtgui_list_t *n)
{
n->next = l->next;
l->next = n;
}
rt_inline rtgui_list_t *rtgui_list_remove(rtgui_list_t *l, rtgui_list_t *n)
{
/* remove slist head */
struct rtgui_list_node *node = l;
while (node->next && node->next != n) node = node->next;
/* remove node */
if (node->next != (rtgui_list_t *)0) node->next = node->next->next;
return l;
}
#define rtgui_list_entry(node, type, member) \
((type *)((char*)(node)-(unsigned long)(&((type *)0)->member)))
#define rtgui_list_foreach(node, list) \
for ((node) = (list)->next; (node) != RT_NULL; (node) = (node)->next)
#endif

View File

@ -1,186 +0,0 @@
/*
* File : matrix.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2010-04-10 Grissiom The first version
*/
#ifndef __MATRIX_H__
#define __MATRIX_H__
/* Port from ejoy2d: https://github.com/cloudwu/ejoy2d/blob/master/LICENSE
* Original License:
*
* The MIT License (MIT)
*
* Copyright (c) 2013 Ejoy.com Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* Port to RTGUI and modified by Grissiom */
#ifdef _MSC_VER
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
#define RTGUI_MATRIX_FRAC_BITS 11
#define RTGUI_MATRIX_FRAC (1 << RTGUI_MATRIX_FRAC_BITS)
struct rtgui_matrix
{
/* The matrix format is :
*
* | m[0] m[1] 0 |
* | m[2] m[3] 0 |
* | m[4] m[5] 1 |
*
* The format of the coordinate of a point is:
*
* | x y 1 |
*
* So, if you want to transform a point p with a matrix m, do:
*
* p * m
*
* Note: m[0-3] is in fix presentation that has 10 bits decimal
* fraction(m/RTGUI_MATRIX_FRAC). While the unit of m[4-5] is pixel.
*
*/
int m[6];
};
rt_inline int32_t _rtgui_matrix_round_div32(int32_t n, int32_t d)
{
if (n == 0)
return 0;
if (d < 0)
{
d = -d;
n = -n;
}
if (n > 0)
return (n + d / 2) / d;
else
return (n - d / 2) / d;
}
rt_inline int32_t _rtgui_matrix_round_div6432(int64_t n, int32_t d)
{
if (n == 0)
return 0;
if (d < 0)
{
d = -d;
n = -n;
}
if (n > 0)
return (n + d / 2) / d;
else
return (n - d / 2) / d;
}
/* mm = mm1 * mm2 */
rt_inline void rtgui_matrix_mul(struct rtgui_matrix *mm,
const struct rtgui_matrix *mm1,
const struct rtgui_matrix *mm2)
{
int *m = mm->m;
const int *m1 = mm1->m;
const int *m2 = mm2->m;
m[0] = _rtgui_matrix_round_div32(m1[0] * m2[0] + m1[1] * m2[2], RTGUI_MATRIX_FRAC);
m[1] = _rtgui_matrix_round_div32(m1[0] * m2[1] + m1[1] * m2[3], RTGUI_MATRIX_FRAC);
m[2] = _rtgui_matrix_round_div32(m1[2] * m2[0] + m1[3] * m2[2], RTGUI_MATRIX_FRAC);
m[3] = _rtgui_matrix_round_div32(m1[2] * m2[1] + m1[3] * m2[3], RTGUI_MATRIX_FRAC);
m[4] = _rtgui_matrix_round_div32(m1[4] * m2[0] + m1[5] * m2[2], RTGUI_MATRIX_FRAC) + m2[4];
m[5] = _rtgui_matrix_round_div32(m1[4] * m2[1] + m1[5] * m2[3], RTGUI_MATRIX_FRAC) + m2[5];
}
/* Matrix multiply point[(p) = (x, y) * m], ignore the movement components. */
rt_inline void rtgui_matrix_mul_point_nomove(struct rtgui_point *p,
int x, int y,
struct rtgui_matrix *m)
{
int *mm = m->m;
p->x = _rtgui_matrix_round_div32(x * mm[0] + y * mm[2], RTGUI_MATRIX_FRAC);
p->y = _rtgui_matrix_round_div32(x * mm[1] + y * mm[3], RTGUI_MATRIX_FRAC);
}
/* Matrix multiply point[(p) = (x, y) * m]. */
rt_inline void rtgui_matrix_mul_point(struct rtgui_point *p,
int x, int y,
struct rtgui_matrix *m)
{
int *mm = m->m;
p->x = _rtgui_matrix_round_div32(x * mm[0] + y * mm[2], RTGUI_MATRIX_FRAC) + mm[4];
p->y = _rtgui_matrix_round_div32(x * mm[1] + y * mm[3], RTGUI_MATRIX_FRAC) + mm[5];
}
/** Set @mm to an identity matrix. */
rt_inline void rtgu_matrix_identity(struct rtgui_matrix *mm)
{
int *mat = mm->m;
mat[0] = RTGUI_MATRIX_FRAC;
mat[1] = 0;
mat[2] = 0;
mat[3] = RTGUI_MATRIX_FRAC;
mat[4] = 0;
mat[5] = 0;
}
/** Save the inversed matrix of @mm to @mo.
*
* @return If the matrix is not inversale, return 1. Otherwise, return 0. */
int rtgui_matrix_inverse(const struct rtgui_matrix *mm, struct rtgui_matrix *mo);
/** @degree range from 0 ~ 512. */
void rtgui_matrix_rotate(struct rtgui_matrix *m, int degree);
/** The unit is fixed point number. RTGUI_MATRIX_FRAC means 1.0. */
void rtgui_matrix_scale(struct rtgui_matrix *m, int sx, int sy);
/** The unit is pixel. Not the fixed point number. */
void rtgui_matrix_move(struct rtgui_matrix *m, int dx, int dy);
#endif /* end of include guard: __MATRIX_H__ */

View File

@ -1,132 +0,0 @@
/*
* File : region.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __RTGUI_REGION_H__
#define __RTGUI_REGION_H__
#include <rtgui/rtgui.h>
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
typedef struct rtgui_region_data rtgui_region_data_t;
struct rtgui_dc;
struct rtgui_region_data
{
rt_uint32_t size;
rt_uint32_t numRects;
/* XXX: And why, exactly, do we have this bogus struct definition? */
/* rtgui_rect_t rects[size]; in memory but not explicitly declared */
};
typedef struct rtgui_region
{
rtgui_rect_t extents;
rtgui_region_data_t *data;
} rtgui_region_t;
typedef enum
{
RTGUI_REGION_STATUS_FAILURE,
RTGUI_REGION_STATUS_SUCCESS
} rtgui_region_status_t;
/* creation/destruction */
void rtgui_region_init(rtgui_region_t *region);
void rtgui_region_init_rect(rtgui_region_t *region,
int x, int y, unsigned int width, unsigned int height);
void rtgui_region_init_with_extents(rtgui_region_t *region, const rtgui_rect_t *extents);
void rtgui_region_fini(rtgui_region_t *region);
void rtgui_region_translate(rtgui_region_t *region, int x, int y);
rtgui_region_status_t rtgui_region_copy(rtgui_region_t *dest, rtgui_region_t *source);
rtgui_region_status_t rtgui_region_intersect(rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_region_t *reg2);
rtgui_region_status_t rtgui_region_intersect_rect(rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_rect_t *rect);
rtgui_region_status_t rtgui_region_union(rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_region_t *reg2);
rtgui_region_status_t rtgui_region_union_rect(rtgui_region_t *dest, rtgui_region_t *source, rtgui_rect_t *rect);
rtgui_region_status_t rtgui_region_subtract(rtgui_region_t *regD, rtgui_region_t *regM, rtgui_region_t *regS);
rtgui_region_status_t rtgui_region_subtract_rect(rtgui_region_t *regD, rtgui_region_t *regM, rtgui_rect_t *rect);
rtgui_region_status_t rtgui_region_inverse(rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_rect_t *invRect);
int rtgui_region_num_rects(rtgui_region_t *region);
rtgui_rect_t *rtgui_region_rects(rtgui_region_t *region);
#define RTGUI_REGION_OUT 0
#define RTGUI_REGION_IN 1
#define RTGUI_REGION_PART 2
int rtgui_region_contains_point(rtgui_region_t *region, int x, int y, rtgui_rect_t *box);
int rtgui_region_contains_rectangle(rtgui_region_t *rtgui_region_t, rtgui_rect_t *prect);
int rtgui_region_not_empty(rtgui_region_t *region);
rtgui_rect_t *rtgui_region_extents(rtgui_region_t *region);
rtgui_region_status_t rtgui_region_append(rtgui_region_t *dest, rtgui_region_t *region);
rtgui_region_status_t rtgui_region_validate(rtgui_region_t *badreg, int *pOverlap);
void rtgui_region_reset(rtgui_region_t *region, rtgui_rect_t *rect);
void rtgui_region_empty(rtgui_region_t *region);
void rtgui_region_dump(rtgui_region_t *region);
void rtgui_region_draw_clip(rtgui_region_t *region, struct rtgui_dc *dc);
int rtgui_region_is_flat(rtgui_region_t *region);
/* rect functions */
extern rtgui_rect_t rtgui_empty_rect;
void rtgui_rect_move(rtgui_rect_t *rect, int x, int y);
void rtgui_rect_move_to_point(rtgui_rect_t *rect, int x, int y);
void rtgui_rect_move_to_align(const rtgui_rect_t *rect, rtgui_rect_t *to, int align);
void rtgui_rect_inflate(rtgui_rect_t *rect, int d);
void rtgui_rect_intersect(rtgui_rect_t *src, rtgui_rect_t *dest);
int rtgui_rect_contains_point(const rtgui_rect_t *rect, int x, int y);
int rtgui_rect_is_intersect(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2);
int rtgui_rect_is_equal(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2);
rtgui_rect_t *rtgui_rect_set(rtgui_rect_t *rect, int x, int y, int w, int h);
rt_bool_t rtgui_rect_is_empty(const rtgui_rect_t *rect);
void rtgui_rect_union(rtgui_rect_t *src, rtgui_rect_t *dest);
rt_inline void rtgui_rect_init(rtgui_rect_t* rect, int x, int y, int width, int height)
{
rect->x1 = x;
rect->y1 = y;
rect->x2 = x + width;
rect->y2 = y + height;
}
#define RTGUI_RECT(rect, x, y, w, h) \
do { \
rect.x1 = x; rect.y1 = y; \
rect.x2 = (x) + (w); rect.y2 = (y) + (h); \
} while (0)
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif /* _PIXMAN_H_ */

View File

@ -1,187 +0,0 @@
/*
* File : rtgui.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-04 Bernard first version
*/
#ifndef __RT_GUI_H__
#define __RT_GUI_H__
#include <rtthread.h>
#include <rtgui/rtgui_config.h>
#ifdef __cplusplus
extern "C" {
#endif
#define _UI_MIN(x, y) (((x)<(y))?(x):(y))
#define _UI_MAX(x, y) (((x)>(y))?(x):(y))
#define _UI_BITBYTES(bits) ((bits + 7)/8)
#define _UI_ABS(x) ((x)>=0? (x):-(x))
/* MDK, GCC and MSVC all support __restrict keyword. */
#define RTGUI_RESTRICT __restrict
#ifdef _MSC_VER
#define RTGUI_PURE
#else
/* GCC and MDK share the same attributes.
* TODO: IAR attributes. */
#define RTGUI_PURE __attribute__((pure))
#endif
struct rtgui_event;
struct rtgui_object;
struct rtgui_widget;
struct rtgui_win;
struct rtgui_font;
typedef struct rtgui_win rtgui_win_t;
typedef rt_bool_t (*rtgui_event_handler_ptr)(struct rtgui_object *object, struct rtgui_event *event);
typedef void (*rtgui_onbutton_func_t)(struct rtgui_object *object, struct rtgui_event *event);
/**
* Coordinate point
*/
struct rtgui_point
{
rt_int16_t x, y;
};
typedef struct rtgui_point rtgui_point_t;
extern rtgui_point_t rtgui_empty_point;
/**
* Rectangle structure
*/
struct rtgui_rect
{
rt_int16_t x1, y1, x2, y2;
};
typedef struct rtgui_rect rtgui_rect_t;
#define rtgui_rect_width(r) ((r).x2 - (r).x1)
#define rtgui_rect_height(r) ((r).y2 - (r).y1)
typedef unsigned long rtgui_color_t;
/**
* Graphic context
*/
struct rtgui_gc
{
/* foreground and background color */
rtgui_color_t foreground, background;
/* text style */
rt_uint16_t textstyle;
/* text align */
rt_uint16_t textalign;
/* font */
struct rtgui_font *font;
};
typedef struct rtgui_gc rtgui_gc_t;
enum RTGUI_MARGIN_STYLE
{
RTGUI_MARGIN_LEFT = 0x01,
RTGUI_MARGIN_RIGHT = 0x02,
RTGUI_MARGIN_TOP = 0x04,
RTGUI_MARGIN_BOTTOM = 0x08,
RTGUI_MARGIN_ALL = RTGUI_MARGIN_LEFT | RTGUI_MARGIN_RIGHT | RTGUI_MARGIN_TOP | RTGUI_MARGIN_BOTTOM
};
/**
* Border style
*/
enum RTGUI_BORDER_STYLE
{
RTGUI_BORDER_NONE = 0,
RTGUI_BORDER_SIMPLE,
RTGUI_BORDER_RAISE,
RTGUI_BORDER_SUNKEN,
RTGUI_BORDER_BOX,
RTGUI_BORDER_STATIC,
RTGUI_BORDER_EXTRA,
RTGUI_BORDER_UP,
RTGUI_BORDER_DOWN
};
#define RTGUI_BORDER_DEFAULT_WIDTH 2
#define RTGUI_WIDGET_DEFAULT_MARGIN 3
/**
* Blend mode
*/
enum RTGUI_BLENDMODE
{
RTGUI_BLENDMODE_NONE = 0x00,
RTGUI_BLENDMODE_BLEND,
RTGUI_BLENDMODE_ADD,
RTGUI_BLENDMODE_MOD,
};
/**
* Orientation
*/
enum RTGUI_ORIENTATION
{
RTGUI_HORIZONTAL = 0x01,
RTGUI_VERTICAL = 0x02,
RTGUI_ORIENTATION_BOTH = RTGUI_HORIZONTAL | RTGUI_VERTICAL
};
enum RTGUI_ALIGN
{
RTGUI_ALIGN_NOT = 0x00,
RTGUI_ALIGN_CENTER_HORIZONTAL = 0x01,
RTGUI_ALIGN_LEFT = RTGUI_ALIGN_NOT,
RTGUI_ALIGN_TOP = RTGUI_ALIGN_NOT,
RTGUI_ALIGN_RIGHT = 0x02,
RTGUI_ALIGN_BOTTOM = 0x04,
RTGUI_ALIGN_CENTER_VERTICAL = 0x08,
RTGUI_ALIGN_CENTER = RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL,
RTGUI_ALIGN_EXPAND = 0x10,
RTGUI_ALIGN_STRETCH = 0x20,
RTGUI_ALIGN_TTF_SIZE = 0x40,
};
enum RTGUI_TEXTSTYLE
{
RTGUI_TEXTSTYLE_NORMAL = 0x00,
RTGUI_TEXTSTYLE_DRAW_BACKGROUND = 0x01,
RTGUI_TEXTSTYLE_SHADOW = 0x02,
RTGUI_TEXTSTYLE_OUTLINE = 0x04,
};
enum RTGUI_MODAL_CODE
{
RTGUI_MODAL_OK,
RTGUI_MODAL_CANCEL,
RTGUI_MODAL_MAX = 0xFFFF,
};
typedef enum RTGUI_MODAL_CODE rtgui_modal_code_t;
#include <rtgui/rtgui_object.h>
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,128 +0,0 @@
/*
* File : rtgui_app.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2012-01-13 Grissiom first version
*/
#ifndef __RTGUI_APP_H__
#define __RTGUI_APP_H__
#include <rtthread.h>
#include <rtgui/rtgui.h>
#include <rtgui/event.h>
#include <rtgui/rtgui_system.h>
#ifdef __cplusplus
extern "C" {
#endif
DECLARE_CLASS_TYPE(application);
/** Gets the type of a application */
#define RTGUI_APP_TYPE (RTGUI_TYPE(application))
/** Casts the object to an rtgui_workbench */
#define RTGUI_APP(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_APP_TYPE, struct rtgui_app))
/** Checks if the object is an rtgui_workbench */
#define RTGUI_IS_APP(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_APP_TYPE))
enum rtgui_app_flag
{
RTGUI_APP_FLAG_EXITED = 0x04,
RTGUI_APP_FLAG_SHOWN = 0x08,
RTGUI_APP_FLAG_KEEP = 0x80,
};
typedef void (*rtgui_idle_func_t)(struct rtgui_object *obj, struct rtgui_event *event);
struct rtgui_app
{
struct rtgui_object parent;
/* application name */
unsigned char *name;
struct rtgui_image *icon;
enum rtgui_app_flag state_flag;
rt_uint16_t ref_count;
rt_uint16_t exit_code;
/* the thread id */
rt_thread_t tid;
/* the message queue of thread */
rt_mq_t mq;
/* event buffer */
rt_uint8_t event_buffer[sizeof(union rtgui_event_generic)];
/* if not RT_NULL, the main_object is the one will be activated when the
* app recieves activate event. By default, it is the first window shown in
* the app. */
struct rtgui_object *main_object;
/* on idle event handler */
rtgui_idle_func_t on_idle;
unsigned int window_cnt;
/* window activate count */
unsigned int win_acti_cnt;
void *user_data;
};
/**
* create an application named @myname on current thread.
*
* @param name the name of the application
*
* @return a pointer to struct rtgui_app on success. RT_NULL on failure.
*/
struct rtgui_app *rtgui_app_create(const char *name);
void rtgui_app_destroy(struct rtgui_app *app);
rt_bool_t rtgui_app_event_handler(struct rtgui_object *obj, rtgui_event_t *event);
rt_base_t rtgui_app_run(struct rtgui_app *app);
void rtgui_app_exit(struct rtgui_app *app, rt_uint16_t code);
void rtgui_app_activate(struct rtgui_app *app);
void rtgui_app_close(struct rtgui_app *app);
void rtgui_app_sleep(struct rtgui_app *app, int millisecond);
void rtgui_app_set_onidle(struct rtgui_app *app, rtgui_idle_func_t onidle);
rtgui_idle_func_t rtgui_app_get_onidle(struct rtgui_app *app);
/**
* return the rtgui_app struct on current thread
*/
struct rtgui_app *rtgui_app_self(void);
rt_err_t rtgui_app_set_as_wm(struct rtgui_app *app);
void rtgui_app_set_main_win(struct rtgui_app *app, struct rtgui_win *win);
struct rtgui_win* rtgui_app_get_main_win(struct rtgui_app *app);
/* get the topwin belong app window activate count */
unsigned int rtgui_app_get_win_acti_cnt(void);
#ifdef __cplusplus
}
#endif
#endif /* end of include guard: __RTGUI_APP_H__ */

View File

@ -1,81 +0,0 @@
/*
* File : rtgui_config.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
* 2010-02-08 Bernard move some RTGUI options to bsp
*/
#ifndef __RTGUI_CONFIG_H__
#define __RTGUI_CONFIG_H__
/* RTGUI options */
#ifndef RT_USING_DFS
#undef RTGUI_USING_DFS_FILERW
#undef RTGUI_USING_HZ_FILE
#endif
#ifdef RT_USING_DFS
/* if file system is used, the DFS_FILERW will be defined */
#ifndef RTGUI_USING_DFS_FILERW
#define RTGUI_USING_DFS_FILERW
#endif
#endif
#if RTGUI_DEFAULT_FONT_SIZE == 0
#define RTGUI_DEFAULT_FONT_SIZE 12
#endif
#define RTGUI_SVR_THREAD_PRIORITY 15
#define RTGUI_SVR_THREAD_TIMESLICE 5
#ifndef RTGUI_SVR_THREAD_STACK_SIZE
#ifdef RTGUI_USING_SMALL_SIZE
#define RTGUI_SVR_THREAD_STACK_SIZE 1024
#else
#define RTGUI_SVR_THREAD_STACK_SIZE 2048
#endif
#endif
#define RTGUI_APP_THREAD_PRIORITY 25
#define RTGUI_APP_THREAD_TIMESLICE 5
#ifdef RTGUI_USING_SMALL_SIZE
#define RTGUI_APP_THREAD_STACK_SIZE 1024
#else
#define RTGUI_APP_THREAD_STACK_SIZE 2048
#endif
// #define RTGUI_USING_CAST_CHECK
// #define RTGUI_USING_DESKTOP_WINDOW
// #undef RTGUI_USING_SMALL_SIZE
//#define RTGUI_USING_CALIBRATION
#define RTGUI_USING_VFRAMEBUFFER
#ifdef DEBUG_MEMLEAK
#define rtgui_malloc rt_malloc
#define rtgui_realloc rt_realloc
#define rtgui_free rt_free
#endif
#endif

View File

@ -1,177 +0,0 @@
/*
* File : rtgui_object.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-04 Bernard first version
*/
#ifndef __RTGUI_OBJECT_H__
#define __RTGUI_OBJECT_H__
#include <rtthread.h>
#include <rtgui/rtgui.h>
#ifdef __cplusplus
extern "C" {
#endif
/* rtgui object type */
#define RTGUI_CONTAINER_OF(obj, type, member) \
((type *)((char *)(obj) - (unsigned long)(&((type *)0)->member)))
/** Casts the function pointer to an rtgui_constructor */
#define RTGUI_CONSTRUCTOR(constructor) ((rtgui_constructor_t)(constructor))
/** Casts the function pointer to an rtgui_constructor */
#define RTGUI_DESTRUCTOR(destructor) ((rtgui_destructor_t)(destructor))
/* pre-definition */
struct rtgui_object;
struct rtgui_app;
typedef struct rtgui_object rtgui_object_t;
typedef void (*rtgui_constructor_t)(rtgui_object_t *object);
typedef void (*rtgui_destructor_t)(rtgui_object_t *object);
/* rtgui type structure */
struct rtgui_type
{
/* type name */
char *name;
/* parent type link */
const struct rtgui_type *parent;
/* constructor and destructor */
rtgui_constructor_t constructor;
rtgui_destructor_t destructor;
/* size of type */
int size;
};
typedef struct rtgui_type rtgui_type_t;
#define RTGUI_TYPE(type) (_rtgui_##type##_get_type())
#define RTGUI_PARENT_TYPE(type) (const struct rtgui_type*)(&_rtgui_##type)
#define DECLARE_CLASS_TYPE(type) \
const rtgui_type_t *_rtgui_##type##_get_type(void); \
extern const struct rtgui_type _rtgui_##type
#define DEFINE_CLASS_TYPE(type, name, parent, constructor, destructor, size) \
const struct rtgui_type _rtgui_##type = { \
name, \
parent, \
RTGUI_CONSTRUCTOR(constructor), \
RTGUI_DESTRUCTOR(destructor), \
size }; \
const rtgui_type_t *_rtgui_##type##_get_type(void) { return &_rtgui_##type; } \
RTM_EXPORT(_rtgui_##type##_get_type)
void rtgui_type_object_construct(const rtgui_type_t *type, rtgui_object_t *object);
void rtgui_type_destructors_call(const rtgui_type_t *type, rtgui_object_t *object);
rt_bool_t rtgui_type_inherits_from(const rtgui_type_t *type, const rtgui_type_t *parent);
const rtgui_type_t *rtgui_type_parent_type_get(const rtgui_type_t *type);
const char *rtgui_type_name_get(const rtgui_type_t *type);
const rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object);
#ifdef RTGUI_USING_CAST_CHECK
#define RTGUI_OBJECT_CAST(obj, obj_type, c_type) \
((c_type *)rtgui_object_check_cast((rtgui_object_t *)(obj), (obj_type), __FUNCTION__, __LINE__))
#else
#define RTGUI_OBJECT_CAST(obj, obj_type, c_type) ((c_type *)(obj))
#endif
#define RTGUI_OBJECT_CHECK_TYPE(_obj, _type) \
(rtgui_type_inherits_from(((rtgui_object_t *)(_obj))->type, (_type)))
DECLARE_CLASS_TYPE(object);
/** Gets the type of an object */
#define RTGUI_OBJECT_TYPE RTGUI_TYPE(object)
/** Casts the object to an rtgui_object_t */
#define RTGUI_OBJECT(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_OBJECT_TYPE, struct rtgui_object))
/** Checks if the object is an rtgui_Object */
#define RTGUI_IS_OBJECT(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_OBJECT_TYPE))
enum rtgui_object_flag
{
RTGUI_OBJECT_FLAG_NONE = 0x0000,
RTGUI_OBJECT_FLAG_STATIC = 0x0001,
RTGUI_OBJECT_FLAG_DISABLED = 0x0002,
/* When an object is created, it's flag is set to valid. When an object is
* deleted, the valid bits will be cleared. */
RTGUI_OBJECT_FLAG_VALID = 0xAB00,
};
/* rtgui base object */
struct rtgui_object
{
/* object type */
const rtgui_type_t *type;
/* the event handler */
rtgui_event_handler_ptr event_handler;
enum rtgui_object_flag flag;
rt_uint32_t id;
};
rtgui_object_t *rtgui_object_create(const rtgui_type_t *object_type);
void rtgui_object_destroy(rtgui_object_t *object);
/* set the event handler of object */
void rtgui_object_set_event_handler(struct rtgui_object *object, rtgui_event_handler_ptr handler);
/* object default event handler */
rt_bool_t rtgui_object_event_handler(struct rtgui_object *object, struct rtgui_event *event);
/* helper micro. widget event handlers could use this. */
#define RTGUI_WIDGET_EVENT_HANDLER_PREPARE \
struct rtgui_widget *widget; \
RT_ASSERT(object != RT_NULL); \
RT_ASSERT(event != RT_NULL); \
widget = RTGUI_WIDGET(object); \
/* supress compiler warning */ \
widget = widget;
/** handle @param event on @param object's own event handler
*
* If the @param object does not have an event handler, which means the object
* does not interested in any event, it will return RT_FALSE. Otherwise, the
* return code of that handler is returned.
*/
rt_inline rt_bool_t rtgui_object_handle(struct rtgui_object *object, struct rtgui_event *event)
{
if (object->event_handler)
return object->event_handler(object, event);
return RT_FALSE;
}
rtgui_object_t *rtgui_object_check_cast(rtgui_object_t *object, const rtgui_type_t *type, const char *func, int line);
const rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object);
void rtgui_object_set_id(struct rtgui_object *obj, rt_uint32_t id);
rt_uint32_t rtgui_object_get_id(struct rtgui_object *obj);
struct rtgui_object* rtgui_get_object(struct rtgui_app *app, rt_uint32_t id);
struct rtgui_object* rtgui_get_self_object(rt_uint32_t id);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,96 +0,0 @@
/*
* File : rtgui_server.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-04 Bernard first version
*/
#ifndef __RTGUI_SERVER_H__
#define __RTGUI_SERVER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <rtservice.h>
#include <rtgui/list.h>
/* RTGUI server definitions */
/* top window definitions in server */
enum rtgui_topwin_flag
{
WINTITLE_INIT = 0x00,
WINTITLE_ACTIVATE = 0x01,
WINTITLE_NOFOCUS = 0x02,
/* window is hidden by default */
WINTITLE_SHOWN = 0x04,
/* window is modaled by other window */
WINTITLE_MODALED = 0x08,
/* window is modaling other window */
WINTITLE_MODALING = 0x100,
WINTITLE_ONTOP = 0x200,
WINTITLE_ONBTM = 0x400,
};
struct rtgui_topwin
{
/* the window flag */
enum rtgui_topwin_flag flag;
/* event mask */
rt_uint32_t mask;
struct rtgui_wintitle *title;
/* the window id */
struct rtgui_win *wid;
/* which app I belong */
struct rtgui_app *app;
/* the extent information */
rtgui_rect_t extent;
struct rtgui_topwin *parent;
/* we need to iterate the topwin list with usual order(get target window)
* or reversely(painting). So it's better to use a double linked list */
rt_list_t list;
rt_list_t child_list;
/* the monitor rect list */
rtgui_list_t monitor_list;
};
/* top win manager init */
void rtgui_topwin_init(void);
void rtgui_server_init(void);
void rtgui_server_install_show_win_hook(void (*hk)(void));
void rtgui_server_install_act_win_hook(void (*hk)(void));
/* post an event to server */
rt_err_t rtgui_server_post_event(struct rtgui_event *event, rt_size_t size);
rt_err_t rtgui_server_post_event_sync(struct rtgui_event *event, rt_size_t size);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,108 +0,0 @@
/*
* File : rtgui_system.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-04 Bernard first version
*/
#ifndef __RTGUI_SYSTEM_H__
#define __RTGUI_SYSTEM_H__
#include <rtthread.h>
#include <rtgui/rtgui.h>
#ifdef __cplusplus
extern "C" {
#endif
struct rtgui_dc;
struct rtgui_event;
struct rtgui_widget;
struct rtgui_timer;
typedef void (*rtgui_timeout_func)(struct rtgui_timer *timer, void *parameter);
enum rtgui_timer_state
{
RTGUI_TIMER_ST_INIT,
RTGUI_TIMER_ST_RUNNING,
RTGUI_TIMER_ST_DESTROY_PENDING,
};
struct rtgui_timer
{
/* the rtgui application it runs on */
struct rtgui_app* app;
/* rt timer */
struct rt_timer timer;
/* How many events are pending on the queue. */
int pending_cnt;
enum rtgui_timer_state state;
/* timeout function and user data */
rtgui_timeout_func timeout;
void *user_data;
};
typedef struct rtgui_timer rtgui_timer_t;
rtgui_timer_t *rtgui_timer_create(rt_int32_t time, rt_base_t flag, rtgui_timeout_func timeout, void *parameter);
void rtgui_timer_destory(rtgui_timer_t *timer);
void rtgui_timer_set_timeout(rtgui_timer_t *timer, rt_int32_t time);
void rtgui_timer_start(rtgui_timer_t *timer);
void rtgui_timer_stop(rtgui_timer_t *timer);
/* rtgui system initialization function */
int rtgui_system_server_init(void);
void *rtgui_malloc(rt_size_t size);
void rtgui_free(void *ptr);
void *rtgui_realloc(void *ptr, rt_size_t size);
#ifdef _WIN32_NATIVE
#define rtgui_enter_critical()
#define rtgui_exit_critical()
#else
#define rtgui_enter_critical rt_enter_critical
#define rtgui_exit_critical rt_exit_critical
#endif
struct rtgui_app* rtgui_get_server(void);
void rtgui_set_mainwin_rect(struct rtgui_rect *rect);
void rtgui_get_mainwin_rect(struct rtgui_rect *rect);
void rtgui_get_screen_rect(struct rtgui_rect *rect);
void rtgui_screen_lock(rt_int32_t timeout);
void rtgui_screen_unlock(void);
int rtgui_screen_lock_freeze(void);
void rtgui_screen_lock_thaw(int value);
struct rtgui_event;
rt_err_t rtgui_send(struct rtgui_app* app, struct rtgui_event *event, rt_size_t event_size);
rt_err_t rtgui_send_urgent(struct rtgui_app* app, struct rtgui_event *event, rt_size_t event_size);
rt_err_t rtgui_send_sync(struct rtgui_app* app, struct rtgui_event *event, rt_size_t event_size);
rt_err_t rtgui_ack(struct rtgui_event *event, rt_int32_t status);
rt_err_t rtgui_recv(struct rtgui_event *event, rt_size_t event_size, rt_int32_t timeout);
rt_err_t rtgui_recv_filter(rt_uint32_t type, struct rtgui_event *event, rt_size_t event_size);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,748 +0,0 @@
/* $NetBSD: tree.h,v 1.8 2004/03/28 19:38:30 provos Exp $ */
/* $OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $ */
/* $FreeBSD$ */
/*-
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SYS_TREE_H_
#define _SYS_TREE_H_
#ifndef NULL
#define NULL RT_NULL
#endif
// #include <sys/cdefs.h>
/*
* This file defines data structures for different types of trees:
* splay trees and red-black trees.
*
* A splay tree is a self-organizing data structure. Every operation
* on the tree causes a splay to happen. The splay moves the requested
* node to the root of the tree and partly rebalances it.
*
* This has the benefit that request locality causes faster lookups as
* the requested nodes move to the top of the tree. On the other hand,
* every lookup causes memory writes.
*
* The Balance Theorem bounds the total access time for m operations
* and n inserts on an initially empty tree as O((m + n)lg n). The
* amortized cost for a sequence of m accesses to a splay tree is O(lg n);
*
* A red-black tree is a binary search tree with the node color as an
* extra attribute. It fulfills a set of conditions:
* - every search path from the root to a leaf consists of the
* same number of black nodes,
* - each red node (except for the root) has a black parent,
* - each leaf node is black.
*
* Every operation on a red-black tree is bounded as O(lg n).
* The maximum height of a red-black tree is 2lg (n+1).
*/
#define SPLAY_HEAD(name, type) \
struct name { \
struct type *sph_root; /* root of the tree */ \
}
#define SPLAY_INITIALIZER(root) \
{ NULL }
#define SPLAY_INIT(root) do { \
(root)->sph_root = NULL; \
} while (/*CONSTCOND*/ 0)
#define SPLAY_ENTRY(type) \
struct { \
struct type *spe_left; /* left element */ \
struct type *spe_right; /* right element */ \
}
#define SPLAY_LEFT(elm, field) (elm)->field.spe_left
#define SPLAY_RIGHT(elm, field) (elm)->field.spe_right
#define SPLAY_ROOT(head) (head)->sph_root
#define SPLAY_EMPTY(head) (SPLAY_ROOT(head) == NULL)
/* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */
#define SPLAY_ROTATE_RIGHT(head, tmp, field) do { \
SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \
SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
(head)->sph_root = tmp; \
} while (/*CONSTCOND*/ 0)
#define SPLAY_ROTATE_LEFT(head, tmp, field) do { \
SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \
SPLAY_LEFT(tmp, field) = (head)->sph_root; \
(head)->sph_root = tmp; \
} while (/*CONSTCOND*/ 0)
#define SPLAY_LINKLEFT(head, tmp, field) do { \
SPLAY_LEFT(tmp, field) = (head)->sph_root; \
tmp = (head)->sph_root; \
(head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \
} while (/*CONSTCOND*/ 0)
#define SPLAY_LINKRIGHT(head, tmp, field) do { \
SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
tmp = (head)->sph_root; \
(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \
} while (/*CONSTCOND*/ 0)
#define SPLAY_ASSEMBLE(head, node, left, right, field) do { \
SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \
SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\
SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \
SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \
} while (/*CONSTCOND*/ 0)
/* Generates prototypes and inline functions */
#define SPLAY_PROTOTYPE(name, type, field, cmp) \
void name##_SPLAY(struct name *, struct type *); \
void name##_SPLAY_MINMAX(struct name *, int); \
struct type *name##_SPLAY_INSERT(struct name *, struct type *); \
struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \
\
/* Finds the node with the same key as elm */ \
rt_inline struct type * \
name##_SPLAY_FIND(struct name *head, struct type *elm) \
{ \
if (SPLAY_EMPTY(head)) \
return(NULL); \
name##_SPLAY(head, elm); \
if ((cmp)(elm, (head)->sph_root) == 0) \
return (head->sph_root); \
return (NULL); \
} \
\
rt_inline struct type * \
name##_SPLAY_NEXT(struct name *head, struct type *elm) \
{ \
name##_SPLAY(head, elm); \
if (SPLAY_RIGHT(elm, field) != NULL) { \
elm = SPLAY_RIGHT(elm, field); \
while (SPLAY_LEFT(elm, field) != NULL) { \
elm = SPLAY_LEFT(elm, field); \
} \
} else \
elm = NULL; \
return (elm); \
} \
\
rt_inline struct type * \
name##_SPLAY_MIN_MAX(struct name *head, int val) \
{ \
name##_SPLAY_MINMAX(head, val); \
return (SPLAY_ROOT(head)); \
}
/* Main splay operation.
* Moves node close to the key of elm to top
*/
#define SPLAY_GENERATE(name, type, field, cmp) \
struct type * \
name##_SPLAY_INSERT(struct name *head, struct type *elm) \
{ \
if (SPLAY_EMPTY(head)) { \
SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL; \
} else { \
int __comp; \
name##_SPLAY(head, elm); \
__comp = (cmp)(elm, (head)->sph_root); \
if(__comp < 0) { \
SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field);\
SPLAY_RIGHT(elm, field) = (head)->sph_root; \
SPLAY_LEFT((head)->sph_root, field) = NULL; \
} else if (__comp > 0) { \
SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field);\
SPLAY_LEFT(elm, field) = (head)->sph_root; \
SPLAY_RIGHT((head)->sph_root, field) = NULL; \
} else \
return ((head)->sph_root); \
} \
(head)->sph_root = (elm); \
return (NULL); \
} \
\
struct type * \
name##_SPLAY_REMOVE(struct name *head, struct type *elm) \
{ \
struct type *__tmp; \
if (SPLAY_EMPTY(head)) \
return (NULL); \
name##_SPLAY(head, elm); \
if ((cmp)(elm, (head)->sph_root) == 0) { \
if (SPLAY_LEFT((head)->sph_root, field) == NULL) { \
(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\
} else { \
__tmp = SPLAY_RIGHT((head)->sph_root, field); \
(head)->sph_root = SPLAY_LEFT((head)->sph_root, field);\
name##_SPLAY(head, elm); \
SPLAY_RIGHT((head)->sph_root, field) = __tmp; \
} \
return (elm); \
} \
return (NULL); \
} \
\
void \
name##_SPLAY(struct name *head, struct type *elm) \
{ \
struct type __node, *__left, *__right, *__tmp; \
int __comp; \
\
SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
__left = __right = &__node; \
\
while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) { \
if (__comp < 0) { \
__tmp = SPLAY_LEFT((head)->sph_root, field); \
if (__tmp == NULL) \
break; \
if ((cmp)(elm, __tmp) < 0){ \
SPLAY_ROTATE_RIGHT(head, __tmp, field); \
if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
break; \
} \
SPLAY_LINKLEFT(head, __right, field); \
} else if (__comp > 0) { \
__tmp = SPLAY_RIGHT((head)->sph_root, field); \
if (__tmp == NULL) \
break; \
if ((cmp)(elm, __tmp) > 0){ \
SPLAY_ROTATE_LEFT(head, __tmp, field); \
if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
break; \
} \
SPLAY_LINKRIGHT(head, __left, field); \
} \
} \
SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \
} \
\
/* Splay with either the minimum or the maximum element \
* Used to find minimum or maximum element in tree. \
*/ \
void name##_SPLAY_MINMAX(struct name *head, int __comp) \
{ \
struct type __node, *__left, *__right, *__tmp; \
\
SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
__left = __right = &__node; \
\
while (1) { \
if (__comp < 0) { \
__tmp = SPLAY_LEFT((head)->sph_root, field); \
if (__tmp == NULL) \
break; \
if (__comp < 0){ \
SPLAY_ROTATE_RIGHT(head, __tmp, field); \
if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
break; \
} \
SPLAY_LINKLEFT(head, __right, field); \
} else if (__comp > 0) { \
__tmp = SPLAY_RIGHT((head)->sph_root, field); \
if (__tmp == NULL) \
break; \
if (__comp > 0) { \
SPLAY_ROTATE_LEFT(head, __tmp, field); \
if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
break; \
} \
SPLAY_LINKRIGHT(head, __left, field); \
} \
} \
SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \
}
#define SPLAY_NEGINF -1
#define SPLAY_INF 1
#define SPLAY_INSERT(name, x, y) name##_SPLAY_INSERT(x, y)
#define SPLAY_REMOVE(name, x, y) name##_SPLAY_REMOVE(x, y)
#define SPLAY_FIND(name, x, y) name##_SPLAY_FIND(x, y)
#define SPLAY_NEXT(name, x, y) name##_SPLAY_NEXT(x, y)
#define SPLAY_MIN(name, x) (SPLAY_EMPTY(x) ? NULL \
: name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF))
#define SPLAY_MAX(name, x) (SPLAY_EMPTY(x) ? NULL \
: name##_SPLAY_MIN_MAX(x, SPLAY_INF))
#define SPLAY_FOREACH(x, name, head) \
for ((x) = SPLAY_MIN(name, head); \
(x) != NULL; \
(x) = SPLAY_NEXT(name, head, x))
/* Macros that define a red-black tree */
#define RB_HEAD(name, type) \
struct name { \
struct type *rbh_root; /* root of the tree */ \
}
#define RB_INITIALIZER(root) \
{ NULL }
#define RB_INIT(root) do { \
(root)->rbh_root = NULL; \
} while (/*CONSTCOND*/ 0)
#define RB_BLACK 0
#define RB_RED 1
#define RB_ENTRY(type) \
struct { \
struct type *rbe_left; /* left element */ \
struct type *rbe_right; /* right element */ \
struct type *rbe_parent; /* parent element */ \
int rbe_color; /* node color */ \
}
#define RB_LEFT(elm, field) (elm)->field.rbe_left
#define RB_RIGHT(elm, field) (elm)->field.rbe_right
#define RB_PARENT(elm, field) (elm)->field.rbe_parent
#define RB_COLOR(elm, field) (elm)->field.rbe_color
#define RB_ROOT(head) (head)->rbh_root
#define RB_EMPTY(head) (RB_ROOT(head) == NULL)
#define RB_SET(elm, parent, field) do { \
RB_PARENT(elm, field) = parent; \
RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \
RB_COLOR(elm, field) = RB_RED; \
} while (/*CONSTCOND*/ 0)
#define RB_SET_BLACKRED(black, red, field) do { \
RB_COLOR(black, field) = RB_BLACK; \
RB_COLOR(red, field) = RB_RED; \
} while (/*CONSTCOND*/ 0)
#ifndef RB_AUGMENT
#define RB_AUGMENT(x) do {} while (0)
#endif
#define RB_ROTATE_LEFT(head, elm, tmp, field) do { \
(tmp) = RB_RIGHT(elm, field); \
if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \
RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \
} \
RB_AUGMENT(elm); \
if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \
if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
else \
RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \
} else \
(head)->rbh_root = (tmp); \
RB_LEFT(tmp, field) = (elm); \
RB_PARENT(elm, field) = (tmp); \
RB_AUGMENT(tmp); \
if ((RB_PARENT(tmp, field))) \
RB_AUGMENT(RB_PARENT(tmp, field)); \
} while (/*CONSTCOND*/ 0)
#define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \
(tmp) = RB_LEFT(elm, field); \
if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \
RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \
} \
RB_AUGMENT(elm); \
if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \
if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
else \
RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \
} else \
(head)->rbh_root = (tmp); \
RB_RIGHT(tmp, field) = (elm); \
RB_PARENT(elm, field) = (tmp); \
RB_AUGMENT(tmp); \
if ((RB_PARENT(tmp, field))) \
RB_AUGMENT(RB_PARENT(tmp, field)); \
} while (/*CONSTCOND*/ 0)
/* Generates prototypes and inline functions */
#define RB_PROTOTYPE(name, type, field, cmp) \
RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \
RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static)
#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \
attr void name##_RB_INSERT_COLOR(struct name *, struct type *); \
attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\
attr struct type *name##_RB_REMOVE(struct name *, struct type *); \
attr struct type *name##_RB_INSERT(struct name *, struct type *); \
attr struct type *name##_RB_FIND(struct name *, struct type *); \
attr struct type *name##_RB_NFIND(struct name *, struct type *); \
attr struct type *name##_RB_NEXT(struct type *); \
attr struct type *name##_RB_PREV(struct type *); \
attr struct type *name##_RB_MINMAX(struct name *, int); \
\
/* Main rb operation.
* Moves node close to the key of elm to top
*/
#define RB_GENERATE(name, type, field, cmp) \
RB_GENERATE_INTERNAL(name, type, field, cmp,)
#define RB_GENERATE_STATIC(name, type, field, cmp) \
RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static)
#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \
attr void \
name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
{ \
struct type *parent, *gparent, *tmp; \
while ((parent = RB_PARENT(elm, field)) != NULL && \
RB_COLOR(parent, field) == RB_RED) { \
gparent = RB_PARENT(parent, field); \
if (parent == RB_LEFT(gparent, field)) { \
tmp = RB_RIGHT(gparent, field); \
if (tmp && RB_COLOR(tmp, field) == RB_RED) { \
RB_COLOR(tmp, field) = RB_BLACK; \
RB_SET_BLACKRED(parent, gparent, field);\
elm = gparent; \
continue; \
} \
if (RB_RIGHT(parent, field) == elm) { \
RB_ROTATE_LEFT(head, parent, tmp, field);\
tmp = parent; \
parent = elm; \
elm = tmp; \
} \
RB_SET_BLACKRED(parent, gparent, field); \
RB_ROTATE_RIGHT(head, gparent, tmp, field); \
} else { \
tmp = RB_LEFT(gparent, field); \
if (tmp && RB_COLOR(tmp, field) == RB_RED) { \
RB_COLOR(tmp, field) = RB_BLACK; \
RB_SET_BLACKRED(parent, gparent, field);\
elm = gparent; \
continue; \
} \
if (RB_LEFT(parent, field) == elm) { \
RB_ROTATE_RIGHT(head, parent, tmp, field);\
tmp = parent; \
parent = elm; \
elm = tmp; \
} \
RB_SET_BLACKRED(parent, gparent, field); \
RB_ROTATE_LEFT(head, gparent, tmp, field); \
} \
} \
RB_COLOR(head->rbh_root, field) = RB_BLACK; \
} \
\
attr void \
name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \
{ \
struct type *tmp; \
while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) && \
elm != RB_ROOT(head)) { \
if (RB_LEFT(parent, field) == elm) { \
tmp = RB_RIGHT(parent, field); \
if (RB_COLOR(tmp, field) == RB_RED) { \
RB_SET_BLACKRED(tmp, parent, field); \
RB_ROTATE_LEFT(head, parent, tmp, field);\
tmp = RB_RIGHT(parent, field); \
} \
if ((RB_LEFT(tmp, field) == NULL || \
RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
(RB_RIGHT(tmp, field) == NULL || \
RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
RB_COLOR(tmp, field) = RB_RED; \
elm = parent; \
parent = RB_PARENT(elm, field); \
} else { \
if (RB_RIGHT(tmp, field) == NULL || \
RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) {\
struct type *oleft; \
if ((oleft = RB_LEFT(tmp, field)) \
!= NULL) \
RB_COLOR(oleft, field) = RB_BLACK;\
RB_COLOR(tmp, field) = RB_RED; \
RB_ROTATE_RIGHT(head, tmp, oleft, field);\
tmp = RB_RIGHT(parent, field); \
} \
RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
RB_COLOR(parent, field) = RB_BLACK; \
if (RB_RIGHT(tmp, field)) \
RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK;\
RB_ROTATE_LEFT(head, parent, tmp, field);\
elm = RB_ROOT(head); \
break; \
} \
} else { \
tmp = RB_LEFT(parent, field); \
if (RB_COLOR(tmp, field) == RB_RED) { \
RB_SET_BLACKRED(tmp, parent, field); \
RB_ROTATE_RIGHT(head, parent, tmp, field);\
tmp = RB_LEFT(parent, field); \
} \
if ((RB_LEFT(tmp, field) == NULL || \
RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
(RB_RIGHT(tmp, field) == NULL || \
RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
RB_COLOR(tmp, field) = RB_RED; \
elm = parent; \
parent = RB_PARENT(elm, field); \
} else { \
if (RB_LEFT(tmp, field) == NULL || \
RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) {\
struct type *oright; \
if ((oright = RB_RIGHT(tmp, field)) \
!= NULL) \
RB_COLOR(oright, field) = RB_BLACK;\
RB_COLOR(tmp, field) = RB_RED; \
RB_ROTATE_LEFT(head, tmp, oright, field);\
tmp = RB_LEFT(parent, field); \
} \
RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
RB_COLOR(parent, field) = RB_BLACK; \
if (RB_LEFT(tmp, field)) \
RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK;\
RB_ROTATE_RIGHT(head, parent, tmp, field);\
elm = RB_ROOT(head); \
break; \
} \
} \
} \
if (elm) \
RB_COLOR(elm, field) = RB_BLACK; \
} \
\
attr struct type * \
name##_RB_REMOVE(struct name *head, struct type *elm) \
{ \
struct type *child, *parent, *old = elm; \
int color; \
if (RB_LEFT(elm, field) == NULL) \
child = RB_RIGHT(elm, field); \
else if (RB_RIGHT(elm, field) == NULL) \
child = RB_LEFT(elm, field); \
else { \
struct type *left; \
elm = RB_RIGHT(elm, field); \
while ((left = RB_LEFT(elm, field)) != NULL) \
elm = left; \
child = RB_RIGHT(elm, field); \
parent = RB_PARENT(elm, field); \
color = RB_COLOR(elm, field); \
if (child) \
RB_PARENT(child, field) = parent; \
if (parent) { \
if (RB_LEFT(parent, field) == elm) \
RB_LEFT(parent, field) = child; \
else \
RB_RIGHT(parent, field) = child; \
RB_AUGMENT(parent); \
} else \
RB_ROOT(head) = child; \
if (RB_PARENT(elm, field) == old) \
parent = elm; \
(elm)->field = (old)->field; \
if (RB_PARENT(old, field)) { \
if (RB_LEFT(RB_PARENT(old, field), field) == old)\
RB_LEFT(RB_PARENT(old, field), field) = elm;\
else \
RB_RIGHT(RB_PARENT(old, field), field) = elm;\
RB_AUGMENT(RB_PARENT(old, field)); \
} else \
RB_ROOT(head) = elm; \
RB_PARENT(RB_LEFT(old, field), field) = elm; \
if (RB_RIGHT(old, field)) \
RB_PARENT(RB_RIGHT(old, field), field) = elm; \
if (parent) { \
left = parent; \
do { \
RB_AUGMENT(left); \
} while ((left = RB_PARENT(left, field)) != NULL); \
} \
goto color; \
} \
parent = RB_PARENT(elm, field); \
color = RB_COLOR(elm, field); \
if (child) \
RB_PARENT(child, field) = parent; \
if (parent) { \
if (RB_LEFT(parent, field) == elm) \
RB_LEFT(parent, field) = child; \
else \
RB_RIGHT(parent, field) = child; \
RB_AUGMENT(parent); \
} else \
RB_ROOT(head) = child; \
color: \
if (color == RB_BLACK) \
name##_RB_REMOVE_COLOR(head, parent, child); \
return (old); \
} \
\
/* Inserts a node into the RB tree */ \
attr struct type * \
name##_RB_INSERT(struct name *head, struct type *elm) \
{ \
struct type *tmp; \
struct type *parent = NULL; \
int comp = 0; \
tmp = RB_ROOT(head); \
while (tmp) { \
parent = tmp; \
comp = (cmp)(elm, parent); \
if (comp < 0) \
tmp = RB_LEFT(tmp, field); \
else if (comp > 0) \
tmp = RB_RIGHT(tmp, field); \
else \
return (tmp); \
} \
RB_SET(elm, parent, field); \
if (parent != NULL) { \
if (comp < 0) \
RB_LEFT(parent, field) = elm; \
else \
RB_RIGHT(parent, field) = elm; \
RB_AUGMENT(parent); \
} else \
RB_ROOT(head) = elm; \
name##_RB_INSERT_COLOR(head, elm); \
return (NULL); \
} \
\
/* Finds the node with the same key as elm */ \
attr struct type * \
name##_RB_FIND(struct name *head, struct type *elm) \
{ \
struct type *tmp = RB_ROOT(head); \
int comp; \
while (tmp) { \
comp = cmp(elm, tmp); \
if (comp < 0) \
tmp = RB_LEFT(tmp, field); \
else if (comp > 0) \
tmp = RB_RIGHT(tmp, field); \
else \
return (tmp); \
} \
return (NULL); \
} \
\
/* Finds the first node greater than or equal to the search key */ \
attr struct type * \
name##_RB_NFIND(struct name *head, struct type *elm) \
{ \
struct type *tmp = RB_ROOT(head); \
struct type *res = NULL; \
int comp; \
while (tmp) { \
comp = cmp(elm, tmp); \
if (comp < 0) { \
res = tmp; \
tmp = RB_LEFT(tmp, field); \
} \
else if (comp > 0) \
tmp = RB_RIGHT(tmp, field); \
else \
return (tmp); \
} \
return (res); \
} \
\
/* ARGSUSED */ \
attr struct type * \
name##_RB_NEXT(struct type *elm) \
{ \
if (RB_RIGHT(elm, field)) { \
elm = RB_RIGHT(elm, field); \
while (RB_LEFT(elm, field)) \
elm = RB_LEFT(elm, field); \
} else { \
if (RB_PARENT(elm, field) && \
(elm == RB_LEFT(RB_PARENT(elm, field), field))) \
elm = RB_PARENT(elm, field); \
else { \
while (RB_PARENT(elm, field) && \
(elm == RB_RIGHT(RB_PARENT(elm, field), field)))\
elm = RB_PARENT(elm, field); \
elm = RB_PARENT(elm, field); \
} \
} \
return (elm); \
} \
\
/* ARGSUSED */ \
attr struct type * \
name##_RB_PREV(struct type *elm) \
{ \
if (RB_LEFT(elm, field)) { \
elm = RB_LEFT(elm, field); \
while (RB_RIGHT(elm, field)) \
elm = RB_RIGHT(elm, field); \
} else { \
if (RB_PARENT(elm, field) && \
(elm == RB_RIGHT(RB_PARENT(elm, field), field))) \
elm = RB_PARENT(elm, field); \
else { \
while (RB_PARENT(elm, field) && \
(elm == RB_LEFT(RB_PARENT(elm, field), field)))\
elm = RB_PARENT(elm, field); \
elm = RB_PARENT(elm, field); \
} \
} \
return (elm); \
} \
\
attr struct type * \
name##_RB_MINMAX(struct name *head, int val) \
{ \
struct type *tmp = RB_ROOT(head); \
struct type *parent = NULL; \
while (tmp) { \
parent = tmp; \
if (val < 0) \
tmp = RB_LEFT(tmp, field); \
else \
tmp = RB_RIGHT(tmp, field); \
} \
return (parent); \
}
#define RB_NEGINF -1
#define RB_INF 1
#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y)
#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y)
#define RB_FIND(name, x, y) name##_RB_FIND(x, y)
#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y)
#define RB_NEXT(name, x, y) name##_RB_NEXT(y)
#define RB_PREV(name, x, y) name##_RB_PREV(y)
#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF)
#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF)
#define RB_FOREACH(x, name, head) \
for ((x) = RB_MIN(name, head); \
(x) != NULL; \
(x) = name##_RB_NEXT(x))
#define RB_FOREACH_REVERSE(x, name, head) \
for ((x) = RB_MAX(name, head); \
(x) != NULL; \
(x) = name##_RB_PREV(x))
#endif /* _SYS_TREE_H_ */

View File

@ -1,65 +0,0 @@
/*
* File : box.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __RTGUI_BOX_H__
#define __RTGUI_BOX_H__
#include <rtgui/rtgui.h>
#include <rtgui/widgets/widget.h>
#include <rtgui/widgets/container.h>
#ifdef __cplusplus
extern "C" {
#endif
DECLARE_CLASS_TYPE(box);
/** Gets the type of a box */
#define RTGUI_BOX_TYPE (RTGUI_TYPE(box))
/** Casts the object to an rtgui_box */
#define RTGUI_BOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_BOX_TYPE, rtgui_box_t))
/** Checks if the object is an rtgui_box */
#define RTGUI_IS_BOX(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_BOX_TYPE))
struct rtgui_box
{
struct rtgui_object parent;
rt_uint16_t orient;
rt_uint16_t border_size;
struct rtgui_container *container;
};
typedef struct rtgui_box rtgui_box_t;
struct rtgui_box *rtgui_box_create(int orientation, int border_size);
void rtgui_box_destroy(struct rtgui_box *box);
void rtgui_box_layout(rtgui_box_t *box);
void rtgui_box_layout_rect(rtgui_box_t *box, struct rtgui_rect *rect);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,80 +0,0 @@
/*
* File : container.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __RTGUI_CONTAINER_H__
#define __RTGUI_CONTAINER_H__
#include <rtgui/widgets/widget.h>
#include <rtgui/widgets/box.h>
#ifdef __cplusplus
extern "C" {
#endif
DECLARE_CLASS_TYPE(container);
/** Gets the type of a container */
#define RTGUI_CONTAINER_TYPE (RTGUI_TYPE(container))
/** Casts the object to an rtgui_container */
#define RTGUI_CONTAINER(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_CONTAINER_TYPE, rtgui_container_t))
/** Checks if the object is an rtgui_container */
#define RTGUI_IS_CONTAINER(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_CONTAINER_TYPE))
/*
* the container widget
*/
struct rtgui_container
{
struct rtgui_widget parent;
/* layout box */
struct rtgui_box *layout_box;
rtgui_list_t children;
};
typedef struct rtgui_container rtgui_container_t;
rtgui_container_t *rtgui_container_create(void);
void rtgui_container_destroy(rtgui_container_t *container);
rt_bool_t rtgui_container_event_handler(struct rtgui_object *widget, struct rtgui_event *event);
/* set layout box */
void rtgui_container_set_box(struct rtgui_container *container, struct rtgui_box *box);
void rtgui_container_layout(struct rtgui_container *container);
void rtgui_container_add_child(rtgui_container_t *container, rtgui_widget_t *child);
void rtgui_container_remove_child(rtgui_container_t *container, rtgui_widget_t *child);
void rtgui_container_destroy_children(rtgui_container_t *container);
rtgui_widget_t *rtgui_container_get_first_child(rtgui_container_t *container);
rt_bool_t rtgui_container_event_handler(struct rtgui_object *widget, rtgui_event_t *event);
rt_bool_t rtgui_container_dispatch_event(rtgui_container_t *container, rtgui_event_t *event);
rt_bool_t rtgui_container_dispatch_mouse_event(rtgui_container_t *container, struct rtgui_event_mouse *event);
struct rtgui_object* rtgui_container_get_object(struct rtgui_container *container, rt_uint32_t id);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,48 +0,0 @@
/*
* File : title.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __RTGUI_TITLE__
#define __RTGUI_TITLE__
#include <rtgui/widgets/widget.h>
DECLARE_CLASS_TYPE(wintitle);
/** Gets the type of a title */
#define RTGUI_WINTITLE_TYPE (RTGUI_TYPE(wintitle))
/** Casts the object to an rtgui_wintitle */
#define RTGUI_WINTITLE(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_WINTITLE_TYPE, rtgui_wintitle_t))
/** Checks if the object is an rtgui_wintitle */
#define RTGUI_IS_WINTITLE(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_WINTITLE_TYPE))
struct rtgui_wintitle
{
struct rtgui_widget parent;
};
typedef struct rtgui_wintitle rtgui_wintitle_t;
rtgui_wintitle_t *rtgui_wintitle_create(struct rtgui_win *window);
void rtgui_wintitle_destroy(rtgui_wintitle_t *wintitle);
rt_bool_t rtgui_wintile_event_handler(struct rtgui_object *object, rtgui_event_t *event);
#endif

View File

@ -1,209 +0,0 @@
/*
* File : widget.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-04 Bernard first version
*/
#ifndef __RTGUI_WIDGET_H__
#define __RTGUI_WIDGET_H__
#include <rtgui/rtgui.h>
#include <rtgui/list.h>
#include <rtgui/region.h>
#include <rtgui/event.h>
#include <rtgui/color.h>
#include <rtgui/font.h>
#ifdef __cplusplus
extern "C" {
#endif
#define RTGUI_WIDGET_FLAG_DEFAULT 0x0000
#define RTGUI_WIDGET_FLAG_SHOWN 0x0001
#define RTGUI_WIDGET_FLAG_DISABLE 0x0002
#define RTGUI_WIDGET_FLAG_FOCUS 0x0004
#define RTGUI_WIDGET_FLAG_TRANSPARENT 0x0008
#define RTGUI_WIDGET_FLAG_FOCUSABLE 0x0010
#define RTGUI_WIDGET_FLAG_DC_VISIBLE 0x0100
#define RTGUI_WIDGET_FLAG_IN_ANIM 0x0200
/* rtgui widget attribute */
#define RTGUI_WIDGET_FOREGROUND(w) (RTGUI_WIDGET(w)->gc.foreground)
#define RTGUI_WIDGET_BACKGROUND(w) (RTGUI_WIDGET(w)->gc.background)
#define RTGUI_WIDGET_TEXTALIGN(w) (RTGUI_WIDGET(w)->gc.textalign)
#define RTGUI_WIDGET_FONT(w) (RTGUI_WIDGET(w)->gc.font)
#define RTGUI_WIDGET_FLAG(w) (RTGUI_WIDGET(w)->flag)
#define RTGUI_WIDGET_ALIGN(w) (RTGUI_WIDGET(w)->align)
#define RTGUI_WIDGET_BORDER(w) (RTGUI_WIDGET(w)->border)
#define RTGUI_WIDGET_BORDER_STYLE(w) (RTGUI_WIDGET(w)->border_style)
#define RTGUI_WIDGET_UNHIDE(w) RTGUI_WIDGET_FLAG(w) |= RTGUI_WIDGET_FLAG_SHOWN
#define RTGUI_WIDGET_HIDE(w) RTGUI_WIDGET_FLAG(w) &= ~RTGUI_WIDGET_FLAG_SHOWN
#define RTGUI_WIDGET_IS_HIDE(w) (!(RTGUI_WIDGET_FLAG(w) & RTGUI_WIDGET_FLAG_SHOWN))
#define RTGUI_WIDGET_ENABLE(w) RTGUI_WIDGET_FLAG(w) &= ~RTGUI_WIDGET_FLAG_DISABLE
#define RTGUI_WIDGET_DISABLE(w) RTGUI_WIDGET_FLAG(w) |= RTGUI_WIDGET_FLAG_DISABLE
#define RTGUI_WIDGET_IS_ENABLE(w) (!((RTGUI_WIDGET_FLAG(w) & RTGUI_WIDGET_FLAG_DISABLE)))
#define RTGUI_WIDGET_UNFOCUS(w) RTGUI_WIDGET_FLAG(w) &= ~RTGUI_WIDGET_FLAG_FOCUS
#define RTGUI_WIDGET_FOCUS(w) RTGUI_WIDGET_FLAG(w) |= RTGUI_WIDGET_FLAG_FOCUS
#define RTGUI_WIDGET_IS_FOCUSED(w) (RTGUI_WIDGET_FLAG(w) & RTGUI_WIDGET_FLAG_FOCUS)
#define RTGUI_WIDGET_IS_FOCUSABLE(w) (RTGUI_WIDGET_FLAG(w) & RTGUI_WIDGET_FLAG_FOCUSABLE)
#define RTGUI_WIDGET_SET_UNFOCUSABLE(w) RTGUI_WIDGET_FLAG(w) &= ~RTGUI_WIDGET_FLAG_FOCUSABLE
#define RTGUI_WIDGET_IS_DC_VISIBLE(w) (RTGUI_WIDGET_FLAG(w) & RTGUI_WIDGET_FLAG_DC_VISIBLE)
#define RTGUI_WIDGET_DC_SET_VISIBLE(w) RTGUI_WIDGET_FLAG(w) |= RTGUI_WIDGET_FLAG_DC_VISIBLE
#define RTGUI_WIDGET_DC_SET_UNVISIBLE(w) RTGUI_WIDGET_FLAG(w) &= ~RTGUI_WIDGET_FLAG_DC_VISIBLE
#define RTGUI_WIDGET_DC(w) ((struct rtgui_dc*)&((w)->dc_type))
DECLARE_CLASS_TYPE(widget);
/** Gets the type of a widget */
#define RTGUI_WIDGET_TYPE (RTGUI_TYPE(widget))
/** Casts the object to a rtgui_widget */
#define RTGUI_WIDGET(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_WIDGET_TYPE, rtgui_widget_t))
/** Check if the object is a rtgui_widget */
#define RTGUI_IS_WIDGET(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_WIDGET_TYPE))
/*
* the base widget object
*/
struct rtgui_widget
{
/* inherit from rtgui_object */
struct rtgui_object object;
/* the widget that contains this widget */
struct rtgui_widget *parent;
/* the window that contains this widget */
struct rtgui_win *toplevel;
/* the widget children and sibling */
rtgui_list_t sibling;
/* widget flag */
rt_int32_t flag;
/* hardware device context */
rt_uint32_t dc_type;
const struct rtgui_dc_engine *dc_engine;
/* the graphic context of widget */
rtgui_gc_t gc;
/* the widget extent */
rtgui_rect_t extent;
/* the visiable extent (includes the rectangles of children) */
rtgui_rect_t extent_visiable;
/* the rect clip information */
rtgui_region_t clip;
/* minimal width and height of widget */
rt_int16_t min_width, min_height;
/* widget align */
rt_int32_t align;
rt_uint16_t border;
rt_uint16_t border_style;
/* call back */
rt_bool_t (*on_focus_in)(struct rtgui_object *widget, struct rtgui_event *event);
rt_bool_t (*on_focus_out)(struct rtgui_object *widget, struct rtgui_event *event);
/* user private data */
rt_uint32_t user_data;
};
typedef struct rtgui_widget rtgui_widget_t;
rtgui_widget_t *rtgui_widget_create(const rtgui_type_t *widget_type);
void rtgui_widget_destroy(rtgui_widget_t *widget);
rt_bool_t rtgui_widget_event_handler(struct rtgui_object *object, rtgui_event_t *event);
/* focus and unfocus */
void rtgui_widget_focus(rtgui_widget_t *widget);
void rtgui_widget_unfocus(rtgui_widget_t *widget);
/* event handler for each command */
void rtgui_widget_set_onfocus(rtgui_widget_t *widget, rtgui_event_handler_ptr handler);
void rtgui_widget_set_onunfocus(rtgui_widget_t *widget, rtgui_event_handler_ptr handler);
/* get and set rect of widget */
void rtgui_widget_get_rect(rtgui_widget_t *widget, rtgui_rect_t *rect);
void rtgui_widget_set_border(rtgui_widget_t *widget, rt_uint32_t style);
void rtgui_widget_set_rect(rtgui_widget_t *widget, const rtgui_rect_t *rect);
void rtgui_widget_set_rectangle(rtgui_widget_t *widget, int x, int y, int width, int height);
void rtgui_widget_get_extent(rtgui_widget_t *widget, rtgui_rect_t *rect);
void rtgui_widget_set_minsize(rtgui_widget_t *widget, int width, int height);
void rtgui_widget_set_minwidth(rtgui_widget_t *widget, int width);
void rtgui_widget_set_minheight(rtgui_widget_t *widget, int height);
void rtgui_widget_set_parent(rtgui_widget_t *widget, rtgui_widget_t *parent);
/* get the physical position of a logic point on widget */
void rtgui_widget_point_to_device(rtgui_widget_t *widget, rtgui_point_t *point);
/* get the physical position of a logic rect on widget */
void rtgui_widget_rect_to_device(rtgui_widget_t *widget, rtgui_rect_t *rect);
/* get the logic position of a physical point on widget */
void rtgui_widget_point_to_logic(rtgui_widget_t *widget, rtgui_point_t *point);
/* get the logic position of a physical rect on widget */
void rtgui_widget_rect_to_logic(rtgui_widget_t *widget, rtgui_rect_t *rect);
void rtgui_widget_clip_parent(rtgui_widget_t *widget);
void rtgui_widget_clip_return(rtgui_widget_t *widget);
/* move widget and its children to a logic point */
void rtgui_widget_move_to_logic(rtgui_widget_t *widget, int dx, int dy);
/* update the clip info of widget */
void rtgui_widget_update_clip(rtgui_widget_t *widget);
/* get the toplevel widget of widget */
struct rtgui_win *rtgui_widget_get_toplevel(rtgui_widget_t *widget);
rt_bool_t rtgui_widget_onupdate_toplvl(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_widget_show(rtgui_widget_t *widget);
rt_bool_t rtgui_widget_onshow(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_widget_hide(rtgui_widget_t *widget);
rt_bool_t rtgui_widget_onhide(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_widget_update(rtgui_widget_t *widget);
rt_bool_t rtgui_widget_onpaint(struct rtgui_object *object, struct rtgui_event *event);
/* get parent color */
rtgui_color_t rtgui_widget_get_parent_foreground(rtgui_widget_t *widget);
rtgui_color_t rtgui_widget_get_parent_background(rtgui_widget_t *widget);
/* get the next sibling of widget */
rtgui_widget_t *rtgui_widget_get_next_sibling(rtgui_widget_t *widget);
/* get the prev sibling of widget */
rtgui_widget_t *rtgui_widget_get_prev_sibling(rtgui_widget_t *widget);
rt_bool_t rtgui_widget_is_in_animation(rtgui_widget_t *widget);
/* dump widget information */
void rtgui_widget_dump(rtgui_widget_t *widget);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,215 +0,0 @@
/*
* File : window.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-04 Bernard first version
* 2010-05-03 Bernard add win close function
*/
#ifndef __RTGUI_WINDOW_H__
#define __RTGUI_WINDOW_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <rtgui/rtgui.h>
#include <rtgui/list.h>
#include <rtgui/dc.h>
#include <rtgui/widgets/widget.h>
#include <rtgui/widgets/box.h>
DECLARE_CLASS_TYPE(win);
/** Gets the type of a win */
#define RTGUI_WIN_TYPE (RTGUI_TYPE(win))
/** Casts the object to an rtgui_win */
#define RTGUI_WIN(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_WIN_TYPE, rtgui_win_t))
/** Checks if the object is an rtgui_win */
#define RTGUI_IS_WIN(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_WIN_TYPE))
#define RTGUI_WIN_STYLE_NO_FOCUS 0x0001 /* non-focused window */
#define RTGUI_WIN_STYLE_NO_TITLE 0x0002 /* no title window */
#define RTGUI_WIN_STYLE_NO_BORDER 0x0004 /* no border window */
#define RTGUI_WIN_STYLE_CLOSEBOX 0x0008 /* window has the close button */
#define RTGUI_WIN_STYLE_MINIBOX 0x0010 /* window has the mini button */
#define RTGUI_WIN_STYLE_DESTROY_ON_CLOSE 0x0020 /* window is destroyed when closed */
#define RTGUI_WIN_STYLE_ONTOP 0x0040 /* window is in the top layer */
#define RTGUI_WIN_STYLE_ONBTM 0x0080 /* window is in the bottom layer */
#define RTGUI_WIN_STYLE_MAINWIN 0x0106 /* window is a main window */
#define RTGUI_WIN_MAGIC 0xA5A55A5A /* win magic flag */
#define RTGUI_WIN_STYLE_DEFAULT (RTGUI_WIN_STYLE_CLOSEBOX | RTGUI_WIN_STYLE_MINIBOX)
#define WINTITLE_HEIGHT 20
#define WINTITLE_CB_WIDTH 16
#define WINTITLE_CB_HEIGHT 16
#define WINTITLE_BORDER_SIZE 2
enum rtgui_win_flag
{
RTGUI_WIN_FLAG_INIT = 0x00, /* init state */
RTGUI_WIN_FLAG_MODAL = 0x01, /* modal mode window */
RTGUI_WIN_FLAG_CLOSED = 0x02, /* window is closed */
RTGUI_WIN_FLAG_ACTIVATE = 0x04, /* window is activated */
RTGUI_WIN_FLAG_UNDER_MODAL = 0x08, /* window is under modal
show(modaled by other) */
RTGUI_WIN_FLAG_CONNECTED = 0x10, /* connected to server */
/* window is event_key dispatcher(dispatch it to the focused widget in
* current window) _and_ a key handler(it should be able to handle keys
* such as ESC). Both of dispatching and handling are in the same
* function(rtgui_win_event_handler). So we have to distinguish between the
* two modes.
*
* If this flag is set, we are in key-handling mode.
*/
RTGUI_WIN_FLAG_HANDLE_KEY = 0x20,
RTGUI_WIN_FLAG_CB_PRESSED = 0x40,
};
struct rtgui_win
{
/* inherit from container */
rtgui_container_t parent;
/* update count */
rt_base_t update;
/* drawing count */
rt_base_t drawing;
struct rtgui_rect drawing_rect;
/* parent window. RT_NULL if the window is a top level window */
struct rtgui_win *parent_window;
struct rtgui_region outer_clip;
struct rtgui_rect outer_extent;
/* the widget that will grab the focus in current window */
struct rtgui_widget *focused_widget;
/* which app I belong */
struct rtgui_app *app;
/* window style */
rt_uint16_t style;
/* window state flag */
enum rtgui_win_flag flag;
rtgui_modal_code_t modal_code;
/* last mouse event handled widget */
rtgui_widget_t *last_mevent_widget;
/* window title */
char *title;
struct rtgui_wintitle *_title_wgt;
/* call back */
rt_bool_t (*on_activate)(struct rtgui_object *widget, struct rtgui_event *event);
rt_bool_t (*on_deactivate)(struct rtgui_object *widget, struct rtgui_event *event);
rt_bool_t (*on_close)(struct rtgui_object *widget, struct rtgui_event *event);
/* the key is sent to the focused widget by default. If the focused widget
* and all of it's parents didn't handle the key event, it will be handled
* by @func on_key
*
* If you want to handle key event on your own, it's better to overload
* this function other than handle EVENT_KBD in event_handler.
*/
rt_bool_t (*on_key)(struct rtgui_object *widget, struct rtgui_event *event);
/* reserved user data */
void *user_data;
/* Private data. */
rt_base_t (*_do_show)(struct rtgui_win *win);
/* app ref_count */
rt_uint16_t app_ref_count;
/* win magic flag, magic value is 0xA5A55A5A */
rt_uint32_t magic;
};
rtgui_win_t *rtgui_win_create(struct rtgui_win *parent_window, const char *title,
rtgui_rect_t *rect, rt_uint16_t style);
rtgui_win_t *rtgui_mainwin_create(struct rtgui_win *parent_window, const char *title, rt_uint16_t style);
void rtgui_win_destroy(rtgui_win_t *win);
int rtgui_win_init(struct rtgui_win *win, struct rtgui_win *parent_window,
const char *title,
rtgui_rect_t *rect,
rt_uint16_t style);
int rtgui_win_fini(struct rtgui_win* win);
/** Close window.
*
* @param win the window you want to close
*
* @return RT_TRUE if the window is closed. RT_FALSE if not. If the onclose
* callback returns RT_FALSE, the window won't be closed.
*
* \sa rtgui_win_set_onclose .
*/
rt_bool_t rtgui_win_close(struct rtgui_win *win);
rt_base_t rtgui_win_show(struct rtgui_win *win, rt_bool_t is_modal);
rt_base_t rtgui_win_do_show(struct rtgui_win *win);
rt_base_t rtgui_win_enter_modal(struct rtgui_win *win);
void rtgui_win_hide(rtgui_win_t *win);
void rtgui_win_end_modal(rtgui_win_t *win, rtgui_modal_code_t modal_code);
rt_err_t rtgui_win_activate(struct rtgui_win *win);
rt_bool_t rtgui_win_is_activated(struct rtgui_win *win);
void rtgui_win_move(struct rtgui_win *win, int x, int y);
/* reset extent of window */
void rtgui_win_set_rect(rtgui_win_t *win, rtgui_rect_t *rect);
void rtgui_win_update_clip(struct rtgui_win *win);
void rtgui_win_set_onactivate(rtgui_win_t *win, rtgui_event_handler_ptr handler);
void rtgui_win_set_ondeactivate(rtgui_win_t *win, rtgui_event_handler_ptr handler);
void rtgui_win_set_onclose(rtgui_win_t *win, rtgui_event_handler_ptr handler);
void rtgui_win_set_onkey(rtgui_win_t *win, rtgui_event_handler_ptr handler);
rt_bool_t rtgui_win_event_handler(struct rtgui_object *win, struct rtgui_event *event);
void rtgui_win_event_loop(rtgui_win_t *wnd);
void rtgui_win_set_title(rtgui_win_t *win, const char *title);
char *rtgui_win_get_title(rtgui_win_t *win);
struct rtgui_dc *rtgui_win_get_drawing(rtgui_win_t * win);
struct rtgui_win* rtgui_win_get_topmost_shown(void);
struct rtgui_win* rtgui_win_get_next_shown(void);
void rtgui_theme_draw_win(struct rtgui_wintitle *wint);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,15 +0,0 @@
# RT-Thread building script for bridge
import os
from building import *
cwd = GetCurrentDir()
objs = []
list = os.listdir(cwd)
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')

Some files were not shown because too many files have changed in this diff Show More