diff options
Diffstat (limited to 'components/gui/include/rtgui')
35 files changed, 643 insertions, 327 deletions
diff --git a/components/gui/include/rtgui/blit.h b/components/gui/include/rtgui/blit.h index f0ff217cad..3a07204f93 100644 --- a/components/gui/include/rtgui/blit.h +++ b/components/gui/include/rtgui/blit.h @@ -1,7 +1,7 @@ /* * File : blit.h - * This file is part of RT-Thread GUI - * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * 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 @@ -47,6 +47,7 @@ #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) \ @@ -201,13 +202,13 @@ struct rtgui_blit_info rt_uint8_t r, g, b, a; }; -struct rtgui_blit_info_src +struct rtgui_image_info { - rt_uint8_t *src; - int src_w, src_h; - int src_skip; + rt_uint8_t *pixels; + int src_pitch; - rt_uint8_t src_fmt; + rt_uint8_t src_fmt; + rt_uint8_t a; }; extern const rt_uint8_t* rtgui_blit_expand_byte[9]; @@ -217,6 +218,7 @@ 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 diff --git a/components/gui/include/rtgui/color.h b/components/gui/include/rtgui/color.h index 0a9854f409..cf6ef08623 100644 --- a/components/gui/include/rtgui/color.h +++ b/components/gui/include/rtgui/color.h @@ -1,11 +1,21 @@ /* * File : color.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 diff --git a/components/gui/include/rtgui/dc.h b/components/gui/include/rtgui/dc.h index 73409659fc..20350cfe89 100644 --- a/components/gui/include/rtgui/dc.h +++ b/components/gui/include/rtgui/dc.h @@ -1,11 +1,21 @@ /* * File : dc.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 @@ -23,7 +33,7 @@ extern "C" { #include <rtgui/driver.h> #include <rtgui/widgets/widget.h> -#define RTGUI_DC(dc) ((struct rtgui_dc*)(dc)) +#define RTGUI_DC(dc) ((struct rtgui_dc*)(dc)) #ifndef M_PI #define M_PI 3.14159265358979323846 @@ -51,10 +61,10 @@ struct rtgui_dc_engine }; /* - * The abstract device context + * The abstract device context * * Normally, a DC is a drawable canvas, user can draw point/line/cycle etc - * on the DC. + * on the DC. * * There are several kinds of DC: * - Hardware DC; @@ -70,44 +80,49 @@ struct rtgui_dc const struct rtgui_dc_engine *engine; }; -/* - * The hardware device context +/* + * The hardware device context * - * The hardware DC is a context based on hardware device, for examle the + * 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. - * + * hardware. + * */ struct rtgui_dc_hw { - struct rtgui_dc parent; - rtgui_widget_t *owner; - const struct rtgui_graphic_driver *hw_driver; + 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. + * 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; + struct rtgui_dc parent; + + /* graphic context */ + rtgui_gc_t gc; - /* graphic context */ - rtgui_gc_t gc; + /* pixel format */ + rt_uint8_t pixel_format; + rt_uint8_t blend_mode; /* RTGUI_BLENDMODE: None/Blend/Add/Mod */ - /* 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; - /* 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 data */ - rt_uint8_t *pixel; + /* pixel data */ + rt_uint8_t *pixel; }; #define RTGUI_DC_FC(dc) (rtgui_dc_get_gc(RTGUI_DC(dc))->foreground) @@ -118,6 +133,10 @@ struct rtgui_dc_buffer /* 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); /* create a widget dc */ @@ -125,11 +144,18 @@ 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); +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); @@ -259,6 +285,9 @@ 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 diff --git a/components/gui/include/rtgui/dc_client.h b/components/gui/include/rtgui/dc_client.h deleted file mode 100644 index e277654f04..0000000000 --- a/components/gui/include/rtgui/dc_client.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * File : dc_buffer.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE - * - * Change Logs: - * Date Author Notes - * 2010-04-10 Bernard first version - * 2010-06-14 Bernard embedded hardware dc to each widget - * 2010-08-09 Bernard rename hardware dc to client dc - */ - -#ifndef __RTGUI_DC_CLIENT_H__ -#define __RTGUI_DC_CLIENT_H__ - -#include <rtgui/dc.h> - -/* create a hardware dc */ -struct rtgui_dc *rtgui_dc_client_create(rtgui_widget_t *owner); -void rtgui_dc_client_init(rtgui_widget_t *owner); - -#endif - diff --git a/components/gui/include/rtgui/dc_draw.h b/components/gui/include/rtgui/dc_draw.h index a2b85e828d..76482367d4 100644 --- a/components/gui/include/rtgui/dc_draw.h +++ b/components/gui/include/rtgui/dc_draw.h @@ -1,7 +1,7 @@ /* - * File : dc_blend.c - * This file is part of RT-Thread GUI - * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * 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 diff --git a/components/gui/include/rtgui/dc_hw.h b/components/gui/include/rtgui/dc_hw.h deleted file mode 100644 index 0dadd7686e..0000000000 --- a/components/gui/include/rtgui/dc_hw.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * File : dc_buffer.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE - * - * Change Logs: - * Date Author Notes - * 2010-04-10 Bernard first version - * 2010-06-14 Bernard embedded hardware dc to each widget - */ -#ifndef __RTGUI_DC_HW_H__ -#define __RTGUI_DC_HW_H__ - -#include <rtgui/dc.h> - -/* create a hardware dc */ -struct rtgui_dc *rtgui_dc_hw_create(rtgui_widget_t *owner); - -#endif - diff --git a/components/gui/include/rtgui/dc_trans.h b/components/gui/include/rtgui/dc_trans.h index 731571a3e0..47216a21a3 100644 --- a/components/gui/include/rtgui/dc_trans.h +++ b/components/gui/include/rtgui/dc_trans.h @@ -1,3 +1,27 @@ +/* + * 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__ diff --git a/components/gui/include/rtgui/driver.h b/components/gui/include/rtgui/driver.h index b070b7d4bb..8246d82256 100644 --- a/components/gui/include/rtgui/driver.h +++ b/components/gui/include/rtgui/driver.h @@ -1,11 +1,21 @@ /* * File : driver.h - * This file is part of RTGUI in RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 @@ -34,17 +44,17 @@ struct rtgui_graphic_driver_ops /* 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); + /* 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_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_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); + 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 @@ -63,7 +73,7 @@ struct rtgui_graphic_driver struct rt_device* device; const struct rtgui_graphic_driver_ops *ops; - const struct rtgui_graphic_ext_ops *ext_ops; + const struct rtgui_graphic_ext_ops *ext_ops; }; struct rtgui_graphic_driver *rtgui_graphic_driver_get_default(void); @@ -77,7 +87,7 @@ void rtgui_graphic_driver_set_framebuffer(void *fb); rt_inline struct rtgui_graphic_driver *rtgui_graphic_get_device() { - return rtgui_graphic_driver_get_default(); + return rtgui_graphic_driver_get_default(); } #ifdef RTGUI_USING_HW_CURSOR @@ -86,8 +96,8 @@ rt_inline struct rtgui_graphic_driver *rtgui_graphic_get_device() */ enum rtgui_cursor_type { - RTGUI_CURSOR_ARROW, - RTGUI_CURSOR_HAND, + RTGUI_CURSOR_ARROW, + RTGUI_CURSOR_HAND, }; void rtgui_cursor_set_device(const char* device_name); diff --git a/components/gui/include/rtgui/event.h b/components/gui/include/rtgui/event.h index c937684fba..5ab3e679ca 100644 --- a/components/gui/include/rtgui/event.h +++ b/components/gui/include/rtgui/event.h @@ -1,11 +1,21 @@ /* * File : event.h - * This file is part of RTGUI in RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 @@ -41,6 +51,7 @@ enum _rtgui_event_type 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 @@ -169,6 +180,13 @@ struct rtgui_event_win_resize 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 @@ -187,6 +205,7 @@ struct rtgui_event_win_resize #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) /* @@ -375,7 +394,7 @@ struct rtgui_event_kbd #define RTGUI_EVENT_KBD_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_KBD) /** - * RTGUI Touch Event + * RTGUI Touch Event * NOTE: There is not touch event to user applications, it's handled by server. */ struct rtgui_event_touch diff --git a/components/gui/include/rtgui/filerw.h b/components/gui/include/rtgui/filerw.h index f1d3cc9bf2..edd2579875 100644 --- a/components/gui/include/rtgui/filerw.h +++ b/components/gui/include/rtgui/filerw.h @@ -1,11 +1,21 @@ /* * File : filerw.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 diff --git a/components/gui/include/rtgui/font.h b/components/gui/include/rtgui/font.h index 72cc2326b2..b1d480d048 100644 --- a/components/gui/include/rtgui/font.h +++ b/components/gui/include/rtgui/font.h @@ -1,11 +1,21 @@ /* * File : font.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 @@ -17,6 +27,7 @@ #include <rtgui/rtgui.h> #include <rtgui/list.h> + #ifdef __cplusplus extern "C" { #endif diff --git a/components/gui/include/rtgui/font_fnt.h b/components/gui/include/rtgui/font_fnt.h index 4756418d6a..3b0089d82e 100644 --- a/components/gui/include/rtgui/font_fnt.h +++ b/components/gui/include/rtgui/font_fnt.h @@ -1,3 +1,27 @@ +/* + * 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__ @@ -7,28 +31,28 @@ /* 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; + 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; + struct fnt_header header; - const MWIMAGEBITS *bits; /* nbits */ - const rt_uint16_t *offset; /* noffset */ - const rt_uint8_t *width; /* nwidth */ + 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; diff --git a/components/gui/include/rtgui/font_freetype.h b/components/gui/include/rtgui/font_freetype.h index 0fadd887a6..64766e37ad 100644 --- a/components/gui/include/rtgui/font_freetype.h +++ b/components/gui/include/rtgui/font_freetype.h @@ -1,3 +1,27 @@ +/* + * 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__ @@ -8,7 +32,8 @@ extern "C" { #endif -rtgui_font_t *rtgui_freetype_font_create(const char *filename, int bold, int italic, rt_size_t size); +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 diff --git a/components/gui/include/rtgui/image.h b/components/gui/include/rtgui/image.h index 9b9cb27462..07ddaec721 100644 --- a/components/gui/include/rtgui/image.h +++ b/components/gui/include/rtgui/image.h @@ -1,11 +1,21 @@ /* * File : image.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 diff --git a/components/gui/include/rtgui/image_bmp.h b/components/gui/include/rtgui/image_bmp.h index 47761d5032..17fffd15e1 100644 --- a/components/gui/include/rtgui/image_bmp.h +++ b/components/gui/include/rtgui/image_bmp.h @@ -1,11 +1,21 @@ /* * File : image_bmp.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 diff --git a/components/gui/include/rtgui/image_container.h b/components/gui/include/rtgui/image_container.h new file mode 100644 index 0000000000..ecf0333359 --- /dev/null +++ b/components/gui/include/rtgui/image_container.h @@ -0,0 +1,58 @@ +/* + * 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 + diff --git a/components/gui/include/rtgui/image_hdc.h b/components/gui/include/rtgui/image_hdc.h index 3ec1e7b1ef..25beb93f24 100644 --- a/components/gui/include/rtgui/image_hdc.h +++ b/components/gui/include/rtgui/image_hdc.h @@ -1,11 +1,21 @@ /* - * File : image_xpm.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * File : image_hdc.h + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 @@ -27,6 +37,21 @@ struct rtgui_image_hdcmm 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; diff --git a/components/gui/include/rtgui/image_jpeg.h b/components/gui/include/rtgui/image_jpeg.h deleted file mode 100644 index 9a22a68805..0000000000 --- a/components/gui/include/rtgui/image_jpeg.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __RTGUI_IMAGE_JPEG_H__ -#define __RTGUI_IMAGE_JPEG_H__ - -#include <rtgui/image.h> - -void rtgui_image_jpeg_init(void); - -#endif diff --git a/components/gui/include/rtgui/image_png.h b/components/gui/include/rtgui/image_png.h deleted file mode 100644 index f2a6d2311d..0000000000 --- a/components/gui/include/rtgui/image_png.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * File : image_png.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE - * - * Change Logs: - * Date Author Notes - * 2009-10-16 Bernard first version - */ -#ifndef __RTGUI_IMAGE_PNG_H__ -#define __RTGUI_IMAGE_PNG_H__ - -#include <rtgui/image.h> - -void rtgui_image_png_init(void); - -#endif diff --git a/components/gui/include/rtgui/image_xpm.h b/components/gui/include/rtgui/image_xpm.h deleted file mode 100644 index 5c6af21313..0000000000 --- a/components/gui/include/rtgui/image_xpm.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * File : image_xpm.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE - * - * Change Logs: - * Date Author Notes - * 2009-10-16 Bernard first version - */ -#ifndef __RTGUI_IMAGE_XPM_H__ -#define __RTGUI_IMAGE_XPM_H__ - -#include <rtgui/image.h> - -void rtgui_image_xpm_init(void); - -#endif diff --git a/components/gui/include/rtgui/kbddef.h b/components/gui/include/rtgui/kbddef.h index d510445f0a..a783a93568 100644 --- a/components/gui/include/rtgui/kbddef.h +++ b/components/gui/include/rtgui/kbddef.h @@ -1,11 +1,21 @@ /* * File : kbddef.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 diff --git a/components/gui/include/rtgui/list.h b/components/gui/include/rtgui/list.h index 20b3957181..6eb77ccf8b 100644 --- a/components/gui/include/rtgui/list.h +++ b/components/gui/include/rtgui/list.h @@ -1,11 +1,21 @@ /* * File : list.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 diff --git a/components/gui/include/rtgui/matrix.h b/components/gui/include/rtgui/matrix.h index 28fd087a76..5d83c4ae85 100644 --- a/components/gui/include/rtgui/matrix.h +++ b/components/gui/include/rtgui/matrix.h @@ -1,3 +1,27 @@ +/* + * 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__ @@ -12,7 +36,7 @@ * 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, + * 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 @@ -60,7 +84,7 @@ struct rtgui_matrix * fraction(m/RTGUI_MATRIX_FRAC). While the unit of m[4-5] is pixel. * */ - int m[6]; + int m[6]; }; rt_inline int32_t _rtgui_matrix_round_div32(int32_t n, int32_t d) @@ -100,22 +124,22 @@ 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; + 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]; + 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 x, int y, + struct rtgui_matrix *m) { int *mm = m->m; @@ -137,13 +161,13 @@ rt_inline void rtgui_matrix_mul_point(struct rtgui_point *p, /** 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; + 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. diff --git a/components/gui/include/rtgui/region.h b/components/gui/include/rtgui/region.h index a540e2b9c9..ef70528d88 100644 --- a/components/gui/include/rtgui/region.h +++ b/components/gui/include/rtgui/region.h @@ -1,11 +1,21 @@ /* * File : region.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 @@ -90,6 +100,7 @@ int rtgui_region_is_flat(rtgui_region_t *region); extern rtgui_rect_t rtgui_empty_rect; void rtgui_rect_moveto(rtgui_rect_t *rect, int x, int y); +void rtgui_rect_moveto_point(rtgui_rect_t *rect, int x, int y); void rtgui_rect_moveto_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); @@ -98,11 +109,14 @@ int rtgui_rect_is_intersect(const rtgui_rect_t *rect1, const rtgui_rect_t *rect 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; + rect->x1 = x; + rect->y1 = y; + rect->x2 = x + width; + rect->y2 = y + height; } #define RTGUI_RECT(rect, x, y, w, h) \ diff --git a/components/gui/include/rtgui/rtgui.h b/components/gui/include/rtgui/rtgui.h index 4837e4103d..2ee2503c53 100644 --- a/components/gui/include/rtgui/rtgui.h +++ b/components/gui/include/rtgui/rtgui.h @@ -1,7 +1,7 @@ /* * File : rtgui.h - * This file is part of RT-Thread GUI - * COPYRIGHT (C) 2009 - 2013, RT-Thread Development Team + * 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 @@ -31,19 +31,10 @@ extern "C" { #endif -#define RTGUI_VERSION 0L /**< major version number */ -#define RTGUI_SUBVERSION 8L /**< minor version number */ -#define RTGUI_REVISION 1L /**< revise version number */ -#define RTGUI_CODENAME "Newton" /**< code name */ - -#define RT_INT16_MAX 32767 -#define RT_INT16_MIN (-RT_INT16_MAX-1) -#define RTGUI_NOT_FOUND (-1) - -#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)) +#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 @@ -136,13 +127,13 @@ enum RTGUI_BORDER_STYLE /** * Blend mode - */ + */ enum RTGUI_BLENDMODE { - RTGUI_BLENDMODE_NONE = 0x00, - RTGUI_BLENDMODE_BLEND, - RTGUI_BLENDMODE_ADD, - RTGUI_BLENDMODE_MOD, + RTGUI_BLENDMODE_NONE = 0x00, + RTGUI_BLENDMODE_BLEND, + RTGUI_BLENDMODE_ADD, + RTGUI_BLENDMODE_MOD, }; /** @@ -180,7 +171,8 @@ enum RTGUI_TEXTSTYLE enum RTGUI_MODAL_CODE { RTGUI_MODAL_OK, - RTGUI_MODAL_CANCEL + RTGUI_MODAL_CANCEL, + RTGUI_MODAL_MAX = 0xFFFF, }; typedef enum RTGUI_MODAL_CODE rtgui_modal_code_t; diff --git a/components/gui/include/rtgui/rtgui_app.h b/components/gui/include/rtgui/rtgui_app.h index 452ccb1970..5cb2c83acc 100644 --- a/components/gui/include/rtgui/rtgui_app.h +++ b/components/gui/include/rtgui/rtgui_app.h @@ -1,11 +1,21 @@ /* * File : rtgui_app.h - * This file is part of RTGUI in RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 diff --git a/components/gui/include/rtgui/rtgui_config.h b/components/gui/include/rtgui/rtgui_config.h index 7d6b1611ff..afb728ed84 100644 --- a/components/gui/include/rtgui/rtgui_config.h +++ b/components/gui/include/rtgui/rtgui_config.h @@ -1,11 +1,21 @@ /* * File : rtgui_config.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 diff --git a/components/gui/include/rtgui/rtgui_object.h b/components/gui/include/rtgui/rtgui_object.h index b70aa851d1..34b23af520 100644 --- a/components/gui/include/rtgui/rtgui_object.h +++ b/components/gui/include/rtgui/rtgui_object.h @@ -1,11 +1,21 @@ /* * File : rtgui_object.h - * This file is part of RTGUI in RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 @@ -81,10 +91,10 @@ 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) \ +#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)) +#define RTGUI_OBJECT_CAST(obj, obj_type, c_type) ((c_type *)(obj)) #endif #define RTGUI_OBJECT_CHECK_TYPE(_obj, _type) \ diff --git a/components/gui/include/rtgui/rtgui_server.h b/components/gui/include/rtgui/rtgui_server.h index bb1481e8f4..6d73bc5b66 100644 --- a/components/gui/include/rtgui/rtgui_server.h +++ b/components/gui/include/rtgui/rtgui_server.h @@ -1,11 +1,21 @@ /* * File : rtgui_server.h - * This file is part of RTGUI in RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 @@ -14,6 +24,10 @@ #ifndef __RTGUI_SERVER_H__ #define __RTGUI_SERVER_H__ +#ifdef __cplusplus +extern "C" { +#endif + #include <rtservice.h> #include <rtgui/list.h> @@ -72,8 +86,11 @@ 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 */ -void rtgui_server_post_event(struct rtgui_event *event, rt_size_t size); +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 diff --git a/components/gui/include/rtgui/rtgui_system.h b/components/gui/include/rtgui/rtgui_system.h index 86b649345b..14d7351e35 100644 --- a/components/gui/include/rtgui/rtgui_system.h +++ b/components/gui/include/rtgui/rtgui_system.h @@ -1,11 +1,21 @@ /* * File : rtgui_system.h - * This file is part of RTGUI in RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 diff --git a/components/gui/include/rtgui/widgets/box.h b/components/gui/include/rtgui/widgets/box.h index 06486b958c..e4ea354478 100644 --- a/components/gui/include/rtgui/widgets/box.h +++ b/components/gui/include/rtgui/widgets/box.h @@ -1,11 +1,21 @@ /* * File : box.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 diff --git a/components/gui/include/rtgui/widgets/container.h b/components/gui/include/rtgui/widgets/container.h index fc89a14556..c45facca2d 100644 --- a/components/gui/include/rtgui/widgets/container.h +++ b/components/gui/include/rtgui/widgets/container.h @@ -1,11 +1,21 @@ /* * File : container.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 diff --git a/components/gui/include/rtgui/widgets/title.h b/components/gui/include/rtgui/widgets/title.h index 5394b9e880..128d1c3143 100644 --- a/components/gui/include/rtgui/widgets/title.h +++ b/components/gui/include/rtgui/widgets/title.h @@ -1,11 +1,21 @@ /* * File : title.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 diff --git a/components/gui/include/rtgui/widgets/widget.h b/components/gui/include/rtgui/widgets/widget.h index 13efcb7e5b..726bd4ae38 100644 --- a/components/gui/include/rtgui/widgets/widget.h +++ b/components/gui/include/rtgui/widgets/widget.h @@ -1,7 +1,7 @@ /* * File : widget.h - * This file is part of RT-Thread GUI - * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * 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 @@ -110,6 +110,10 @@ struct rtgui_widget /* 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; @@ -117,13 +121,10 @@ struct rtgui_widget rt_int32_t align; rt_uint16_t border; rt_uint16_t border_style; - /* the rect clip */ - rtgui_region_t clip; /* 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); - rt_bool_t (*on_paint)(struct rtgui_object *widget, struct rtgui_event *event); /* user private data */ rt_uint32_t user_data; @@ -142,7 +143,6 @@ 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); -void rtgui_widget_set_onpaint(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); diff --git a/components/gui/include/rtgui/widgets/window.h b/components/gui/include/rtgui/widgets/window.h index 635e3bced9..3623426296 100644 --- a/components/gui/include/rtgui/widgets/window.h +++ b/components/gui/include/rtgui/widgets/window.h @@ -1,11 +1,21 @@ /* * File : window.h - * This file is part of RTGUI in RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * 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 @@ -80,6 +90,7 @@ struct rtgui_win /* 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; @@ -135,9 +146,9 @@ rtgui_win_t *rtgui_mainwin_create(struct rtgui_win *parent_window, const char *t 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); + const char *title, + rtgui_rect_t *rect, + rt_uint16_t style); int rtgui_win_fini(struct rtgui_win* win); /** Close window. @@ -183,6 +194,8 @@ 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 |
