mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-22 11:30:01 +08:00
implement hardware DC in each widget.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@787 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -10,31 +10,19 @@
|
||||
* 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>
|
||||
|
||||
/* hardware device context */
|
||||
struct rtgui_dc_hw
|
||||
{
|
||||
struct rtgui_dc parent;
|
||||
|
||||
/* widget owner */
|
||||
rtgui_widget_t* owner;
|
||||
|
||||
/* visible */
|
||||
rt_bool_t visible;
|
||||
|
||||
/* display driver */
|
||||
struct rtgui_graphic_driver* device;
|
||||
};
|
||||
|
||||
/* create a hardware dc */
|
||||
struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner);
|
||||
void rtgui_dc_hw_init(rtgui_widget_t* owner);
|
||||
|
||||
/* draw a hline with raw pixel data */
|
||||
void rtgui_dc_hw_draw_raw_hline(struct rtgui_dc_hw* dc, rt_uint8_t* raw_ptr, int x1, int x2, int y);
|
||||
void rtgui_dc_hw_draw_raw_hline(struct rtgui_dc* dc, rt_uint8_t* raw_ptr, int x1, int x2, int y);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -49,13 +49,19 @@ struct rtgui_graphic_driver
|
||||
rtgui_list_t list;
|
||||
};
|
||||
|
||||
#ifdef RTGUI_USING_GRAPHIC_DRIVER_LIST
|
||||
void rtgui_graphic_driver_add(struct rtgui_graphic_driver* driver);
|
||||
void rtgui_graphic_driver_remove(struct rtgui_graphic_driver* driver);
|
||||
|
||||
struct rtgui_graphic_driver* rtgui_graphic_driver_find(char* name);
|
||||
struct rtgui_graphic_driver* rtgui_graphic_driver_get_default(void);
|
||||
#else
|
||||
void rtgui_graphic_driver_add(const struct rtgui_graphic_driver* driver);
|
||||
#endif
|
||||
|
||||
void rtgui_graphic_driver_get_rect(struct rtgui_graphic_driver *driver, rtgui_rect_t *rect);
|
||||
const 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_get_default_rect(rtgui_rect_t *rect);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ struct rtgui_event;
|
||||
|
||||
struct rtgui_widget;
|
||||
struct rtgui_win;
|
||||
struct rtgui_font;
|
||||
struct rtgui_font;
|
||||
|
||||
typedef struct rtgui_panel rtgui_panel_t;
|
||||
typedef struct rtgui_win rtgui_win_t;
|
||||
@@ -47,7 +47,7 @@ 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;
|
||||
typedef unsigned long rtgui_color_t;
|
||||
|
||||
struct rtgui_gc
|
||||
{
|
||||
@@ -129,3 +129,4 @@ typedef enum RTGUI_MODAL_CODE rtgui_modal_code_t;
|
||||
#include <rtgui/rtgui_object.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ 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))
|
||||
|
||||
@@ -72,7 +72,9 @@ void rtgui_server_post_event(struct rtgui_event* event, rt_size_t size);
|
||||
/* register or deregister panel in server */
|
||||
void rtgui_panel_register(char* name, rtgui_rect_t* extent);
|
||||
void rtgui_panel_deregister(char* name);
|
||||
|
||||
void rtgui_panel_set_default_focused(char* name);
|
||||
void rtgui_panel_set_nofocused(char* name);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -25,12 +25,13 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RTGUI_WIDGET_FLAG_HIDE 0x01
|
||||
#define RTGUI_WIDGET_FLAG_DISABLE 0x02
|
||||
#define RTGUI_WIDGET_FLAG_FOCUS 0x04
|
||||
#define RTGUI_WIDGET_FLAG_TRANSPARENT 0x08
|
||||
#define RTGUI_WIDGET_FLAG_FOCUSABLE 0x10
|
||||
#define RTGUI_WIDGET_FLAG_DEFAULT 0x00
|
||||
#define RTGUI_WIDGET_FLAG_DEFAULT 0x0000
|
||||
#define RTGUI_WIDGET_FLAG_HIDE 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_UNHIDE(w) (w)->flag &= ~RTGUI_WIDGET_FLAG_HIDE
|
||||
#define RTGUI_WIDGET_HIDE(w) (w)->flag |= RTGUI_WIDGET_FLAG_HIDE
|
||||
@@ -46,6 +47,11 @@ extern "C" {
|
||||
|
||||
#define RTGUI_WIDGET_IS_FOCUSABLE(w) ((w)->flag & RTGUI_WIDGET_FLAG_FOCUSABLE)
|
||||
|
||||
#define RTGUI_WIDGET_IS_DC_VISIBLE(w) ((w)->flag & RTGUI_WIDGET_FLAG_DC_VISIBLE)
|
||||
#define RTGUI_WIDGET_DC_SET_VISIBLE(w) (w)->flag |= RTGUI_WIDGET_FLAG_DC_VISIBLE
|
||||
#define RTGUI_WIDGET_DC_SET_UNVISIBLE(w) (w)->flag &= ~RTGUI_WIDGET_FLAG_DC_VISIBLE
|
||||
#define RTGUI_WIDGET_DC(w) ((struct rtgui_dc*)&((w)->dc_type))
|
||||
|
||||
/* get rtgui widget object */
|
||||
#define RTGUI_WIDGET_FOREGROUND(w) ((w)->gc.foreground)
|
||||
#define RTGUI_WIDGET_BACKGROUND(w) ((w)->gc.background)
|
||||
@@ -75,19 +81,24 @@ struct rtgui_widget
|
||||
|
||||
/* widget flag */
|
||||
rt_int32_t flag;
|
||||
#ifndef RTGUI_USING_SMALL_SIZE
|
||||
/* widget align */
|
||||
rt_int32_t align;
|
||||
#endif
|
||||
|
||||
/* 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;
|
||||
|
||||
#ifndef RTGUI_USING_SMALL_SIZE
|
||||
/* minimal width and height of widget */
|
||||
rt_int16_t mini_width, mini_height;
|
||||
rt_int16_t margin, margin_style;
|
||||
|
||||
/* widget align */
|
||||
rt_int32_t align;
|
||||
#endif
|
||||
|
||||
/* the rect clip */
|
||||
|
||||
Reference in New Issue
Block a user