Ejemplo n.º 1
0
void textbutton_set_border(component *c, color col) {
    textbutton *tb = c->obj;
    tb->border_enabled = 1;
    tb->border_color = col;
    if(tb->border_created) {
        // destroy the old border first
        surface_free(&tb->border);
    }

    // create new border
    int chars = strlen(tb->text);
    int width = chars*tb->font->w;
    menu_background_border_create(&tb->border, width+6, tb->font->h+3);
    tb->border_created = 1;
}
Ejemplo n.º 2
0
void textbutton_set_border(component *c, color col) {
    textbutton *tb = widget_get_obj(c);
    tb->border_enabled = 1;
    tb->border_color = col;
    if(tb->border_created) {
        // destroy the old border first
        surface_free(&tb->border);
    }

    // create new border
    int chars = strlen(tb->text);
    int fsize = text_char_width(&tb->tconf);
    int width = chars * fsize;
    menu_background_border_create(&tb->border, width+6, fsize+3);
    tb->border_created = 1;
}