X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/44d60c0b26303c2b72bb4445fc9df270ffdaf429..503602dfe7fd468159d8d563657ad10c0bf6601f:/src/msw/treectrl.cpp diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index b7329c5289..6bc4c2341c 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -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 @@ -926,7 +926,7 @@ bool wxTreeCtrl::SetForegroundColour(const wxColour &colour) wxString wxTreeCtrl::GetItemText(const wxTreeItemId& item) const { - wxCHECK_MSG( item.IsOk(), wxT(""), wxT("invalid tree item") ); + wxCHECK_MSG( item.IsOk(), wxEmptyString, wxT("invalid tree item") ); wxChar buf[512]; // the size is arbitrary... @@ -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; +#ifdef WM_CONTEXTMENU + if ( nMsg == WM_CONTEXTMENU ) + { + wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_MENU, GetId() ); + event.m_item = GetSelection(); + event.SetEventObject( this ); + if ( GetEventHandler()->ProcessEvent(event) ) + return true; + //else: continue with generating wxEVT_CONTEXT_MENU in base class code + } +#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); @@ -2851,7 +2903,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxASSERT_MSG( !m_dragImage, _T("starting to drag once again?") ); m_dragImage = new wxDragImage(*this, event.m_item); - m_dragImage->BeginDrag(wxPoint(0, 0), this); + m_dragImage->BeginDrag(wxPoint(0,0), this); m_dragImage->Show(); } break; @@ -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