X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/afff720b28d92364a9d88e214deddf831a60c1c2..399b60a0ad232265cd74ce8bf6a53a1f2cc57ff2:/src/msw/treectrl.cpp diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 63f54e57d3..7f8403c58f 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -86,10 +86,6 @@ // looks quite ugly. #define wxUSE_CHECKBOXES_IN_MULTI_SEL_TREE 0 -// from msw/window.cpp -extern bool wxIsShiftDown(); -extern bool wxIsCtrlDown(); - // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- @@ -101,7 +97,6 @@ static HTREEITEM GetItemFromPoint(HWND hwndTV, int x, int y) tvht.pt.x = x; tvht.pt.y = y; - // TreeView_HitTest() doesn't do the right cast in mingw32 headers return (HTREEITEM)TreeView_HitTest(hwndTV, &tvht); } @@ -156,7 +151,7 @@ static void SelectRange(HWND hwndTV, { // find the first (or last) item and select it bool cont = TRUE; - HTREEITEM htItem = TreeView_GetRoot(hwndTV); + HTREEITEM htItem = (HTREEITEM)TreeView_GetRoot(hwndTV); while ( htItem && cont ) { if ( (htItem == htFirst) || (htItem == htLast) ) @@ -176,7 +171,7 @@ static void SelectRange(HWND hwndTV, } } - htItem = TreeView_GetNextVisible(hwndTV, htItem); + htItem = (HTREEITEM)TreeView_GetNextVisible(hwndTV, htItem); } // select the items in range @@ -190,7 +185,7 @@ static void SelectRange(HWND hwndTV, cont = (htItem != htFirst) && (htItem != htLast); - htItem = TreeView_GetNextVisible(hwndTV, htItem); + htItem = (HTREEITEM)TreeView_GetNextVisible(hwndTV, htItem); } // unselect the rest @@ -203,7 +198,7 @@ static void SelectRange(HWND hwndTV, UnselectItem(hwndTV, htItem); } - htItem = TreeView_GetNextVisible(hwndTV, htItem); + htItem = (HTREEITEM)TreeView_GetNextVisible(hwndTV, htItem); } } @@ -218,7 +213,7 @@ static void SelectRange(HWND hwndTV, static void SetFocus(HWND hwndTV, HTREEITEM htItem) { // the current focus - HTREEITEM htFocus = TreeView_GetSelection(hwndTV); + HTREEITEM htFocus = (HTREEITEM)TreeView_GetSelection(hwndTV); if ( htItem ) { @@ -1203,6 +1198,10 @@ wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent, int image, int selectedImage, wxTreeItemData *data) { + wxCHECK_MSG( parent.IsOk() || !TreeView_GetRoot(GetHwnd()), + wxTreeItemId(), + _T("can't have more than one root in the tree") ); + TV_INSERTSTRUCT tvIns; tvIns.hParent = HITEM(parent); tvIns.hInsertAfter = HITEM(hInsertAfter); @@ -1842,7 +1841,7 @@ long wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) // we handle.arrows and space, but not page up/down and home/end: the // latter should be easy, but not the former - HTREEITEM htSel = TreeView_GetSelection(GetHwnd()); + HTREEITEM htSel = (HTREEITEM)TreeView_GetSelection(GetHwnd()); if ( !m_htSelStart ) { m_htSelStart = (WXHTREEITEM)htSel; @@ -1875,9 +1874,9 @@ long wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { (void)wxControl::MSWWindowProc(nMsg, wParam, lParam); - HTREEITEM htNext = - wParam == VK_UP ? TreeView_GetPrevVisible(GetHwnd(), htSel) - : TreeView_GetNextVisible(GetHwnd(), htSel); + HTREEITEM htNext = (HTREEITEM)(wParam == VK_UP + ? TreeView_GetPrevVisible(GetHwnd(), htSel) + : TreeView_GetNextVisible(GetHwnd(), htSel)); if ( !htNext ) {