mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 20:18:22 +08:00
add new style id
This commit is contained in:
parent
680a22a3fb
commit
61ce4ebddf
@ -115,6 +115,7 @@ ret_t edit_on_paint_self(widget_t* widget, canvas_t* c) {
|
||||
edit_t* edit = EDIT(widget);
|
||||
style_t* style = widget->astyle;
|
||||
wchar_t temp_str[TEMP_STR_LEN + 1];
|
||||
color_t trans = color_init(0, 0, 0, 0);
|
||||
uint8_t left_margin = edit->left_margin;
|
||||
uint8_t right_margin = edit->right_margin;
|
||||
uint8_t top_margin = edit->top_margin;
|
||||
@ -122,7 +123,14 @@ ret_t edit_on_paint_self(widget_t* widget, canvas_t* c) {
|
||||
wh_t w = widget->w - left_margin - right_margin;
|
||||
wh_t h = widget->h - top_margin - bottom_margin;
|
||||
align_h_t align_h = (align_h_t)style_get_int(style, STYLE_ID_TEXT_ALIGN_H, ALIGN_H_CENTER);
|
||||
/*
|
||||
color_t selected_bg = style_get_color(style, STYLE_ID_SELECTED_FG_COLOR, trans);
|
||||
color_t selected_fg = style_get_color(style, STYLE_ID_SELECTED_BG_COLOR, trans);
|
||||
color_t selected_tc = style_get_color(style, STYLE_ID_SELECTED_TEXT_COLOR, trans);
|
||||
|
||||
log_debug("selected_bg=0x%08X selected_fg=%08X selected_tc=%08X\n",
|
||||
selected_bg.color, selected_fg.color, selected_tc.color);
|
||||
*/
|
||||
memset(temp_str, 0x00, sizeof(temp_str));
|
||||
return_value_if_fail(widget_prepare_text_style(widget, c) == RET_OK, RET_FAIL);
|
||||
return_value_if_fail(edit_get_display_text(widget, c, &text, temp_str) == RET_OK, RET_FAIL);
|
||||
|
@ -46,7 +46,11 @@ static const key_type_value_t style_id_name_value[] = {
|
||||
{"icon_at", TYPE_STRING, STYLE_ID_ICON_AT},
|
||||
{"x_offset", TYPE_INT, STYLE_ID_X_OFFSET},
|
||||
{"y_offset", TYPE_INT, STYLE_ID_Y_OFFSET},
|
||||
{"margin", TYPE_INT, STYLE_ID_MARGIN}};
|
||||
{"margin", TYPE_INT, STYLE_ID_MARGIN},
|
||||
{"selected_bg_color", TYPE_COLOR, STYLE_ID_SELECTED_BG_COLOR},
|
||||
{"selected_fg_color", TYPE_COLOR, STYLE_ID_SELECTED_FG_COLOR},
|
||||
{"selected_text_color", TYPE_COLOR, STYLE_ID_SELECTED_TEXT_COLOR},
|
||||
};
|
||||
|
||||
static const key_type_value_t widget_state_name_value[] = {
|
||||
{"normal", 0, WIDGET_STATE_NORMAL},
|
||||
|
@ -39,7 +39,7 @@ typedef enum _style_id_t {
|
||||
*/
|
||||
STYLE_ID_BG_COLOR = 1,
|
||||
/**
|
||||
* @const STYLE_ID_BG_COLOR
|
||||
* @const STYLE_ID_FG_COLOR
|
||||
* 前景颜色。
|
||||
*/
|
||||
STYLE_ID_FG_COLOR,
|
||||
@ -137,7 +137,22 @@ typedef enum _style_id_t {
|
||||
* @const STYLE_ID_Y_OFFSET
|
||||
* Y方向的偏移,方便实现按下的效果。
|
||||
*/
|
||||
STYLE_ID_Y_OFFSET
|
||||
STYLE_ID_Y_OFFSET,
|
||||
/**
|
||||
* @const STYLE_ID_SELECTED_BG_COLOR
|
||||
* 编辑器中选中区域的背景颜色。
|
||||
*/
|
||||
STYLE_ID_SELECTED_BG_COLOR,
|
||||
/**
|
||||
* @const STYLE_ID_SELECTED_FG_COLOR
|
||||
* 编辑器中选中区域的前景颜色。
|
||||
*/
|
||||
STYLE_ID_SELECTED_FG_COLOR,
|
||||
/**
|
||||
* @const STYLE_ID_SELECTED_TEXT_COLOR
|
||||
* 编辑器中选中区域的文本颜色。
|
||||
*/
|
||||
STYLE_ID_SELECTED_TEXT_COLOR,
|
||||
} style_id_t;
|
||||
|
||||
struct _style_t;
|
||||
|
Loading…
Reference in New Issue
Block a user