-extern "C" {
-static void
-gtk_collpane_map_unmap_callback( GtkWidget *WXUNUSED(pane), GdkEvent *WXUNUSED(event), wxCollapsiblePane* p )
-{
+ // VERY IMPORTANT:
+ // just calling
+ // p->OnStateChange(sz);
+ // here would work work BUT:
+ // 1) in the expanded->collapsed transition it provokes a lot of flickering
+ // 2) in the collapsed->expanded transition using the "Change status" wxButton
+ // in samples/collpane application some strange warnings would be generated
+ // by the "clearlooks" theme, if that's your theme.
+ //
+ // So we prefer to use some GTK+ native optimized calls, which prevent too many resize
+ // calculations to happen. Note that the following code has been very carefully designed
+ // and tested - be VERY careful when changing it!
+
+ // 1) need to update our size hints
+ // NB: this function call won't actually do any long operation
+ // (redraw/relayout/resize) so that it's flicker-free
+ p->SetMinSize(sz);
+