X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/84a6b8590b1e95e0325727059660508e4cf4df05..7b9da2077d0975db6c965a85c91d5aca671ab5e3:/src/msw/treectrl.cpp diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 8517884f18..aebe08ac39 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -67,7 +67,10 @@ // ---------------------------------------------------------------------------- // a convenient wrapper around TV_ITEM struct which adds a ctor +#ifdef __VISUALC__ #pragma warning( disable : 4097 ) +#endif + struct wxTreeViewItem : public TV_ITEM { wxTreeViewItem(const wxTreeItemId& item, // the item handle @@ -80,7 +83,10 @@ struct wxTreeViewItem : public TV_ITEM hItem = (HTREEITEM) (WXHTREEITEM) item; } }; + +#ifdef __VISUALC__ #pragma warning( default : 4097 ) +#endif // a class which encapsulates the tree traversal logic: it vists all (unless // OnVisit() returns FALSE) items under the given one @@ -309,10 +315,10 @@ bool wxTreeCtrl::Create(wxWindow *parent, if ( m_windowStyle & wxTR_LINES_AT_ROOT ) wstyle |= TVS_LINESATROOT; -#if !defined( __GNUWIN32__ ) && !defined( __BORLANDC__ ) && !defined(wxUSE_NORLANDER_HEADERS) +#if !defined( __GNUWIN32__ ) && !defined( __BORLANDC__ ) && !defined( __WATCOMC__ ) && !defined(wxUSE_NORLANDER_HEADERS) // 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 !defined(__VISUALC__) || (__VISUALC__ != 1010) +#if !defined(__VISUALC__) || (__VISUALC__ > 1010) if ( m_windowStyle & wxTR_MULTIPLE ) wstyle |= TVS_CHECKBOXES; #endif @@ -1342,22 +1348,24 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) switch ( hdr->code ) { case NM_RCLICK: - { - if ( wxControl::MSWOnNotify(idCtrl, lParam, result) ) - return TRUE; - - TV_HITTESTINFO tvhti; - ::GetCursorPos(&(tvhti.pt)); - ::ScreenToClient(GetHwnd(),&(tvhti.pt)); - if(TreeView_HitTest(GetHwnd(),&tvhti)!=NULL) { - if(tvhti.flags & TVHT_ONITEM) { - event.m_item = (WXHTREEITEM) tvhti.hItem; - eventType=wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK; - } - } - break; - } - + { + if ( wxControl::MSWOnNotify(idCtrl, lParam, result) ) + return TRUE; + + TV_HITTESTINFO tvhti; + ::GetCursorPos(&(tvhti.pt)); + ::ScreenToClient(GetHwnd(),&(tvhti.pt)); + if ( TreeView_HitTest(GetHwnd(),&tvhti) ) + { + if( tvhti.flags & TVHT_ONITEM ) + { + event.m_item = (WXHTREEITEM) tvhti.hItem; + eventType=wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK; + } + } + break; + } + case TVN_BEGINDRAG: eventType = wxEVT_COMMAND_TREE_BEGIN_DRAG; // fall through @@ -1401,6 +1409,8 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) event.m_item = (WXHTREEITEM)info->item.hItem; event.m_label = info->item.pszText; + if (info->item.pszText == NULL) + return FALSE; break; } @@ -1444,7 +1454,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) "message"), tv->action); } - bool ing = (hdr->code == TVN_ITEMEXPANDING); + bool ing = ((int)hdr->code == TVN_ITEMEXPANDING); eventType = g_events[expand][ing]; event.m_item = (WXHTREEITEM) tv->itemNew.hItem;