add a recursive flags to OtkWidget::show/hide
dont delet eshit in the style from button's destructor
This commit is contained in:
parent
cb5dfe7cfb
commit
4d1a90b0d2
3 changed files with 17 additions and 13 deletions
|
@ -20,8 +20,6 @@ OtkButton::OtkButton(OtkWidget *parent)
|
||||||
|
|
||||||
OtkButton::~OtkButton()
|
OtkButton::~OtkButton()
|
||||||
{
|
{
|
||||||
if (_pressed_focus_tx) delete _pressed_focus_tx;
|
|
||||||
if (_pressed_unfocus_tx) delete _pressed_unfocus_tx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OtkButton::press(unsigned int mouse_button)
|
void OtkButton::press(unsigned int mouse_button)
|
||||||
|
|
|
@ -147,7 +147,7 @@ void OtkWidget::setGeometry(int x, int y, int width, int height)
|
||||||
_ignore_config++;
|
_ignore_config++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OtkWidget::show(void)
|
void OtkWidget::show(bool recursive)
|
||||||
{
|
{
|
||||||
if (_visible)
|
if (_visible)
|
||||||
return;
|
return;
|
||||||
|
@ -156,22 +156,26 @@ void OtkWidget::show(void)
|
||||||
if (_dirty)
|
if (_dirty)
|
||||||
update();
|
update();
|
||||||
|
|
||||||
OtkWidgetList::iterator it = _children.begin(), end = _children.end();
|
if (recursive) {
|
||||||
for (; it != end; ++it)
|
OtkWidgetList::iterator it = _children.begin(), end = _children.end();
|
||||||
(*it)->show();
|
for (; it != end; ++it)
|
||||||
|
(*it)->show();
|
||||||
|
}
|
||||||
|
|
||||||
XMapWindow(otk::OBDisplay::display, _window);
|
XMapWindow(otk::OBDisplay::display, _window);
|
||||||
_visible = true;
|
_visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OtkWidget::hide(void)
|
void OtkWidget::hide(bool recursive)
|
||||||
{
|
{
|
||||||
if (! _visible)
|
if (! _visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
OtkWidgetList::iterator it = _children.begin(), end = _children.end();
|
if (recursive) {
|
||||||
for (; it != end; ++it)
|
OtkWidgetList::iterator it = _children.begin(), end = _children.end();
|
||||||
(*it)->hide();
|
for (; it != end; ++it)
|
||||||
|
(*it)->hide();
|
||||||
|
}
|
||||||
|
|
||||||
XUnmapWindow(otk::OBDisplay::display, _window);
|
XUnmapWindow(otk::OBDisplay::display, _window);
|
||||||
_visible = false;
|
_visible = false;
|
||||||
|
@ -227,6 +231,8 @@ void OtkWidget::ungrabKeyboard(void)
|
||||||
|
|
||||||
void OtkWidget::render(void)
|
void OtkWidget::render(void)
|
||||||
{
|
{
|
||||||
|
if (!_texture) return;
|
||||||
|
|
||||||
_bg_pixmap = _texture->render(_rect.width(), _rect.height(), _bg_pixmap);
|
_bg_pixmap = _texture->render(_rect.width(), _rect.height(), _bg_pixmap);
|
||||||
|
|
||||||
if (_bg_pixmap)
|
if (_bg_pixmap)
|
||||||
|
|
|
@ -60,8 +60,8 @@ public:
|
||||||
virtual void setGeometry(int x, int y, int width, int height);
|
virtual void setGeometry(int x, int y, int width, int height);
|
||||||
|
|
||||||
inline bool isVisible(void) const { return _visible; };
|
inline bool isVisible(void) const { return _visible; };
|
||||||
virtual void show(void);
|
virtual void show(bool recursive = false);
|
||||||
virtual void hide(void);
|
virtual void hide(bool recursive = false);
|
||||||
|
|
||||||
inline bool isFocused(void) const { return _focused; };
|
inline bool isFocused(void) const { return _focused; };
|
||||||
virtual void focus(void);
|
virtual void focus(void);
|
||||||
|
|
Loading…
Reference in a new issue