made wxNO_FULL_REPAINT_ON_RESIZE default, added wxFULL_REPAINT_ON_RESIZE

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23871 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2003-09-24 00:26:40 +00:00
parent 80097f32fe
commit e441e1f4e8
21 changed files with 70 additions and 55 deletions

View File

@ -5,6 +5,19 @@ wxWindows 2.5/2.6 Change Log
INCOMPATIBLE CHANGES SINCE 2.4.x
================================
Please take a few minutes to read the following list, especially
paying attention to the most important changes which are marked
with '!' in the first column.
Also please note that you should ensure that WXWIN_COMPATIBILITY_2_4
is defined to 1 if you wish to retain maximal compatibility with 2.4
series.
! windows are no longer fully repainted when resized, use new style
wxFULL_REPAINT_ON_RESIZE to force this (wxNO_FULL_REPAINT_ON_RESIZE stll
exists but doesn't do anything any more, this behaviour is default now)
- no initialization/cleanup can be done in wxApp/~wxApp because they are
now called much earlier/later than before; please move any exiting code
from there to wxApp::OnInit()/OnExit()

View File

@ -53,6 +53,11 @@ This style is currently only implemented for wxMSW and wxUniversal and does
nothing on the other platforms.}
\twocolitem{\windowstyle{wxCLIP\_CHILDREN}}{Use this style to eliminate flicker caused by the background being
repainted, then children being painted over them. Windows only.}
\twocolitem{\windowstyle{wxFULL\_REPAINT\_ON\_RESIZE}}{Use this style to force
a complete redraw of the window whenever it is resized instead of redrawing
just the part of the window affected by resizing. Note that this was the
behaviour by default before 2.5.1 release and that if you experience redraw
problems with the code which previously used to work you may want to try this.}
\end{twocollist}
See also \helpref{window styles overview}{windowstyles}.

View File

@ -1219,9 +1219,15 @@ enum wxBorder
// mouse is clicked outside of it or if it loses focus in any other way
#define wxPOPUP_WINDOW 0x00020000
// force a full repaint when the window is resized (instead of repainting just
// the invalidated area)
#define wxFULL_REPAINT_ON_RESIZE 0x00010000
// obsolete: now this is the default behaviour
//
// don't invalidate the whole window (resulting in a PAINT event) when the
// window is resized (currently, makes sense for wxMSW only)
#define wxNO_FULL_REPAINT_ON_RESIZE 0x00010000
#define wxNO_FULL_REPAINT_ON_RESIZE 0
/*
* Extra window style flags (use wxWS_EX prefix to make it clear that they

View File

@ -87,10 +87,6 @@ bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id,
style &= ~wxBORDER_MASK;
style |= wxBORDER_NONE;
// we don't need to be completely repainted after resize and doing it
// results in horrible flicker
style |= wxNO_FULL_REPAINT_ON_RESIZE;
if ( !wxWindow::Create(parent, id, pos, size, style, name) )
return FALSE;

View File

@ -611,10 +611,11 @@ static void gtk_window_draw_callback( GtkWidget *widget,
if (g_isIdle)
wxapp_install_idle_handler();
// The wxNO_FULL_REPAINT_ON_RESIZE flag only works if
// there are no child windows.
if ((win->HasFlag(wxNO_FULL_REPAINT_ON_RESIZE)) &&
(win->GetChildren().GetCount() == 0))
// if there are any children we must refresh everything
//
// VZ: why?
if ( !win->HasFlag(wxFULL_REPAINT_ON_RESIZE) &&
win->GetChildren().IsEmpty() )
{
return;
}
@ -2748,13 +2749,13 @@ void wxWindowGTK::PostCreation()
gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
if (HasFlag(wxNO_FULL_REPAINT_ON_RESIZE))
if (!HasFlag(wxFULL_REPAINT_ON_RESIZE))
{
gtk_signal_connect( GTK_OBJECT(m_wxwindow), "event",
GTK_SIGNAL_FUNC(gtk_window_event_event_callback), (gpointer)this );
}
#else
// gtk_widget_set_redraw_on_allocate( GTK_WIDGET(m_wxwindow), HasFlag( wxNO_FULL_REPAINT_ON_RESIZE ) );
// gtk_widget_set_redraw_on_allocate( GTK_WIDGET(m_wxwindow), !HasFlag( wxFULL_REPAINT_ON_RESIZE ) );
#endif
#ifdef __WXGTK20__

View File

@ -611,10 +611,11 @@ static void gtk_window_draw_callback( GtkWidget *widget,
if (g_isIdle)
wxapp_install_idle_handler();
// The wxNO_FULL_REPAINT_ON_RESIZE flag only works if
// there are no child windows.
if ((win->HasFlag(wxNO_FULL_REPAINT_ON_RESIZE)) &&
(win->GetChildren().GetCount() == 0))
// if there are any children we must refresh everything
//
// VZ: why?
if ( !win->HasFlag(wxFULL_REPAINT_ON_RESIZE) &&
win->GetChildren().IsEmpty() )
{
return;
}
@ -2748,13 +2749,13 @@ void wxWindowGTK::PostCreation()
gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
if (HasFlag(wxNO_FULL_REPAINT_ON_RESIZE))
if (!HasFlag(wxFULL_REPAINT_ON_RESIZE))
{
gtk_signal_connect( GTK_OBJECT(m_wxwindow), "event",
GTK_SIGNAL_FUNC(gtk_window_event_event_callback), (gpointer)this );
}
#else
// gtk_widget_set_redraw_on_allocate( GTK_WIDGET(m_wxwindow), HasFlag( wxNO_FULL_REPAINT_ON_RESIZE ) );
// gtk_widget_set_redraw_on_allocate( GTK_WIDGET(m_wxwindow), !HasFlag( wxFULL_REPAINT_ON_RESIZE ) );
#endif
#ifdef __WXGTK20__

View File

@ -1088,7 +1088,7 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
// the OS takes care of invalidating and erasing the new area so we only have to
// take care of refreshing for full repaints
if ( doResize && !HasFlag(wxNO_FULL_REPAINT_ON_RESIZE) )
if ( doResize && HasFlag(wxFULL_REPAINT_ON_RESIZE) )
Refresh() ;

View File

@ -627,7 +627,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
bool partialRepaint = false ;
if ( HasFlag(wxNO_FULL_REPAINT_ON_RESIZE) )
if ( !HasFlag(wxFULL_REPAINT_ON_RESIZE) )
{
wxPoint oldPos( m_x , m_y ) ;
wxPoint newPos( actualX , actualY ) ;

View File

@ -1088,7 +1088,7 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
// the OS takes care of invalidating and erasing the new area so we only have to
// take care of refreshing for full repaints
if ( doResize && !HasFlag(wxNO_FULL_REPAINT_ON_RESIZE) )
if ( doResize && HasFlag(wxFULL_REPAINT_ON_RESIZE) )
Refresh() ;

View File

@ -627,7 +627,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
bool partialRepaint = false ;
if ( HasFlag(wxNO_FULL_REPAINT_ON_RESIZE) )
if ( !HasFlag(wxFULL_REPAINT_ON_RESIZE) )
{
wxPoint oldPos( m_x , m_y ) ;
wxPoint newPos( actualX , actualY ) ;

View File

@ -624,7 +624,7 @@ bool wxWindowMGL::Create(wxWindow *parent,
long mgl_style = 0;
window_t *wnd_parent = parent ? parent->GetHandle() : NULL;
if ( !(style & wxNO_FULL_REPAINT_ON_RESIZE) )
if ( style & wxFULL_REPAINT_ON_RESIZE )
{
mgl_style |= MGL_WM_FULL_REPAINT_ON_RESIZE;
}

View File

@ -502,7 +502,7 @@ long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
// creates flicker but at least doesn't show garbage on the screen
rc = wxWindow::MSWWindowProc(message, wParam, lParam);
processed = TRUE;
if ( !HasFlag(wxNO_FULL_REPAINT_ON_RESIZE) )
if ( HasFlag(wxFULL_REPAINT_ON_RESIZE) )
{
::InvalidateRect(GetHwnd(), NULL, FALSE /* erase bg */);
}

View File

@ -671,9 +671,9 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
MDICREATESTRUCT mcs;
mcs.szClass = style & wxNO_FULL_REPAINT_ON_RESIZE
? wxMDIChildFrameClassNameNoRedraw
: wxMDIChildFrameClassName;
mcs.szClass = style & wxFULL_REPAINT_ON_RESIZE
? wxMDIChildFrameClassName
: wxMDIChildFrameClassNameNoRedraw;
mcs.szTitle = title;
mcs.hOwner = wxGetInstance();
if (x > -1)

View File

@ -3021,7 +3021,7 @@ bool wxWindowMSW::MSWCreate(const wxChar *wclass,
// which is the same but without CS_[HV]REDRAW class styles so using it
// ensures that the window is not fully repainted on each resize
wxString className(wclass);
if ( GetWindowStyleFlag() & wxNO_FULL_REPAINT_ON_RESIZE )
if ( !HasFlag(wxFULL_REPAINT_ON_RESIZE) )
{
className += wxT("NR");
}

View File

@ -3188,7 +3188,7 @@ bool wxWindowOS2::OS2Create(
// which is the same but without CS_[HV]REDRAW class styles so using it
// ensures that the window is not fully repainted on each resize
//
if (GetWindowStyleFlag() & wxNO_FULL_REPAINT_ON_RESIZE)
if (!HasStyle(wxFULL_REPAINT_ON_RESIZE))
{
sClassName += wxT("NR");
}

View File

@ -70,12 +70,7 @@ bool wxControl::Create(wxWindow *parent,
const wxValidator& validator,
const wxString& name)
{
// Ee use wxNO_FULL_REPAINT_ON_RESIZE by default as it results in much
// less flicker and none of the standard controls needs to be entirely
// repainted after resize anyhow.
if ( !wxControlBase::Create(parent, id, pos, size,
style | wxNO_FULL_REPAINT_ON_RESIZE ,
validator, name) )
if ( !wxControlBase::Create(parent, id, pos, size, style, validator, name) )
{
// underlying window creation failed?
return FALSE;

View File

@ -123,7 +123,7 @@ class wxPopupMenuWindow : public wxPopupTransientWindow
{
public:
wxPopupMenuWindow(wxWindow *parent, wxMenu *menu);
~wxPopupMenuWindow();
// override the base class version to select the first item initially
@ -259,7 +259,7 @@ public:
else
{
// return FALSE;
return wxEvtHandler::ProcessEvent(event);
}
}
@ -376,7 +376,7 @@ wxMenuItemList::compatibility_iterator wxPopupMenuWindow::GetPrevNode() const
: m_menu->GetMenuItems().GetLast();
}
wxMenuItemList::compatibility_iterator
wxMenuItemList::compatibility_iterator
wxPopupMenuWindow::GetPrevNode(wxMenuItemList::compatibility_iterator node) const
{
if ( node )
@ -399,7 +399,7 @@ wxMenuItemList::compatibility_iterator wxPopupMenuWindow::GetNextNode() const
: m_menu->GetMenuItems().GetFirst();
}
wxMenuItemList::compatibility_iterator
wxMenuItemList::compatibility_iterator
wxPopupMenuWindow::GetNextNode(wxMenuItemList::compatibility_iterator node) const
{
if ( node )
@ -620,7 +620,7 @@ void wxPopupMenuWindow::ClickItem(wxMenuItem *item)
// close all menus
DismissAndNotify();
menu->ClickItem(item);
}
@ -685,7 +685,7 @@ bool wxPopupMenuWindow::ProcessLeftDown(wxMouseEvent& event)
wxPopupMenuWindow *win = menu->m_popupMenu;
wxCHECK_MSG( win, FALSE, _T("parent menu not shown?") );
pos = ClientToScreen(pos);
if ( win->GetMenuItemFromPoint(win->ScreenToClient(pos)) )
{
@ -1245,7 +1245,7 @@ wxWindow *wxMenu::GetRootWindow() const
// We are a submenu of a menu of a menubar
if (menu->GetMenuBar())
return menu->GetMenuBar();
win = menu->GetInvokingWindow();
if ( win )
break;
@ -1256,7 +1256,7 @@ wxWindow *wxMenu::GetRootWindow() const
// we're probably going to crash in the caller anyhow, but try to detect
// this error as soon as possible
wxASSERT_MSG( win, _T("menu without any associated window?") );
// also remember it in this menu so that we don't have to search for it the
// next time
wxConstCast(this, wxMenu)->m_invokingWindow = win;
@ -1333,7 +1333,7 @@ void wxMenu::OnDismiss(bool dismissParent)
wxCHECK_RET( m_invokingWindow, _T("what kind of menu is this?") );
m_invokingWindow->DismissPopupMenu();
// Why reset it here? We need it for sending the event to...
// SetInvokingWindow(NULL);
}
@ -1353,7 +1353,7 @@ void wxMenu::Popup(const wxPoint& pos, const wxSize& size, bool selectFirst)
{
m_popupMenu->SelectFirst();
}
// the geometry might have changed since the last time we were shown, so
// always resize
m_popupMenu->SetClientSize(GetGeometryInfo().GetSize());
@ -1405,7 +1405,7 @@ bool wxMenu::ClickItem(wxMenuItem *item)
// not applicabled
isChecked = -1;
}
return SendEvent(item->GetId(), isChecked);
}
@ -1664,8 +1664,6 @@ void wxMenuBar::Init()
m_menuShown = NULL;
m_shouldShowMenu = FALSE;
m_windowStyle |= wxNO_FULL_REPAINT_ON_RESIZE;
}
void wxMenuBar::Attach(wxFrame *frame)
@ -2500,9 +2498,9 @@ bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
#endif // 0
menu->SetInvokingWindow(this);
// wxLogDebug( "Name of invoking window %s", menu->GetInvokingWindow()->GetName().c_str() );
menu->Popup(ClientToScreen(wxPoint(x, y)), wxSize(0, 0));
// this is not very useful if the menu was popped up because of the mouse
@ -2537,7 +2535,7 @@ bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
void wxWindow::DismissPopupMenu()
{
wxCHECK_RET( ms_evtLoopPopup, _T("no popup menu shown") );
ms_evtLoopPopup->Exit();
}

View File

@ -533,7 +533,7 @@ void wxWindow::OnSize(wxSizeEvent& event)
#if 0 // ndef __WXMSW__
// Refresh the area (strip) previously occupied by the border
if (HasFlag( wxNO_FULL_REPAINT_ON_RESIZE ) && IsShown())
if ( !HasFlag(wxFULL_REPAINT_ON_RESIZE) && IsShown() )
{
// This code assumes that wxSizeEvent.GetSize() returns
// the area of the entire window, not just the client

View File

@ -221,7 +221,7 @@ bool wxTextCtrl::Create( wxWindow *parent,
style |= wxALWAYS_SHOW_SB;
wxTextCtrlBase::Create( parent, id, pos /* wxDefaultPosition */, size,
style|wxVSCROLL|wxHSCROLL|wxNO_FULL_REPAINT_ON_RESIZE );
style | wxVSCROLL | wxHSCROLL);
SetBackgroundColour( *wxWHITE );

View File

@ -139,7 +139,7 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
xattributes.override_redirect = True;
}
if (HasFlag( wxNO_FULL_REPAINT_ON_RESIZE ))
if (!HasFlag( wxFULL_REPAINT_ON_RESIZE ))
{
xattributes_mask |= CWBitGravity;
xattributes.bit_gravity = NorthWestGravity;

View File

@ -224,7 +224,7 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
PropertyChangeMask | VisibilityChangeMask ;
if (HasFlag( wxNO_FULL_REPAINT_ON_RESIZE ))
if (!HasFlag( wxFULL_REPAINT_ON_RESIZE ))
{
xattributes_mask |= CWBitGravity;
xattributes.bit_gravity = StaticGravity;
@ -304,7 +304,7 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
PropertyChangeMask | VisibilityChangeMask ;
if (HasFlag( wxNO_FULL_REPAINT_ON_RESIZE ))
if (!HasFlag( wxFULL_REPAINT_ON_RESIZE ))
{
xattributes_mask |= CWBitGravity;
xattributes.bit_gravity = NorthWestGravity;