diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-09-07 08:52:30 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-09-07 08:52:30 +0200 |
commit | 72f050e2fc2f7fdc2565100b6e1c0ddc10910c53 (patch) | |
tree | 412cb492ed924a9a1599fed068567a1fe8b37a44 /source/widgets/textbox.c | |
parent | d4bf5ad02081038da3247c5833bfa6aaf8010ade (diff) |
Move enabled into widget.
Diffstat (limited to 'source/widgets/textbox.c')
-rw-r--r-- | source/widgets/textbox.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index 57856b1c..2df91c7f 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -130,26 +130,8 @@ static WidgetTriggerActionResult textbox_editable_trigger_action ( widget *wid, return WIDGET_TRIGGER_ACTION_RESULT_IGNORED; } -textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags, TextBoxFontType tbft, const char *text, double xalign, double yalign ) +static void textbox_initialize_font ( textbox *tb ) { - textbox *tb = g_slice_new0 ( textbox ); - - widget_init ( WIDGET ( tb ), type, name ); - - tb->widget.draw = textbox_draw; - tb->widget.free = textbox_free; - tb->widget.resize = textbox_resize; - tb->widget.get_width = textbox_get_width; - tb->widget.get_height = _textbox_get_height; - tb->widget.get_desired_height = textbox_get_desired_height; - tb->widget.get_desired_width = textbox_get_desired_width; - tb->flags = flags; - - tb->changed = FALSE; - - tb->layout = pango_layout_new ( p_context ); - textbox_font ( tb, tbft ); - tb->metrics = p_metrics; const char * font = rofi_theme_get_string ( WIDGET ( tb ), "font", NULL ); tb->left_offset = textbox_get_estimated_char_height (); @@ -178,6 +160,31 @@ textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags, tb->left_offset = ( tbfc->height ) / (double) PANGO_SCALE; } } +} + +textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags, TextBoxFontType tbft, const char *text, double xalign, double yalign ) +{ + textbox *tb = g_slice_new0 ( textbox ); + + widget_init ( WIDGET ( tb ), type, name ); + + tb->widget.draw = textbox_draw; + tb->widget.free = textbox_free; + tb->widget.resize = textbox_resize; + tb->widget.get_width = textbox_get_width; + tb->widget.get_height = _textbox_get_height; + tb->widget.get_desired_height = textbox_get_desired_height; + tb->widget.get_desired_width = textbox_get_desired_width; + tb->flags = flags; + + tb->changed = FALSE; + + tb->layout = pango_layout_new ( p_context ); + textbox_font ( tb, tbft ); + + + textbox_initialize_font ( tb ); + if ( ( tb->flags & TB_ICON ) != TB_ICON ) { tb->left_offset = 0; } @@ -204,8 +211,6 @@ textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags, tb->yalign = MAX ( 0, MIN ( 1.0, tb->yalign ) ); tb->xalign = rofi_theme_get_double ( WIDGET ( tb ), "horizontal-align", yalign ); tb->xalign = MAX ( 0, MIN ( 1.0, tb->xalign ) ); - // Enabled by default - tb->widget.enabled = rofi_theme_get_boolean ( WIDGET ( tb ), "enabled", TRUE ); return tb; } |