+wxTreeItemId wxTreeCtrl::GetSelection () const
+{
+ wxCHECK_MSG( !(m_windowStyle & wxTR_MULTIPLE), (long)(WXHTREEITEM)0,
+ wxT("this only works with single selection controls") );
+
+ PMYRECORD pRecord = NULL;
+
+ pRecord = (PMYRECORD)PVOIDFROMMR(::WinSendMsg( GetHWND()
+ ,CM_QUERYRECORDEMPHASIS
+ ,MPARAM(CMA_FIRST)
+ ,MPARAM(CRA_SELECTED)
+ ));
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+ return wxTreeItemId((long)pRecord->m_ulItemId);
+} // end of wxTreeCtrl::GetSelection
+
+wxTreeItemId wxTreeCtrl::GetItemParent (
+ const wxTreeItemId& rItem
+) const
+{
+ PMYRECORD pRecord = FindOS2TreeRecordByID ( GetHWND()
+ ,rItem.m_pItem
+ );
+
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+ pRecord = (PMYRECORD)PVOIDFROMMR(::WinSendMsg( GetHWND()
+ ,CM_QUERYRECORD
+ ,MPFROMP(pRecord)
+ ,MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER)
+ ));
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+ return wxTreeItemId((long)pRecord->m_ulItemId);
+} // end of wxTreeCtrl::GetItemParent
+
+wxTreeItemId wxTreeCtrl::GetFirstChild (
+ const wxTreeItemId& rItem
+, long& rCookie
+) const
+{
+ PMYRECORD pRecord = FindOS2TreeRecordByID ( GetHWND()
+ ,rItem.m_pItem
+ );
+
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+ pRecord = (PMYRECORD)PVOIDFROMMR(::WinSendMsg( GetHWND()
+ ,CM_QUERYRECORD
+ ,MPFROMP(pRecord)
+ ,MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER)
+ ));
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+ //
+ // Remember the last child returned in 'cookie'
+ //
+ rCookie = (long)pRecord->m_ulItemId;
+ return wxTreeItemId(rCookie);
+} // end of wxTreeCtrl::GetFirstChild
+
+wxTreeItemId wxTreeCtrl::GetNextChild (
+ const wxTreeItemId& WXUNUSED(rItem)
+, long& rCookie
+) const
+{
+ PMYRECORD pRecord = FindOS2TreeRecordByID ( GetHWND()
+ ,rCookie
+ );
+
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+ pRecord = (PMYRECORD)PVOIDFROMMR(::WinSendMsg( GetHWND()
+ ,CM_QUERYRECORD
+ ,MPFROMP(pRecord)
+ ,MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)
+ ));
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+ rCookie = (long)pRecord->m_ulItemId;
+ return wxTreeItemId(rCookie);
+} // end of wxTreeCtrl::GetNextChild
+
+wxTreeItemId wxTreeCtrl::GetLastChild (
+ const wxTreeItemId& rItem
+) const
+{
+ PMYRECORD pRecord = FindOS2TreeRecordByID ( GetHWND()
+ ,rItem.m_pItem
+ );
+
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+ pRecord = (PMYRECORD)PVOIDFROMMR(::WinSendMsg( GetHWND()
+ ,CM_QUERYRECORD
+ ,MPFROMP(pRecord)
+ ,MPFROM2SHORT(CMA_LASTCHILD, CMA_ITEMORDER)
+ ));
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+ return wxTreeItemId((long)pRecord->m_ulItemId);
+} // end of wxTreeCtrl::GetLastChild
+
+wxTreeItemId wxTreeCtrl::GetNextSibling (
+ const wxTreeItemId& rItem
+) const
+{
+ PMYRECORD pRecord = FindOS2TreeRecordByID ( GetHWND()
+ ,rItem.m_pItem
+ );
+
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+ pRecord = (PMYRECORD)PVOIDFROMMR(::WinSendMsg( GetHWND()
+ ,CM_QUERYRECORD
+ ,MPFROMP(pRecord)
+ ,MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)
+ ));
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+ return wxTreeItemId((long)pRecord->m_ulItemId);
+} // end of wxTreeCtrl::GetNextSibling
+
+wxTreeItemId wxTreeCtrl::GetPrevSibling (
+ const wxTreeItemId& rItem
+) const
+{
+ PMYRECORD pRecord = FindOS2TreeRecordByID ( GetHWND()
+ ,rItem.m_pItem
+ );
+
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+ pRecord = (PMYRECORD)PVOIDFROMMR(::WinSendMsg( GetHWND()
+ ,CM_QUERYRECORD
+ ,MPFROMP(pRecord)
+ ,MPFROM2SHORT(CMA_PREV, CMA_ITEMORDER)
+ ));
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+ return wxTreeItemId((long)pRecord->m_ulItemId);
+} // end of wxTreeCtrl::GetPrevSibling
+
+wxTreeItemId wxTreeCtrl::GetFirstVisibleItem () const
+{
+ PMYRECORD pRecord = (PMYRECORD)PVOIDFROMMR(::WinSendMsg( GetHWND()
+ ,CM_QUERYRECORD
+ ,MPFROMP(pRecord)
+ ,MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)
+ ));
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+
+ if (IsVisible(wxTreeItemId((long)pRecord->m_ulItemId)))
+ return wxTreeItemId((long)pRecord->m_ulItemId);
+ while(pRecord)
+ {
+ pRecord = (PMYRECORD)PVOIDFROMMR(::WinSendMsg( GetHWND()
+ ,CM_QUERYRECORD
+ ,MPFROMP(pRecord)
+ ,MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)
+ ));
+ if (!pRecord)
+ return wxTreeItemId(-1L);
+ if (IsVisible(wxTreeItemId((long)pRecord->m_ulItemId)))
+ return wxTreeItemId((long)pRecord->m_ulItemId);
+ }
+ return wxTreeItemId(-1L);
+} // end of wxTreeCtrl::GetFirstVisibleItem