Esempio n. 1
0
void wxGxContentView::ShowContextMenu(const wxPoint& pos)
{
	long item = wxNOT_FOUND;
    item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
	if(item == wxNOT_FOUND)
	{
        wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(m_nParentGxObjectID);

		IGxObjectUI* pGxObjectUI = dynamic_cast<IGxObjectUI*>(pGxObject);
        if(pGxObjectUI)
        {
            //wxString psContextMenu = pGxObjectUI->NewMenu();
            wxString psContextMenu = pGxObjectUI->ContextMenu();
            if(m_pApp)
            {
                wxMenu* pMenu = dynamic_cast<wxMenu*>(m_pApp->GetCommandBar(psContextMenu));
                if(pMenu)
                {
                    PopupMenu(pMenu, pos.x, pos.y);
                }
            }
        }
		return;
	}

	LPITEMDATA pItemData = (LPITEMDATA)GetItemData(item);
	if(pItemData != NULL)
	{
        //bool bAdd = true;
        //m_pSelection->Select(pItemData->nObjectID, bAdd, NOTFIRESELID);

        wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(pItemData->nObjectID);
		IGxObjectUI* pGxObjectUI = dynamic_cast<IGxObjectUI*>(pGxObject);
		if(pGxObjectUI != NULL)
		{
            wxString psContextMenu = pGxObjectUI->ContextMenu();
            if(m_pApp)
            {
                wxMenu* pMenu = dynamic_cast<wxMenu*>(m_pApp->GetCommandBar(psContextMenu));
                if(pMenu)
                {
                    PopupMenu(pMenu, pos.x, pos.y);
                }
            }
		}
	}
}
void wxGISToolExecuteView::ShowContextMenu(const wxPoint& pos)
{
    long item = wxNOT_FOUND;
    item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
    if(item == wxNOT_FOUND)
    {
        wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(m_nParentGxObjectId);
        IGxObjectUI* pGxObjectUI = dynamic_cast<IGxObjectUI*>(pGxObject);
        if(pGxObjectUI)
        {
            wxString psContextMenu = pGxObjectUI->ContextMenu();
            if(m_pApp)
            {
                wxMenu* pMenu = dynamic_cast<wxMenu*>(m_pApp->GetCommandBar(psContextMenu));
                if(pMenu)
                {
                    PopupMenu(pMenu, pos.x, pos.y);
                }
            }
        }
        return;
    }

    wxGxObject* pObject = m_pCatalog->GetRegisterObject(GetItemData(item));
    if(!pObject)
        return;

    bool bAdd = true;
    m_pSelection->Select(pObject->GetId(), bAdd, NOTFIRESELID);

    IGxObjectUI* pGxObjectUI = dynamic_cast<IGxObjectUI*>(pObject);
    if(pGxObjectUI)
    {
        wxString psContextMenu = pGxObjectUI->ContextMenu();
        if(m_pApp)
        {
            wxMenu* pMenu = dynamic_cast<wxMenu*>(m_pApp->GetCommandBar(psContextMenu));
            if(pMenu)
            {
                PopupMenu(pMenu, pos.x, pos.y);
            }
        }
    }
}
Esempio n. 3
0
void wxGxTreeViewBase::OnItemRightClick(wxTreeEvent& event)
{
	wxTreeItemId item = event.GetItem();

	if(!item.IsOk())
		return;
	wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(item);
	if(pData != NULL)
	{
        wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(pData->m_nObjectID);
        IGxObjectUI* pGxObjectUI = dynamic_cast<IGxObjectUI*>(pGxObject);
        if(pGxObjectUI)
        {
            wxString psContextMenu = pGxObjectUI->ContextMenu();
            wxMenu* pMenu = dynamic_cast<wxMenu*>(m_pApp->GetCommandBar(psContextMenu));
            if(pMenu)
            {
                PopupMenu(pMenu, event.GetPoint());
            }
        }
    }
}