fixed flicker in wxTreeCtrl::SetItemXXX()
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 15 Dec 2001 22:20:54 +0000 (22:20 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 15 Dec 2001 22:20:54 +0000 (22:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13026 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/msw/treectrl.h
src/msw/treectrl.cpp

index 609040bc9d6a88dce4e90d86e6898d5de4b0522f..988bb291ed67a8ba73b7df170314e9d53272a84f 100644 (file)
@@ -60,6 +60,13 @@ Unix ports:
   and the compiler flags for C++ files only, CFLAGS should still be used
   to compile pure C files.
 
+2.3.3
+-----
+
+wxMSW:
+
+- fixed flicker in wxTreeCtrl::SetItemXXX()
+
 2.3.2
 -----
 
index f995392953c90f1093051964095db058f7f1c92a..ef9f23cff152f259b7bc782e9fae42401d56d2d7 100644 (file)
@@ -400,6 +400,9 @@ protected:
     // SetImageList helper
     void SetAnyImageList(wxImageList *imageList, int which);
 
+    // refresh a single item
+    void RefreshItem(const wxTreeItemId& item);
+
     wxTextCtrl  *m_textCtrl;        // used while editing the item label
     wxImageList *m_imageListNormal, // images for tree elements
                 *m_imageListState;  // special images for app defined states
index e34ecfac6229f0a890adc6deaa464b2128f3746b..69ff37efc2366f901da016a18737628d7aa90e94 100644 (file)
@@ -1032,6 +1032,15 @@ void wxTreeCtrl::SetItemDropHighlight(const wxTreeItemId& item, bool highlight)
     DoSetItem(&tvItem);
 }
 
+void wxTreeCtrl::RefreshItem(const wxTreeItemId& item)
+{
+    wxRect rect;
+    if ( GetBoundingRect(item, rect) )
+    {
+        RefreshRect(rect);
+    }
+}
+
 void wxTreeCtrl::SetItemTextColour(const wxTreeItemId& item,
                                    const wxColour& col)
 {
@@ -1046,7 +1055,8 @@ void wxTreeCtrl::SetItemTextColour(const wxTreeItemId& item,
     }
 
     attr->SetTextColour(col);
-    Refresh();
+
+    RefreshItem(item);
 }
 
 void wxTreeCtrl::SetItemBackgroundColour(const wxTreeItemId& item,
@@ -1063,7 +1073,8 @@ void wxTreeCtrl::SetItemBackgroundColour(const wxTreeItemId& item,
     }
 
     attr->SetBackgroundColour(col);
-    Refresh();
+
+    RefreshItem(item);
 }
 
 void wxTreeCtrl::SetItemFont(const wxTreeItemId& item, const wxFont& font)
@@ -1079,7 +1090,8 @@ void wxTreeCtrl::SetItemFont(const wxTreeItemId& item, const wxFont& font)
     }
 
     attr->SetFont(font);
-    Refresh();
+
+    RefreshItem(item);
 }
 
 // ----------------------------------------------------------------------------
@@ -1097,7 +1109,6 @@ bool wxTreeCtrl::IsVisible(const wxTreeItemId& item) const
 
     // FALSE means get item rect for the whole item, not only text
     return SendMessage(GetHwnd(), TVM_GETITEMRECT, FALSE, (LPARAM)&rect) != 0;
-
 }
 
 bool wxTreeCtrl::ItemHasChildren(const wxTreeItemId& item) const