Exemple #1
0
/**
 * @brief 用tab全局样式对象初始化tab对象
 *
 * @param style tab样式对象指针
 * @param b tab指针
 *
 * @return 成功返回0,否则返回-1
 **/
static si_t tab_init_with_default_style(struct tab * b)
{
    char *config_path = get_config_path("tab.cfg");

    si_t res = widget_init_with_default_style(config_path,
            WIDGET_POINTER(b), &tab_default_style.common,
            NULL, 0);
    free(config_path);

    return res;
}
Exemple #2
0
/**
 * @brief 用panel全局样式对象初始化panel对象
 *
 * @param style panel样式对象指针
 * @param p panel指针
 *
 * @return 成功返回0,否则返回-1
 **/
static si_t panel_init_with_default_style(struct panel * p)
{
    char *config_path = get_config_path("panel.cfg");

    si_t res = widget_init_with_default_style(config_path,
            WIDGET_POINTER(p), &panel_default_style.common,
            NULL, 0);
    free(config_path);

    return res;
}
Exemple #3
0
 *
 * @return 成功返回0,否则返回-1
 **/

static si_t button_init_with_default_style(struct button * b)
{
    char tmp_str[TMP_ARRAY_SIZE] = {'\0'};
    si_t tmp_int;
    struct widget_style_entry extra[] = {
        {.key="font", .type=WIDGET_STYLE_TYPE_STR, .val=tmp_str},
    };
    char *config_path = get_config_path("button.cfg");

    /* warnings are expected when no configuration file is available */
    si_t res = widget_init_with_default_style(config_path,
            WIDGET_POINTER(b), &button_default_style.common,
            extra, sizeof(extra)/sizeof(extra[0]));
    free(config_path);

    if((tmp_int = get_font_enum_from_str(tmp_str)) >= 0) {
        button_default_style.font = tmp_int;
    }

    b->font = button_default_style.font;

    return res;
}

static si_t button_default_widget_show(struct button * b, union message * msg)
{
    struct rectangle area;
Exemple #4
0
    char *config_path = get_config_path("text_line.cfg");
    struct widget_style_entry extra[] = {
        {.key="frame_color_r", .type=WIDGET_STYLE_TYPE_INT,
            .val=&(text_line_default_style.frame_color_r)},
        {.key="frame_color_g", .type=WIDGET_STYLE_TYPE_INT,
            .val=&(text_line_default_style.frame_color_g)},
        {.key="frame_color_b", .type=WIDGET_STYLE_TYPE_INT,
            .val=&(text_line_default_style.frame_color_b)},
        {.key="frame_color_a", .type=WIDGET_STYLE_TYPE_INT,
            .val=&(text_line_default_style.frame_color_a)},
        {.key="font", .type=WIDGET_STYLE_TYPE_STR,
            .val=&(text_line_default_style.font)},
    };

    si_t res = widget_init_with_default_style(config_path,
            WIDGET_POINTER(tl), &text_line_default_style.common,
            extra, sizeof(extra)/sizeof(extra[0]));
    free(config_path);

    if((tmp_int = get_font_enum_from_str(tmp_str)) >= 0) {
        text_line_default_style.font = tmp_int;
    }

    tl->frame_color.r = text_line_default_style.frame_color_r;
    tl->frame_color.g = text_line_default_style.frame_color_g;
    tl->frame_color.b = text_line_default_style.frame_color_b;
    tl->frame_color.a = text_line_default_style.frame_color_a;

    tl->font = text_line_default_style.font;

    return res;