]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/treectrl.cpp
fixes for compilation with wxUSE_PALETTE=0
[wxWidgets.git] / src / msw / treectrl.cpp
index b21c0ec0c0935edef5b27826884d3ed2e84151ad..f6dab4428b734f8c276cdbf6c14a73a2cdd69e14 100644 (file)
@@ -1046,6 +1046,7 @@ void wxTreeCtrl::SetItemTextColour(const wxTreeItemId& item,
     }
 
     attr->SetTextColour(col);
+    Refresh();
 }
 
 void wxTreeCtrl::SetItemBackgroundColour(const wxTreeItemId& item,
@@ -1062,6 +1063,7 @@ void wxTreeCtrl::SetItemBackgroundColour(const wxTreeItemId& item,
     }
 
     attr->SetBackgroundColour(col);
+    Refresh();
 }
 
 void wxTreeCtrl::SetItemFont(const wxTreeItemId& item, const wxFont& font)
@@ -1077,6 +1079,7 @@ void wxTreeCtrl::SetItemFont(const wxTreeItemId& item, const wxFont& font)
     }
 
     attr->SetFont(font);
+    Refresh();
 }
 
 // ----------------------------------------------------------------------------
@@ -2067,9 +2070,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;
@@ -2101,7 +2101,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() &&
@@ -2138,19 +2144,19 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
             }
             break;
 
-#if defined(_WIN32_IE) && _WIN32_IE >= 0x300 && !wxUSE_COMCTL32_SAFELY
+#if defined(_WIN32_IE) && _WIN32_IE >= 0x300 && !wxUSE_COMCTL32_SAFELY && !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 0 ) )
         case NM_CUSTOMDRAW:
             {
                 LPNMTVCUSTOMDRAW lptvcd = (LPNMTVCUSTOMDRAW)lParam;
                 NMCUSTOMDRAW& nmcd = lptvcd->nmcd;
-                switch( nmcd.dwDrawStage )
+                switch ( nmcd.dwDrawStage )
                 {
                     case CDDS_PREPAINT:
                         // if we've got any items with non standard attributes,
                         // notify us before painting each item
                         *result = m_hasAnyAttr ? CDRF_NOTIFYITEMDRAW
                                                : CDRF_DODEFAULT;
-                        return TRUE;
+                        break;
 
                     case CDDS_ITEMPREPAINT:
                         {
@@ -2160,7 +2166,8 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
                             if ( !attr )
                             {
                                 // nothing to do for this item
-                                return CDRF_DODEFAULT;
+                                *result = CDRF_DODEFAULT;
+                                break;
                             }
 
                             HFONT hFont;
@@ -2223,16 +2230,16 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
                             {
                                 *result = CDRF_DODEFAULT;
                             }
-
-                            return TRUE;
                         }
+                        break;
 
                     default:
                         *result = CDRF_DODEFAULT;
-                        return TRUE;
                 }
             }
-//            break;  // can never be reached
+
+            // we always process it
+            return TRUE;
 #endif // _WIN32_IE >= 0x300
 
         case NM_DBLCLK: