aboutsummaryrefslogtreecommitdiff
path: root/dw/widget.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2013-08-16 18:17:47 +0200
committerSebastian Geerken <devnull@localhost>2013-08-16 18:17:47 +0200
commita5e77bdac14a79d6c8a09a6db8f1a2307b1537f3 (patch)
treec00e1260cd8328e35295afe30e0ae451d3b7a8a0 /dw/widget.cc
parent183e15f49625b3a15a9b2e511970c988d7164c23 (diff)
Fixed a bug in DeepIterator (level calculation should regard generators).
Diffstat (limited to 'dw/widget.cc')
-rw-r--r--dw/widget.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/dw/widget.cc b/dw/widget.cc
index 42566a17..f5bca367 100644
--- a/dw/widget.cc
+++ b/dw/widget.cc
@@ -478,6 +478,25 @@ int Widget::getLevel ()
}
/**
+ * \brief Get the level of the widget within the tree, regarting the
+ * generators, not the parents.
+ *
+ * The root widget has the level 0.
+ */
+int Widget::getGeneratorLevel ()
+{
+ Widget *widget = this;
+ int level = 0;
+
+ while (widget->getGenerator ()) {
+ level++;
+ widget = widget->getGenerator ();
+ }
+
+ return level;
+}
+
+/**
* \brief Get the widget with the highest level, which is a direct ancestor of
* widget1 and widget2.
*/