sizes of the sizer items to be in the same proportion as the items
proportions to return to the old behaviour.
+- wxWindow::Freeze/Thaw() are not virtual any more, if you overrode them in
+ your code you need to override DoFreeze/Thaw() instead now.
+
+
Changes in behaviour which may result in compilation errors
-----------------------------------------------------------
- Removed global GetLine() function from wx/protocol/protocol.h, use
wxProtocol::ReadLine() instead.
-
+
- wxVariant no longer derives from wxObject. wxVariantData also no longer
derives from wxObject; instead of using wxDynamicCast with wxVariantData you
can use the macro wxDynamicCastVariantData with the same arguments.
Freezes the window or, in other words, prevents any updates from taking place
on screen, the window is not redrawn at all. \helpref{Thaw}{wxwindowthaw} must
be called to reenable window redrawing. Calls to these two functions may be
-nested.
+nested but to ensure that the window is properly repainted again, you must thaw
+it exactly as many times as you froze it.
This method is useful for visual appearance optimization (for example, it
is a good idea to use it before doing many large text insertions in a row into
virtual void Refresh(bool eraseBackground = true,
const wxRect *rect = (const wxRect *) NULL);
virtual void Update();
- virtual void Freeze();
- virtual void Thaw();
- virtual bool IsFrozen() const { return m_frozenness > 0; }
virtual bool SetCursor(const wxCursor &cursor);
virtual bool SetFont(const wxFont &font) { m_font = font; return true; }
virtual void DoCaptureMouse();
virtual void DoReleaseMouse();
+ virtual void DoThaw();
+
// move the window to the specified location and resize it: this is called
// from both DoSetSize() and DoSetClientSize() and would usually just call
// ::MoveWindow() except for composite controls which will want to arrange
// don't access it directly)
wxRect m_rect;
- // number of calls to Freeze() minus number of calls to Thaw()
- unsigned m_frozenness;
-
// overlays for this window (or NULL if it doesn't have any)
wxDfbOverlaysList *m_overlays;
virtual void Refresh(bool eraseBackground = true,
const wxRect *rect = NULL);
- virtual void Freeze();
- virtual void Thaw();
-
virtual bool SetBackgroundColour( const wxColour &colour );
virtual bool SetForegroundColour( const wxColour &colour );
virtual wxColour GetBackgroundColour() const;
virtual wxSize DoGetBestSize() const;
+ virtual void DoFreeze();
+ virtual void DoThaw();
+
// return the text for the given column of the given item
virtual wxString OnGetItemText(long item, long column) const;
virtual bool SetBackgroundColour(const wxColour& colour);
virtual bool SetForegroundColour(const wxColour& colour);
- virtual void Freeze();
- virtual void Thaw();
virtual void Refresh(bool eraseBackground = true, const wxRect *rect = NULL);
virtual bool SetFont( const wxFont &font );
bool m_lastOnSame; // last click on the same item as prev
wxImageList *m_imageListButtons;
- int m_freezeCount;
int m_dragCount;
wxPoint m_dragStart;
wxGenericTreeItem *m_dropTarget;
// the common part of all ctors
void Init();
+ // overridden wxWindow methods
+ virtual void DoThaw();
+
// misc helpers
void SendDeleteEvent(wxGenericTreeItem *itemBeingDeleted);
void SetUpdateFont(bool WXUNUSED(update)) { }
- // GTK+ textctrl is so dumb that you need to freeze/thaw it manually to
- // avoid horrible flicker/scrolling back and forth
- virtual void Freeze();
- virtual void Thaw();
-
// implementation only from now on
// tell the control to ignore next text changed signal
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
- // has the control been frozen by Freeze()?
- bool IsFrozen() const { return m_freezeCount > 0; }
-
protected:
// wxGTK-specific: called recursively by Enable,
// to give widgets an oppprtunity to correct their colours after they
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+ virtual void DoFreeze();
+ virtual void DoThaw();
+
// common part of all ctors
void Init();
// a dummy one when frozen
GtkTextBuffer *m_buffer;
- // number of calls to Freeze() minus number of calls to Thaw()
- unsigned m_freezeCount;
GtkTextMark* m_showPositionOnThaw;
// For wxTE_AUTO_URL
void SetModified() { m_modified = true; }
- // GTK+ textctrl is so dumb that you need to freeze/thaw it manually to
- // avoid horrible flicker/scrolling back and forth
- virtual void Freeze();
- virtual void Thaw();
-
// textctrl specific scrolling
virtual bool ScrollLines(int lines);
virtual bool ScrollPages(int pages);
// common part of all ctors
void Init();
+ // overridden wxWindow methods
+ virtual void DoFreeze();
+ virtual void DoThaw();
+
// get the vertical adjustment, if any, NULL otherwise
GtkAdjustment *GetVAdj() const;
virtual void Refresh( bool eraseBackground = true,
const wxRect *rect = NULL );
- virtual void Freeze();
- virtual void Thaw();
- virtual bool IsFrozen() const;
virtual void Update() ;
virtual void ClearBackground();
virtual void DoEnable( bool enable );
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
+ virtual void DoFreeze();
+ virtual void DoThaw();
+
public:
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
int range, bool refresh = true );
// For controls like radio buttons which are genuinely composite
wxList m_subControls;
- // number of calls to Freeze() minus number of calls to Thaw()
- unsigned int m_frozenness;
-
// the peer object, allowing for cleaner API support
wxMacControl * m_peer ;
virtual void Refresh(bool eraseBackground = true,
const wxRect *rect = (const wxRect *) NULL);
virtual void Update();
- virtual void Freeze();
- virtual void Thaw();
virtual bool SetCursor(const wxCursor &cursor);
virtual bool SetFont(const wxFont &font) { m_font = font; return true; }
void OnInternalIdle();
protected:
+ virtual void DoFreeze();
+ virtual void DoThaw();
+
+
// the window handle
struct window_t *m_wnd;
// whether there should be wxEraseEvent before wxPaintEvent or not
// (see wxWindow::Refresh)
- bool m_frozen:1;
bool m_refreshAfterThaw:1;
int m_eraseBackground;
virtual bool SetTransparent(wxByte alpha);
virtual bool CanSetTransparent();
- //Top level windows have different freeze semantics on Windows
- virtual void Freeze();
- virtual void Thaw();
-
virtual void AddChild( wxWindowBase *child );
virtual void DoGetSize(int *width, int *height) const;
#endif // __WXWINCE__
+ // Top level windows have different freeze semantics on Windows
+ virtual void DoFreeze();
+ virtual void DoThaw();
+
// helper of SetIcons(): calls gets the icon with the size specified by the
// given system metrics (SM_C{X|Y}[SM]ICON) from the bundle and sets it
// using WM_SETICON with the specified wParam (ICOM_SMALL or ICON_BIG)
virtual void Refresh( bool eraseBackground = true,
const wxRect *rect = (const wxRect *) NULL );
virtual void Update();
- virtual void Freeze();
- virtual void Thaw();
- virtual bool IsFrozen() const { return m_frozenness > 0; }
virtual void SetWindowStyleFlag(long style);
virtual void SetExtraStyle(long exStyle);
virtual void DoEnable(bool enable);
+ virtual void DoFreeze();
+ virtual void DoThaw();
+
// this simply moves/resizes the given HWND which is supposed to be our
// sibling (this is useful for controls which are composite at MSW level
// and for which DoMoveWindow() is not enough)
bool HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
-
-
// current defer window position operation handle (may be NULL)
WXHANDLE m_hDWP;
wxPoint m_pendingPosition;
wxSize m_pendingSize;
- // number of calls to Freeze() minus number of calls to Thaw()
- // protected so that wxTopLevelWindowMSW can access it
- unsigned int m_frozenness;
-
private:
#ifdef __POCKETPC__
bool m_contextMenuEnabled;
virtual void Refresh( bool bEraseBackground = true
,const wxRect* pRect = (const wxRect *)NULL
);
- virtual void Freeze(void);
virtual void Update(void);
- virtual void Thaw(void);
virtual void SetWindowStyleFlag(long lStyle);
virtual bool SetCursor(const wxCursor& rCursor);
virtual bool SetFont(const wxFont& rFont);
PSWP GetSwp(void) {return &m_vWinSwp;}
protected:
+ virtual void DoFreeze(void);
+ virtual void DoThaw(void);
+
// PM can't create some MSW styles natively but can perform these after
// creation by sending messages
typedef enum extra_flags { kFrameToolWindow = 0x0001
virtual void Refresh( bool eraseBackground = true,
const wxRect *rect = NULL );
virtual void Update();
- virtual void Freeze();
- virtual void Thaw();
virtual bool SetCursor( const wxCursor &cursor );
virtual bool SetFont( const wxFont &font );
bool HandleMoving(wxRect& rect);
bool HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags);
- // number of calls to Freeze() minus number of calls to Thaw()
- unsigned int m_frozenness;
-
DECLARE_DYNAMIC_CLASS(wxWindowPalm)
DECLARE_NO_COPY_CLASS(wxWindowPalm)
DECLARE_EVENT_TABLE()
virtual void SelectAll();
virtual void SetEditable(bool editable);
- /// Call Freeze to prevent refresh
- virtual void Freeze();
-
- /// Call Thaw to refresh
- virtual void Thaw();
-
- /// Call Thaw to refresh
- virtual bool IsFrozen() const { return m_freezeCount > 0; }
-
virtual bool HasSelection() const;
///// Functionality specific to wxRichTextCtrl
virtual void DoSetValue(const wxString& value, int flags = 0);
+ virtual void DoThaw();
+
// Data members
private:
-
- /// Allows nested Freeze/Thaw
- int m_freezeCount;
-
#if wxRICHTEXT_BUFFERED_PAINTING
/// Buffer bitmap
wxBitmap m_bufferBitmap;
virtual void ClearBackground();
// freeze the window: don't redraw it until it is thawed
- virtual void Freeze() { }
+ void Freeze() { if ( !m_freezeCount++ ) DoFreeze(); }
// thaw the window: redraw it after it had been frozen
- virtual void Thaw() { }
+ void Thaw()
+ {
+ wxASSERT_MSG( m_freezeCount, "Thaw() without matching Freeze()" );
+
+ if ( !--m_freezeCount )
+ DoThaw();
+ }
// return true if window had been frozen and not unthawed yet
- virtual bool IsFrozen() const { return false; }
+ bool IsFrozen() const { return m_freezeCount != 0; }
// adjust DC for drawing on this window
virtual void PrepareDC( wxDC & WXUNUSED(dc) ) { }
// implements the window variants
virtual void DoSetWindowVariant( wxWindowVariant variant ) ;
+
+ // really freeze/thaw the window (should have port-specific implementation)
+ virtual void DoFreeze() { }
+ virtual void DoThaw() { }
+
+
// Must be called when mouse capture is lost to send
// wxMouseCaptureLostEvent to windows on capture stack.
static void NotifyCaptureLost();
// the stack of windows which have captured the mouse
static struct WXDLLIMPEXP_FWD_CORE wxWindowNext *ms_winCaptureNext;
+
// the window that currently has mouse capture
static wxWindow *ms_winCaptureCurrent;
+
// indicates if execution is inside CaptureMouse/ReleaseMouse
static bool ms_winCaptureChanging;
+
+ // number of Freeze() calls minus the number of Thaw() calls: we're frozen
+ // (i.e. not being updated) if it is positive
+ unsigned int m_freezeCount;
+
+
DECLARE_ABSTRACT_CLASS(wxWindowBase)
DECLARE_NO_COPY_CLASS(wxWindowBase)
DECLARE_EVENT_TABLE()
void SetModified() { m_modified = true; }
- virtual void Freeze();
- virtual void Thaw();
-
// textctrl specific scrolling
virtual bool ScrollLines(int lines);
virtual bool ScrollPages(int pages);
// VZ: this one shouldn't exist...
m_isBeingDeleted = false;
+
+ m_freezeCount = 0;
}
// common part of window creation process
void wxWindowDFB::Init()
{
m_isShown = true;
- m_frozenness = 0;
m_tlw = NULL;
m_overlays = NULL;
}
GetParent()->Update();
}
-void wxWindowDFB::Freeze()
+void wxWindowDFB::DoThaw()
{
- m_frozenness++;
-}
-
-void wxWindowDFB::Thaw()
-{
- wxASSERT_MSG( IsFrozen(), "Thaw() without matching Freeze()" );
-
- if ( --m_frozenness == 0 )
- {
- if ( IsShown() )
- DoRefreshWindow();
- }
+ if ( IsShown() )
+ DoRefreshWindow();
}
void wxWindowDFB::PaintWindow(const wxRect& rect)
return wxFindWindowAtPoint(pt = wxGetMousePosition());
}
-wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
+wxWindow* wxFindWindowAtPoint(const wxPoint& WXUNUSED(pt))
{
wxFAIL_MSG( "wxFindWindowAtPoint not implemented" );
return NULL;
SetFocusIgnoringChildren();
}
- // suspend/resume redrawing the control
- void Freeze();
- void Thaw();
+ // we don't draw anything while we're frozen so we must refresh ourselves
+ // when we're thawed to make sure the changes are displayed correctly
+ virtual void DoThaw() { Refresh(); }
void OnRenameTimer();
bool OnRenameAccept(size_t itemEdit, const wxString& value);
wxBrush *m_highlightBrush,
*m_highlightUnfocusedBrush;
- // if this is > 0, the control is frozen and doesn't redraw itself
- size_t m_freezeCount;
-
// wrapper around the text control currently used for in place editing or
// NULL if no item is being edited
wxListTextCtrlWrapper *m_textctrlWrapper;
m_lineLastClicked =
m_lineSelectSingleOnUp =
m_lineBeforeLastClicked = (size_t)-1;
-
- m_freezeCount = 0;
}
wxListMainWindow::wxListMainWindow()
}
}
-void wxListMainWindow::Freeze()
-{
- m_freezeCount++;
-}
-
-void wxListMainWindow::Thaw()
-{
- wxCHECK_RET( m_freezeCount > 0, _T("thawing unfrozen list control?") );
-
- if ( --m_freezeCount == 0 )
- Refresh();
-}
-
void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{
// Note: a wxPaintDC must be constructed even if no drawing is
// done (a Windows requirement).
wxPaintDC dc( this );
- if ( IsEmpty() || m_freezeCount )
+ if ( IsEmpty() || IsFrozen() )
+ {
// nothing to draw or not the moment to draw it
return;
+ }
if ( m_dirty )
+ {
// delay the repainting until we calculate all the items positions
return;
+ }
PrepareDC( dc );
}
}
-void wxGenericListCtrl::Freeze()
+void wxGenericListCtrl::DoFreeze()
{
m_mainWin->Freeze();
}
-void wxGenericListCtrl::Thaw()
+void wxGenericListCtrl::DoThaw()
{
m_mainWin->Thaw();
}
m_textCtrl = NULL;
m_renameTimer = NULL;
- m_freezeCount = 0;
m_findTimer = NULL;
}
item->Expand();
- if ( !m_freezeCount )
+ if ( !IsFrozen() )
{
CalculatePositions();
void wxGenericTreeCtrl::Refresh(bool eraseBackground, const wxRect *rect)
{
- if ( !m_freezeCount )
+ if ( !IsFrozen() )
wxTreeCtrlBase::Refresh(eraseBackground, rect);
}
void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item)
{
- if (m_dirty || m_freezeCount)
+ if (m_dirty || IsFrozen() )
return;
wxSize client = GetClientSize();
void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item )
{
- if (m_dirty || m_freezeCount)
+ if (m_dirty || IsFrozen() )
return;
wxRect rect;
void wxGenericTreeCtrl::RefreshSelected()
{
- if (m_freezeCount)
+ if (IsFrozen())
return;
// TODO: this is awfully inefficient, we should keep the list of all
void wxGenericTreeCtrl::RefreshSelectedUnder(wxGenericTreeItem *item)
{
- if (m_freezeCount)
+ if (IsFrozen())
return;
if ( item->IsSelected() )
}
}
-void wxGenericTreeCtrl::Freeze()
+void wxGenericTreeCtrl::DoThaw()
{
- m_freezeCount++;
-}
-
-void wxGenericTreeCtrl::Thaw()
-{
- wxCHECK_RET( m_freezeCount > 0, _T("thawing unfrozen tree control?") );
-
- if ( --m_freezeCount == 0 )
- {
- if ( m_dirty )
- DoDirtyProcessing();
- else
- Refresh();
- }
+ if ( m_dirty )
+ DoDirtyProcessing();
+ else
+ Refresh();
}
// ----------------------------------------------------------------------------
void wxGenericTreeCtrl::DoDirtyProcessing()
{
- if (m_freezeCount)
+ if (IsFrozen())
return;
m_dirty = false;
SetUpdateFont(false);
m_text = NULL;
- m_freezeCount = 0;
m_showPositionOnThaw = NULL;
m_gdkHandCursor = NULL;
m_gdkXTermCursor = NULL;
// freeze/thaw
// ----------------------------------------------------------------------------
-void wxTextCtrl::Freeze()
+void wxTextCtrl::DoFreeze()
{
wxCHECK_RET(m_text != NULL, wxT("invalid text ctrl"));
if ( HasFlag(wxTE_MULTILINE) )
{
- if (m_freezeCount++ == 0)
- {
- // freeze textview updates and remove buffer
- g_signal_connect (m_text, "expose_event",
- G_CALLBACK (gtk_text_exposed_callback), this);
- g_signal_connect (m_widget, "expose_event",
- G_CALLBACK (gtk_text_exposed_callback), this);
- gtk_widget_set_sensitive(m_widget, false);
- g_object_ref(m_buffer);
- GtkTextBuffer* buf_new = gtk_text_buffer_new(NULL);
- GtkTextMark* mark = GTK_TEXT_VIEW(m_text)->first_para_mark;
- gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), buf_new);
- // gtk_text_view_set_buffer adds its own reference
- g_object_unref(buf_new);
- // This mark should be deleted when the buffer is changed,
- // but it's not (in GTK+ up to at least 2.10.6).
- // Otherwise these anonymous marks start to build up in the buffer,
- // and Freeze takes longer and longer each time it is called.
- if (GTK_IS_TEXT_MARK(mark) && !gtk_text_mark_get_deleted(mark))
- gtk_text_buffer_delete_mark(m_buffer, mark);
- }
- }
-}
-
-void wxTextCtrl::Thaw()
+ // freeze textview updates and remove buffer
+ g_signal_connect (m_text, "expose_event",
+ G_CALLBACK (gtk_text_exposed_callback), this);
+ g_signal_connect (m_widget, "expose_event",
+ G_CALLBACK (gtk_text_exposed_callback), this);
+ gtk_widget_set_sensitive(m_widget, false);
+ g_object_ref(m_buffer);
+ GtkTextBuffer* buf_new = gtk_text_buffer_new(NULL);
+ GtkTextMark* mark = GTK_TEXT_VIEW(m_text)->first_para_mark;
+ gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), buf_new);
+ // gtk_text_view_set_buffer adds its own reference
+ g_object_unref(buf_new);
+ // This mark should be deleted when the buffer is changed,
+ // but it's not (in GTK+ up to at least 2.10.6).
+ // Otherwise these anonymous marks start to build up in the buffer,
+ // and Freeze takes longer and longer each time it is called.
+ if (GTK_IS_TEXT_MARK(mark) && !gtk_text_mark_get_deleted(mark))
+ gtk_text_buffer_delete_mark(m_buffer, mark);
+ }
+}
+
+void wxTextCtrl::DoThaw()
{
if ( HasFlag(wxTE_MULTILINE) )
{
- wxCHECK_RET(m_freezeCount != 0, _T("Thaw() without matching Freeze()"));
-
- if (--m_freezeCount == 0)
+ // Reattach buffer and thaw textview updates
+ gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), m_buffer);
+ g_object_unref(m_buffer);
+ gtk_widget_set_sensitive(m_widget, true);
+ g_signal_handlers_disconnect_by_func (m_widget,
+ (gpointer) gtk_text_exposed_callback, this);
+ g_signal_handlers_disconnect_by_func (m_text,
+ (gpointer) gtk_text_exposed_callback, this);
+ if (m_showPositionOnThaw != NULL)
{
- // Reattach buffer and thaw textview updates
- gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), m_buffer);
- g_object_unref(m_buffer);
- gtk_widget_set_sensitive(m_widget, true);
- g_signal_handlers_disconnect_by_func (m_widget,
- (gpointer) gtk_text_exposed_callback, this);
- g_signal_handlers_disconnect_by_func (m_text,
- (gpointer) gtk_text_exposed_callback, this);
- if (m_showPositionOnThaw != NULL)
- {
- gtk_text_view_scroll_mark_onscreen(
- GTK_TEXT_VIEW(m_text), m_showPositionOnThaw);
- m_showPositionOnThaw = NULL;
- }
+ gtk_text_view_scroll_mark_onscreen(
+ GTK_TEXT_VIEW(m_text), m_showPositionOnThaw);
+ m_showPositionOnThaw = NULL;
}
}
}
// freeze/thaw
// ----------------------------------------------------------------------------
-void wxTextCtrl::Freeze()
+void wxTextCtrl::DoFreeze()
{
if ( HasFlag(wxTE_MULTILINE) )
{
}
}
-void wxTextCtrl::Thaw()
+void wxTextCtrl::DoThaw()
{
if ( HasFlag(wxTE_MULTILINE) )
{
void wxWindowMac::Init()
{
m_peer = NULL ;
- m_frozenness = 0 ;
m_macAlpha = 255 ;
m_cgContextRef = NULL ;
}
}
-void wxWindowMac::Freeze()
+void wxWindowMac::DoFreeze()
{
#if TARGET_API_MAC_OSX
- if ( !m_frozenness++ )
- {
- if ( m_peer && m_peer->Ok() )
- m_peer->SetDrawingEnabled( false ) ;
- }
+ if ( m_peer && m_peer->Ok() )
+ m_peer->SetDrawingEnabled( false ) ;
#endif
}
-void wxWindowMac::Thaw()
+void wxWindowMac::DoThaw()
{
#if TARGET_API_MAC_OSX
- wxASSERT_MSG( m_frozenness > 0, wxT("Thaw() without matching Freeze()") );
-
- if ( !--m_frozenness )
+ if ( m_peer && m_peer->Ok() )
{
- if ( m_peer && m_peer->Ok() )
- {
- m_peer->SetDrawingEnabled( true ) ;
- m_peer->InvalidateWithChildren() ;
- }
+ m_peer->SetDrawingEnabled( true ) ;
+ m_peer->InvalidateWithChildren() ;
}
#endif
}
-bool wxWindowMac::IsFrozen() const
-{
- return m_frozenness != 0;
-}
-
wxWindowMac *wxGetActiveWindow()
{
// actually this is a windows-only concept
// mgl specific:
m_wnd = NULL;
m_isShown = true;
- m_frozen = false;
m_paintMGLDC = NULL;
m_eraseBackground = -1;
}
void wxWindowMGL::Update()
{
- if ( !m_frozen )
+ if ( !IsFrozen() )
MGL_wmUpdateDC(g_winMng);
}
-void wxWindowMGL::Freeze()
+void wxWindowMGL::DoFreeze()
{
- m_frozen = true;
m_refreshAfterThaw = false;
}
-void wxWindowMGL::Thaw()
+void wxWindowMGL::DoThaw()
{
- m_frozen = false;
if ( m_refreshAfterThaw )
Refresh();
}
void wxWindowMGL::HandlePaint(MGLDevCtx *dc)
{
- if ( m_frozen )
+ if ( IsFrozen() )
{
// Don't paint anything if the window is frozen.
m_refreshAfterThaw = true;
}
-void wxTopLevelWindowMSW::Freeze()
+void wxTopLevelWindowMSW::DoFreeze()
{
- if ( !m_frozenness++) {
- if (IsShown()) {
- for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
- node;
- node = node->GetNext() )
- {
- wxWindow *child = node->GetData();
- if ( child->IsTopLevel() )
- continue;
- else
- child->Freeze();
- }
+ if ( IsShown() )
+ {
+ for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxWindow *child = node->GetData();
+ if ( child->IsTopLevel() )
+ continue;
+
+ child->Freeze();
}
}
}
-void wxTopLevelWindowMSW::Thaw()
+void wxTopLevelWindowMSW::DoThaw()
{
- wxASSERT_MSG( m_frozenness > 0, _T("Thaw() without matching Freeze()") );
- if ( --m_frozenness == 0 )
+ if ( IsShown() )
{
- if ( IsShown() ) {
- for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
- node;
- node = node->GetNext() )
- {
- wxWindow *child = node->GetData();
- if ( child->IsTopLevel() )
- continue;
- else
- child->Thaw();
- }
+ for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxWindow *child = node->GetData();
+ if ( child->IsTopLevel() )
+ continue;
+
+ child->Thaw();
}
}
}
-void wxTopLevelWindowMSW::AddChild(wxWindowBase *child )
+void wxTopLevelWindowMSW::AddChild(wxWindowBase *child)
{
- //adding a child while frozen will assert when thawn,
- // so freeze it
- if (child && !child->IsTopLevel() && IsFrozen()) {
- //need to match our current freeze level
- for (unsigned int ii=0;ii< m_frozenness;ii++) {
- child->Freeze();
- }
+ // adding a child while frozen will assert when thawn, so freeze it as if
+ // it had been already present when we were frozen
+ if ( child && !child->IsTopLevel() && IsFrozen() )
+ {
+ child->Freeze();
}
+
wxTopLevelWindowBase::AddChild(child);
}
m_mouseInWindow = false;
m_lastKeydownProcessed = false;
- m_frozenness = 0;
-
m_hWnd = 0;
m_hDWP = 0;
#endif
}
-void wxWindowMSW::Freeze()
+void wxWindowMSW::DoFreeze()
{
- if ( !m_frozenness++ )
- {
- if ( IsShown() )
- SendSetRedraw(GetHwnd(), false);
- }
+ if ( IsShown() )
+ SendSetRedraw(GetHwnd(), false);
}
-void wxWindowMSW::Thaw()
+void wxWindowMSW::DoThaw()
{
- wxASSERT_MSG( m_frozenness > 0, _T("Thaw() without matching Freeze()") );
-
- if ( --m_frozenness == 0 )
+ if ( IsShown() )
{
- if ( IsShown() )
- {
- SendSetRedraw(GetHwnd(), true);
+ SendSetRedraw(GetHwnd(), true);
- // we need to refresh everything or otherwise the invalidated area
- // is not going to be repainted
- Refresh();
- }
+ // we need to refresh everything or otherwise the invalidated area
+ // is not going to be repainted
+ Refresh();
}
}
::WinUpdateWindow(GetHwnd());
} // end of wxWindowOS2::Update
-void wxWindowOS2::Freeze()
+void wxWindowOS2::DoFreeze()
{
::WinSendMsg(GetHwnd(), WM_VRNDISABLED, (MPARAM)0, (MPARAM)0);
} // end of wxWindowOS2::Freeze
-void wxWindowOS2::Thaw()
+void wxWindowOS2::DoThaw()
{
::WinSendMsg(GetHwnd(), WM_VRNENABLED, (MPARAM)TRUE, (MPARAM)0);
return false;
}
-void wxWindowPalm::Freeze()
-{
-}
-
-void wxWindowPalm::Thaw()
-{
-}
-
void wxWindowPalm::Refresh(bool eraseBack, const wxRect *rect)
{
WinHandle handle = (WinHandle)GetHWND();
/// Member initialisation
void wxRichTextCtrl::Init()
{
- m_freezeCount = 0;
m_contextMenu = NULL;
m_caret = NULL;
m_caretPosition = -1;
m_caretPositionForDefaultStyle = -2;
}
-/// Call Freeze to prevent refresh
-void wxRichTextCtrl::Freeze()
+void wxRichTextCtrl::DoThaw()
{
- m_freezeCount ++;
-}
-
-/// Call Thaw to refresh
-void wxRichTextCtrl::Thaw()
-{
- m_freezeCount --;
-
- if (m_freezeCount == 0)
- {
- if (GetBuffer().GetDirty())
- LayoutContent();
- else
- SetupScrollbars();
- Refresh(false);
- }
+ if (GetBuffer().GetDirty())
+ LayoutContent();
+ else
+ SetupScrollbars();
+ Refresh(false);
}
/// Clear all text
m_caretAtLineStart = false;
m_selectionRange.SetRange(-2, -2);
- if (m_freezeCount == 0)
+ if (!IsFrozen())
{
LayoutContent();
Refresh(false);
#else
wxPaintDC dc(this);
#endif
- PrepareDC(dc);
- if (m_freezeCount > 0)
+ if (IsFrozen())
return;
+ PrepareDC(dc);
+
dc.SetFont(GetFont());
// Paint the background
/// Set up scrollbars, e.g. after a resize
void wxRichTextCtrl::SetupScrollbars(bool atTop)
{
- if (m_freezeCount)
+ if (IsFrozen())
return;
if (GetBuffer().IsEmpty())
}
}
-// ----------------------------------------------------------------------------
-// freeze/thaw
-// ----------------------------------------------------------------------------
-
-void wxTextCtrl::Freeze()
-{
-}
-
-void wxTextCtrl::Thaw()
-{
-}
-
void wxTextCtrl::OnSetFocus( wxFocusEvent& event )
{
// To hide or show caret, as appropriate