Set box orientation in theme.

This commit is contained in:
Dave Davenport 2017-05-26 20:23:46 +02:00
parent c23df70aeb
commit b73f938a82
3 changed files with 14 additions and 2 deletions

View File

@ -53,9 +53,9 @@ typedef struct _box box;
typedef enum
{
/** Pack widgets horizontal */
BOX_HORIZONTAL,
BOX_HORIZONTAL = 0,
/** Pack widgets vertical */
BOX_VERTICAL
BOX_VERTICAL = 1
} boxType;
/**

View File

@ -327,6 +327,8 @@ box * box_create ( const char *name, boxType type )
b->widget.get_desired_height = box_get_desired_height;
b->widget.enabled = rofi_theme_get_boolean ( WIDGET ( b ), "enabled", TRUE );
b->type = rofi_theme_get_boolean ( WIDGET (b), "vertical",b->type );
b->spacing = rofi_theme_get_distance ( WIDGET ( b ), "spacing", DEFAULT_SPACING );
return b;
}

View File

@ -169,6 +169,16 @@ textbox* textbox_create ( const char *name, TextboxFlags flags, TextBoxFontType
tb->yalign = MAX ( 0, MIN ( 1.0, tb->yalign));
// Enabled by default
tb->widget.enabled = rofi_theme_get_boolean ( WIDGET ( tb ), "enabled", TRUE );
Distance w = rofi_theme_get_distance ( WIDGET ( tb ), "width", 0 );
int wi = distance_get_pixel ( w, ORIENTATION_HORIZONTAL );
if ( wi > 0 )
{
printf("set width: %d\n", wi);
tb->widget.w = wi;
textbox_moveresize ( tb, tb->widget.x, tb->widget.y, tb->widget.w, tb->widget.h );
}
return tb;
}