X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bf9b6266faaa6534b75e5282aab58f1476eecbaa..df16a53ef9ae506c51023178e4fe45ce45e69447:/src/msw/treectrl.cpp diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 5e20b78bb5..69ff37efc2 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -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 @@ -1786,7 +1797,6 @@ long wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { bool processed = FALSE; long rc = 0; - bool isMultiple = (GetWindowStyle() & wxTR_MULTIPLE) != 0; if ( (nMsg >= WM_MOUSEFIRST) && (nMsg <= WM_MOUSELAST) ) @@ -1978,7 +1988,6 @@ long wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) } } #endif // !wxUSE_CHECKBOXES_IN_MULTI_SEL_TREE - if ( !processed ) rc = wxControl::MSWWindowProc(nMsg, wParam, lParam); @@ -2070,9 +2079,6 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) } case TVN_ITEMEXPANDING: - event.m_code = FALSE; - // fall through - case TVN_ITEMEXPANDED: { NM_TREEVIEW* tv = (NM_TREEVIEW*)lParam; @@ -2104,7 +2110,13 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) eventType = wxEVT_COMMAND_TREE_KEY_DOWN; TV_KEYDOWN *info = (TV_KEYDOWN *)lParam; - event.m_code = wxCharCodeMSWToWX(info->wVKey); + // we pass 0 as last CreateKeyEvent() parameter because we + // don't have access to the real key press flags here - but as + // it is only used to determin wxKeyEvent::m_altDown flag it's + // not too bad + event.m_evtKey = CreateKeyEvent(wxEVT_KEY_DOWN, + wxCharCodeMSWToWX(info->wVKey), + 0); // a separate event for Space/Return if ( !wxIsCtrlDown() && !wxIsShiftDown() && @@ -2387,7 +2399,6 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // for the other messages the return value is ignored and there is // nothing special to do } - return processed; }