implemented Freeze/Thaw() (patch 922156)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26499 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -89,8 +89,8 @@ All (GUI):
|
|||||||
|
|
||||||
- wxHtmlWindow now delays image scaling until rendering,
|
- wxHtmlWindow now delays image scaling until rendering,
|
||||||
resulting in much better display of scaled images
|
resulting in much better display of scaled images
|
||||||
- Added UpdateSize to wxSplitterWindow to allow layout
|
- Added UpdateSize to wxSplitterWindow to allow layout while hidden
|
||||||
while hidden
|
- implemented Freeze/Thaw() for wxGenericTreeCtrl (Kevin Hock)
|
||||||
|
|
||||||
wxMSW:
|
wxMSW:
|
||||||
|
|
||||||
|
@@ -378,6 +378,9 @@ public:
|
|||||||
virtual bool SetBackgroundColour(const wxColour& colour);
|
virtual bool SetBackgroundColour(const wxColour& colour);
|
||||||
virtual bool SetForegroundColour(const wxColour& colour);
|
virtual bool SetForegroundColour(const wxColour& colour);
|
||||||
|
|
||||||
|
virtual void Freeze();
|
||||||
|
virtual void Thaw();
|
||||||
|
|
||||||
// callbacks
|
// callbacks
|
||||||
void OnPaint( wxPaintEvent &event );
|
void OnPaint( wxPaintEvent &event );
|
||||||
void OnSetFocus( wxFocusEvent &event );
|
void OnSetFocus( wxFocusEvent &event );
|
||||||
@@ -419,6 +422,7 @@ protected:
|
|||||||
*m_imageListState,
|
*m_imageListState,
|
||||||
*m_imageListButtons;
|
*m_imageListButtons;
|
||||||
|
|
||||||
|
int m_freezeCount;
|
||||||
int m_dragCount;
|
int m_dragCount;
|
||||||
wxPoint m_dragStart;
|
wxPoint m_dragStart;
|
||||||
wxGenericTreeItem *m_dropTarget;
|
wxGenericTreeItem *m_dropTarget;
|
||||||
|
@@ -734,6 +734,8 @@ void wxGenericTreeCtrl::Init()
|
|||||||
m_textCtrl = NULL;
|
m_textCtrl = NULL;
|
||||||
|
|
||||||
m_renameTimer = NULL;
|
m_renameTimer = NULL;
|
||||||
|
m_freezeCount = 0;
|
||||||
|
|
||||||
m_findTimer = NULL;
|
m_findTimer = NULL;
|
||||||
|
|
||||||
m_lastOnSame = FALSE;
|
m_lastOnSame = FALSE;
|
||||||
@@ -3219,6 +3221,7 @@ void wxGenericTreeCtrl::OnInternalIdle()
|
|||||||
* we actually redraw the tree when everything is over */
|
* we actually redraw the tree when everything is over */
|
||||||
|
|
||||||
if (!m_dirty) return;
|
if (!m_dirty) return;
|
||||||
|
if (m_freezeCount) return;
|
||||||
|
|
||||||
m_dirty = FALSE;
|
m_dirty = FALSE;
|
||||||
|
|
||||||
@@ -3330,6 +3333,7 @@ void wxGenericTreeCtrl::CalculatePositions()
|
|||||||
void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item)
|
void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item)
|
||||||
{
|
{
|
||||||
if (m_dirty) return;
|
if (m_dirty) return;
|
||||||
|
if (m_freezeCount) return;
|
||||||
|
|
||||||
wxSize client = GetClientSize();
|
wxSize client = GetClientSize();
|
||||||
|
|
||||||
@@ -3346,6 +3350,7 @@ void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item)
|
|||||||
void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item )
|
void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item )
|
||||||
{
|
{
|
||||||
if (m_dirty) return;
|
if (m_dirty) return;
|
||||||
|
if (m_freezeCount) return;
|
||||||
|
|
||||||
wxRect rect;
|
wxRect rect;
|
||||||
CalcScrolledPosition(0, item->GetY(), NULL, &rect.y);
|
CalcScrolledPosition(0, item->GetY(), NULL, &rect.y);
|
||||||
@@ -3357,6 +3362,8 @@ void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item )
|
|||||||
|
|
||||||
void wxGenericTreeCtrl::RefreshSelected()
|
void wxGenericTreeCtrl::RefreshSelected()
|
||||||
{
|
{
|
||||||
|
if (m_freezeCount) return;
|
||||||
|
|
||||||
// TODO: this is awfully inefficient, we should keep the list of all
|
// TODO: this is awfully inefficient, we should keep the list of all
|
||||||
// selected items internally, should be much faster
|
// selected items internally, should be much faster
|
||||||
if ( m_anchor )
|
if ( m_anchor )
|
||||||
@@ -3365,6 +3372,8 @@ void wxGenericTreeCtrl::RefreshSelected()
|
|||||||
|
|
||||||
void wxGenericTreeCtrl::RefreshSelectedUnder(wxGenericTreeItem *item)
|
void wxGenericTreeCtrl::RefreshSelectedUnder(wxGenericTreeItem *item)
|
||||||
{
|
{
|
||||||
|
if (m_freezeCount) return;
|
||||||
|
|
||||||
if ( item->IsSelected() )
|
if ( item->IsSelected() )
|
||||||
RefreshLine(item);
|
RefreshLine(item);
|
||||||
|
|
||||||
@@ -3376,6 +3385,21 @@ 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 )
|
||||||
|
{
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// changing colours: we need to refresh the tree control
|
// changing colours: we need to refresh the tree control
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -3385,6 +3409,8 @@ bool wxGenericTreeCtrl::SetBackgroundColour(const wxColour& colour)
|
|||||||
if ( !wxWindow::SetBackgroundColour(colour) )
|
if ( !wxWindow::SetBackgroundColour(colour) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (m_freezeCount) return TRUE;
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -3395,6 +3421,8 @@ bool wxGenericTreeCtrl::SetForegroundColour(const wxColour& colour)
|
|||||||
if ( !wxWindow::SetForegroundColour(colour) )
|
if ( !wxWindow::SetForegroundColour(colour) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (m_freezeCount) return TRUE;
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Reference in New Issue
Block a user