move Freeze() and Thaw() to wxWindowBase to ensure that they behave consistently (i.e. recursively, as described in the docs) in all ports; removed different duplications of freeze count from derived classes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51018 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -68,6 +68,10 @@ Changes in behaviour not resulting in compilation errors, please read this!
|
||||
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
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@@ -728,7 +728,8 @@ subwindows.
|
||||
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
|
||||
|
@@ -75,9 +75,6 @@ public:
|
||||
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; }
|
||||
@@ -128,6 +125,8 @@ protected:
|
||||
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
|
||||
@@ -183,9 +182,6 @@ private:
|
||||
// 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;
|
||||
|
||||
|
@@ -174,9 +174,6 @@ public:
|
||||
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;
|
||||
@@ -218,6 +215,9 @@ protected:
|
||||
|
||||
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;
|
||||
|
||||
|
@@ -197,8 +197,6 @@ public:
|
||||
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 );
|
||||
@@ -253,7 +251,6 @@ protected:
|
||||
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;
|
||||
@@ -273,6 +270,9 @@ protected:
|
||||
// the common part of all ctors
|
||||
void Init();
|
||||
|
||||
// overridden wxWindow methods
|
||||
virtual void DoThaw();
|
||||
|
||||
// misc helpers
|
||||
void SendDeleteEvent(wxGenericTreeItem *itemBeingDeleted);
|
||||
|
||||
|
@@ -121,11 +121,6 @@ public:
|
||||
|
||||
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
|
||||
@@ -148,9 +143,6 @@ public:
|
||||
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
|
||||
@@ -162,6 +154,9 @@ protected:
|
||||
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
||||
|
||||
virtual void DoFreeze();
|
||||
virtual void DoThaw();
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
@@ -217,8 +212,6 @@ private:
|
||||
// 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
|
||||
|
@@ -139,11 +139,6 @@ public:
|
||||
|
||||
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);
|
||||
@@ -170,6 +165,10 @@ protected:
|
||||
// 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;
|
||||
|
||||
|
@@ -62,9 +62,6 @@ public:
|
||||
|
||||
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();
|
||||
@@ -86,6 +83,9 @@ protected:
|
||||
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 );
|
||||
@@ -262,9 +262,6 @@ protected:
|
||||
// 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 ;
|
||||
|
||||
|
@@ -68,8 +68,6 @@ public:
|
||||
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; }
|
||||
@@ -100,11 +98,14 @@ public:
|
||||
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;
|
||||
|
||||
|
@@ -75,10 +75,6 @@ public:
|
||||
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 );
|
||||
|
||||
|
||||
@@ -142,6 +138,10 @@ protected:
|
||||
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)
|
||||
|
@@ -83,9 +83,6 @@ public:
|
||||
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);
|
||||
@@ -503,6 +500,9 @@ protected:
|
||||
|
||||
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)
|
||||
@@ -555,8 +555,6 @@ private:
|
||||
bool HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
||||
|
||||
|
||||
|
||||
|
||||
// current defer window position operation handle (may be NULL)
|
||||
WXHANDLE m_hDWP;
|
||||
|
||||
@@ -567,10 +565,6 @@ protected:
|
||||
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;
|
||||
|
@@ -92,9 +92,7 @@ public:
|
||||
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);
|
||||
@@ -416,6 +414,9 @@ public:
|
||||
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
|
||||
|
@@ -73,8 +73,6 @@ public:
|
||||
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 );
|
||||
@@ -271,9 +269,6 @@ private:
|
||||
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()
|
||||
|
@@ -263,15 +263,6 @@ public:
|
||||
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
|
||||
@@ -772,13 +763,11 @@ protected:
|
||||
|
||||
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;
|
||||
|
@@ -858,13 +858,19 @@ public:
|
||||
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) ) { }
|
||||
@@ -1563,6 +1569,12 @@ protected:
|
||||
// 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();
|
||||
@@ -1583,11 +1595,19 @@ private:
|
||||
|
||||
// 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()
|
||||
|
@@ -205,9 +205,6 @@ public:
|
||||
|
||||
void SetModified() { m_modified = true; }
|
||||
|
||||
virtual void Freeze();
|
||||
virtual void Thaw();
|
||||
|
||||
// textctrl specific scrolling
|
||||
virtual bool ScrollLines(int lines);
|
||||
virtual bool ScrollPages(int pages);
|
||||
|
@@ -212,6 +212,8 @@ wxWindowBase::wxWindowBase()
|
||||
|
||||
// VZ: this one shouldn't exist...
|
||||
m_isBeingDeleted = false;
|
||||
|
||||
m_freezeCount = 0;
|
||||
}
|
||||
|
||||
// common part of window creation process
|
||||
|
@@ -79,7 +79,6 @@ END_EVENT_TABLE()
|
||||
void wxWindowDFB::Init()
|
||||
{
|
||||
m_isShown = true;
|
||||
m_frozenness = 0;
|
||||
m_tlw = NULL;
|
||||
m_overlays = NULL;
|
||||
}
|
||||
@@ -638,21 +637,11 @@ void wxWindowDFB::Update()
|
||||
GetParent()->Update();
|
||||
}
|
||||
|
||||
void wxWindowDFB::Freeze()
|
||||
{
|
||||
m_frozenness++;
|
||||
}
|
||||
|
||||
void wxWindowDFB::Thaw()
|
||||
{
|
||||
wxASSERT_MSG( IsFrozen(), "Thaw() without matching Freeze()" );
|
||||
|
||||
if ( --m_frozenness == 0 )
|
||||
void wxWindowDFB::DoThaw()
|
||||
{
|
||||
if ( IsShown() )
|
||||
DoRefreshWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void wxWindowDFB::PaintWindow(const wxRect& rect)
|
||||
{
|
||||
@@ -1080,7 +1069,7 @@ wxWindow* wxFindWindowAtPointer(wxPoint& pt)
|
||||
return wxFindWindowAtPoint(pt = wxGetMousePosition());
|
||||
}
|
||||
|
||||
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
|
||||
wxWindow* wxFindWindowAtPoint(const wxPoint& WXUNUSED(pt))
|
||||
{
|
||||
wxFAIL_MSG( "wxFindWindowAtPoint not implemented" );
|
||||
return NULL;
|
||||
|
@@ -600,9 +600,9 @@ public:
|
||||
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);
|
||||
@@ -850,9 +850,6 @@ private:
|
||||
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;
|
||||
@@ -2283,8 +2280,6 @@ void wxListMainWindow::Init()
|
||||
m_lineLastClicked =
|
||||
m_lineSelectSingleOnUp =
|
||||
m_lineBeforeLastClicked = (size_t)-1;
|
||||
|
||||
m_freezeCount = 0;
|
||||
}
|
||||
|
||||
wxListMainWindow::wxListMainWindow()
|
||||
@@ -2703,32 +2698,23 @@ void wxListMainWindow::RefreshSelected()
|
||||
}
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
@@ -5920,12 +5906,12 @@ void wxGenericListCtrl::Refresh(bool eraseBackground, const wxRect *rect)
|
||||
}
|
||||
}
|
||||
|
||||
void wxGenericListCtrl::Freeze()
|
||||
void wxGenericListCtrl::DoFreeze()
|
||||
{
|
||||
m_mainWin->Freeze();
|
||||
}
|
||||
|
||||
void wxGenericListCtrl::Thaw()
|
||||
void wxGenericListCtrl::DoThaw()
|
||||
{
|
||||
m_mainWin->Thaw();
|
||||
}
|
||||
|
@@ -782,7 +782,6 @@ void wxGenericTreeCtrl::Init()
|
||||
m_textCtrl = NULL;
|
||||
|
||||
m_renameTimer = NULL;
|
||||
m_freezeCount = 0;
|
||||
|
||||
m_findTimer = NULL;
|
||||
|
||||
@@ -1646,7 +1645,7 @@ void wxGenericTreeCtrl::Expand(const wxTreeItemId& itemId)
|
||||
}
|
||||
|
||||
item->Expand();
|
||||
if ( !m_freezeCount )
|
||||
if ( !IsFrozen() )
|
||||
{
|
||||
CalculatePositions();
|
||||
|
||||
@@ -3517,13 +3516,13 @@ void wxGenericTreeCtrl::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();
|
||||
@@ -3540,7 +3539,7 @@ void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item)
|
||||
|
||||
void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item )
|
||||
{
|
||||
if (m_dirty || m_freezeCount)
|
||||
if (m_dirty || IsFrozen() )
|
||||
return;
|
||||
|
||||
wxRect rect;
|
||||
@@ -3553,7 +3552,7 @@ void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item )
|
||||
|
||||
void wxGenericTreeCtrl::RefreshSelected()
|
||||
{
|
||||
if (m_freezeCount)
|
||||
if (IsFrozen())
|
||||
return;
|
||||
|
||||
// TODO: this is awfully inefficient, we should keep the list of all
|
||||
@@ -3564,7 +3563,7 @@ void wxGenericTreeCtrl::RefreshSelected()
|
||||
|
||||
void wxGenericTreeCtrl::RefreshSelectedUnder(wxGenericTreeItem *item)
|
||||
{
|
||||
if (m_freezeCount)
|
||||
if (IsFrozen())
|
||||
return;
|
||||
|
||||
if ( item->IsSelected() )
|
||||
@@ -3578,23 +3577,13 @@ void wxGenericTreeCtrl::RefreshSelectedUnder(wxGenericTreeItem *item)
|
||||
}
|
||||
}
|
||||
|
||||
void wxGenericTreeCtrl::Freeze()
|
||||
{
|
||||
m_freezeCount++;
|
||||
}
|
||||
|
||||
void wxGenericTreeCtrl::Thaw()
|
||||
{
|
||||
wxCHECK_RET( m_freezeCount > 0, _T("thawing unfrozen tree control?") );
|
||||
|
||||
if ( --m_freezeCount == 0 )
|
||||
void wxGenericTreeCtrl::DoThaw()
|
||||
{
|
||||
if ( m_dirty )
|
||||
DoDirtyProcessing();
|
||||
else
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// changing colours: we need to refresh the tree control
|
||||
@@ -3654,7 +3643,7 @@ wxGenericTreeCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
|
||||
|
||||
void wxGenericTreeCtrl::DoDirtyProcessing()
|
||||
{
|
||||
if (m_freezeCount)
|
||||
if (IsFrozen())
|
||||
return;
|
||||
|
||||
m_dirty = false;
|
||||
|
@@ -614,7 +614,6 @@ void wxTextCtrl::Init()
|
||||
SetUpdateFont(false);
|
||||
|
||||
m_text = NULL;
|
||||
m_freezeCount = 0;
|
||||
m_showPositionOnThaw = NULL;
|
||||
m_gdkHandCursor = NULL;
|
||||
m_gdkXTermCursor = NULL;
|
||||
@@ -1719,13 +1718,11 @@ wxSize wxTextCtrl::DoGetBestSize() const
|
||||
// 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",
|
||||
@@ -1747,15 +1744,10 @@ void wxTextCtrl::Freeze()
|
||||
gtk_text_buffer_delete_mark(m_buffer, mark);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxTextCtrl::Thaw()
|
||||
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);
|
||||
@@ -1773,7 +1765,6 @@ void wxTextCtrl::Thaw()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextUrlEvent passing if style & wxTE_AUTO_URL
|
||||
|
@@ -1290,7 +1290,7 @@ wxSize wxTextCtrl::DoGetBestSize() const
|
||||
// freeze/thaw
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxTextCtrl::Freeze()
|
||||
void wxTextCtrl::DoFreeze()
|
||||
{
|
||||
if ( HasFlag(wxTE_MULTILINE) )
|
||||
{
|
||||
@@ -1298,7 +1298,7 @@ void wxTextCtrl::Freeze()
|
||||
}
|
||||
}
|
||||
|
||||
void wxTextCtrl::Thaw()
|
||||
void wxTextCtrl::DoThaw()
|
||||
{
|
||||
if ( HasFlag(wxTE_MULTILINE) )
|
||||
{
|
||||
|
@@ -865,7 +865,6 @@ wxWindowMac::wxWindowMac(wxWindowMac *parent,
|
||||
void wxWindowMac::Init()
|
||||
{
|
||||
m_peer = NULL ;
|
||||
m_frozenness = 0 ;
|
||||
m_macAlpha = 255 ;
|
||||
m_cgContextRef = NULL ;
|
||||
|
||||
@@ -2091,38 +2090,25 @@ void wxWindowMac::Refresh(bool WXUNUSED(eraseBack), const wxRect *rect)
|
||||
}
|
||||
}
|
||||
|
||||
void wxWindowMac::Freeze()
|
||||
void wxWindowMac::DoFreeze()
|
||||
{
|
||||
#if TARGET_API_MAC_OSX
|
||||
if ( !m_frozenness++ )
|
||||
{
|
||||
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() )
|
||||
{
|
||||
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
|
||||
|
@@ -550,7 +550,6 @@ void wxWindowMGL::Init()
|
||||
// mgl specific:
|
||||
m_wnd = NULL;
|
||||
m_isShown = true;
|
||||
m_frozen = false;
|
||||
m_paintMGLDC = NULL;
|
||||
m_eraseBackground = -1;
|
||||
}
|
||||
@@ -1119,26 +1118,24 @@ void wxWindowMGL::Refresh(bool eraseBack, const wxRect *rect)
|
||||
|
||||
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;
|
||||
|
@@ -1172,10 +1172,10 @@ bool wxTopLevelWindowMSW::CanSetTransparent()
|
||||
}
|
||||
|
||||
|
||||
void wxTopLevelWindowMSW::Freeze()
|
||||
void wxTopLevelWindowMSW::DoFreeze()
|
||||
{
|
||||
if ( IsShown() )
|
||||
{
|
||||
if ( !m_frozenness++) {
|
||||
if (IsShown()) {
|
||||
for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
|
||||
node;
|
||||
node = node->GetNext() )
|
||||
@@ -1183,19 +1183,16 @@ void wxTopLevelWindowMSW::Freeze()
|
||||
wxWindow *child = node->GetData();
|
||||
if ( child->IsTopLevel() )
|
||||
continue;
|
||||
else
|
||||
|
||||
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() )
|
||||
@@ -1203,24 +1200,22 @@ void wxTopLevelWindowMSW::Thaw()
|
||||
wxWindow *child = node->GetData();
|
||||
if ( child->IsTopLevel() )
|
||||
continue;
|
||||
else
|
||||
|
||||
child->Thaw();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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++) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@@ -524,8 +524,6 @@ void wxWindowMSW::Init()
|
||||
m_mouseInWindow = false;
|
||||
m_lastKeydownProcessed = false;
|
||||
|
||||
m_frozenness = 0;
|
||||
|
||||
m_hWnd = 0;
|
||||
m_hDWP = 0;
|
||||
|
||||
@@ -1606,20 +1604,13 @@ static inline void SendSetRedraw(HWND hwnd, bool on)
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxWindowMSW::Freeze()
|
||||
{
|
||||
if ( !m_frozenness++ )
|
||||
void wxWindowMSW::DoFreeze()
|
||||
{
|
||||
if ( IsShown() )
|
||||
SendSetRedraw(GetHwnd(), false);
|
||||
}
|
||||
}
|
||||
|
||||
void wxWindowMSW::Thaw()
|
||||
{
|
||||
wxASSERT_MSG( m_frozenness > 0, _T("Thaw() without matching Freeze()") );
|
||||
|
||||
if ( --m_frozenness == 0 )
|
||||
void wxWindowMSW::DoThaw()
|
||||
{
|
||||
if ( IsShown() )
|
||||
{
|
||||
@@ -1630,7 +1621,6 @@ void wxWindowMSW::Thaw()
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxWindowMSW::Refresh(bool eraseBack, const wxRect *rect)
|
||||
{
|
||||
|
@@ -1109,12 +1109,12 @@ void wxWindowOS2::Update()
|
||||
::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);
|
||||
|
||||
|
@@ -432,14 +432,6 @@ bool wxWindowPalm::Reparent(wxWindowBase *parent)
|
||||
return false;
|
||||
}
|
||||
|
||||
void wxWindowPalm::Freeze()
|
||||
{
|
||||
}
|
||||
|
||||
void wxWindowPalm::Thaw()
|
||||
{
|
||||
}
|
||||
|
||||
void wxWindowPalm::Refresh(bool eraseBack, const wxRect *rect)
|
||||
{
|
||||
WinHandle handle = (WinHandle)GetHWND();
|
||||
|
@@ -201,7 +201,6 @@ wxRichTextCtrl::~wxRichTextCtrl()
|
||||
/// Member initialisation
|
||||
void wxRichTextCtrl::Init()
|
||||
{
|
||||
m_freezeCount = 0;
|
||||
m_contextMenu = NULL;
|
||||
m_caret = NULL;
|
||||
m_caretPosition = -1;
|
||||
@@ -217,18 +216,7 @@ void wxRichTextCtrl::Init()
|
||||
m_caretPositionForDefaultStyle = -2;
|
||||
}
|
||||
|
||||
/// Call Freeze to prevent refresh
|
||||
void wxRichTextCtrl::Freeze()
|
||||
{
|
||||
m_freezeCount ++;
|
||||
}
|
||||
|
||||
/// Call Thaw to refresh
|
||||
void wxRichTextCtrl::Thaw()
|
||||
{
|
||||
m_freezeCount --;
|
||||
|
||||
if (m_freezeCount == 0)
|
||||
void wxRichTextCtrl::DoThaw()
|
||||
{
|
||||
if (GetBuffer().GetDirty())
|
||||
LayoutContent();
|
||||
@@ -236,7 +224,6 @@ void wxRichTextCtrl::Thaw()
|
||||
SetupScrollbars();
|
||||
Refresh(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// Clear all text
|
||||
void wxRichTextCtrl::Clear()
|
||||
@@ -248,7 +235,7 @@ void wxRichTextCtrl::Clear()
|
||||
m_caretAtLineStart = false;
|
||||
m_selectionRange.SetRange(-2, -2);
|
||||
|
||||
if (m_freezeCount == 0)
|
||||
if (!IsFrozen())
|
||||
{
|
||||
LayoutContent();
|
||||
Refresh(false);
|
||||
@@ -269,11 +256,12 @@ void wxRichTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
#else
|
||||
wxPaintDC dc(this);
|
||||
#endif
|
||||
PrepareDC(dc);
|
||||
|
||||
if (m_freezeCount > 0)
|
||||
if (IsFrozen())
|
||||
return;
|
||||
|
||||
PrepareDC(dc);
|
||||
|
||||
dc.SetFont(GetFont());
|
||||
|
||||
// Paint the background
|
||||
@@ -1789,7 +1777,7 @@ void wxRichTextCtrl::OnScroll(wxScrollWinEvent& event)
|
||||
/// Set up scrollbars, e.g. after a resize
|
||||
void wxRichTextCtrl::SetupScrollbars(bool atTop)
|
||||
{
|
||||
if (m_freezeCount)
|
||||
if (IsFrozen())
|
||||
return;
|
||||
|
||||
if (GetBuffer().IsEmpty())
|
||||
|
@@ -2375,18 +2375,6 @@ wxSize wxTextCtrl::DoGetBestSize() const
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// freeze/thaw
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxTextCtrl::Freeze()
|
||||
{
|
||||
}
|
||||
|
||||
void wxTextCtrl::Thaw()
|
||||
{
|
||||
}
|
||||
|
||||
void wxTextCtrl::OnSetFocus( wxFocusEvent& event )
|
||||
{
|
||||
// To hide or show caret, as appropriate
|
||||
|
Reference in New Issue
Block a user