summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-11-16 13:28:26 +0000
committerDana Jansens <danakj@orodu.net>2002-11-16 13:28:26 +0000
commit77342413efd183bd1c0681a57b68acc836022923 (patch)
treec60d7f5512a415259f516d4161846f27170e73dd
parentd4d15160fe81353a9f7958c1feb1821abe179a70 (diff)
change how the widgets' _dirty flag works so that all inheritence levels of the widget class can use it
-rw-r--r--otk/focuslabel.cc17
-rw-r--r--otk/focuslabel.hh3
-rw-r--r--otk/label.cc17
-rw-r--r--otk/label.hh3
-rw-r--r--otk/widget.cc37
-rw-r--r--otk/widget.hh6
6 files changed, 23 insertions, 60 deletions
diff --git a/otk/focuslabel.cc b/otk/focuslabel.cc
index ea5ecfc2..ea4e9ca2 100644
--- a/otk/focuslabel.cc
+++ b/otk/focuslabel.cc
@@ -3,7 +3,7 @@
namespace otk {
OtkFocusLabel::OtkFocusLabel(OtkWidget *parent)
- : OtkFocusWidget(parent), _text(""), _dirty(false)
+ : OtkFocusWidget(parent), _text("")
{
setTexture(getStyle()->getLabelFocus());
setUnfocusTexture(getStyle()->getLabelUnfocus());
@@ -55,21 +55,6 @@ void OtkFocusLabel::update(void)
ft.drawString(getWindow(), x, bevel, *text_color, t);
} else
OtkFocusWidget::update();
-
- _dirty = false;
-}
-
-int OtkFocusLabel::exposeHandler(const XExposeEvent &e)
-{
- _dirty = true;
- return OtkFocusWidget::exposeHandler(e);
-}
-
-int OtkFocusLabel::configureHandler(const XConfigureEvent &e)
-{
- if (!(e.width == width() && e.height == height()))
- _dirty = true;
- return OtkFocusWidget::configureHandler(e);
}
}
diff --git a/otk/focuslabel.hh b/otk/focuslabel.hh
index ea21710a..c15876fe 100644
--- a/otk/focuslabel.hh
+++ b/otk/focuslabel.hh
@@ -16,13 +16,10 @@ public:
void setText(const std::string &text) { _text = text; _dirty = true; }
void update(void);
- int exposeHandler(const XExposeEvent &e);
- int configureHandler(const XConfigureEvent &e);
private:
std::string _text;
- bool _dirty;
};
}
diff --git a/otk/label.cc b/otk/label.cc
index 5f2b22ee..40a85bb3 100644
--- a/otk/label.cc
+++ b/otk/label.cc
@@ -3,7 +3,7 @@
namespace otk {
OtkLabel::OtkLabel(OtkWidget *parent)
- : OtkWidget(parent), _text(""), _dirty(false)
+ : OtkWidget(parent), _text("")
{
setTexture(getStyle()->getLabelUnfocus());
}
@@ -52,21 +52,6 @@ void OtkLabel::update(void)
ft.drawString(getWindow(), x, bevel, *getStyle()->getTextUnfocus(), t);
} else
OtkWidget::update();
-
- _dirty = false;
-}
-
-int OtkLabel::exposeHandler(const XExposeEvent &e)
-{
- _dirty = true;
- return OtkWidget::exposeHandler(e);
-}
-
-int OtkLabel::configureHandler(const XConfigureEvent &e)
-{
- if (!(e.width == width() && e.height == height()))
- _dirty = true;
- return OtkWidget::configureHandler(e);
}
}
diff --git a/otk/label.hh b/otk/label.hh
index 3bf397a6..7cfa23bf 100644
--- a/otk/label.hh
+++ b/otk/label.hh
@@ -16,13 +16,10 @@ public:
void setText(const std::string &text) { _text = text; _dirty = true; }
void update(void);
- int exposeHandler(const XExposeEvent &e);
- int configureHandler(const XConfigureEvent &e);
private:
std::string _text;
- bool _dirty;
};
}
diff --git a/otk/widget.cc b/otk/widget.cc
index 85b4206e..9ae25cfc 100644
--- a/otk/widget.cc
+++ b/otk/widget.cc
@@ -10,6 +10,7 @@ namespace otk {
OtkWidget::OtkWidget(OtkWidget *parent, Direction direction)
: OtkEventHandler(),
+ _dirty(false),
_parent(parent), _style(parent->getStyle()), _direction(direction),
_cursor(parent->getCursor()), _bevel_width(parent->getBevelWidth()),
_ignore_config(0),
@@ -17,7 +18,7 @@ OtkWidget::OtkWidget(OtkWidget *parent, Direction direction)
_grabbed_keyboard(false), _stretchable_vert(false),
_stretchable_horz(false), _texture(0), _bg_pixmap(0), _bg_pixel(0),
_screen(parent->getScreen()), _fixed_width(false), _fixed_height(false),
- _dirty(false), _event_dispatcher(parent->getEventDispatcher())
+ _event_dispatcher(parent->getEventDispatcher())
{
parent->addChild(this);
create();
@@ -27,12 +28,13 @@ OtkWidget::OtkWidget(OtkWidget *parent, Direction direction)
OtkWidget::OtkWidget(OtkApplication *app, Direction direction,
Cursor cursor, int bevel_width)
: OtkEventHandler(),
+ _dirty(false),
_parent(0), _style(app->getStyle()), _direction(direction), _cursor(cursor),
_bevel_width(bevel_width), _ignore_config(0), _visible(false),
_focused(false), _grabbed_mouse(false), _grabbed_keyboard(false),
_stretchable_vert(false), _stretchable_horz(false), _texture(0),
_bg_pixmap(0), _bg_pixel(0), _screen(app->getStyle()->getScreen()),
- _fixed_width(false), _fixed_height(false), _dirty(false),
+ _fixed_width(false), _fixed_height(false),
_event_dispatcher(app)
{
assert(app);
@@ -43,12 +45,13 @@ OtkWidget::OtkWidget(OtkApplication *app, Direction direction,
OtkWidget::OtkWidget(Style *style, Direction direction,
Cursor cursor, int bevel_width)
: OtkEventHandler(),
+ _dirty(false),
_parent(0), _style(style), _direction(direction), _cursor(cursor),
_bevel_width(bevel_width), _ignore_config(0), _visible(false),
_focused(false), _grabbed_mouse(false), _grabbed_keyboard(false),
_stretchable_vert(false), _stretchable_horz(false), _texture(0),
_bg_pixmap(0), _bg_pixel(0), _screen(style->getScreen()),
- _fixed_width(false), _fixed_height(false), _dirty(false)
+ _fixed_width(false), _fixed_height(false)
{
assert(style);
create();
@@ -426,31 +429,25 @@ void OtkWidget::setEventDispatcher(OtkEventDispatcher *disp)
int OtkWidget::exposeHandler(const XExposeEvent &e)
{
OtkEventHandler::exposeHandler(e);
- if (e.window == _window) {
- _dirty = true;
- update();
- return true;
- }
- return false;
+ _dirty = true;
+ update();
+ return true;
}
int OtkWidget::configureHandler(const XConfigureEvent &e)
{
OtkEventHandler::configureHandler(e);
- if (e.window == _window) {
- if (_ignore_config) {
- _ignore_config--;
- } else {
- if (!(e.width == _rect.width() && e.height == _rect.height())) {
- _dirty = true;
- _rect.setSize(e.width, e.height);
- }
- update();
+ if (_ignore_config) {
+ _ignore_config--;
+ } else {
+ if (!(e.width == _rect.width() && e.height == _rect.height())) {
+ _dirty = true;
+ _rect.setSize(e.width, e.height);
}
- return true;
+ update();
}
- return false;
+ return true;
}
}
diff --git a/otk/widget.hh b/otk/widget.hh
index a8787754..fb3b1e37 100644
--- a/otk/widget.hh
+++ b/otk/widget.hh
@@ -100,6 +100,10 @@ public:
{ return _event_dispatcher; }
void setEventDispatcher(OtkEventDispatcher *disp);
+protected:
+
+ bool _dirty;
+
private:
void create(void);
@@ -139,8 +143,6 @@ private:
bool _fixed_width;
bool _fixed_height;
- bool _dirty;
-
OtkEventDispatcher *_event_dispatcher;
};