void EventSheetEditor::ExpandAllGroups(bool open, CEditorEvent* pParent) { EventVector* pEvents = this->m_pEventList; if(pParent) { if(pParent->m_type == GROUP_TYPE) { pParent->m_open(this) = open; } pEvents = &pParent->m_EventList; } EventVector::iterator e = pEvents->begin(); for(; e!= pEvents->end(); e++) { ExpandAllGroups(open, *e); } }
//------------------------------------------------------------------------ //! Override this method to change the context menu when activating context //! menu in client area with no rows //! //! @param pWnd Handle to the window in which the user right clicked the mouse //! @param point Position of the cursor, in screen coordinates, at the time of the mouse click. //------------------------------------------------------------------------ void CGridListCtrlGroups::OnContextMenuGrid(CWnd* pWnd, CPoint point) { if (IsGroupStateEnabled()) { CMenu menu; UINT uFlags = MF_BYPOSITION | MF_STRING; VERIFY( menu.CreatePopupMenu() ); menu.InsertMenu(0, uFlags, 1, _T("Expand all groups")); menu.InsertMenu(1, uFlags, 2, _T("Collapse all groups")); menu.InsertMenu(2, uFlags, 3, _T("Disable grouping")); int nResult = menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RETURNCMD, point.x, point.y, this, 0); switch(nResult) { case 1: ExpandAllGroups(); break; case 2: CollapseAllGroups(); break; case 3: RemoveAllGroups(); EnableGroupView(FALSE); break; } } }