예제 #1
0
void ProjectExplorerWindow::OnMenu(wxTreeEvent& event)
{
  if (event.GetInt() == 0)
    m_tree->PopupMenu(m_contextMenu, event.GetPoint());
  else if (event.GetInt() == 1)
    m_tree->PopupMenu(m_directoryContextMenu, event.GetPoint());
}
예제 #2
0
void CocosFrame::OnSolutionRightClicked(wxTreeEvent& event) {
	wxTreeItemId itemid = event.GetItem();
	wxTreeCtrl *solTreeCtrl = (wxTreeCtrl*)FindWindow(ID_SOLUTION_TREECTRL);
	CocosTreeItemData *data = itemid.IsOk() ? (CocosTreeItemData*)solTreeCtrl->GetItemData(itemid) : NULL;
	if (!data) {
		wxLogMessage("Data of tree item clicked is NULL!");
	}

	wxMenu menu;
	if (data->GetKind() == CoKind::Solution) {
		menu.Append(ID_SOL_ADD_PROJECT_NEW, _T("new project"));
		menu.AppendSeparator();
		menu.Append(ID_SOL_ADD_PROJECT_EXIST, _T("add projects existing"));
	} else if (data->GetKind() == CoKind::Project) {
		menu.Append(ID_POJ_ADD_ANIMATE_NEW, _T("new animate"));
		menu.AppendSeparator();
		menu.Append(ID_POJ_ADD_FILE_EXIST, _T("add file existing"));
		menu.AppendSeparator();
		menu.Append(ID_POJ_ADD_FILTER, _T("new filter"));
		menu.AppendSeparator();
		menu.Append(ID_POJ_REM_PROJECT, _T("remove"));
	} else if (data->GetKind() == CoKind::Folder) {
// 		menu.Append(ID_FOLDER_ADD_ANIMATE_NEW, _T("new animate"));
// 		menu.AppendSeparator();
// 		menu.Append(ID_FOLDER_ADD_FILE_EXIST, _T("add file existing"));
	} else if (data->GetKind() == CoKind::Filer) {
		menu.Append(ID_FILE_REM_FILE, _T("remove"));
	}
	PopupMenu(&menu, event.GetPoint());
}
예제 #3
0
void wxSTEditorTreeCtrl::OnTreeCtrl(wxTreeEvent &event)
{
    wxTreeItemId id = event.GetItem();

    if (!id || (m_steNotebook == NULL))
        return;

    wxSTETreeItemData* data = (wxSTETreeItemData*)GetItemData(id);

    if (event.GetEventType() == wxEVT_COMMAND_TREE_ITEM_ACTIVATED)
    {
        if (data && (data->m_page_num >= 0) && (data->m_page_num < (int)m_steNotebook->GetPageCount()))
            m_steNotebook->SetSelection(data->m_page_num);
        else
            event.Skip();
    }
    else if (event.GetEventType() == wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP)
    {
        if (data)
            event.SetToolTip(data->m_fileName.GetFullPath());
    }
    else if (event.GetEventType() == wxEVT_COMMAND_TREE_ITEM_MENU)
    {
        if (data)
            PopupMenu(m_popupMenu, event.GetPoint());
    }
}
예제 #4
0
void
DeckLibraryTab::OnTreeRightClicked (wxTreeEvent &event)
{
    if (m_bNoEvents || !m_pTree) return;
    m_pTree->SelectItem (event.GetItem ());
    m_pTree->PopupMenu (&m_oPopupMenu, event.GetPoint ());
}
예제 #5
0
void wxGISIdentifyDlg::OnItemRightClick(wxTreeEvent& event)
{
 	wxTreeItemId item = event.GetItem();
	if(!item.IsOk())
		return;
    m_pTreeCtrl->SelectItem(item);
    PopupMenu(m_pMenu, event.GetPoint());
}
예제 #6
0
void ClassBrowser::OnTreeItemRightClick(wxTreeEvent& event)
{
    wxTreeCtrl* tree = (wxTreeCtrl*)event.GetEventObject();
    if (!tree)
        return;

    tree->SelectItem(event.GetItem());
    ShowMenu(tree, event.GetItem(), event.GetPoint());
}
예제 #7
0
void MainWindow::directory_ctrlOnTreeItemMenu( wxTreeEvent& event )
{
	wxPoint pt = event.GetPoint();

	wxMenu menu(wxEmptyString);
    menu.Append(FDBex_ExtractFolder, _("Extract folder to..."));

    PopupMenu(&menu, pt);
}
예제 #8
0
void SkillObjectTree::OnItemMenu(wxTreeEvent& event)
{
	wxTreeItemId itemId = event.GetItem();
	
	wxPoint clientpt = event.GetPoint();
	wxPoint screenpt = ClientToScreen(clientpt);

	ShowMenu(itemId, clientpt);
	event.Skip();
}
예제 #9
0
파일: ModelPanel.cpp 프로젝트: SinYocto/Zee
void ModelListTree::OnItemMenu(wxTreeEvent& event)
{
	ModelTreeItemData* itemData = (ModelTreeItemData*)GetItemData(event.GetItem());
	Model* model = itemData->GetModel();

	wxPoint pt = event.GetPoint();

	wxMenu menu;
	menu.Append(ID_MODEL_PANEL_ITEM_MENU_ADD_TO_SCENE, wxT("&add to scene"));

	PopupMenu(&menu, pt);
}
// tree item right-clicked
void OpenFilesListPlugin::OnTreeItemRightClick(wxTreeEvent& event)
{
    if (Manager::IsAppShuttingDown())
        return;

    EditorBase* ed = static_cast<EditorBase*>( static_cast<OpenFilesListData*>(m_pTree->GetItemData(event.GetItem()))->GetEditor() );
    if (ed)
    {
        wxPoint pt = m_pTree->ClientToScreen(event.GetPoint());
        ed->DisplayContextMenu(pt,mtOpenFilesList);
    }
}
예제 #11
0
////////////////////////////////////////////////////////////////////////////////
// This handler will display a popup menu for the item at the mouse position
////////////////////////////////////////////////////////////////////////////////
void frmMain::OnSelRightClick(wxTreeEvent& event)
{
    wxTreeItemId item = event.GetItem();
    if (item != browser->GetSelection())
    {
        browser->SelectItem(item);
        currentObject = browser->GetObject(item);
    }

    if (currentObject)
        doPopup(browser, event.GetPoint(), currentObject);
}
예제 #12
0
void EvtSimHlpEvtHandler::OnTreeItemRightClick (wxTreeEvent &event)
{
    wxASSERT_MSG (m_treeItemRightClickProcessed == false,
            _T("Tree item right click event handler has already been processed"));

    m_treeItemRightClickProcessed = true;

    wxMenu *m = new wxMenu (_T("PopupMenu"));
    m->Append (1234, _T("PopupMenuItem"));
    wxPoint p (0, 0);
    WxGuiTestHelper::PopupMenu ((wxTreeCtrl *) event.GetEventObject (), m,
            event.GetPoint (), _T("sccDatasetBrowserPopupMenu"));
}
예제 #13
0
void MyTreeCtrl::OnItemMenu(wxTreeEvent& event)
{
    wxTreeItemId itemId = event.GetItem();
    MyTreeItemData *item = itemId.IsOk() ? (MyTreeItemData *)GetItemData(itemId)
                                         : NULL;
    wxPoint clientpt = event.GetPoint();
    wxPoint screenpt = ClientToScreen(clientpt);

    wxLogMessage(wxT("OnItemMenu for item \"%s\" at screen coords (%i, %i)"), 
                 item ? item->GetDesc() : _T(""), screenpt.x, screenpt.y);

    ShowMenu(itemId, clientpt);
    event.Skip();
}
예제 #14
0
void DecisionLogicFrame::TreeOnBeginDrag(wxTreeEvent& event)
{
    // need to explicitly allow drag
    if ( ItemIsDraggable(event.GetItem()) )
	{
        m_draggedItem = event.GetItem();

        wxPoint clientpt = event.GetPoint();
        wxPoint screenpt = ClientToScreen(clientpt);

		m_draiggingName = m_tree->GetItemText(event.GetItem());

        event.Allow();
    }
}
void mmCategDialog::OnItemRightClick(wxTreeEvent& event)
{
    wxMenu* mainMenu = new wxMenu;
    mainMenu->Append(new wxMenuItem(mainMenu, MENU_ITEM_HIDE, _("Hide Selected Category")));
    mainMenu->Append(new wxMenuItem(mainMenu, MENU_ITEM_UNHIDE, _("Unhide Selected Category")));
    mainMenu->AppendSeparator();
    mainMenu->Append(new wxMenuItem(mainMenu, MENU_ITEM_CLEAR, _("Clear Settings")));

    bool bItemHidden = (m_treeCtrl->GetItemTextColour(selectedItemId_) != NormalColor_);
    mainMenu->Enable(MENU_ITEM_HIDE, !bItemHidden && (selectedItemId_ != root_));
    mainMenu->Enable(MENU_ITEM_UNHIDE, bItemHidden && (selectedItemId_ != root_));

    PopupMenu(mainMenu, event.GetPoint());
    delete mainMenu;
    event.Skip();
}
예제 #16
0
파일: events.cpp 프로젝트: search5/pgadmin3
////////////////////////////////////////////////////////////////////////////////
// This handler will display a popup menu for the item at the mouse position
////////////////////////////////////////////////////////////////////////////////
void frmMain::OnSelRightClick(wxTreeEvent &event)
{
	wxTreeItemId item = event.GetItem();
	if (item != browser->GetSelection())
	{
		browser->SelectItem(item);

		// Prevent changes to "currentObject" by "execSelchange" function by another
		// thread. Will hold the lock until we have the actual object in hand.
		s_currentObjectMutex.Lock();
		currentObject = browser->GetObject(item);
		s_currentObjectMutex.Unlock();
	}

	if (currentObject)
		doPopup(browser, event.GetPoint(), currentObject);
}
예제 #17
0
void SceneBrowser::OnContextMenu( ObjectPtr &object, wxTreeEvent& event )
{
	const Ogre::String &type = object->getType();

	if ( type == "Actor" )
	{
		ActorAnimationSettingDialog *dlg = new ActorAnimationSettingDialog(this, wxID_ANY,
			_("ActorAnimationSetting Dialog"), object, mSceneManipulator, event.GetPoint());

		int result = dlg->Show(true);
		//if (result == wxID_CANCEL)
		//{
		//	// 如果异常列表中仍有内容,就给出提示
		//	if (dlg->mListBox->GetCount() > 0)
		//	{
		//		wxMessageBox(_("Thera are still some wrongs in scene,remember to fix them!"));
		//	}
		//	else
		//	{
		//		wxMessageBox(_("All wrongs in scene have been fixed,remember to save the scene!"));
		//	}
		//}

	}
	else if ( type == "Effect" )
	{
		
		Fairy::Effect *effect = static_cast<Fairy::EffectObject *>(object.get())->getEffect();

		if ( effect )
		{
			if ( NULL == mEffectDialog )
			{
				mEffectDialog = new WXEffectEditDialog(this, wxID_ANY, _("Effect Setting"));
			}
			if ( false == mEffectDialog->IsShown() )
				mEffectDialog->Show();			
			mEffectDialog->InitEffectDialog(effect, mSceneManipulator);
		}			
	}

	mSceneManipulator->setActiveAction(NULL);
}
예제 #18
0
void ResourcesPage::onTreeItemMenu(wxTreeEvent& event)
{
	menuItemId = event.GetItem();
	
	const ResourceHandle& res = getResourceFromTreeId( menuItemId );

	if( !res )
		return;

	wxMenu menu;

	menu.Append( ID_ResourceMenu_Reimport, "&Reimport" );
	
	menu.AppendSeparator();
	
	menu.Append( ID_ResourceMenu_Open, "&Open" );
	menu.Append( ID_ResourceMenu_Browse, "&Browse" );
	menu.Append( ID_ResourceMenu_Reload, "&Reload" );
	menu.Append( ID_ResourceMenu_Unload, "&Unload" );

	wxMenu* menuVCS = new wxMenu("Subversion");
	menuVCS->Append( ID_ResourceMenu_VCS_Update, "&Update" );
	//menuVCS->Append( ID_ResourceMenu_VCS_Status, "&Status" );
	menuVCS->Append( ID_ResourceMenu_VCS_Commit, "&Commit" );
	menuVCS->Append( ID_ResourceMenu_VCS_ShowLog, "Show &log" );
	menu.AppendSubMenu(menuVCS, "Version Control");

	if( !isUnderVersionControl(res.Resolve()) )
	{
		wxMenuItemList& menus = menuVCS->GetMenuItems();

		for(size_t i = 0; i < menus.size(); i++ )
		{
			wxMenuItem* menuItem = menus[i];
			menuItem->Enable(false);
		}
	}

	wxPoint clientpt = event.GetPoint();
	PopupMenu(&menu, clientpt);
}
예제 #19
0
// context menu event
void fileDissectTreeCtrl::OnItemMenu(wxTreeEvent& event)
{
	wxMenu mnuPopup;
	wxTreeItemId id = event.GetItem();
	wxMenuItem *pm;

	pm = mnuPopup.Append(IDM_NODE_EXPANDBELOW, wxT("E&xpand children"));
	if (!HasChildren(id))
		pm->Enable(false);

	pm = mnuPopup.Append(IDM_NODE_COLLAPSEBELOW, wxT("&Collapse children"));
	if (!HasChildren(id))
		pm->Enable(false);

	pm = mnuPopup.Append(IDM_NODE_HIGHLIGHT, wxT("&Highlight"));
	if (!GetItemData(id))
		pm->Enable(false);

	wxPoint pt = event.GetPoint();
    PopupMenu(&mnuPopup, pt);
}
예제 #20
0
void SkillObjectTree::OnBeginDrag(wxTreeEvent& event)
{
	// need to explicitly allow drag
	if ( event.GetItem() != GetRootItem() )
	{
		m_draggedItem = event.GetItem();

		wxPoint clientpt = event.GetPoint();
		wxPoint screenpt = ClientToScreen(clientpt);

		//wxLogMessage(wxT("OnBeginDrag: started dragging %s at screen coords (%i,%i)"),
		//	GetItemText(m_draggedItem).c_str(),
		//	screenpt.x, screenpt.y);

		event.Allow();
	}
	else
	{
		//wxLogMessage(wxT("OnBeginDrag: this item can't be dragged."));
	}
}
예제 #21
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());
            }
        }
    }
}
예제 #22
0
//------------------------------------------------------------------------------
void OutputTree::OnItemRightClick(wxTreeEvent& event)
{
   //wxWidgets-2.6.3 does not need this but wxWidgets-2.8.0 needs to SelectItem
   SelectItem(event.GetItem());
   ShowMenu(event.GetItem(), event.GetPoint());
}
예제 #23
0
void browsers::CellBrowser::OnItemRightClick(wxTreeEvent& event) 
{
   ShowMenu(event.GetItem(), event.GetPoint());
}
void WorkspaceBrowserF::OnTreeItemRightClick(wxTreeEvent& event)
{
    wxTreeCtrl* tree = (wxTreeCtrl*)event.GetEventObject();
	tree->SelectItem(event.GetItem());
    ShowMenu(tree, event.GetItem(), event.GetPoint());// + tree->GetPosition());
}
예제 #25
0
void WorkspacePanel::OnRightClick(wxTreeEvent& event)
{
	showContextMenu(event.GetPoint(), event.GetItem());
}
예제 #26
0
파일: cmpctrl.cpp 프로젝트: DDMAL/aruspix
void CmpCtrl::OnMenu( wxTreeEvent &event )
{
    wxMenu popup;
    
    popup.Append( ID6_POPUP_TREE_LOAD, _("Reload files"), _("Reload images and Aruspix files")  );
    // Books
    popup.AppendSeparator( );
    popup.Append( ID6_POPUP_TREE_ADD_BOOK, _("Add book") );   
    popup.Enable( ID6_POPUP_TREE_ADD_BOOK, false );
    // Book submenu
    // I am not absolutely sure it we gets deleted, so potential very smal memory leak
    wxMenu *bookSubmenu = new wxMenu(); 
    bookSubmenu->Append( ID6_POPUP_TREE_ASSEMBLE, _("Assemble parts") );
    bookSubmenu->Enable( ID6_POPUP_TREE_ASSEMBLE, false );
    bookSubmenu->AppendSeparator( );
    bookSubmenu->Append( ID6_POPUP_TREE_ADD_PART, _("Add part to book") );
    bookSubmenu->Enable( ID6_POPUP_TREE_ADD_PART, false );
    bookSubmenu->Append( ID6_POPUP_TREE_ADD_AXFILE, _("Add file to part") );
    bookSubmenu->Enable( ID6_POPUP_TREE_ADD_AXFILE, false );
    // Page submenu in Book submenu
    wxMenu *pageSubmenu = new wxMenu();
    pageSubmenu->Append( ID6_POPUP_TREE_ADD_PART_PAGE_START, _("Add start delimiter for a page") );
    pageSubmenu->Enable( ID6_POPUP_TREE_ADD_PART_PAGE_START, false );
    pageSubmenu->Append( ID6_POPUP_TREE_ADD_PART_PAGE_END, _("Add end delimiter for a page") );
    pageSubmenu->Enable( ID6_POPUP_TREE_ADD_PART_PAGE_END, false );
    pageSubmenu->Append( ID6_POPUP_TREE_REMOVE_PART_PAGE_START, _("Remove start delimiter for a page") );
    pageSubmenu->Enable( ID6_POPUP_TREE_REMOVE_PART_PAGE_START, false );
    pageSubmenu->Append( ID6_POPUP_TREE_REMOVE_PART_PAGE_END, _("Remove end delimiter for a page") );
    pageSubmenu->Enable( ID6_POPUP_TREE_REMOVE_PART_PAGE_END, false );
    bookSubmenu->AppendSubMenu( pageSubmenu,  _("Part page") );
    popup.AppendSubMenu( bookSubmenu, _("Book") );
    // Collations
    popup.AppendSeparator( );
    popup.Append( ID6_POPUP_TREE_ADD_COLLATION, _("Add collation") );   
    popup.Enable( ID6_POPUP_TREE_ADD_COLLATION, false );
    // Collation submenu
    wxMenu *colSubmenu = new wxMenu(); 
    colSubmenu->Append( ID6_POPUP_TREE_ADD_COLLATION_PART, _("Add part to collation") );
    colSubmenu->Enable( ID6_POPUP_TREE_ADD_COLLATION_PART, false );
    popup.AppendSubMenu( colSubmenu, _("Collation") );
    
    int itemType = GetType( event.GetItem() );

    // first menu according to wxTreeItemId
    if ( itemType == CMP_TREE_BOOKS )
    {
        popup.Enable( ID6_POPUP_TREE_ADD_BOOK, true );
    }
    else if ( itemType == CMP_TREE_BOOK_PARTS ) {
        // we have click Parts and want to add a part to a book
        popup.Enable( ID6_POPUP_TREE_ADD_PART, true );
        popup.Enable( ID6_POPUP_TREE_ASSEMBLE, true );
    }
    else if ( itemType == CMP_TREE_BOOK_AXFILE ) {
        // we have click Aruspix file of a book and want to add it to a part
        popup.Enable( ID6_POPUP_TREE_ADD_AXFILE, true );
    }
    else if ( itemType == CMP_TREE_COLLATIONS )
    {
        popup.Enable( ID6_POPUP_TREE_ADD_COLLATION, true );
    }
    else if ( itemType == CMP_TREE_COLLATION ) {
        // we have click a collation and want to add a part to a it
        popup.Enable( ID6_POPUP_TREE_ADD_COLLATION_PART, true );
    }
    
    // bitfields would be better...
    if ( (itemType == CMP_TREE_BOOK_PART_PAGE) || (itemType == CMP_TREE_BOOK_PART_PAGE_END)  ) {
        // we have click a page and want to add a start delimiter
        popup.Enable( ID6_POPUP_TREE_ADD_PART_PAGE_START, true );
    }
    if ( (itemType == CMP_TREE_BOOK_PART_PAGE) || (itemType == CMP_TREE_BOOK_PART_PAGE_START)  ) {
        // we have click a page and want to add a end delimiter
        popup.Enable( ID6_POPUP_TREE_ADD_PART_PAGE_END, true );
    }
    if ( (itemType == CMP_TREE_BOOK_PART_PAGE_START) || (itemType == CMP_TREE_BOOK_PART_PAGE_START_END)  ) {
        // we have click a page and want to remove a start delimiter
        popup.Enable( ID6_POPUP_TREE_REMOVE_PART_PAGE_START, true );
    }
    if ( (itemType == CMP_TREE_BOOK_PART_PAGE_END) || (itemType == CMP_TREE_BOOK_PART_PAGE_START_END)  ) {
        // we have click a page and want to remove a end delimiter
        popup.Enable( ID6_POPUP_TREE_REMOVE_PART_PAGE_END, true );
    }
    
    wxPoint clientpt = event.GetPoint();
    wxPoint screenpt = ClientToScreen(clientpt);    
    PopupMenu(&popup, clientpt );
}
예제 #27
0
void               P3DPlantModelTreeCtrl::OnItemRightClick
                                      (wxTreeEvent        &event)
 {
  P3DBranchModel                      *BranchModel;
  P3DMaterialInstanceSimple           *MaterialSimple;

  if (event.GetItem() != GetSelection())
   {
    SelectItem(event.GetItem());
   }

  BranchModel = ((P3DPlantModelTreeCtrlItemData*)(GetItemData(GetSelection())))->GetBranchModel();

  wxMenu                               PopupMenu;
  wxMenu                              *StemModelMenu;
  wxMenu                              *AppendBranchMenu;

  P3DStemModel *StemModel = BranchModel->GetStemModel();

  if (StemModel == 0)
   {
   }
  else
   {
    StemModelMenu = new wxMenu();
    StemModelMenu->Append(P3D_SET_STEM_MODEL_TUBE_ID,wxT("Tube"));
    StemModelMenu->Append(P3D_SET_STEM_MODEL_QUAD_ID,wxT("Quad"));
    StemModelMenu->Append(P3D_SET_STEM_MODEL_WINGS_ID,wxT("Wings"));

    if      (dynamic_cast<P3DStemModelTube*>(StemModel) != 0)
     {
      StemModelMenu->Enable(P3D_SET_STEM_MODEL_TUBE_ID,false);
     }
    else if (dynamic_cast<P3DStemModelQuad*>(StemModel) != 0)
     {
      StemModelMenu->Enable(P3D_SET_STEM_MODEL_QUAD_ID,false);
     }
    else if (dynamic_cast<P3DStemModelWings*>(StemModel) != 0)
     {
      StemModelMenu->Enable(P3D_SET_STEM_MODEL_WINGS_ID,false);
     }

    const P3DPluginInfoVector &GMeshPlugins = P3DApp::GetApp()->GetGMeshPlugins();

    if (GMeshPlugins.size() > 0)
     {
      wxMenu      *GMeshPluginsMenu = new wxMenu();
      int          MenuItemId = wxID_GMESH_PLUGIN_FIRST;

      for (unsigned int Index = 0; Index < GMeshPlugins.size(); Index++)
       {
        GMeshPluginsMenu->Append(MenuItemId++,wxString(GMeshPlugins[Index].GetMenuName(),wxConvUTF8));
       }

      StemModelMenu->Append(P3D_SET_STEM_MODEL_GMESH_ID,wxT("G-Mesh"),GMeshPluginsMenu);
     }
    else
     {
      StemModelMenu->Append(P3D_SET_STEM_MODEL_GMESH_ID,wxT("G-Mesh"));
      StemModelMenu->Enable(P3D_SET_STEM_MODEL_GMESH_ID,false);
     }

    if (BranchModel->GetSubBranchCount() > 0)
     {
      StemModelMenu->Enable(P3D_SET_STEM_MODEL_QUAD_ID,false);
      StemModelMenu->Enable(P3D_SET_STEM_MODEL_WINGS_ID,false);
      StemModelMenu->Enable(P3D_SET_STEM_MODEL_GMESH_ID,false);
     }

    if (GetItemParent(GetSelection()) == GetRootItem())
     {
      StemModelMenu->Enable(P3D_SET_STEM_MODEL_WINGS_ID,false);
     }
   }

  MaterialSimple = dynamic_cast<P3DMaterialInstanceSimple*>(BranchModel->GetMaterialInstance());

  AppendBranchMenu = new wxMenu();
  AppendBranchMenu->Append(PLANT_TREE_APPEND_BRANCH_NEW_ID,wxT("New branch"));
  AppendBranchMenu->Append(PLANT_TREE_APPEND_BRANCH_COPY_ID,wxT("Copy branch..."));

  PopupMenu.Append(PLANT_TREE_APPEND_BRANCH_ID,wxT("Append branch"),AppendBranchMenu);
  PopupMenu.Append(PLANT_TREE_REMOVE_STEM_ID,wxT("Delete stem"));

  if (GetItemParent(GetSelection()).IsOk())
   {
    PopupMenu.AppendSeparator();
    PopupMenu.Append(P3D_SET_STEM_MODEL_ID,wxT("Stem model"),StemModelMenu);

    wxMenuItem *DummyModeMenuItem = PopupMenu.AppendCheckItem(P3D_SET_STEM_DUMMY_MODE,wxT("Dummy"));

    DummyModeMenuItem->Check(BranchModel->IsDummy());

    PopupMenu.AppendSeparator();

    if (!BranchModel->IsDummy())
     {
      if (MaterialSimple->IsHidden())
       {
        PopupMenu.Append(PLANT_TREE_HIDESHOW_STEM_ID,wxT("Show"));
       }
      else
       {
        PopupMenu.Append(PLANT_TREE_HIDESHOW_STEM_ID,wxT("Hide"));
       }
     }
   }

  PopupMenu.Append(PLANT_TREE_RENAME_STEM_ID,wxT("Rename..."));

  if (GetRootItem() == GetSelection())
   {
    PopupMenu.Enable(PLANT_TREE_REMOVE_STEM_ID,false);
   }

  if (BranchModel->GetSubBranchCount() < P3DBranchModelSubBranchMaxCount)
   {
   }
  else
   {
    PopupMenu.Enable(PLANT_TREE_APPEND_BRANCH_ID,false);
   }

  if      (dynamic_cast<P3DStemModelQuad*>(StemModel) != 0)
   {
    PopupMenu.Enable(PLANT_TREE_APPEND_BRANCH_ID,false);
   }
  else if (dynamic_cast<P3DStemModelWings*>(StemModel) != 0)
   {
    PopupMenu.Enable(PLANT_TREE_APPEND_BRANCH_ID,false);
   }

  this->PopupMenu(&PopupMenu,event.GetPoint());
 }
void BFBackupTree::OnItemMenu(wxTreeEvent& rEvent)
{
    wxPoint         point   (rEvent.GetPoint());
    wxMenu          menu;
	wxMenu*			pMenu_backup = NULL;
	wxMenu*			pMenu_type = NULL;
    wxString        strLabel_ModifyTaskType(_("modify all sub-tasks to ..."));
    wxString        strLabel_DeleteTask(_("delete task"));
    wxString        strLabel_CreateDest(_("create destination directory"));
    wxString        strLabel_Backup(_("backup"));

    // remember the selected item
    lastItemId_ = rEvent.GetItem();

    // check if there are task-items as childs
    vecLastChildTasks_ = GetTaskItems(lastItemId_);

    if ( IsTask(lastItemId_) )
    {
        BFTask* pTask = GetTaskByItem(lastItemId_);

        if (pTask == NULL)
            return;

        // ** create destination directory **
        if (pTask->GetType() == TaskDIRCOPY)
            menu.Append(BFBACKUPCTRL_ID_CREATEDESTINATION, strLabel_CreateDest);

        // ** delete task **
        menu.Append(BFBACKUPCTRL_ID_DELETETASK, strLabel_DeleteTask);

        // ** modify types **
        if ( vecLastChildTasks_.size() > 0)
        {
            BFBackupTree::GenerateBackupMenu(pMenu_type, true, false);
            menu.AppendSubMenu(pMenu_type, strLabel_ModifyTaskType);
        }

        // separator
        menu.AppendSeparator();

        // ** backup **
        if (pTask->GetType() == TaskFILECOPY)
            BFBackupTree::GenerateBackupMenu(pMenu_backup, false);
        else
            BFBackupTree::GenerateBackupMenu(pMenu_backup, true);

        menu.AppendSubMenu(pMenu_backup, strLabel_Backup);

        // separator
        menu.AppendSeparator();

        // ** task settings **
        menu.Append(BFBACKUPCTRL_ID_TASKSETTINGS, _("Task settings"));
    }
    else
    {
        // for non-existing (while backup created) directories
        menu.Append(BFBACKUPCTRL_ID_CREATEDESTINATION, strLabel_CreateDest);

        // right click on root item
        if (GetRootItem() == lastItemId_)
        {
            // for real existing directories
            menu.Append(BFBACKUPCTRL_ID_ADDDESTINATION, _("add destination directory"));
            menu.Append(BFBACKUPCTRL_ID_DELETETASK, strLabel_DeleteTask);

            // ** modify types **
            if ( vecLastChildTasks_.size() > 0)
            {
                BFBackupTree::GenerateBackupMenu(pMenu_type, true, false);
                menu.AppendSubMenu(pMenu_type, strLabel_ModifyTaskType);
            }

            menu.AppendSeparator();
            menu.Append(BFBACKUPCTRL_ID_RUNBACKUP,          _("Run Backup...") );
            menu.AppendSeparator();
            menu.Append(BFBACKUPCTRL_ID_PROJECTSETTINGS,    _("Project Settings") );
            menu.Append(BFBACKUPCTRL_ID_PROJECTPLANNER,     _("Project Planner") );
            if ( BFSettings::Instance().GetScheduler() == 0 )
                menu.Enable(BFBACKUPCTRL_ID_PROJECTPLANNER, false);
            menu.AppendSeparator();
            menu.Append(BFBACKUPCTRL_ID_PROJECTSAVE,        _("&Save Project") );
            menu.Append(BFBACKUPCTRL_ID_PROJECTSAVEAS,      _("Save Project &as ...") );
        }
        else
        {
            menu.Append(BFBACKUPCTRL_ID_MODIFYDDESTINATION, _("modify destination"));
            menu.Append(BFBACKUPCTRL_ID_DELETETASK, strLabel_DeleteTask);

            // ** modify types **
            if ( vecLastChildTasks_.size() > 0)
            {
                BFBackupTree::GenerateBackupMenu(pMenu_type, true, false);
                menu.AppendSubMenu(pMenu_type, strLabel_ModifyTaskType);
            }

            menu.AppendSeparator();
            BFBackupTree::GenerateBackupMenu(pMenu_backup, true);
            menu.AppendSubMenu(pMenu_backup, strLabel_Backup);
        }
    }

    if (menu.GetMenuItemCount() > 0)
        PopupMenu(&menu);//, point);
}
예제 #29
0
파일: glue.cpp 프로젝트: GWRon/wx.mod
void bmx_wxtreeevent_getpoint(wxTreeEvent & event, int * x, int * y) {
	wxPoint p = event.GetPoint();
	*x = p.x;
	*y = p.y;
}
예제 #30
0
void DebuggerTree::OnTreeRightClick(wxTreeEvent& event)
{
    m_pTree->SelectItem(event.GetItem());
    ShowMenu(event.GetItem(), event.GetPoint());
}