* BUG: Reparenting a container correctly keeps the visibility state of its 
  children.


git-svn-id: svn://localhost/gambas/trunk@5262 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2012-10-29 01:44:27 +00:00
parent fb2c780011
commit 1f734dfd83

View file

@ -1060,13 +1060,28 @@ bool gMainWindow::close()
return doClose(); return doClose();
} }
static void hide_hidden_children(gContainer *cont)
{
int i;
gControl *child;
for (i = 0;; i++)
{
child = cont->child(i);
if (!child)
break;
if (!child->isVisible())
gtk_widget_hide(child->border);
else if (child->isContainer())
hide_hidden_children((gContainer *)child);
}
}
void gMainWindow::reparent(gContainer *newpr, int x, int y) void gMainWindow::reparent(gContainer *newpr, int x, int y)
{ {
GtkWidget *new_border; GtkWidget *new_border;
int w, h; int w, h;
gColor fg, bg; gColor fg, bg;
int i;
gControl *child;
if (_xembed) if (_xembed)
return; return;
@ -1104,14 +1119,7 @@ void gMainWindow::reparent(gContainer *newpr, int x, int y)
gtk_widget_set_size_request(border, width(), height()); gtk_widget_set_size_request(border, width(), height());
// Hidden children are incorrectly shown. Fix that! // Hidden children are incorrectly shown. Fix that!
for (i = 0;; i++) hide_hidden_children(this);
{
child = getControl(i);
if (!child)
break;
if (!child->isVisible())
child->setVisible(false);
}
} }
else if ((!isTopLevel() && !newpr) else if ((!isTopLevel() && !newpr)
|| (isTopLevel() && isPopup())) || (isTopLevel() && isPopup()))