summaryrefslogtreecommitdiff
path: root/dw/layout.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2014-05-31 15:24:26 +0200
committerSebastian Geerken <devnull@localhost>2014-05-31 15:24:26 +0200
commitd83eece3ba060818a608031ee1c5de94f3959ae8 (patch)
treebb01547baf586fcf0e62cecd9e8606f992fbbde5 /dw/layout.cc
parente76a9bbaa581357aa770d58b80ca15e270bf0e4b (diff)
GROWS: First work on how to handle viewport changes.
Diffstat (limited to 'dw/layout.cc')
-rw-r--r--dw/layout.cc30
1 files changed, 28 insertions, 2 deletions
diff --git a/dw/layout.cc b/dw/layout.cc
index 49f65b96..b9c6ff98 100644
--- a/dw/layout.cc
+++ b/dw/layout.cc
@@ -926,7 +926,8 @@ void Layout::resizeIdle ()
canvasHeightGreater = true;
DBG_OBJ_SET_SYM ("canvasHeightGreater",
canvasHeightGreater ? "true" : "false");
- // TODO tell widget about change.
+ assert (topLevel); // No toplevel widget would have no size.
+ containerSizeChanged (topLevel);
}
// Set viewport sizes.
@@ -1295,7 +1296,32 @@ void Layout::viewportSizeChanged (View *view, int width, int height)
DBG_OBJ_SET_NUM ("viewportWidth", viewportWidth);
DBG_OBJ_SET_NUM ("viewportHeight", viewportHeight);
- // TODO tell widget about change.
+ if (topLevel)
+ containerSizeChanged (topLevel);
+}
+
+bool Layout::widgetAffectedByContainerSizeChange (Widget *widget)
+{
+ return true; // TODO only absolute dimensions? Depending on widget class?
+}
+
+void Layout::containerSizeChanged (Widget *widget)
+{
+ if (widgetAffectedByContainerSizeChange (widget)) {
+ widget->queueResize (0, false);
+
+ // TODO Wrong! Iteration must stop when the *container* (not the
+ // *parent*!) is unaffected. (Does not matter as long as
+ // widgetAffectedByContainerSizeChange() returns always true.)
+
+ Iterator *it =
+ widget->iterator ((Content::Type)
+ (Content::WIDGET_IN_FLOW | Content::WIDGET_OOF_CONT),
+ false);
+ while (it->next ())
+ containerSizeChanged (it->getContent()->widget);
+ it->unref ();
+ }
}
} // namespace core