diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/glwidgets.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/glwidgets.cc b/lib/glwidgets.cc index 56b8e2f..0ac5f8b 100644 --- a/lib/glwidgets.cc +++ b/lib/glwidgets.cc @@ -11,19 +11,24 @@ #define _(x) x #endif -mogltk::widget::widget() { -} +mogltk::widget * mogltk::widget::cur_root = 0; mogltk::widget::widget(widget * _father, int _x, int _y, int _sx, int _sy) throw (GeneralException) : x(_x), y(_y), sx(_sx), sy(_sy), father(_father) { + if (!father) - throw GeneralException(_("No father. Only root can be adam.")); + father = cur_root; - next = father->child; + if (father) { + next = father->child; + father->child = this; + root = father->root; + } else { + next = 0; + cur_root = root = this; + } prev = 0; - father->child = this; child = 0; - root = father->root; } mogltk::widget::~widget() { |