X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7b21891e541b2381b2d0ce63b01563f4fd94d4d7..babc97583e1280ac0992ca8e3dbd7604e2d3963b:/src/msw/treectrl.cpp?ds=inline diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 500d880e7c..39277963f3 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -65,6 +65,10 @@ #define TV_FIRST 0x1100 #endif +#ifndef TVS_CHECKBOXES + #define TVS_CHECKBOXES 0x0100 +#endif + // old headers might miss these messages (comctl32.dll 4.71+ only) #ifndef TVM_SETBKCOLOR #define TVM_SETBKCOLOR (TV_FIRST + 29) @@ -247,7 +251,8 @@ static HTREEITEM GetItemFromPoint(HWND hwndTV, int x, int y) tvht.pt.x = x; tvht.pt.y = y; - return TreeView_HitTest(hwndTV, &tvht); + // TreeView_HitTest() doesn't do the right cast in mingw32 headers + return (HTREEITEM)TreeView_HitTest(hwndTV, &tvht); } // ---------------------------------------------------------------------------- @@ -344,6 +349,7 @@ bool wxTreeCtrl::Create(wxWindow *parent, !defined( __BORLANDC__ ) && \ !defined( __WATCOMC__ ) && \ (!defined(__VISUALC__) || (__VISUALC__ > 1010)) + // we emulate the multiple selection tree controls by using checkboxes: set // up the image list we need for this if we do have multiple selections if ( m_windowStyle & wxTR_MULTIPLE ) @@ -1315,6 +1321,24 @@ void wxTreeCtrl::ScrollTo(const wxTreeItemId& item) wxTextCtrl* wxTreeCtrl::GetEditControl() const { + // normally, we could try to do something like this to return something + // even when the editing was started by the user and not by calling + // EditLabel() - but as nobody has asked for this so far and there might be + // problems in the code below, I leave it disabled for now (VZ) +#if 0 + if ( !m_textCtrl ) + { + HWND hwndText = TreeView_GetEditControl(GetHwnd()); + if ( hwndText ) + { + m_textCtrl = new wxTextCtrl(this, -1); + m_textCtrl->Hide(); + m_textCtrl->SetHWND((WXHWND)hwndText); + } + //else: not editing label right now + } +#endif // 0 + return m_textCtrl; } @@ -1334,6 +1358,8 @@ wxTextCtrl* wxTreeCtrl::EditLabel(const wxTreeItemId& item, { wxASSERT( textControlClass->IsKindOf(CLASSINFO(wxTextCtrl)) ); + DeleteTextCtrl(); + HWND hWnd = (HWND) TreeView_EditLabel(GetHwnd(), (HTREEITEM) (WXHTREEITEM) item); // this is not an error - the TVN_BEGINLABELEDIT handler might have @@ -1343,8 +1369,6 @@ wxTextCtrl* wxTreeCtrl::EditLabel(const wxTreeItemId& item, return NULL; } - DeleteTextCtrl(); - m_textCtrl = (wxTextCtrl *)textControlClass->CreateObject(); m_textCtrl->SetHWND((WXHWND)hWnd); m_textCtrl->SubclassWin((WXHWND)hWnd); @@ -1525,6 +1549,10 @@ long wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) event.SetEventObject(this); (void)GetEventHandler()->ProcessEvent(event); + + // if we don't do it, the tree seems to think that 2 items + // are selected simultaneously which is quite weird + TreeView_SelectDropTarget(GetHwnd(), 0); } break; }