aboutsummaryrefslogtreecommitdiff
path: root/src/layout.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2012-08-12 17:40:20 +0200
committerThomas White <taw@bitwiz.org.uk>2012-08-12 17:40:20 +0200
commit2fd37a95bd5fe109a62917eca483b36a18a74777 (patch)
tree0864a76938670d7b2740eaa9b8da281670ecd0d8 /src/layout.c
parent6d0e78aadcf111cfd82cc8762ebd43c10c7923ae (diff)
The style mechanism
Diffstat (limited to 'src/layout.c')
-rw-r--r--src/layout.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/layout.c b/src/layout.c
index c111e18..a257112 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -27,11 +27,22 @@
#include <assert.h>
#include <stdlib.h>
+#include <string.h>
#include "presentation.h"
#include "layout.h"
+#include "stylesheet.h"
-void layout_frame(struct frame *fr, double w, double h)
+
+static void copy_lop_from_style(struct frame *fr, struct style *style)
+{
+ if ( style == NULL ) return; /* Not dictated by style sheet */
+
+ memcpy(&fr->lop, &style->lop, sizeof(struct layout_parameters));
+}
+
+
+static void layout_subframe(struct frame *fr, double w, double h)
{
int i;
@@ -47,6 +58,8 @@ void layout_frame(struct frame *fr, double w, double h)
if ( child == fr ) continue;
+ copy_lop_from_style(child, child->style);
+
child->offs_x = child->lop.margin_l + fr->lop.pad_l;
child->offs_y = child->lop.margin_t + fr->lop.pad_r;
child_w = w - (child->lop.margin_l + child->lop.margin_r);
@@ -54,8 +67,14 @@ void layout_frame(struct frame *fr, double w, double h)
child_w -= (fr->lop.pad_l + fr->lop.pad_r);
child_h -= (fr->lop.pad_t + fr->lop.pad_b);
- layout_frame(child, child_w, child_h);
+ layout_subframe(child, child_w, child_h);
}
}
+
+void layout_frame(struct frame *fr, double w, double h)
+{
+ copy_lop_from_style(fr, fr->style);
+ layout_subframe(fr, w, h);
+}