]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/treectrl.cpp
compilation fix for CE: don't use GetModuleHandleA() which doesn't exist there
[wxWidgets.git] / src / msw / treectrl.cpp
index b7329c5289178ace09ea60d6e6d3b0dc8790acda..2a2bb3b124d954c622a037ff3cf422a662557259 100644 (file)
@@ -716,8 +716,8 @@ bool wxTreeCtrl::Create(wxWindow *parent,
         HDC hdcMem = CreateCompatibleDC(NULL);
 
         // create a mono bitmap of the standard size
-        int x = GetSystemMetrics(SM_CXMENUCHECK);
-        int y = GetSystemMetrics(SM_CYMENUCHECK);
+        int x = ::GetSystemMetrics(SM_CXMENUCHECK);
+        int y = ::GetSystemMetrics(SM_CYMENUCHECK);
         wxImageList imagelistCheckboxes(x, y, false, 2);
         HBITMAP hbmpCheck = CreateBitmap(x, y,   // bitmap size
                                          1,      // # of color planes
@@ -1719,6 +1719,26 @@ wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parent,
                         image, selImage, NULL);
 }
 
+wxImageList *wxTreeCtrl::GetImageList(int) const
+{
+    return GetImageList();
+}
+
+void wxTreeCtrl::SetImageList(wxImageList *imageList, int)
+{
+    SetImageList(imageList);
+}
+
+int wxTreeCtrl::GetItemSelectedImage(const wxTreeItemId& item) const
+{
+    return GetItemImage(item, wxTreeItemIcon_Selected);
+}
+
+void wxTreeCtrl::SetItemSelectedImage(const wxTreeItemId& item, int image)
+{
+    SetItemImage(item, image, wxTreeItemIcon_Selected);
+}
+
 #endif // WXWIN_COMPATIBILITY_2_4
 
 wxTreeItemId wxTreeCtrl::AddRoot(const wxString& text,
@@ -1900,10 +1920,12 @@ void wxTreeCtrl::Toggle(const wxTreeItemId& item)
 }
 
 #if WXWIN_COMPATIBILITY_2_4
+
 void wxTreeCtrl::ExpandItem(const wxTreeItemId& item, int action)
 {
     DoExpand(item, action);
 }
+
 #endif
 
 void wxTreeCtrl::Unselect()
@@ -2053,7 +2075,7 @@ wxTextCtrl* wxTreeCtrl::EditLabel(const wxTreeItemId& item,
 }
 
 // End label editing, optionally cancelling the edit
-void wxTreeCtrl::EndEditLabel(const wxTreeItemId& WXUNUSED(item), bool discardChanges)
+void wxTreeCtrl::DoEndEditLabel(bool discardChanges)
 {
     TreeView_EndEditLabelNow(GetHwnd(), discardChanges);
 
@@ -2219,6 +2241,18 @@ WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara
     WXLRESULT rc = 0;
     bool isMultiple = (GetWindowStyle() & wxTR_MULTIPLE) != 0;
 
+#ifndef __SMARTPHONE__
+    if (nMsg == WM_CONTEXTMENU)
+    {
+        wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_MENU, GetId() );
+        event.m_item = GetSelection();
+        event.SetEventObject( this );
+        GetEventHandler()->ProcessEvent( event );
+
+        return rc;
+    }
+#endif // __SMARTPHONE__
+
     if ( (nMsg >= WM_MOUSEFIRST) && (nMsg <= WM_MOUSELAST) )
     {
         // we only process mouse messages here and these parameters have the
@@ -2476,6 +2510,24 @@ WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara
             processed = true;
         }
     }
+    else if ( nMsg == WM_COMMAND )
+    {
+        // if we receive a EN_KILLFOCUS command from the in-place edit control
+        // used for label editing, make sure to end editing
+        WORD id, cmd;
+        WXHWND hwnd;
+        UnpackCommand(wParam, lParam, &id, &hwnd, &cmd);
+
+        if ( cmd == EN_KILLFOCUS )
+        {
+            if ( m_textCtrl && m_textCtrl->GetHandle() == hwnd )
+            {
+                DoEndEditLabel();
+
+                processed = true;
+            }
+        }
+    }
 
     if ( !processed )
         rc = wxControl::MSWWindowProc(nMsg, wParam, lParam);
@@ -3039,5 +3091,14 @@ int wxTreeCtrl::GetState(const wxTreeItemId& node)
     return STATEIMAGEMASKTOINDEX(tvi.state);
 }
 
+#if WXWIN_COMPATIBILITY_2_2
+
+wxTreeItemId wxTreeCtrl::GetParent(const wxTreeItemId& item) const
+{
+    return GetItemParent( item );
+}
+
+#endif  // WXWIN_COMPATIBILITY_2_2
+
 #endif // wxUSE_TREECTRL