Fix extra wxEVT_COLLAPSIBLEPANE_CHANGED with wxCP_NO_TLW_RESIZE
A pane using wxCP_NO_TLW_RESIZE would generate wxCollapsiblePaneEvent even when toggled from a program because the GTK+ callback didn't take m_bIgnoreNextChange flag into account in this case. Fix this and also avoid duplicating the code for sending the event.
This commit is contained in:
@@ -99,40 +99,33 @@ gtk_collapsiblepane_expanded_callback(GObject * WXUNUSED(object),
|
|||||||
// (redraw/relayout/resize) so that it's flicker-free
|
// (redraw/relayout/resize) so that it's flicker-free
|
||||||
p->SetMinSize(sz);
|
p->SetMinSize(sz);
|
||||||
|
|
||||||
if (p->HasFlag(wxCP_NO_TLW_RESIZE))
|
if (!p->HasFlag(wxCP_NO_TLW_RESIZE))
|
||||||
{
|
{
|
||||||
// fire an event
|
wxTopLevelWindow *
|
||||||
wxCollapsiblePaneEvent ev(p, p->GetId(), p->IsCollapsed());
|
top = wxDynamicCast(wxGetTopLevelParent(p), wxTopLevelWindow);
|
||||||
p->HandleWindowEvent(ev);
|
if ( top && top->GetSizer() )
|
||||||
|
|
||||||
// the user asked to explicitly handle the resizing itself...
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxTopLevelWindow *
|
|
||||||
top = wxDynamicCast(wxGetTopLevelParent(p), wxTopLevelWindow);
|
|
||||||
if ( top && top->GetSizer() )
|
|
||||||
{
|
|
||||||
// 2) recalculate minimal size of the top window
|
|
||||||
sz = top->GetSizer()->CalcMin();
|
|
||||||
|
|
||||||
if (top->m_mainWidget)
|
|
||||||
{
|
{
|
||||||
// 3) MAGIC HACK: if you ever used GtkExpander in a GTK+ program
|
// 2) recalculate minimal size of the top window
|
||||||
// you know that this magic call is required to make it possible
|
sz = top->GetSizer()->CalcMin();
|
||||||
// to shrink the top level window in the expanded->collapsed
|
|
||||||
// transition. This may be sometimes undesired but *is*
|
|
||||||
// necessary and if you look carefully, all GTK+ programs using
|
|
||||||
// GtkExpander perform this trick (e.g. the standard "open file"
|
|
||||||
// dialog of GTK+>=2.4 is not resizable when the expander is
|
|
||||||
// collapsed!)
|
|
||||||
gtk_window_set_resizable (GTK_WINDOW (top->m_widget), p->IsExpanded());
|
|
||||||
|
|
||||||
// 4) set size hints
|
if (top->m_mainWidget)
|
||||||
top->SetMinClientSize(sz);
|
{
|
||||||
|
// 3) MAGIC HACK: if you ever used GtkExpander in a GTK+ program
|
||||||
|
// you know that this magic call is required to make it possible
|
||||||
|
// to shrink the top level window in the expanded->collapsed
|
||||||
|
// transition. This may be sometimes undesired but *is*
|
||||||
|
// necessary and if you look carefully, all GTK+ programs using
|
||||||
|
// GtkExpander perform this trick (e.g. the standard "open file"
|
||||||
|
// dialog of GTK+>=2.4 is not resizable when the expander is
|
||||||
|
// collapsed!)
|
||||||
|
gtk_window_set_resizable (GTK_WINDOW (top->m_widget), p->IsExpanded());
|
||||||
|
|
||||||
// 5) set size
|
// 4) set size hints
|
||||||
top->SetClientSize(sz);
|
top->SetMinClientSize(sz);
|
||||||
|
|
||||||
|
// 5) set size
|
||||||
|
top->SetClientSize(sz);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user