first
This commit is contained in:
371
include_lib/system/ui/ui/control.h
Normal file
371
include_lib/system/ui/ui/control.h
Normal file
@ -0,0 +1,371 @@
|
||||
#ifndef UI_CONTROL_H
|
||||
#define UI_CONTROL_H
|
||||
|
||||
#include "ui/ui_core.h"
|
||||
|
||||
union ui_control_info;
|
||||
struct layout_info;
|
||||
|
||||
#define CTRL_TYPE_WINDOW 2
|
||||
#define CTRL_TYPE_LAYOUT 3
|
||||
#define CTRL_TYPE_LAYER 4
|
||||
#define CTRL_TYPE_GRID 5
|
||||
#define CTRL_TYPE_LIST 6
|
||||
#define CTRL_TYPE_BUTTON 7
|
||||
#define CTRL_TYPE_PIC 8
|
||||
#define CTRL_TYPE_BATTERY 9
|
||||
#define CTRL_TYPE_TIME 10
|
||||
#define CTRL_TYPE_CAMERA_VIEW 11
|
||||
#define CTRL_TYPE_TEXT 12
|
||||
#define CTRL_TYPE_ANIMATION 13
|
||||
#define CTRL_TYPE_PLAYER 14
|
||||
#define CTRL_TYPE_NUMBER 15
|
||||
|
||||
#define CTRL_TYPE_PROGRESS 20
|
||||
#define CTRL_PROGRESS_CHILD_BEGIN (CTRL_TYPE_PROGRESS + 1)
|
||||
#define CTRL_PROGRESS_CHILD_HIGHLIGHT (CTRL_PROGRESS_CHILD_BEGIN) //21
|
||||
#define CTRL_PROGRESS_CHILD_END (CTRL_PROGRESS_CHILD_BEGIN + 1)
|
||||
|
||||
#define CTRL_TYPE_MULTIPROGRESS 22
|
||||
#define CTRL_MULTIPROGRESS_CHILD_BEGIN (CTRL_TYPE_MULTIPROGRESS + 1)
|
||||
#define CTRL_MULTIPROGRESS_CHILD_HIGHLIGHT (CTRL_MULTIPROGRESS_CHILD_BEGIN)//23
|
||||
#define CTRL_MULTIPROGRESS_CHILD_END (CTRL_MULTIPROGRESS_CHILD_BEGIN + 1)
|
||||
|
||||
#define CTRL_TYPE_WATCH 24
|
||||
#define CTRL_WATCH_CHILD_BEGIN (CTRL_TYPE_WATCH + 1)
|
||||
#define CTRL_WATCH_CHILD_HOUR (CTRL_WATCH_CHILD_BEGIN)//25
|
||||
#define CTRL_WATCH_CHILD_MIN (CTRL_WATCH_CHILD_BEGIN+1)//26
|
||||
#define CTRL_WATCH_CHILD_SEC (CTRL_WATCH_CHILD_BEGIN+2)//27
|
||||
#define CTRL_WATCH_CHILD_END (CTRL_WATCH_CHILD_BEGIN+3)
|
||||
|
||||
|
||||
#define CTRL_TYPE_SLIDER 28
|
||||
|
||||
#define SLIDER_CHILD_BEGIN (CTRL_TYPE_SLIDER+1)
|
||||
#define SLIDER_CHILD_UNSELECT_PIC (SLIDER_CHILD_BEGIN)//29
|
||||
#define SLIDER_CHILD_SELECTED_PIC (SLIDER_CHILD_BEGIN+1)//30
|
||||
#define SLIDER_CHILD_SLIDER_PIC (SLIDER_CHILD_BEGIN+2)//31
|
||||
#define SLIDER_CHILD_PERSENT_TEXT (SLIDER_CHILD_BEGIN+3)//32
|
||||
#define SLIDER_CHILD_END (SLIDER_CHILD_BEGIN+4)
|
||||
|
||||
|
||||
#define CTRL_TYPE_VSLIDER 33
|
||||
|
||||
#define VSLIDER_CHILD_BEGIN (CTRL_TYPE_VSLIDER+1)
|
||||
#define VSLIDER_CHILD_UNSELECT_PIC (VSLIDER_CHILD_BEGIN)//34
|
||||
#define VSLIDER_CHILD_SELECTED_PIC (VSLIDER_CHILD_BEGIN+1)//35
|
||||
#define VSLIDER_CHILD_SLIDER_PIC (VSLIDER_CHILD_BEGIN+2)//36
|
||||
#define VSLIDER_CHILD_PERSENT_TEXT (VSLIDER_CHILD_BEGIN+3)//37
|
||||
#define VSLIDER_CHILD_END (VSLIDER_CHILD_BEGIN+4)
|
||||
|
||||
|
||||
struct ui_ctrl_info_head {
|
||||
u8 type;
|
||||
u8 ctrl_num;
|
||||
u8 css_num;
|
||||
u8 len;
|
||||
u8 page;
|
||||
u8 rev[3];
|
||||
int id;
|
||||
struct element_css1 *css;
|
||||
};
|
||||
|
||||
struct ui_image_list {
|
||||
u16 num;
|
||||
u16 image[0];
|
||||
};
|
||||
|
||||
struct ui_text_list {
|
||||
u16 num;
|
||||
char str[0];
|
||||
};
|
||||
|
||||
|
||||
struct ui_image_list_t {
|
||||
u16 num;
|
||||
u16 image[64];
|
||||
};
|
||||
|
||||
#define UI_TEXT_LIST_MAX_NUM 3
|
||||
struct ui_text_list_t {
|
||||
u16 num;
|
||||
u16 str[50];
|
||||
};
|
||||
|
||||
struct ui_button_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
struct element_event_action *action;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct ui_camera_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
char device[8];
|
||||
struct element_event_action *action;
|
||||
};
|
||||
|
||||
struct ui_player_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
char device[8];
|
||||
struct element_event_action *action;
|
||||
};
|
||||
|
||||
struct ui_time_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
char source[8];
|
||||
u8 auto_cnt;
|
||||
u8 rev[3];
|
||||
char format[16];
|
||||
int color;
|
||||
int hi_color;
|
||||
u16 number[10];
|
||||
u16 delimiter[10];
|
||||
struct element_event_action *action;
|
||||
};
|
||||
|
||||
struct ui_number_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
char source[8];
|
||||
char format[16];
|
||||
int color;
|
||||
int hi_color;
|
||||
u16 number[10];
|
||||
u16 delimiter[10];
|
||||
u16 space[2];
|
||||
struct element_event_action *action;
|
||||
};
|
||||
|
||||
|
||||
struct ui_pic_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
u8 highlight;
|
||||
u16 cent_x;
|
||||
u16 cent_y;
|
||||
struct ui_image_list *normal_img;
|
||||
struct ui_image_list *highlight_img;
|
||||
struct element_event_action *action;
|
||||
};
|
||||
|
||||
|
||||
struct ui_battery_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
struct ui_image_list *normal_image;
|
||||
struct ui_image_list *charge_image;
|
||||
struct element_event_action *action;
|
||||
};
|
||||
|
||||
|
||||
struct ui_text_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
char source[8];
|
||||
char code[8];
|
||||
int color;
|
||||
int highlight_color;
|
||||
struct ui_text_list *str;
|
||||
struct element_event_action *action;
|
||||
};
|
||||
|
||||
|
||||
struct ui_grid_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
u8 page_mode;
|
||||
char highlight_index;
|
||||
struct element_event_action *action;
|
||||
struct layout_info *info;
|
||||
};
|
||||
|
||||
struct ui_animation_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
u16 loop_num;
|
||||
u32 interval;
|
||||
struct ui_image_list *img;
|
||||
struct element_event_action *action;
|
||||
};
|
||||
|
||||
struct ui_slider_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
u8 step;
|
||||
struct ui_ctrl_info_head *ctrl;
|
||||
// struct element_event_action *action;
|
||||
};
|
||||
|
||||
struct ui_vslider_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
u8 step;
|
||||
struct ui_ctrl_info_head *ctrl;
|
||||
// struct element_event_action *action;
|
||||
};
|
||||
|
||||
struct ui_watch_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
char source[8];
|
||||
struct element_event_action *action;
|
||||
struct ui_ctrl_info_head *ctrl;
|
||||
};
|
||||
|
||||
struct ui_progress_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
char source[8];
|
||||
struct element_event_action *action;
|
||||
struct ui_ctrl_info_head *ctrl;
|
||||
};
|
||||
|
||||
struct ui_multiprogress_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
char source[8];
|
||||
struct element_event_action *action;
|
||||
struct ui_ctrl_info_head *ctrl;
|
||||
};
|
||||
|
||||
struct ui_browser_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
u8 row;
|
||||
u8 column;
|
||||
u8 interval;
|
||||
u8 scroll;
|
||||
u8 auto_highlight;
|
||||
struct element_event_action *action;
|
||||
struct ui_ctrl_info_head *ctrl;
|
||||
};
|
||||
|
||||
struct ui_fattrs_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
struct element_event_action *action;
|
||||
struct ui_ctrl_info_head *ctrl;
|
||||
};
|
||||
|
||||
struct layout_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
struct element_event_action *action;
|
||||
union ui_control_info *ctrl;
|
||||
};
|
||||
|
||||
|
||||
struct layer_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
u8 format;
|
||||
struct element_event_action *action;
|
||||
struct layout_info *layout;
|
||||
};
|
||||
|
||||
|
||||
union ui_control_info {
|
||||
struct ui_ctrl_info_head head;//16 bytes
|
||||
struct ui_button_info button;//20 bytes
|
||||
struct ui_camera_info camera;//28 bytes
|
||||
struct ui_time_info time;//84 bytes
|
||||
struct ui_number_info number;
|
||||
struct ui_pic_info pic;//36 bytes
|
||||
struct ui_battery_info battery;//28 bytes
|
||||
struct ui_text_info text;//40 bytes
|
||||
struct ui_grid_info grid;//28 bytes
|
||||
struct layer_info layer;
|
||||
struct layout_info layout;
|
||||
struct ui_watch_info watch;
|
||||
struct ui_progress_info progress;
|
||||
struct ui_multiprogress_info multiprogress;
|
||||
struct ui_slider_info slider;
|
||||
struct ui_vslider_info vslider;
|
||||
};//84 bytes
|
||||
|
||||
// union ui_control_info {
|
||||
// struct ui_ctrl_info_head head;
|
||||
// struct ui_button_info button;
|
||||
// struct ui_camera_info camera;
|
||||
// struct ui_time_info time;
|
||||
// struct ui_number_info number;
|
||||
// struct ui_pic_info pic;
|
||||
// struct ui_battery_info battery;
|
||||
// struct ui_text_info text;
|
||||
// struct ui_grid_info grid;
|
||||
// };
|
||||
|
||||
|
||||
struct window_info {
|
||||
u8 type;
|
||||
u8 ctrl_num;
|
||||
u8 css_num;
|
||||
u8 len;
|
||||
u8 rev[4];
|
||||
struct rect rect;
|
||||
struct layer_info *layer;
|
||||
// struct element_event_action *action;
|
||||
};
|
||||
|
||||
struct control_ops {
|
||||
int type;
|
||||
void *(*new)(const void *, struct element *);
|
||||
/*int (*delete)(void *);*/
|
||||
};
|
||||
|
||||
extern const struct control_ops control_ops_begin[];
|
||||
extern const struct control_ops control_ops_end[];
|
||||
|
||||
|
||||
#define REGISTER_CONTROL_OPS(_type) \
|
||||
static const struct control_ops control_ops_##_type sec(.control_ops) __attribute__((used)) = { \
|
||||
.type = _type,
|
||||
|
||||
|
||||
|
||||
#define get_control_ops_by_type(_type) \
|
||||
({ \
|
||||
const struct control_ops *ops, *ret=NULL; \
|
||||
for (ops = control_ops_begin; ops < control_ops_end; ops++) { \
|
||||
if (ops->type == _type) { \
|
||||
ret = ops; \
|
||||
break; \
|
||||
} \
|
||||
}\
|
||||
ret; \
|
||||
})
|
||||
|
||||
|
||||
#if 0
|
||||
struct control_event_header {
|
||||
int id;
|
||||
int len;
|
||||
};
|
||||
|
||||
extern struct control_event_header control_event_handler_begin[];
|
||||
extern struct control_event_header control_event_handler_end[];
|
||||
|
||||
|
||||
#define REGISTER_CONTROL_EVENT_HANDLER(control, _id) \
|
||||
static const struct control##_event_handler __##control##_event_handler_##_id \
|
||||
sec(.control_event_handler) = { \
|
||||
.header = { \
|
||||
.id = _id, \
|
||||
.len = sizeof(struct control##_event_handler), \
|
||||
}, \
|
||||
|
||||
|
||||
|
||||
|
||||
static inline void *control_event_handler_for_id(int id)
|
||||
{
|
||||
struct control_event_header *p;
|
||||
|
||||
for (p = control_event_handler_begin; p < control_event_handler_end;) {
|
||||
if (p->id == id) {
|
||||
return p;
|
||||
}
|
||||
p = (u8 *)p + p->len;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
53
include_lib/system/ui/ui/layer.h
Normal file
53
include_lib/system/ui/ui/layer.h
Normal file
@ -0,0 +1,53 @@
|
||||
#ifndef LAYER_H
|
||||
#define LAYER_H
|
||||
|
||||
|
||||
#include "ui/layout.h"
|
||||
#include "ui/control.h"
|
||||
|
||||
|
||||
struct layer {
|
||||
struct element elm; //must be first
|
||||
u8 hide;
|
||||
u8 inited;
|
||||
u8 highlight;
|
||||
u8 ctrl_num;
|
||||
u8 css_num;
|
||||
u32 css[2];
|
||||
struct draw_context dc;
|
||||
struct layout *layout;
|
||||
const struct layer_info *info;
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
|
||||
#define layer_for_id(id) \
|
||||
(struct layer *)ui_core_get_element_by_id(id);
|
||||
|
||||
|
||||
struct layer *layer_new(struct layer_info *info, int num, struct element *parent);
|
||||
|
||||
|
||||
void layer_delete_probe(struct layer *layer, int num);
|
||||
|
||||
void layer_delete(struct layer *layer, int num);
|
||||
|
||||
int layer_show(int id);
|
||||
|
||||
int layer_hide(int id);
|
||||
|
||||
int layer_toggle(int id);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
54
include_lib/system/ui/ui/layout.h
Normal file
54
include_lib/system/ui/ui/layout.h
Normal file
@ -0,0 +1,54 @@
|
||||
#ifndef LAYOUT_H
|
||||
#define LAYOUT_H
|
||||
|
||||
|
||||
#include "ui/ui_core.h"
|
||||
#include "ui/control.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct layout {
|
||||
struct element elm; //must be first
|
||||
u8 hide: 1;
|
||||
u8 inited: 1;
|
||||
u8 release: 6;
|
||||
// u8 css_num:5;
|
||||
// u32 css[2];
|
||||
struct layout *layout;
|
||||
const struct layout_info *info;
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define layout_for_id(id) \
|
||||
(struct layout *)ui_core_get_element_by_id(id);
|
||||
|
||||
|
||||
struct layout *layout_new(struct layout_info *, int, struct element *);
|
||||
|
||||
void layout_delete_probe(struct layout *layout, int num);
|
||||
|
||||
void layout_delete(struct layout *layout, int num);
|
||||
|
||||
int layout_show(int id);
|
||||
|
||||
int layout_hide(int id);
|
||||
|
||||
int layout_toggle(int id);
|
||||
|
||||
void layout_on_focus(struct layout *layout);
|
||||
void layout_lose_focus(struct layout *layout);
|
||||
|
||||
|
||||
/*int layout_current_highlight(int id);*/
|
||||
|
||||
/*int layout_onkey(struct layout *layout, struct element_key_event *e);*/
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
40
include_lib/system/ui/ui/p.h
Normal file
40
include_lib/system/ui/ui/p.h
Normal file
@ -0,0 +1,40 @@
|
||||
#ifndef UI_P_H
|
||||
#define UI_P_H
|
||||
|
||||
#include "ui/ui_core.h"
|
||||
|
||||
struct ui_str {
|
||||
const char *format;
|
||||
char *str;
|
||||
};
|
||||
|
||||
struct element_text {
|
||||
struct element elm; //must be first
|
||||
char *str;
|
||||
const char *format;
|
||||
void *priv;
|
||||
int color;
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
|
||||
|
||||
void text_element_set_text(struct element_text *text, char *str,
|
||||
const char *format, int color);
|
||||
|
||||
|
||||
void text_element_init(struct element_text *text, int id, u8 page, u8 prj,
|
||||
const struct element_css1 *css,
|
||||
const struct element_event_action *action);
|
||||
|
||||
|
||||
void text_element_set_event_handler(struct element_text *text, void *priv,
|
||||
const struct element_event_handler *handler);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
112
include_lib/system/ui/ui/ui.h
Normal file
112
include_lib/system/ui/ui/ui.h
Normal file
@ -0,0 +1,112 @@
|
||||
#ifndef UI_CORE_H
|
||||
#define UI_CORE_H
|
||||
|
||||
#include "window.h"
|
||||
#include "ui_button.h"
|
||||
#include "ui_grid.h"
|
||||
#include "ui_time.h"
|
||||
#include "ui_camera.h"
|
||||
#include "ui_pic.h"
|
||||
#include "ui_text.h"
|
||||
#include "ui_battery.h"
|
||||
#include "ui_browser.h"
|
||||
#include "ui_slider.h"
|
||||
#include "ui_slider_vert.h"
|
||||
#include "ui_number.h"
|
||||
#include "ui_watch.h"
|
||||
#include "ui_progress.h"
|
||||
#include "ui_progress_multi.h"
|
||||
#include "ui_rotate.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
struct uimsg_handl {
|
||||
const char *msg;
|
||||
int (*handler)(const char *type, u32 args);
|
||||
};
|
||||
|
||||
int ui_framework_init(void *);
|
||||
|
||||
int ui_set_style_file(struct ui_style *style);
|
||||
|
||||
int ui_style_file_version_compare(int version);
|
||||
|
||||
int ui_redraw(int id);
|
||||
|
||||
int ui_show(int id);
|
||||
|
||||
int ui_hide(int id);
|
||||
|
||||
int ui_set_call(int (*func)(int), int param);
|
||||
|
||||
int ui_event_onkey(struct element_key_event *e);
|
||||
|
||||
int ui_event_ontouch(struct element_touch_event *e);
|
||||
|
||||
struct element *ui_get_highlight_child_by_id(int id);
|
||||
int ui_invert_element_by_id(int id);
|
||||
|
||||
int ui_no_highlight_element(struct element *elm);
|
||||
int ui_no_highlight_element_by_id(int id);
|
||||
int ui_highlight_element(struct element *elm);
|
||||
int ui_highlight_element_by_id(int id);
|
||||
|
||||
int ui_get_current_window_id();
|
||||
|
||||
int ui_register_msg_handler(int id, const struct uimsg_handl *handl);
|
||||
|
||||
int ui_message_handler(int id, const char *msg, va_list);
|
||||
|
||||
const char *str_substr_iter(const char *str, char delim, int *iter);
|
||||
|
||||
int ui_get_child_by_id(int id, int (*event_handler_cb)(void *, int, int));
|
||||
|
||||
int ui_set_default_handler(int (*ontouch)(void *, struct element_touch_event *),
|
||||
int (*onkey)(void *, struct element_key_event *),
|
||||
int (*onchange)(void *, enum element_change_event, void *));
|
||||
|
||||
/*
|
||||
* 锁定元素elm之外的区域,所有的触摸消息都发给elm
|
||||
*/
|
||||
void ui_ontouch_lock(void *elm);
|
||||
void ui_ontouch_unlock(void *elm);
|
||||
|
||||
/*
|
||||
* 锁定控件的夫图层,先不推向imb显示
|
||||
*/
|
||||
int ui_lock_layer(int id);
|
||||
int ui_unlock_layer(int id);
|
||||
|
||||
int ui_get_disp_status_by_id(int id);
|
||||
|
||||
int create_control_by_id(char *tabfile, int page_id, int id, int parent_id);
|
||||
int delete_control_by_id(int id);
|
||||
|
||||
|
||||
void ui_remove_backcolor(struct element *elm);
|
||||
void ui_remove_backimage(struct element *elm);
|
||||
void ui_remove_border(struct element *elm);
|
||||
|
||||
int ui_fill_rect(struct draw_context *dc, int left, int top, int width, int height, u32 acolor);
|
||||
int ui_draw_image(struct draw_context *dc, int page, int id, int x, int y);
|
||||
int ui_draw_ascii(struct draw_context *dc, char *str, int strlen, int x, int y, int color);
|
||||
int ui_draw_text(struct draw_context *dc, int encode, int endian, char *str, int strlen, int x, int y, int color);
|
||||
int ui_draw_strpic(struct draw_context *dc, int id, int x, int y, int color);
|
||||
void ui_draw_line(void *_dc, int x0, int y0, int x1, int y1, int color);
|
||||
void ui_draw_line_by_angle(void *_dc, int x, int y, int length, int angle, int color);
|
||||
void ui_draw_rect(void *_dc, int x, int y, int width, int height, int color);
|
||||
void ui_draw_circle(struct draw_context *dc, int center_x, int center_y,
|
||||
int radius_big, int radius_small, int angle_begin,
|
||||
int angle_end, int color, int percent);
|
||||
int ui_draw_set_pixel(struct draw_context *dc, int x, int y, int pixel);
|
||||
u32 ui_draw_get_pixel(struct draw_context *dc, int x, int y);
|
||||
u16 ui_draw_get_mixed_pixel(u16 backcolor, u16 forecolor, u8 alpha);
|
||||
|
||||
void *load_control_info_by_id(char *tabfile, u32 page_id, u32 id);
|
||||
void *ui_control_new(void *_pos, void *parent);
|
||||
|
||||
|
||||
#define ui_id2type(id) (((id)>>16) & 0x3f)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
37
include_lib/system/ui/ui/ui.ld
Normal file
37
include_lib/system/ui/ui/ui.ld
Normal file
@ -0,0 +1,37 @@
|
||||
lcd_interface_begin = .;
|
||||
KEEP(*(.lcd_if_info))
|
||||
lcd_interface_end = .;
|
||||
|
||||
ui_style_begin = .;
|
||||
KEEP(*(.ui_style))
|
||||
ui_style_end = .;
|
||||
|
||||
|
||||
elm_event_handler_begin_JL = .;
|
||||
KEEP(*(.elm_event_handler_JL))
|
||||
elm_event_handler_end_JL = .;
|
||||
|
||||
elm_event_handler_begin_UPGRADE = .;
|
||||
KEEP(*(.elm_event_handler_UPGRADE))
|
||||
elm_event_handler_end_UPGRADE = .;
|
||||
|
||||
|
||||
|
||||
elm_event_handler_begin_DIAL = .;
|
||||
KEEP(*(.elm_event_handler_DIAL))
|
||||
elm_event_handler_end_DIAL = .;
|
||||
|
||||
|
||||
control_event_handler_begin = .;
|
||||
KEEP(*(.control_event_handler))
|
||||
control_event_handler_end = .;
|
||||
|
||||
control_ops_begin = .;
|
||||
KEEP(*(.control_ops))
|
||||
control_ops_end = .;
|
||||
|
||||
battery_notify_begin = .;
|
||||
*(.battery_notify)
|
||||
battery_notify_end = .;
|
||||
|
||||
|
||||
29
include_lib/system/ui/ui/ui_battery.h
Normal file
29
include_lib/system/ui/ui/ui_battery.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef UI_BATTERY_H
|
||||
#define UI_BATTERY_H
|
||||
|
||||
|
||||
#include "ui/control.h"
|
||||
#include "list.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct ui_battery {
|
||||
struct element elm;
|
||||
int src;
|
||||
u8 index;
|
||||
u16 charge_image;
|
||||
u16 normal_image;
|
||||
struct list_head entry;
|
||||
const struct ui_battery_info *info;
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
void ui_battery_enable();
|
||||
void ui_battery_level_change(int persent, int incharge);//改变所有电池控件
|
||||
int ui_battery_set_level_by_id(int id, int persent, int incharge);//修改指定id
|
||||
int ui_battery_set_level(struct ui_battery *battery, int persent, int incharge);//初始化使用
|
||||
|
||||
#endif
|
||||
92
include_lib/system/ui/ui/ui_browser.h
Normal file
92
include_lib/system/ui/ui/ui_browser.h
Normal file
@ -0,0 +1,92 @@
|
||||
#ifndef UI_BROWSER_H
|
||||
#define UI_BROWSER_H
|
||||
|
||||
|
||||
|
||||
#include "ui/ui_core.h"
|
||||
#include "ui/control.h"
|
||||
|
||||
|
||||
|
||||
|
||||
struct ui_browser {
|
||||
struct element elm;
|
||||
struct ui_file_browser *hdl;
|
||||
char order; // 1 表示 正序, 非1 表示反序
|
||||
u8 inited;
|
||||
u8 hide_byself;
|
||||
u8 item_num;
|
||||
u8 highlight;
|
||||
u8 show_mode;
|
||||
u16 cur_number;
|
||||
u16 file_number;
|
||||
struct ui_grid *grid;
|
||||
const char *path;
|
||||
const char *ftype;
|
||||
const struct ui_browser_info *info;
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
|
||||
#define ui_file_browser_cur_item(bro) ui_grid_cur_item(((struct ui_browser *)bro)->grid)
|
||||
|
||||
|
||||
int ui_file_browser_page_num(struct ui_browser *bro);
|
||||
|
||||
int ui_file_browser_cur_page(struct ui_browser *bro, int *file_num);
|
||||
|
||||
int ui_file_browser_set_page(struct ui_browser *bro, int page);
|
||||
|
||||
int ui_file_browser_set_page_by_id(int id, int page);
|
||||
|
||||
int ui_file_browser_next_page(struct ui_browser *bro);
|
||||
|
||||
int ui_file_browser_next_page_by_id(int id);
|
||||
|
||||
int ui_file_browser_prev_page(struct ui_browser *bro);
|
||||
|
||||
int ui_file_browser_prev_page_by_id(int id);
|
||||
|
||||
int ui_file_browser_set_dir(struct ui_browser *bro, const char *path, const char *ftype);
|
||||
|
||||
int ui_file_browser_set_dir_by_id(int id, const char *path, const char *ftype);
|
||||
|
||||
int ui_file_browser_get_file_attrs(struct ui_browser *bro, int item,
|
||||
struct ui_file_attrs *attrs);
|
||||
|
||||
int ui_file_browser_set_file_attrs(struct ui_browser *bro, int item,
|
||||
struct ui_file_attrs *attrs);
|
||||
|
||||
void *ui_file_browser_open_file(struct ui_browser *bro, int item);
|
||||
|
||||
|
||||
int ui_file_browser_del_file(struct ui_browser *bro, int item);
|
||||
|
||||
int ui_file_browser_highlight_item(struct ui_browser *bro, int item, bool yes);
|
||||
|
||||
void *ui_file_browser_get_child_by_id(struct ui_browser *bro, int item, int id);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
20
include_lib/system/ui/ui/ui_button.h
Normal file
20
include_lib/system/ui/ui/ui_button.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef UI_BUTTON_H
|
||||
#define UI_BUTTON_H
|
||||
|
||||
|
||||
#include "ui/control.h"
|
||||
#include "ui/ui_core.h"
|
||||
|
||||
struct button {
|
||||
struct element elm;
|
||||
u8 image_index;
|
||||
u8 css_num;
|
||||
u32 css[2];
|
||||
const struct ui_button_info *info;
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
void ui_button_enable();
|
||||
|
||||
#endif
|
||||
|
||||
34
include_lib/system/ui/ui/ui_camera.h
Normal file
34
include_lib/system/ui/ui/ui_camera.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef UI_CAMERA_H
|
||||
#define UI_CAMERA_H
|
||||
|
||||
#include "ui/control.h"
|
||||
#include "ui/ui_core.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct ui_camera {
|
||||
struct element elm; //must be first
|
||||
int fd;
|
||||
const struct ui_camera_info *info;
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define ui_camera_for_id(id) \
|
||||
(struct ui_camera*)ui_core_get_element_by_id(id)
|
||||
|
||||
|
||||
|
||||
void register_ui_camera_handler(const struct element_event_handler *handler);
|
||||
|
||||
int ui_camera_set_rect(int id, struct rect *r);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
566
include_lib/system/ui/ui/ui_core.h
Normal file
566
include_lib/system/ui/ui/ui_core.h
Normal file
@ -0,0 +1,566 @@
|
||||
#ifndef UI_ELEMENT_CORE_H
|
||||
#define UI_ELEMENT_CORE_H
|
||||
|
||||
#include "typedef.h"
|
||||
#include "rect.h"
|
||||
#include "system/event.h"
|
||||
// #include "fs/fs.h"
|
||||
#include "res/resfile.h"
|
||||
|
||||
|
||||
#define UI_CTRL_BUTTON 0
|
||||
|
||||
struct element;
|
||||
|
||||
|
||||
#ifdef offsetof
|
||||
#undef offsetof
|
||||
#endif
|
||||
#ifdef container_of
|
||||
#undef container_of
|
||||
#endif
|
||||
|
||||
#define offsetof(type, memb) \
|
||||
((unsigned long)(&((type *)0)->memb))
|
||||
|
||||
#define container_of(ptr, type, memb) \
|
||||
((type *)((char *)ptr - offsetof(type, memb)))
|
||||
|
||||
enum ui_direction {
|
||||
UI_DIR_UP,
|
||||
UI_DIR_DOWN,
|
||||
UI_DIR_LEFT,
|
||||
UI_DIR_RIGHT,
|
||||
};
|
||||
|
||||
enum ui_align {
|
||||
UI_ALIGN_LEFT = 0,
|
||||
UI_ALIGN_CENTER,
|
||||
UI_ALIGN_RIGHT,
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
POSITION_ABSOLUTE = 0,
|
||||
POSITION_RELATIVE = 1,
|
||||
};
|
||||
|
||||
enum {
|
||||
ELM_EVENT_TOUCH_DOWN,
|
||||
ELM_EVENT_TOUCH_MOVE,
|
||||
ELM_EVENT_TOUCH_R_MOVE,
|
||||
ELM_EVENT_TOUCH_L_MOVE,
|
||||
ELM_EVENT_TOUCH_D_MOVE,
|
||||
ELM_EVENT_TOUCH_U_MOVE,
|
||||
ELM_EVENT_TOUCH_HOLD,
|
||||
ELM_EVENT_TOUCH_UP,
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
ELM_EVENT_KEY_CLICK,
|
||||
ELM_EVENT_KEY_LONG,
|
||||
ELM_EVENT_KEY_HOLD,
|
||||
};
|
||||
|
||||
enum {
|
||||
ELM_STA_INITED,
|
||||
//ELM_STA_SHOW_PROBE,
|
||||
//ELM_STA_SHOW_POST,
|
||||
ELM_STA_HIDE,
|
||||
ELM_STA_SHOW,
|
||||
ELM_STA_PAUSE,
|
||||
};
|
||||
|
||||
enum {
|
||||
ELM_FLAG_NORMAL,
|
||||
ELM_FLAG_HEAD,
|
||||
};
|
||||
|
||||
enum {
|
||||
DC_DATA_FORMAT_OSD8 = 0,
|
||||
DC_DATA_FORMAT_YUV420 = 1,
|
||||
DC_DATA_FORMAT_OSD16 = 2,
|
||||
DC_DATA_FORMAT_OSD8A = 3,
|
||||
DC_DATA_FORMAT_MONO = 4,
|
||||
};
|
||||
|
||||
|
||||
struct element_touch_event {
|
||||
int event;
|
||||
int xoffset;
|
||||
int yoffset;
|
||||
u8 hold_up;
|
||||
u8 onfocus;
|
||||
u8 move_dir;
|
||||
struct position pos;
|
||||
struct position mov;
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
struct element_key_event {
|
||||
u8 event;
|
||||
u8 value;
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
#define ELM_KEY_EVENT(e) (0x0000 | (e->event) | (e->value << 8))
|
||||
#define ELM_TOUCH_EVENT(e) (0x1000 | (e->event))
|
||||
#define ELM_CHANGE_EVENT(e) (0x2000 | (e->event))
|
||||
|
||||
enum element_change_event {
|
||||
ON_CHANGE_INIT_PROBE,
|
||||
ON_CHANGE_INIT,
|
||||
ON_CHANGE_TRY_OPEN_DC,
|
||||
ON_CHANGE_FIRST_SHOW,
|
||||
ON_CHANGE_SHOW_PROBE,
|
||||
ON_CHANGE_SHOW,
|
||||
ON_CHANGE_SHOW_POST,
|
||||
ON_CHANGE_HIDE,
|
||||
ON_CHANGE_HIGHLIGHT,
|
||||
ON_CHANGE_RELEASE_PROBE,
|
||||
ON_CHANGE_RELEASE,
|
||||
ON_CHANGE_ANIMATION_END,
|
||||
ON_CHANGE_SHOW_COMPLETED,
|
||||
ON_CHANGE_UPDATE_ITEM,
|
||||
};
|
||||
|
||||
|
||||
struct element_event_handler {
|
||||
int id;
|
||||
int (*ontouch)(void *, struct element_touch_event *);
|
||||
int (*onkey)(void *, struct element_key_event *);
|
||||
int (*onchange)(void *, enum element_change_event, void *);
|
||||
};
|
||||
|
||||
struct jaction {
|
||||
u32 show;
|
||||
u32 hide;
|
||||
};
|
||||
|
||||
enum {
|
||||
ELM_ACTION_HIDE = 0,
|
||||
ELM_ACTION_SHOW,
|
||||
ELM_ACTION_TOGGLE,
|
||||
ELM_ACTION_HIGHLIGHT,
|
||||
};
|
||||
|
||||
struct event_action {
|
||||
u16 event;
|
||||
u16 action;
|
||||
int id;
|
||||
u8 argc;
|
||||
char argv[];
|
||||
};
|
||||
|
||||
struct element_event_action {
|
||||
u16 num;
|
||||
struct event_action action[0];
|
||||
};
|
||||
|
||||
struct image_preview {
|
||||
RESFILE *file;
|
||||
int id;
|
||||
int page;
|
||||
};
|
||||
|
||||
|
||||
struct image {
|
||||
int x;
|
||||
int y;
|
||||
int id;
|
||||
int page;
|
||||
int en;
|
||||
};
|
||||
|
||||
struct draw_context {
|
||||
u8 ref;
|
||||
u8 alpha;
|
||||
u8 align;
|
||||
u8 data_format;
|
||||
u8 prj;
|
||||
u8 page;
|
||||
u8 buf_num;
|
||||
u32 background_color;
|
||||
void *handl;
|
||||
struct element *elm;
|
||||
struct rect rect;
|
||||
struct rect draw;
|
||||
void *dc;
|
||||
|
||||
struct image_preview preview;
|
||||
|
||||
struct rect need_draw;
|
||||
struct rect disp;
|
||||
u16 width;
|
||||
u16 height;
|
||||
u8 *fbuf;
|
||||
u32 fbuf_len;
|
||||
u8 *buf;
|
||||
u8 *buf0;
|
||||
u8 *buf1;
|
||||
u32 len;
|
||||
u16 lines;
|
||||
u8 col_align;
|
||||
u8 row_align;
|
||||
|
||||
struct image draw_img;
|
||||
|
||||
u8 *mask;
|
||||
};
|
||||
|
||||
struct css_border {
|
||||
u16 left: 4;
|
||||
u16 top: 4;
|
||||
u16 right: 4;
|
||||
u16 bottom: 4;
|
||||
u16 color: 16;
|
||||
};
|
||||
|
||||
struct css_border1 {
|
||||
u8 left;
|
||||
u8 top;
|
||||
u8 right;
|
||||
u8 bottom;
|
||||
int color: 24;
|
||||
};
|
||||
|
||||
struct element_css {
|
||||
u8 align: 2;
|
||||
u8 invisible: 1;
|
||||
u8 z_order: 5;
|
||||
int left/* : 16 */;
|
||||
int top/* : 16 */;
|
||||
int width/* : 16 */;
|
||||
int height/* : 16 */;
|
||||
u32 background_color: 24;
|
||||
u32 alpha: 8;
|
||||
int background_image: 24;
|
||||
int image_quadrant: 8;
|
||||
struct css_border border;
|
||||
};
|
||||
|
||||
struct element_css1 {
|
||||
u8 align;
|
||||
u8 invisible;
|
||||
u8 z_order;
|
||||
int left;
|
||||
int top;
|
||||
int width;
|
||||
int height;
|
||||
u32 background_color: 24;
|
||||
u32 alpha: 8;
|
||||
int background_image: 24;
|
||||
int image_quadrant: 8;
|
||||
struct css_border1 border;
|
||||
};
|
||||
|
||||
struct element_ops {
|
||||
int (*show)(struct element *);
|
||||
int (*redraw)(struct element *, struct rect *);
|
||||
};
|
||||
|
||||
struct element {
|
||||
u32 highlight: 1;
|
||||
u32 state: 2;
|
||||
u32 ref: 5;
|
||||
u32 prj: 3;
|
||||
u32 page: 21;
|
||||
// u32 alive;
|
||||
int id;
|
||||
struct element *parent;
|
||||
struct list_head sibling;
|
||||
struct list_head child;
|
||||
struct element *focus;
|
||||
struct element_css css;
|
||||
struct draw_context *dc;
|
||||
// const struct element_ops *ops;
|
||||
const struct element_event_handler *handler;
|
||||
// const struct element_event_action *action;
|
||||
};
|
||||
|
||||
struct ui_style {
|
||||
const char *file;
|
||||
u32 version;
|
||||
};
|
||||
|
||||
enum {
|
||||
UI_FTYPE_VIDEO = 0,
|
||||
UI_FTYPE_IMAGE,
|
||||
UI_FTYPE_AUDIO,
|
||||
UI_FTYPE_DIR,
|
||||
UI_FTYPE_UNKNOW = 0xff,
|
||||
};
|
||||
|
||||
struct ui_file_attrs {
|
||||
char *format;
|
||||
char fname[128];
|
||||
struct vfs_attr attr;
|
||||
u8 ftype;
|
||||
u16 file_num;
|
||||
u32 film_len;
|
||||
};
|
||||
|
||||
struct ui_image_attrs {
|
||||
u16 width;
|
||||
u16 height;
|
||||
};
|
||||
|
||||
struct ui_text_attrs {
|
||||
const char *str;
|
||||
const char *format;
|
||||
int color;
|
||||
u16 strlen;
|
||||
u16 offset;
|
||||
u8 encode: 2;
|
||||
u8 endian: 1;
|
||||
u8 flags: 5;
|
||||
// u16 offset;
|
||||
u16 displen;
|
||||
};
|
||||
|
||||
struct ui_file_browser {
|
||||
int file_number;
|
||||
u8 dev_num;
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
#define ELEMENT_ALIVE 0x53547a7b
|
||||
|
||||
#define element_born(elm) \
|
||||
elm->alive = ELEMENT_ALIVE
|
||||
|
||||
#define element_alive(elm) \
|
||||
(elm->alive == ELEMENT_ALIVE)
|
||||
|
||||
|
||||
#define list_for_each_child_element(p, elm) \
|
||||
list_for_each_entry(p, &(elm)->child, sibling)
|
||||
|
||||
#define list_for_each_child_element_reverse(p, n, elm) \
|
||||
list_for_each_entry_reverse_safe(p, n, &(elm)->child, sibling)
|
||||
|
||||
#define list_for_each_child_element_safe(p, n, elm) \
|
||||
list_for_each_entry_safe(p, n, &(elm)->child, sibling)
|
||||
|
||||
struct ui_platform_api {
|
||||
void *(*malloc)(int);
|
||||
void (*free)(void *);
|
||||
|
||||
int (*load_style)(struct ui_style *);
|
||||
|
||||
void *(*load_window)(int id);
|
||||
void (*unload_window)(void *);
|
||||
|
||||
int (*open_draw_context)(struct draw_context *);
|
||||
int (*get_draw_context)(struct draw_context *);
|
||||
int (*put_draw_context)(struct draw_context *);
|
||||
int (*set_draw_context)(struct draw_context *);
|
||||
int (*close_draw_context)(struct draw_context *);
|
||||
|
||||
int (*fill_rect)(struct draw_context *, u32 color);
|
||||
int (*draw_rect)(struct draw_context *, struct css_border *border);
|
||||
int (*draw_image)(struct draw_context *, u32 src, u8 quadrant, u8 *mask);
|
||||
int (*draw_point)(struct draw_context *, u16 x, u16 y, u32 color);
|
||||
u32(*read_point)(struct draw_context *dc, u16 x, u16 y);
|
||||
int (*invert_rect)(struct draw_context *, u32 color);
|
||||
|
||||
void *(*load_widget_info)(void *_head, u8 page);
|
||||
void *(*load_css)(u8 page, void *_css);
|
||||
void *(*load_image_list)(u8 page, void *_list);
|
||||
void *(*load_text_list)(u8 page, void *__list);
|
||||
|
||||
//int (*highlight)(struct draw_context *);
|
||||
int (*show_text)(struct draw_context *, struct ui_text_attrs *);
|
||||
int (*read_image_info)(struct draw_context *, u32, u8, struct ui_image_attrs *);
|
||||
|
||||
int (*open_device)(struct draw_context *, const char *device);
|
||||
int (*close_device)(int);
|
||||
|
||||
void *(*set_timer)(void *, void (*callback)(void *), u32 msec);
|
||||
int (*del_timer)(void *);
|
||||
|
||||
struct ui_file_browser *(*file_browser_open)(struct rect *r,
|
||||
const char *path, const char *ftype, int show_mode);
|
||||
|
||||
int (*get_file_attrs)(struct ui_file_browser *, struct ui_file_attrs *attrs);
|
||||
|
||||
int (*set_file_attrs)(struct ui_file_browser *, struct ui_file_attrs *attrs);
|
||||
|
||||
int (*clear_file_preview)(struct ui_file_browser *, struct rect *r);
|
||||
|
||||
int (*show_file_preview)(struct ui_file_browser *, struct rect *r, struct ui_file_attrs *attrs);
|
||||
|
||||
int (*flush_file_preview)(struct ui_file_browser *);
|
||||
|
||||
void *(*open_file)(struct ui_file_browser *, struct ui_file_attrs *attrs);
|
||||
int (*delete_file)(struct ui_file_browser *, struct ui_file_attrs *attrs);
|
||||
|
||||
int (*move_file_preview)(struct ui_file_browser *_bro, struct rect *dst, struct rect *src);
|
||||
|
||||
void (*file_browser_close)(struct ui_file_browser *);
|
||||
|
||||
};
|
||||
|
||||
extern /* const */ struct ui_platform_api *platform_api;
|
||||
|
||||
extern /* const */ struct element_event_handler dumy_handler;
|
||||
|
||||
struct janimation {
|
||||
u8 persent[5];
|
||||
u8 direction;
|
||||
u8 play_state;
|
||||
u8 iteration_count;
|
||||
u16 delay;
|
||||
u16 duration;
|
||||
struct element_css css[0];
|
||||
};
|
||||
|
||||
|
||||
extern struct element_event_handler *elm_event_handler_begin;
|
||||
extern struct element_event_handler *elm_event_handler_end;
|
||||
|
||||
|
||||
#define ___REGISTER_UI_EVENT_HANDLER(style, _id) \
|
||||
static const struct element_event_handler element_event_handler_##_id \
|
||||
sec(.elm_event_handler_##style) __attribute__((used)) = { \
|
||||
.id = _id,
|
||||
|
||||
#define __REGISTER_UI_EVENT_HANDLER(style, _id) \
|
||||
___REGISTER_UI_EVENT_HANDLER(style, _id)
|
||||
|
||||
#define REGISTER_UI_EVENT_HANDLER(id) \
|
||||
__REGISTER_UI_EVENT_HANDLER(STYLE_NAME, id)
|
||||
|
||||
|
||||
|
||||
struct ui_style_info {
|
||||
const char *name;
|
||||
struct element_event_handler *begin;
|
||||
struct element_event_handler *end;
|
||||
};
|
||||
|
||||
extern struct ui_style_info ui_style_begin[];
|
||||
extern struct ui_style_info ui_style_end[];
|
||||
|
||||
#define __REGISTER_UI_STYLE(style_name) \
|
||||
extern struct element_event_handler elm_event_handler_begin_##style_name[]; \
|
||||
extern struct element_event_handler elm_event_handler_end_##style_name[]; \
|
||||
static const struct ui_style_info ui_style_##style_name sec(.ui_style) __attribute__((used)) = { \
|
||||
.name = #style_name, \
|
||||
.begin = elm_event_handler_begin_##style_name, \
|
||||
.end = elm_event_handler_end_##style_name, \
|
||||
};
|
||||
|
||||
#define REGISTER_UI_STYLE(style_name) \
|
||||
__REGISTER_UI_STYLE(style_name)
|
||||
|
||||
|
||||
static inline struct element_event_handler *element_event_handler_for_id(u32 id)
|
||||
{
|
||||
struct element_event_handler *p;
|
||||
|
||||
for (p = elm_event_handler_begin; p < elm_event_handler_end; p++) {
|
||||
if (p->id == id) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#define ui_core_get_element_css(elm) \
|
||||
&((struct element *)(elm))->css
|
||||
|
||||
#define ui_core_element_invisable(elm, i) \
|
||||
((struct element *)(elm))->css.invisible = i
|
||||
|
||||
|
||||
int ui_core_init(const struct ui_platform_api *api, struct rect *rect);
|
||||
|
||||
int ui_core_set_style(const char *style);
|
||||
|
||||
void ui_core_set_rotate(int _rotate);
|
||||
|
||||
int ui_core_get_rotate();
|
||||
|
||||
|
||||
void *ui_core_malloc(int size);
|
||||
|
||||
void ui_core_free(void *buf);
|
||||
|
||||
void ui_core_element_init(struct element *,
|
||||
u32 id,
|
||||
u8 page,
|
||||
u8 prj,
|
||||
/* const */ struct element_css1 *,
|
||||
const struct element_event_handler *,
|
||||
const struct element_event_action *);
|
||||
|
||||
void ui_core_get_element_abs_rect(struct element *elm, struct rect *rect);
|
||||
|
||||
void ui_core_append_child(void *_child);
|
||||
|
||||
struct element *ui_core_get_first_child();
|
||||
|
||||
void ui_core_remove_element(void *_child);
|
||||
|
||||
|
||||
int ui_core_open_draw_context(struct draw_context *dc, struct element *elm);
|
||||
|
||||
int ui_core_close_draw_context(struct draw_context *dc);
|
||||
|
||||
int ui_core_show(void *_elm, int init);
|
||||
|
||||
int ui_core_hide(void *_elm);
|
||||
|
||||
struct element *get_element_by_id(struct element *elm, u32 id);
|
||||
|
||||
struct element *ui_core_get_element_by_id(u32 id);
|
||||
int ui_core_get_disp_status_by_id(u32 id);
|
||||
|
||||
struct element *ui_core_get_up_element(struct element *elm);
|
||||
struct element *ui_core_get_down_element(struct element *elm);
|
||||
struct element *ui_core_get_left_element(struct element *elm);
|
||||
struct element *ui_core_get_right_element(struct element *elm);
|
||||
|
||||
int ui_core_element_ontouch(struct element *, struct element_touch_event *e);
|
||||
|
||||
int ui_core_ontouch(struct element_touch_event *e);
|
||||
|
||||
int ui_core_element_onkey(struct element *elm, struct element_key_event *e);
|
||||
|
||||
int ui_core_onkey(struct element_key_event *e);
|
||||
|
||||
void ui_core_element_append_child(struct element *parent, struct element *child);
|
||||
|
||||
struct element_css *ui_core_set_element_css(void *_elm, const struct element_css1 *css);
|
||||
|
||||
int ui_core_invert_rect(struct draw_context *dc);
|
||||
|
||||
void ui_core_release_child_probe(struct element *elm);
|
||||
|
||||
void ui_core_release_child(struct element *elm);
|
||||
|
||||
|
||||
int ui_core_redraw(void *_elm);
|
||||
|
||||
int ui_core_highlight_element(struct element *elm, int yes);
|
||||
|
||||
void ui_core_element_on_focus(struct element *elm, int yes);
|
||||
|
||||
|
||||
void ui_core_ontouch_lose_focus(struct element *elm);
|
||||
|
||||
void ui_core_ontouch_lock(struct element *elm);
|
||||
|
||||
void ui_core_ontouch_unlock(struct element *elm);
|
||||
|
||||
int ui_core_get_draw_context(struct draw_context *dc, struct element *elm, struct rect *draw);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
149
include_lib/system/ui/ui/ui_grid.h
Normal file
149
include_lib/system/ui/ui/ui_grid.h
Normal file
@ -0,0 +1,149 @@
|
||||
#ifndef UI_GRID_H
|
||||
#define UI_GRID_H
|
||||
|
||||
|
||||
#include "ui/ui_core.h"
|
||||
#include "ui/control.h"
|
||||
|
||||
enum {
|
||||
GRID_SCROLL_MODE,
|
||||
GRID_PAGE_MODE,
|
||||
};
|
||||
|
||||
enum {
|
||||
SCROLL_DIRECTION_NONE,
|
||||
SCROLL_DIRECTION_LR,
|
||||
SCROLL_DIRECTION_UD,
|
||||
};
|
||||
|
||||
struct ui_grid_item_info {
|
||||
u8 row;
|
||||
u8 col;
|
||||
u8 page_mode;
|
||||
u8 highlight_index;
|
||||
u16 interval;
|
||||
struct layout_info *info;
|
||||
};
|
||||
|
||||
struct scroll_area {
|
||||
int left;
|
||||
int top;
|
||||
int right;
|
||||
int bottom;
|
||||
};
|
||||
|
||||
|
||||
struct ui_grid_dynamic {
|
||||
int dhi_index;
|
||||
int dcol_num;
|
||||
int drow_num;
|
||||
|
||||
int min_row_index;
|
||||
int max_row_index;
|
||||
int min_col_index;
|
||||
int max_col_index;
|
||||
int min_show_row_index;
|
||||
int max_show_row_index;
|
||||
int min_show_col_index;
|
||||
int max_show_col_index;
|
||||
|
||||
int grid_xval;
|
||||
int grid_yval;
|
||||
u8 grid_col_num;
|
||||
u8 grid_row_num;
|
||||
u8 grid_show_row;
|
||||
u8 grid_show_col;
|
||||
int base_index_once;
|
||||
};
|
||||
|
||||
struct ui_grid {
|
||||
struct element elm;
|
||||
// char hi_num;
|
||||
char hi_index;
|
||||
char touch_index;
|
||||
char onfocus;
|
||||
u8 page_mode;
|
||||
u8 slide_direction;
|
||||
u8 col_num;
|
||||
u8 row_num;
|
||||
u8 show_row;
|
||||
u8 show_col;
|
||||
u8 avail_item_num;
|
||||
u8 pix_scroll;
|
||||
u8 ctrl_num;
|
||||
// u8 rotate;
|
||||
int x_interval;
|
||||
int y_interval;
|
||||
int max_show_left;
|
||||
int max_show_top;
|
||||
int min_show_left;
|
||||
int min_show_top;
|
||||
int max_left;
|
||||
int max_top;
|
||||
int min_left;
|
||||
int min_top;
|
||||
// int scroll_step;
|
||||
// u8 ctrl_num;
|
||||
struct scroll_area *area;
|
||||
struct layout *item;
|
||||
struct layout_info *item_info;
|
||||
// struct element elm2;
|
||||
struct ui_grid_dynamic *dynamic;
|
||||
struct position pos;
|
||||
struct draw_context dc;
|
||||
const struct ui_grid_info *info;
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
extern const struct element_event_handler grid_elm_handler;
|
||||
|
||||
static inline int ui_grid_cur_item(struct ui_grid *grid)
|
||||
{
|
||||
if (grid->touch_index >= 0) {
|
||||
return grid->touch_index;
|
||||
}
|
||||
return grid->hi_index;
|
||||
}
|
||||
|
||||
#define ui_grid_set_item(grid, index) (grid)->hi_index = index
|
||||
|
||||
void ui_grid_enable();
|
||||
void ui_grid_on_focus(struct ui_grid *grid);
|
||||
void ui_grid_lose_focus(struct ui_grid *grid);
|
||||
void ui_grid_state_reset(struct ui_grid *grid, int highlight_item);
|
||||
int ui_grid_highlight_item(struct ui_grid *grid, int item, bool yes);
|
||||
int ui_grid_highlight_item_by_id(int id, int item, bool yes);
|
||||
struct ui_grid *__ui_grid_new(struct element_css1 *css, int id, struct ui_grid_item_info *info, struct element *parent);
|
||||
int ui_grid_slide(struct ui_grid *grid, int direction, int steps);
|
||||
int ui_grid_set_item_num(struct ui_grid *grid, int item_num);
|
||||
int ui_grid_set_slide_direction(struct ui_grid *grid, int dir);
|
||||
int ui_grid_slide_with_callback(struct ui_grid *grid, int direction, int steps, void(*callback)(void *ctrl));
|
||||
|
||||
int ui_grid_dynamic_slide(struct ui_grid *grid, int direction, int steps);//动态列表滚动
|
||||
int ui_grid_dynamic_create(struct ui_grid *grid, int direction, int list_total, int (*event_handler_cb)(void *, int, int, int)); //动态列表创建
|
||||
int ui_grid_dynamic_release(struct ui_grid *grid);//动态列表释放
|
||||
|
||||
int ui_grid_dynamic_cur_item(struct ui_grid *grid);//动态列表获取选项
|
||||
int ui_grid_dynamic_set_item_by_id(int id, int count);//修改动态列表数
|
||||
int ui_grid_dynamic_reset(struct ui_grid *grid, int index); //重置动态列表
|
||||
void ui_grid_set_scroll_area(struct ui_grid *grid, struct scroll_area *area);
|
||||
|
||||
int ui_grid_init_dynamic(struct ui_grid *grid, int *row, int *col);
|
||||
int ui_grid_add_dynamic(struct ui_grid *grid, int *row, int *col, int redraw);
|
||||
int ui_grid_del_dynamic(struct ui_grid *grid, int *row, int *col, int redraw);
|
||||
int ui_grid_set_hi_index(struct ui_grid *grid, int hi_index);
|
||||
int ui_grid_set_pix_scroll(struct ui_grid *grid, int enable);
|
||||
int ui_grid_get_hindex(struct ui_grid *grid);
|
||||
int ui_grid_set_hindex_dynamic(struct ui_grid *grid, int dhindex, int init, int hi_index);
|
||||
int ui_grid_get_hindex_dynamic(struct ui_grid *grid);
|
||||
int ui_grid_set_base_dynamic(struct ui_grid *grid, u32 base_index_once);
|
||||
// int ui_grid_update_by_id_dynamic(int id, int redraw);
|
||||
int ui_grid_update_by_id_dynamic(int id, int item_sel, int redraw);
|
||||
int ui_grid_add_dynamic_by_id(int id, int *row, int *col, int redraw);
|
||||
int ui_grid_del_dynamic_by_id(int id, int *row, int *col, int redraw);
|
||||
int ui_grid_cur_item_dynamic(struct ui_grid *grid);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
44
include_lib/system/ui/ui/ui_number.h
Normal file
44
include_lib/system/ui/ui/ui_number.h
Normal file
@ -0,0 +1,44 @@
|
||||
#ifndef UI_NUMBER_H
|
||||
#define UI_NUMBER_H
|
||||
|
||||
|
||||
#include "ui/control.h"
|
||||
#include "ui/ui_core.h"
|
||||
#include "ui/p.h"
|
||||
|
||||
enum {
|
||||
TYPE_NUM,
|
||||
TYPE_STRING,
|
||||
};
|
||||
|
||||
struct unumber {
|
||||
u8 numbs;
|
||||
u8 type;
|
||||
u32 number[2];
|
||||
u8 *num_str;
|
||||
};
|
||||
|
||||
struct ui_number {
|
||||
struct element_text text;
|
||||
char source[8];
|
||||
u16 number[2];
|
||||
u16 buf[20];
|
||||
|
||||
int color;
|
||||
int hi_color;
|
||||
u8 css_num;
|
||||
u8 nums: 6;
|
||||
u8 type: 2;
|
||||
u32 css[2];
|
||||
u8 *num_str;
|
||||
const struct ui_number_info *info;
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
void ui_number_enable();
|
||||
void *new_ui_number(const void *_info, struct element *parent);
|
||||
int ui_number_update(struct ui_number *number, struct unumber *n);
|
||||
int ui_number_update_by_id(int id, struct unumber *n);
|
||||
|
||||
#endif
|
||||
|
||||
30
include_lib/system/ui/ui/ui_pic.h
Normal file
30
include_lib/system/ui/ui/ui_pic.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef UI_PIC_H
|
||||
#define UI_PIC_H
|
||||
|
||||
#include "ui/ui_core.h"
|
||||
|
||||
|
||||
|
||||
|
||||
struct ui_pic {
|
||||
struct element elm;
|
||||
u8 index;
|
||||
// u8 css_num:2;
|
||||
// u32 css[2];
|
||||
// u16 highlight_img;
|
||||
// u16 normal_img;
|
||||
// u16 highlight_img_num:8;
|
||||
// u16 normal_img_num:8;
|
||||
const struct ui_pic_info *info;
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
void ui_pic_enable();
|
||||
void *new_ui_pic(const void *_info, struct element *parent);
|
||||
int ui_pic_show_image_by_id(int id, int index);
|
||||
int ui_pic_set_image_index(struct ui_pic *pic, int index);
|
||||
int ui_pic_get_normal_image_number_by_id(int id);
|
||||
int ui_pic_get_highlgiht_image_number_by_id(int id);
|
||||
int ui_pic_set_hide_by_id(int id, int hide);
|
||||
|
||||
#endif
|
||||
48
include_lib/system/ui/ui/ui_progress.h
Normal file
48
include_lib/system/ui/ui/ui_progress.h
Normal file
@ -0,0 +1,48 @@
|
||||
#ifndef UI_PROGRESS_H
|
||||
#define UI_PROGRESS_H
|
||||
|
||||
|
||||
#include "ui/control.h"
|
||||
#include "ui/ui_core.h"
|
||||
|
||||
|
||||
#define PROGRESS_CHILD_NUM (CTRL_PROGRESS_CHILD_END - CTRL_PROGRESS_CHILD_BEGIN)
|
||||
|
||||
|
||||
struct progress_highlight_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
u16 center_x;
|
||||
u16 center_y;
|
||||
u16 radius_big;
|
||||
u16 radius_small;
|
||||
u16 angle_begin;
|
||||
u16 angle_end;
|
||||
struct ui_image_list *img;
|
||||
};
|
||||
|
||||
struct ui_progress {
|
||||
struct element elm;
|
||||
struct element child_elm[PROGRESS_CHILD_NUM];
|
||||
char source[8];
|
||||
u16 center_x;
|
||||
u16 center_y;
|
||||
u16 radius;
|
||||
u16 angle_begin;
|
||||
u16 angle_end;
|
||||
u8 ctrl_num;
|
||||
char percent;
|
||||
u8 *mask;
|
||||
u16 mask_len;
|
||||
void *timer;
|
||||
const struct layout_info *info;
|
||||
const struct progress_highlight_info *pic_info[PROGRESS_CHILD_NUM];
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
void ui_progress_enable();
|
||||
int ui_progress_set_persent_by_id(int id, int persent);
|
||||
int ui_progress_set_persent(struct ui_progress *progress, int percent);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
59
include_lib/system/ui/ui/ui_progress_multi.h
Normal file
59
include_lib/system/ui/ui/ui_progress_multi.h
Normal file
@ -0,0 +1,59 @@
|
||||
#ifndef UI_PROGRESS_MULTI_H
|
||||
#define UI_PROGRESS_MULTI_H
|
||||
|
||||
|
||||
#include "ui/control.h"
|
||||
#include "ui/ui_core.h"
|
||||
|
||||
|
||||
#define MULTIPROGRESS_CHILD_NUM (CTRL_MULTIPROGRESS_CHILD_END - CTRL_MULTIPROGRESS_CHILD_BEGIN)
|
||||
|
||||
struct multiprogress_highlight_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
u16 number;
|
||||
u16 center_x;
|
||||
u16 center_y;
|
||||
u16 radius0_big;
|
||||
u16 radius0_small;
|
||||
u16 radius1_big;
|
||||
u16 radius1_small;
|
||||
u16 radius2_big;
|
||||
u16 radius2_small;
|
||||
u16 angle_begin;
|
||||
u16 angle_end;
|
||||
struct ui_image_list *img;
|
||||
};
|
||||
|
||||
struct ui_multiprogress {
|
||||
struct element elm;
|
||||
struct element child_elm[MULTIPROGRESS_CHILD_NUM];
|
||||
char source[8];
|
||||
u16 center_x;
|
||||
u16 center_y;
|
||||
u16 radius;
|
||||
u16 angle_begin;
|
||||
u16 angle_end;
|
||||
u8 ctrl_num;
|
||||
char percent[3];
|
||||
u8 circle_num;
|
||||
u8 index;
|
||||
u8 *mask;
|
||||
u16 mask_len;
|
||||
void *timer;
|
||||
const struct layout_info *info;
|
||||
const struct multiprogress_highlight_info *pic_info[MULTIPROGRESS_CHILD_NUM];
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
void ui_multiprogress_enable();
|
||||
int ui_multiprogress_set_persent_by_id(int id, int persent);
|
||||
int ui_multiprogress_set_second_persent_by_id(int id, int percent);
|
||||
int ui_multiprogress_set_third_persent_by_id(int id, int percent);
|
||||
|
||||
int ui_multiprogress_set_persent(struct ui_multiprogress *multiprogress, int percent);
|
||||
int ui_multiprogress_set_second_persent(struct ui_multiprogress *multiprogress, int percent);
|
||||
int ui_multiprogress_set_third_persent(struct ui_multiprogress *multiprogress, int percent);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
11
include_lib/system/ui/ui/ui_rotate.h
Normal file
11
include_lib/system/ui/ui/ui_rotate.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef __UI_ROTATE_H__
|
||||
#define __UI_ROTATE_H__
|
||||
|
||||
#include "rect.h"
|
||||
|
||||
void rotate_0(unsigned char *src, unsigned char *src1, int sw, int sh, int cx, int cy, unsigned char *dst, int dw, int dh, int dx, int dy, struct rect *rect, int angle);
|
||||
void rotate_1(unsigned char *tmp, unsigned char *src, int sw, int sh, int cx, int cy, unsigned char *dst, int dw, int dh, int dx, int dy, struct rect *rect, int angle);
|
||||
void rotate_map(int sw, int sh, int scx, int scy, int *dw, int *dh, int dcx, int dcy, int angle);
|
||||
|
||||
#endif
|
||||
|
||||
43
include_lib/system/ui/ui/ui_slider.h
Normal file
43
include_lib/system/ui/ui/ui_slider.h
Normal file
@ -0,0 +1,43 @@
|
||||
#ifndef UI_SLIDER_H
|
||||
#define UI_SLIDER_H
|
||||
|
||||
#include "ui/ui_core.h"
|
||||
#include "ui/control.h"
|
||||
|
||||
|
||||
#define SLIDER_CHILD_NUM (SLIDER_CHILD_END - SLIDER_CHILD_BEGIN)
|
||||
|
||||
|
||||
struct slider_text_info {
|
||||
u8 move;
|
||||
int min_value;
|
||||
int max_value;
|
||||
int text_color;
|
||||
};
|
||||
|
||||
|
||||
struct ui_slider {
|
||||
struct element elm;
|
||||
struct element child_elm[SLIDER_CHILD_NUM];
|
||||
u8 step;
|
||||
char persent;
|
||||
s16 left;
|
||||
s16 width;
|
||||
s16 min_value;
|
||||
s16 max_value;
|
||||
u16 text_color;
|
||||
const struct ui_slider_info *info;
|
||||
const struct slider_text_info *text_info;
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
void ui_slider_enable();
|
||||
int ui_slider_set_persent_by_id(int id, int persent);
|
||||
int ui_slider_set_persent(struct ui_slider *slider, int persent);
|
||||
|
||||
int slider_touch_slider_move(struct ui_slider *slider, struct element_touch_event *e);//触摸滑动功能
|
||||
|
||||
int slider_get_percent(struct ui_slider *slider);
|
||||
|
||||
#endif
|
||||
|
||||
41
include_lib/system/ui/ui/ui_slider_vert.h
Normal file
41
include_lib/system/ui/ui/ui_slider_vert.h
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef UI_SLIDER_VERT_H
|
||||
#define UI_SLIDER_VERT_H
|
||||
|
||||
#include "ui/ui_core.h"
|
||||
#include "ui/control.h"
|
||||
|
||||
#define VSLIDER_CHILD_NUM (VSLIDER_CHILD_END - VSLIDER_CHILD_BEGIN)
|
||||
|
||||
struct vslider_text_info {
|
||||
u8 move;
|
||||
int min_value;
|
||||
int max_value;
|
||||
int text_color;
|
||||
};
|
||||
|
||||
|
||||
struct ui_vslider {
|
||||
struct element elm;
|
||||
struct element child_elm[VSLIDER_CHILD_NUM];
|
||||
u8 step;
|
||||
char persent;
|
||||
s16 top;
|
||||
s16 height;
|
||||
u16 min_value;
|
||||
u16 max_value;
|
||||
u16 text_color;
|
||||
const struct ui_slider_info *info;
|
||||
const struct vslider_text_info *text_info;
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
|
||||
void ui_vslider_enable();
|
||||
int ui_vslider_set_persent_by_id(int id, int persent);
|
||||
int ui_vslider_set_persent(struct ui_vslider *vslider, int persent);
|
||||
|
||||
int vslider_touch_slider_move(struct ui_vslider *vslider, struct element_touch_event *e);//触摸滑动功能
|
||||
|
||||
int vslider_get_percent(struct ui_vslider *vslider);
|
||||
#endif
|
||||
|
||||
56
include_lib/system/ui/ui/ui_text.h
Normal file
56
include_lib/system/ui/ui/ui_text.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef UI_TEXT_H
|
||||
#define UI_TEXT_H
|
||||
|
||||
#include "ui/ui_core.h"
|
||||
#include "ui/control.h"
|
||||
#include "font/font_all.h"
|
||||
|
||||
|
||||
struct ui_text {
|
||||
struct element elm;
|
||||
struct ui_text_attrs attrs;
|
||||
char source[8];
|
||||
u16 timer;
|
||||
u16 _str[UI_TEXT_LIST_MAX_NUM];
|
||||
char _format[7];
|
||||
u8 str_num;
|
||||
u8 index;
|
||||
// u8 str_num:4;
|
||||
// u8 css_num:4;
|
||||
// u32 css[2];
|
||||
// u16 attr_color;
|
||||
// u16 attr_highlight_color;
|
||||
// struct ui_text_attrs attrs;
|
||||
const struct ui_text_info *info;
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
|
||||
|
||||
void ui_text_enable();
|
||||
void *new_ui_text(const void *_info, struct element *parent);
|
||||
/*api of format 'ascii'*/
|
||||
int ui_text_set_str(struct ui_text *text, const char *format, const char *str, int strlen, u32 flags);
|
||||
int ui_text_set_str_by_id(int id, const char *format, const char *str);
|
||||
/*api of format 'strpic'*/
|
||||
int ui_text_set_index(struct ui_text *text, int index);
|
||||
int ui_text_show_index_by_id(int id, int index);
|
||||
/*api of format 'text'*/
|
||||
void ui_text_set_text_attrs(struct ui_text *text, const char *str, int strlen, u8 encode, u8 endian, u32 flags);
|
||||
int ui_text_set_text_by_id(int id, const char *str, int strlen, u32 flags);
|
||||
int ui_text_set_textw_by_id(int id, const char *str, int strlen, int endian, u32 flags);
|
||||
int ui_text_set_textu_by_id(int id, const char *str, int strlen, u32 flags);
|
||||
|
||||
void text_release(struct ui_text *text);
|
||||
/*
|
||||
* 注意:
|
||||
* 1.store_buf必须是全局或者静态,不能是局部,大小为index_num+1
|
||||
* 2.index_buf表示当前文本控件字符串id的序号,从0开始
|
||||
* 3.index_num表示有多少个字符串id拼起来
|
||||
* */
|
||||
int ui_text_set_combine_index(struct ui_text *text, u16 *store_buf, u8 *index_buf, int index_num);
|
||||
|
||||
|
||||
int ui_text_set_hide_by_id(int id, int hide);
|
||||
|
||||
#endif
|
||||
44
include_lib/system/ui/ui/ui_time.h
Normal file
44
include_lib/system/ui/ui/ui_time.h
Normal file
@ -0,0 +1,44 @@
|
||||
#ifndef UI_TIME_H
|
||||
#define UI_TIME_H
|
||||
|
||||
|
||||
#include "ui/control.h"
|
||||
#include "ui/ui_core.h"
|
||||
#include "ui/p.h"
|
||||
|
||||
struct utime {
|
||||
u16 year;
|
||||
u8 month;
|
||||
u8 day;
|
||||
u8 hour;
|
||||
u8 min;
|
||||
u8 sec;
|
||||
};
|
||||
|
||||
struct ui_time {
|
||||
struct element_text text;
|
||||
char source[8];
|
||||
u16 year: 12;
|
||||
u16 month: 4;
|
||||
u8 day;
|
||||
u8 hour;
|
||||
u8 min;
|
||||
u8 sec;
|
||||
u8 css_num;
|
||||
u8 auto_cnt;
|
||||
u32 css[2];
|
||||
int color;
|
||||
int hi_color;
|
||||
u16 buf[20];
|
||||
void *timer;
|
||||
const struct ui_time_info *info;
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
void ui_time_enable();
|
||||
void *new_ui_time(const void *_info, struct element *parent);
|
||||
|
||||
int ui_time_update(struct ui_time *time, struct utime *t);
|
||||
int ui_time_update_by_id(int id, struct utime *time);
|
||||
|
||||
#endif
|
||||
52
include_lib/system/ui/ui/ui_watch.h
Normal file
52
include_lib/system/ui/ui/ui_watch.h
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef UI_WATCH_H
|
||||
#define UI_WATCH_H
|
||||
|
||||
|
||||
#include "ui/control.h"
|
||||
#include "ui/ui_core.h"
|
||||
|
||||
|
||||
#define WATCH_CHILD_NUM (CTRL_WATCH_CHILD_END - CTRL_WATCH_CHILD_BEGIN)
|
||||
|
||||
|
||||
struct watch_pic_info {
|
||||
struct ui_ctrl_info_head head;
|
||||
u16 cent_x;
|
||||
u16 cent_y;
|
||||
struct ui_image_list *img;
|
||||
};
|
||||
|
||||
struct watch_css_info {
|
||||
int left: 16;
|
||||
int top: 16;
|
||||
int width: 16;
|
||||
int height: 16;
|
||||
};
|
||||
|
||||
struct ui_watch {
|
||||
struct element elm;
|
||||
struct element child_elm[WATCH_CHILD_NUM];
|
||||
struct watch_css_info child_css[WATCH_CHILD_NUM];
|
||||
char source[8];
|
||||
u8 hour;
|
||||
u8 min;
|
||||
u8 sec;
|
||||
u8 last_hour;
|
||||
u8 last_min;
|
||||
u8 last_sec;
|
||||
u8 updata;
|
||||
u8 ctrl_num;
|
||||
void *timer;
|
||||
const struct layout_info *info;
|
||||
const struct watch_pic_info *pic_info[WATCH_CHILD_NUM];
|
||||
const struct element_event_handler *handler;
|
||||
};
|
||||
|
||||
|
||||
void ui_watch_enable();
|
||||
int ui_watch_set_time_by_id(int id, int hour, int min, int sec);
|
||||
int ui_watch_set_time(struct ui_watch *watch, int hour, int min, int sec);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
48
include_lib/system/ui/ui/window.h
Normal file
48
include_lib/system/ui/ui/window.h
Normal file
@ -0,0 +1,48 @@
|
||||
#ifndef UI_WINDOW_H
|
||||
#define UI_WINDOW_H
|
||||
|
||||
|
||||
#include "ui/layer.h"
|
||||
#include "ui/ui_core.h"
|
||||
#include "ui/control.h"
|
||||
#include "list.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct window {
|
||||
struct element elm; //must be first
|
||||
u8 busy;
|
||||
u8 hide;
|
||||
u8 ctrl_num;
|
||||
struct list_head entry;
|
||||
struct layer *layer;
|
||||
const struct window_info *info;
|
||||
const struct element_event_handler *handler;
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
|
||||
extern const struct window_info *window_table;
|
||||
|
||||
|
||||
|
||||
#define REGISTER_WINDOW_EVENT_HANDLER(id) \
|
||||
REGISTER_UI_EVENT_HANDLER(id)
|
||||
|
||||
|
||||
int window_show(int);
|
||||
|
||||
int window_hide(int id);
|
||||
|
||||
int window_toggle(int id);
|
||||
|
||||
int window_ontouch(struct element_touch_event *e);
|
||||
|
||||
int window_onkey(struct element_key_event *e);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user