Added intermediate state (m_showOnIdle) indicating that
time must be given to a window to get placed correctly before it is shown. The avoids jumping windows. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40745 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -117,9 +117,6 @@ public:
|
|||||||
|
|
||||||
virtual WXWidget GetHandle() const { return m_widget; }
|
virtual WXWidget GetHandle() const { return m_widget; }
|
||||||
|
|
||||||
// I don't want users to override what's done in idle so everything that
|
|
||||||
// has to be done in idle time in order for wxGTK to work is done in
|
|
||||||
// OnInternalIdle
|
|
||||||
virtual void OnInternalIdle();
|
virtual void OnInternalIdle();
|
||||||
|
|
||||||
// Internal represention of Update()
|
// Internal represention of Update()
|
||||||
@@ -179,6 +176,12 @@ public:
|
|||||||
// the layouting functions have to be called later on
|
// the layouting functions have to be called later on
|
||||||
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
||||||
void GtkUpdateSize() { m_sizeSet = false; }
|
void GtkUpdateSize() { m_sizeSet = false; }
|
||||||
|
|
||||||
|
|
||||||
|
// Called when a window should delay showing itself
|
||||||
|
// until idle time. This partly mimmicks defered
|
||||||
|
// sizing under MSW.
|
||||||
|
void GtkShowOnIdle() { m_showOnIdle = true; }
|
||||||
|
|
||||||
// fix up the mouse event coords, used by wxListBox only so far
|
// fix up the mouse event coords, used by wxListBox only so far
|
||||||
virtual void FixUpMouseEvent(GtkWidget * WXUNUSED(widget),
|
virtual void FixUpMouseEvent(GtkWidget * WXUNUSED(widget),
|
||||||
@@ -260,6 +263,8 @@ public:
|
|||||||
// background style until OnIdle
|
// background style until OnIdle
|
||||||
bool m_mouseButtonDown:1;
|
bool m_mouseButtonDown:1;
|
||||||
bool m_blockScrollEvent:1;
|
bool m_blockScrollEvent:1;
|
||||||
|
|
||||||
|
bool m_showOnIdle:1; // postpone showing the window until idle
|
||||||
|
|
||||||
// C++ has no virtual methods in the constrcutor of any class but we need
|
// C++ has no virtual methods in the constrcutor of any class but we need
|
||||||
// different methods of inserting a child window into a wxFrame,
|
// different methods of inserting a child window into a wxFrame,
|
||||||
|
@@ -2457,6 +2457,8 @@ void wxWindowGTK::Init()
|
|||||||
m_hasVMT = false;
|
m_hasVMT = false;
|
||||||
m_needParent = true;
|
m_needParent = true;
|
||||||
m_isBeingDeleted = false;
|
m_isBeingDeleted = false;
|
||||||
|
|
||||||
|
m_showOnIdle= false;
|
||||||
|
|
||||||
m_noExpose = false;
|
m_noExpose = false;
|
||||||
m_nativeSizeEvent = false;
|
m_nativeSizeEvent = false;
|
||||||
@@ -2973,6 +2975,21 @@ void wxWindowGTK::OnInternalIdle()
|
|||||||
m_needsStyleChange = false;
|
m_needsStyleChange = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsShown() && m_showOnIdle && !GTK_WIDGET_VISIBLE (m_widget))
|
||||||
|
{
|
||||||
|
GtkAllocation alloc;
|
||||||
|
alloc.x = m_x;
|
||||||
|
alloc.y = m_y;
|
||||||
|
alloc.width = m_width;
|
||||||
|
alloc.height = m_height;
|
||||||
|
gtk_widget_size_allocate( m_widget, &alloc );
|
||||||
|
gtk_widget_show( m_widget );
|
||||||
|
wxShowEvent eventShow(GetId(), true);
|
||||||
|
eventShow.SetEventObject(this);
|
||||||
|
GetEventHandler()->ProcessEvent(eventShow);
|
||||||
|
m_showOnIdle = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Update invalidated regions.
|
// Update invalidated regions.
|
||||||
GtkUpdate();
|
GtkUpdate();
|
||||||
|
|
||||||
@@ -3182,14 +3199,22 @@ bool wxWindowGTK::Show( bool show )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (show)
|
if (show)
|
||||||
gtk_widget_show( m_widget );
|
{
|
||||||
|
if (!m_showOnIdle)
|
||||||
|
{
|
||||||
|
gtk_widget_show( m_widget );
|
||||||
|
wxShowEvent eventShow(GetId(), show);
|
||||||
|
eventShow.SetEventObject(this);
|
||||||
|
GetEventHandler()->ProcessEvent(eventShow);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
gtk_widget_hide( m_widget );
|
gtk_widget_hide( m_widget );
|
||||||
|
wxShowEvent eventShow(GetId(), show);
|
||||||
wxShowEvent eventShow(GetId(), show);
|
eventShow.SetEventObject(this);
|
||||||
eventShow.SetEventObject(this);
|
GetEventHandler()->ProcessEvent(eventShow);
|
||||||
|
}
|
||||||
GetEventHandler()->ProcessEvent(eventShow);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3427,6 +3452,12 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase )
|
|||||||
|
|
||||||
if (newParent)
|
if (newParent)
|
||||||
{
|
{
|
||||||
|
if (GTK_WIDGET_VISIBLE (newParent->m_widget))
|
||||||
|
{
|
||||||
|
m_showOnIdle = true;
|
||||||
|
gtk_widget_hide( m_widget );
|
||||||
|
}
|
||||||
|
|
||||||
/* insert GTK representation */
|
/* insert GTK representation */
|
||||||
(*(newParent->m_insertCallback))(newParent, this);
|
(*(newParent->m_insertCallback))(newParent, this);
|
||||||
}
|
}
|
||||||
@@ -3661,6 +3692,8 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
|
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
{
|
{
|
||||||
|
if (!GTK_PIZZA(m_wxwindow)->bin_window) return;
|
||||||
|
|
||||||
GdkRectangle gdk_rect,
|
GdkRectangle gdk_rect,
|
||||||
*p;
|
*p;
|
||||||
if (rect)
|
if (rect)
|
||||||
|
Reference in New Issue
Block a user