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:
Vadim Zeitlin 2004-03-30 17:10:30 +00:00
parent 83ce56341b
commit e1983ab588
3 changed files with 35 additions and 3 deletions

View File

@ -89,8 +89,8 @@ All (GUI):
- wxHtmlWindow now delays image scaling until rendering,
resulting in much better display of scaled images
- Added UpdateSize to wxSplitterWindow to allow layout
while hidden
- Added UpdateSize to wxSplitterWindow to allow layout while hidden
- implemented Freeze/Thaw() for wxGenericTreeCtrl (Kevin Hock)
wxMSW:

View File

@ -378,6 +378,9 @@ public:
virtual bool SetBackgroundColour(const wxColour& colour);
virtual bool SetForegroundColour(const wxColour& colour);
virtual void Freeze();
virtual void Thaw();
// callbacks
void OnPaint( wxPaintEvent &event );
void OnSetFocus( wxFocusEvent &event );
@ -419,6 +422,7 @@ protected:
*m_imageListState,
*m_imageListButtons;
int m_freezeCount;
int m_dragCount;
wxPoint m_dragStart;
wxGenericTreeItem *m_dropTarget;

View File

@ -734,6 +734,8 @@ void wxGenericTreeCtrl::Init()
m_textCtrl = NULL;
m_renameTimer = NULL;
m_freezeCount = 0;
m_findTimer = NULL;
m_lastOnSame = FALSE;
@ -3219,7 +3221,8 @@ void wxGenericTreeCtrl::OnInternalIdle()
* we actually redraw the tree when everything is over */
if (!m_dirty) return;
if (m_freezeCount) return;
m_dirty = FALSE;
CalculatePositions();
@ -3330,6 +3333,7 @@ void wxGenericTreeCtrl::CalculatePositions()
void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item)
{
if (m_dirty) return;
if (m_freezeCount) return;
wxSize client = GetClientSize();
@ -3346,6 +3350,7 @@ void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item)
void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item )
{
if (m_dirty) return;
if (m_freezeCount) return;
wxRect rect;
CalcScrolledPosition(0, item->GetY(), NULL, &rect.y);
@ -3357,6 +3362,8 @@ void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item )
void wxGenericTreeCtrl::RefreshSelected()
{
if (m_freezeCount) return;
// TODO: this is awfully inefficient, we should keep the list of all
// selected items internally, should be much faster
if ( m_anchor )
@ -3365,6 +3372,8 @@ void wxGenericTreeCtrl::RefreshSelected()
void wxGenericTreeCtrl::RefreshSelectedUnder(wxGenericTreeItem *item)
{
if (m_freezeCount) return;
if ( item->IsSelected() )
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
// ----------------------------------------------------------------------------
@ -3385,6 +3409,8 @@ bool wxGenericTreeCtrl::SetBackgroundColour(const wxColour& colour)
if ( !wxWindow::SetBackgroundColour(colour) )
return FALSE;
if (m_freezeCount) return TRUE;
Refresh();
return TRUE;
@ -3395,6 +3421,8 @@ bool wxGenericTreeCtrl::SetForegroundColour(const wxColour& colour)
if ( !wxWindow::SetForegroundColour(colour) )
return FALSE;
if (m_freezeCount) return TRUE;
Refresh();
return TRUE;