summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/glwidgets.h4
-rw-r--r--lib/glwidgets.cc17
2 files changed, 13 insertions, 8 deletions
diff --git a/include/glwidgets.h b/include/glwidgets.h
index 1894924..0ee9cea 100644
--- a/include/glwidgets.h
+++ b/include/glwidgets.h
@@ -6,14 +6,14 @@
namespace mogltk {
class widget : public Base {
public:
- widget();
virtual ~widget();
+ bool PointerEvent(int x, int y);
protected:
widget(widget * father, int x, int y, int sx, int sy) throw (GeneralException);
private:
int x, y, sx, sy;
widget * father, * next, * prev, * child, * root;
- static widget * cur_father;
+ static widget * cur_root, * focused;
};
};
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() {