void wxTreeViewComboPopup::OnMouseClick(wxMouseEvent& event) { m_bClicked = true; wxTreeItemId ItemId = GetSelection(); if(ItemId.IsOk()) { if(m_PrewItemId.IsOk()) { CollapseAllChildren(GetItemParent(m_PrewItemId)); } if(ItemId != GetRootItem()) { CollapseAllChildren(ItemId); } else { CollapseAll(); Expand(GetRootItem()); } wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(ItemId); if(pData != NULL) { SelectItem(ItemId); m_pSelection->Select(pData->m_nObjectID, false, GetId()); m_PrewItemId = ItemId; } } Dismiss(); event.Skip(true); }
void wxTreeCtrlBase::CollapseAll() { if ( IsEmpty() ) return; CollapseAllChildren(GetRootItem()); }
void wxTreeCtrlBase::CollapseAllChildren(const wxTreeItemId& item) { Freeze(); // first (recursively) collapse all the children wxTreeItemIdValue cookie; #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ for ( wxTreeItemId idCurr = GetFirstChild(item, cookie); idCurr.IsOk(); idCurr = GetNextChild(item, cookie) ) { CollapseAllChildren(idCurr); } // then collapse this element too unless it's the hidden root which can't // be collapsed if ( item != GetRootItem() || !HasFlag(wxTR_HIDE_ROOT) ) Collapse(item); Thaw(); }
void wxTreeCtrlBase::CollapseAllChildren(const wxTreeItemId& item) { // first (recursively) collapse all the children wxTreeItemIdValue cookie; for ( wxTreeItemId idCurr = GetFirstChild(item, cookie); idCurr.IsOk(); idCurr = GetNextChild(item, cookie) ) { CollapseAllChildren(idCurr); } // then collapse this element too Collapse(item); }
void wxTreeCtrlBase::CollapseAllChildren(const wxTreeItemId& item) { Freeze(); // first (recursively) collapse all the children wxTreeItemIdValue cookie; for ( wxTreeItemId idCurr = GetFirstChild(item, cookie); idCurr.IsOk(); idCurr = GetNextChild(item, cookie) ) { CollapseAllChildren(idCurr); } // then collapse this element too unless it's the hidden root which can't // be collapsed if ( item != GetRootItem() || !HasFlag(wxTR_HIDE_ROOT) ) Collapse(item); Thaw(); }
bool wxSTEditorTreeCtrl::HandleMenuEvent(wxCommandEvent &event) { int win_id = event.GetId(); wxTreeItemId id = GetSelection(); wxSTETreeItemData* data = NULL; if (id) data = (wxSTETreeItemData*)GetItemData(id); switch (win_id) { case ID_STT_FILE_OPEN : { if (id) { wxTreeEvent treeEvent(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, this, id); OnTreeCtrl(treeEvent); } return true; } case ID_STT_FILE_CLOSE : { if (id && m_steNotebook && data) { m_steNotebook->ClosePage(data->m_page_num, true); } return true; } case ID_STT_FILE_PROPERTIES : { if (id && m_steNotebook && data && data->m_notePage) { wxSTEditor* editor = wxDynamicCast(data->m_notePage, wxSTEditor); if (!editor && wxDynamicCast(data->m_notePage, wxSTEditorSplitter)) editor = wxDynamicCast(data->m_notePage, wxSTEditorSplitter)->GetEditor(); if (editor) editor->ShowPropertiesDialog(); } return true; } case ID_STT_EXPAND_ALL : { ExpandAll(); return true; } case ID_STT_COLLAPSE_ALL : { // Can't CollapseAll() if root node is hidden. wxTreeItemIdValue cookie; wxTreeItemId rootId = GetRootItem(); wxTreeItemId childId = GetFirstChild(rootId, cookie); for (; childId; childId = GetNextChild(rootId, cookie)) { CollapseAllChildren(childId); } return true; } case ID_STT_SHOW_FILENAME_ONLY : case ID_STT_SHOW_FILEPATH_ONLY : case ID_STT_SHOW_PATH_THEN_FILENAME : case ID_STT_SHOW_ALL_PATHS : { SetDisplayType((FileDisplay_Type)(win_id-ID_STT_SHOW_FILENAME_ONLY)); return true; } } return false; }