summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-11-15 02:30:14 +0000
committerDana Jansens <danakj@orodu.net>2002-11-15 02:30:14 +0000
commitb3822fcfb19bfdcf775fbc6ff2f89a817d16cb4c (patch)
treed4ab5a38fb0e697c10f8e789895ef94fb6a76545
parented4696f6910047ae596a874ef3f1f85b5390aadb (diff)
make stuff draw on expose events
-rw-r--r--otk/button.cc6
-rw-r--r--otk/button.hh2
-rw-r--r--otk/otk_test.cc2
-rw-r--r--otk/widget.cc12
-rw-r--r--otk/widget.hh3
5 files changed, 21 insertions, 4 deletions
diff --git a/otk/button.cc b/otk/button.cc
index 98d57805..18838e87 100644
--- a/otk/button.cc
+++ b/otk/button.cc
@@ -57,12 +57,12 @@ void OtkButton::update(void)
OtkFocusWidget::resize(ft.measureString(_text) + bevel * 2,
ft.height() + bevel * 2);
- ft.drawString(getWindow(), bevel, bevel, *text_color, _text);
OtkFocusWidget::update();
- }
- _dirty = false;
+ ft.drawString(getWindow(), bevel, bevel, *text_color, _text);
+ } else
+ OtkFocusWidget::update();
}
}
diff --git a/otk/button.hh b/otk/button.hh
index 55a2389c..6908322e 100644
--- a/otk/button.hh
+++ b/otk/button.hh
@@ -40,7 +40,7 @@ private:
std::string _text;
//OtkPixmap _pixmap;
bool _pressed;
- bool _dirty;
+// bool _dirty;
BTexture *_pressed_focus_tx;
BTexture *_pressed_unfocus_tx;
diff --git a/otk/otk_test.cc b/otk/otk_test.cc
index 3c182b04..f36fcf99 100644
--- a/otk/otk_test.cc
+++ b/otk/otk_test.cc
@@ -59,6 +59,8 @@ int main(void) {
if (XPending(otk::OBDisplay::display)) {
XEvent e;
XNextEvent(otk::OBDisplay::display, &e);
+ if (e.type == Expose)
+ foo.expose(e.xexpose);
}
}
diff --git a/otk/widget.cc b/otk/widget.cc
index ea90a32f..aaec59b6 100644
--- a/otk/widget.cc
+++ b/otk/widget.cc
@@ -390,4 +390,16 @@ void OtkWidget::removeChild(OtkWidget *child)
_children.erase(it);
}
+void OtkWidget::expose(const XExposeEvent &e)
+{
+ if (e.window == _window) {
+ _dirty = true;
+ update();
+ } else {
+ OtkWidgetList::iterator it = _children.begin(), end = _children.end();
+ for (; it != end; ++it)
+ (*it)->expose(e);
+ }
+}
+
}
diff --git a/otk/widget.hh b/otk/widget.hh
index 85eefe79..1651a507 100644
--- a/otk/widget.hh
+++ b/otk/widget.hh
@@ -27,6 +27,8 @@ public:
virtual void update(void);
+ void expose(const XExposeEvent &e);
+
inline Window getWindow(void) const { return _window; }
inline const OtkWidget *getParent(void) const { return _parent; }
inline const OtkWidgetList &getChildren(void) const { return _children; }
@@ -124,6 +126,7 @@ private:
bool _fixed_width;
bool _fixed_height;
+protected:
bool _dirty;
};