summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-05-26 20:23:46 +0200
committerDave Davenport <qball@gmpclient.org>2017-05-26 20:23:46 +0200
commitb73f938a826153ae6e8ebbcc9c7624f146c49d44 (patch)
tree71cf244356b5cc70d220b0def32c5e17100670c8
parentc23df70aebf9d6926303b4ddb8d099a4d285949f (diff)
Set box orientation in theme.
-rw-r--r--include/widgets/box.h4
-rw-r--r--source/widgets/box.c2
-rw-r--r--source/widgets/textbox.c10
3 files changed, 14 insertions, 2 deletions
diff --git a/include/widgets/box.h b/include/widgets/box.h
index b698e026..46d0fdb1 100644
--- a/include/widgets/box.h
+++ b/include/widgets/box.h
@@ -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;
/**
diff --git a/source/widgets/box.c b/source/widgets/box.c
index 409fa0b1..47452ad9 100644
--- a/source/widgets/box.c
+++ b/source/widgets/box.c
@@ -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;
}
diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c
index 150783a1..21a4222f 100644
--- a/source/widgets/textbox.c
+++ b/source/widgets/textbox.c
@@ -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;
}