Example #1
0
void CUnitPane::OnRClick(wxListEvent& event)
{
    wxMenu       menu;
    long         idx   = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
    CUnit      * pUnit = GetUnit(idx);
    int          x=0,y;

    int          width, height;

    int nItems = GetSelectedItemCount();


    wxDisplaySize(&width, &height);
    y = event.GetPoint().y;
    ClientToScreen(&x, &y);
    if (height-y < 150)
        y = height-150;
    ScreenToClient(&x, &y);

    if (nItems>1)
    {
        // multiple units
        menu.Append(menu_Popup_IssueOrders     , wxT("Issue orders"));
        menu.Append(menu_Popup_UnitFlags       , wxT("Set custom flags")    );
        menu.Append(menu_Popup_AddToTracking   , wxT("Add to a tracking group"));

        PopupMenu( &menu, event.GetPoint().x, y);
    }
    else
        if (pUnit)
        {
            // single unit
            if (pUnit->IsOurs)
            {
                menu.Append(menu_Popup_ShareSilv     , wxT("Share SILV")        );
                menu.Append(menu_Popup_Teach         , wxT("Teach")             );
                menu.Append(menu_Popup_Split         , wxT("Split")             );
                menu.Append(menu_Popup_DiscardJunk   , wxT("Discard junk items"));
                menu.Append(menu_Popup_GiveEverything, wxT("Give everything")   );
                menu.Append(menu_Popup_DetectSpies   , wxT("Detect spies")      );
            }

            menu.Append(menu_Popup_UnitFlags       , wxT("Set custom flags")    );
            menu.Append(menu_Popup_AddToTracking   , wxT("Add to a tracking group"));


            PopupMenu( &menu, event.GetPoint().x, y);
        }
}
Example #2
0
/* FIXME I'm confused here with the wx event system
   The example is the context menu below. It has to invoke several functions
   and esspecially tui::TopedFrame::OnDefineLayer(). This function needs a
   parameter (currently selected layer) and I'm trying to send it via
   wxCommandEvent. Unfortunately it doesn't work with the event definitions
   I've tried. In the same time the function can be invoked via the menu, but
   then the parameter can't be passed. Another possibility is to put the
   contents of the tui::TopedFrame::OnDefineLayer() in a function here, in
   this class. The problem with this is that it invokes a dialog box
   tui::defineLayer, which needs a parent frame as a parameter. The parent
   frame must be the TopedFrame - as a top frame in the hierarchy. It's not
   easy to get that pointer from here. The only solution at the moment is a
   bit convoluted and I'm not quite happy with it. The context menu invokes
   tui::TopedFrame::OnDefineLayer() - without a parameter, which in turn calls
   (indirectly) browsers::layerbrowser::getFirstSelected() to get that parameter
   and finaly ivokes tui::defineLayer.
   Quite similar is the situation with tui::TopedFrame::OnCellRef_B and
   tui::TopedFrame::OnCellARef_B (could be others) which are invoked via the
   context menu in browsers::CellBrowser::ShowMenu() above
*/
void browsers::layerbrowser::OnItemRightClick(wxListEvent& event)
{
   wxMenu menu;
   bool multi_selection = _layerlist->GetSelectedItemCount() > 1;
   wxString plural = (multi_selection) ? wxT("s") : wxT("");
   wxString mline1;
   mline1 << wxT("Hide Layer") << plural;
   menu.Append( LAYERHIDESELECTED, mline1);

   wxString mline2;
   mline2 << wxT("Show Layer") << plural;
   menu.Append(LAYERSHOWSELECTED, mline2);
   
   wxString mline3;
   mline3 << wxT("Lock Layer") << plural;
   menu.Append( LAYERLOCKSELECTED, mline3);
   
   wxString mline4;
   mline4 << wxT("Unlock Layer") << plural;
   menu.Append( LAYERUNLOCKSELECTED, mline4);
   if (!multi_selection)
   {
      menu.AppendSeparator();
      menu.Append(tui::TMSET_DEFLAY, wxT("Edit layer"));
      menu.Append(LAYERCURRENTSELECTED ,wxT("Make Current"));
   }
   PopupMenu(&menu, event.GetPoint());
}
Example #3
0
void frmMain::OnPropRightClick(wxListEvent &event)
{
	OnPropSelChanged(event);

	if (currentObject)
		doPopup(properties, event.GetPoint(), currentObject);
}
Example #4
0
void UpdateDlg::OnFileRightClick(wxListEvent& event)
{
//    LOGSTREAM << "pt.x=" << event.GetPoint().x << ", pt.y=" << event.GetPoint().y << '\n';
    UpdateRec* rec = GetRecFromListView();
    if (!rec)
        return;

    wxMenu popup;
    popup.Append(idPopupDownloadAndInstall, _("Download && install"));
    popup.AppendSeparator();
    popup.Append(idPopupDownload, _("Download"));
    popup.Append(idPopupInstall, _("Install"));
    popup.AppendSeparator();
    popup.Append(idPopupUninstall, _("Uninstall"));

    bool canDl = !rec->downloaded || rec->version != rec->installed_version;
    bool canInst = rec->downloaded && (!rec->installed || rec->version != rec->installed_version);

    popup.Enable(idPopupDownload, canDl);
    popup.Enable(idPopupInstall, canInst);
    popup.Enable(idPopupDownloadAndInstall, canInst || canDl);
    popup.Enable(idPopupUninstall, rec->installed);

    wxListCtrl* lst = XRCCTRL(*this, "lvFiles", wxListCtrl);
    lst->PopupMenu(&popup, event.GetPoint());
}
Example #5
0
void wxPlaylist::OnRightClick(wxListEvent & event)
{
	if (!m_FileList->GetItemCount()) return;

	wxMenu *popup = new wxMenu();

	if (m_FileList->GetSelectedItemCount()==1) {
		popup->Append(ID_PL_PLAY, wxT("Play"));
		popup->AppendSeparator();
	}
	popup->Append(ID_PL_SEL_REV, wxT("Inverse Selection"));
	if (m_FileList->GetSelectedItemCount()) popup->Append(ID_PL_REM_FILE, wxT("Remove File(s)"));
	if (m_FileList->GetItemCount()>1) {
		popup->AppendSeparator();
		popup->Append(ID_PL_SORT_TITLE, wxT("Sort By Title"));
		popup->Append(ID_PL_SORT_FILE, wxT("Sort By File Name"));
		popup->Append(ID_PL_SORT_DUR, wxT("Sort By Duration"));
		popup->AppendSeparator();
		popup->Append(ID_PL_REVERSE, wxT("Reverse List"));
		popup->Append(ID_PL_RANDOMIZE, wxT("Randomize"));
	}

	PopupMenu(popup, event.GetPoint());
	delete popup;
}
Example #6
0
//-----------------------------------------------------------------------------
void DeviceListCtrl::OnItemRightClick( wxListEvent& e )
//-----------------------------------------------------------------------------
{
    wxMenu menu( wxT( "" ) );
    menu.Append( LIST_ASSIGN_TEMPORARY_IP, wxT( "&Assign Temporary IPv4 Address" ), wxEmptyString );
    menu.Append( LIST_VIEW_POTENTIAL_PERFORMANCE_ISSUES, wxT( "&View Potential Performance Issues" ), wxEmptyString );
    PopupMenu( &menu, e.GetPoint() );
}
Example #7
0
void ItemEditorFrame::OnItemListRightClick( wxListEvent& event )
{
	if ( selectItemIndex < 0 )
		return;

	wxMenu* menu = new wxMenu;
	menu->Append( COM_CHANGE_ITEM_ID , wxT("Change ID") );
	menu->Append( COM_DELETE_ITEM    , wxT("Delete Item") );
	m_ItemListCtrl->PopupMenu( menu , event.GetPoint() );
	event.Skip();
}
Example #8
0
void CMuleListCtrl::OnColumnRClick(wxListEvent& evt)
{
	wxMenu menu;
	wxListItem item;
	
	for ( int i = 0; i < GetColumnCount() && i < 15; ++i) {
		GetColumn(i, item);

		menu.AppendCheckItem(i + MP_LISTCOL_1, item.GetText() );
		menu.Check( i + MP_LISTCOL_1, GetColumnWidth(i) > COL_SIZE_MIN );
	}

	PopupMenu(&menu, evt.GetPoint());
}
Example #9
0
void MyListCtrl::OnColRightClick(wxListEvent& event)
{
    int col = event.GetColumn();
    if ( col != -1 )
    {
        SetColumnImage(col, -1);
    }

    // Show popupmenu at position
    wxMenu menu(wxT("Test"));
    menu.Append(LIST_ABOUT, _T("&About"));
    PopupMenu(&menu, event.GetPoint());

    wxLogMessage( wxT("OnColumnRightClick at %d."), event.GetColumn() );
}
void 
PlayerPanel::onRightClicked(wxListEvent& ev)
{
    if (!mOperateMenu)
    {
        return;
    }

    if (!mListResultSet)
    {
        return;
    }

    if ((mListResultSet->GetWindowStyle() & wxLC_REPORT) && mListResultSet->GetSelectedItemCount() == 1)
    {
        wxPoint pt = ev.GetPoint();
        pt.y += mListResultSet->GetPosition().y;
        PopupMenu(mOperateMenu, pt);
    }
}
Example #11
0
void GameViewer::RightClick(wxListEvent& event)
{
	for (wxMenuItem *item : m_popup->GetMenuItems()) {
		m_popup->Destroy(item);
	}
	
	wxMenuItem* boot_item = new wxMenuItem(m_popup, 0, _T("Boot"));
#if defined (_WIN32)
	// wxMenuItem::Set(Get)Font only available for the wxMSW port
	wxFont font = GetFont();
	font.SetWeight(wxFONTWEIGHT_BOLD);
	boot_item->SetFont(font);
#endif
	m_popup->Append(boot_item);
	m_popup->Append(1, _T("Configure"));
	m_popup->Append(2, _T("Remove Game"));

	Bind(wxEVT_MENU, &GameViewer::BootGame, this, 0);
	Bind(wxEVT_MENU, &GameViewer::ConfigureGame, this, 1);
	Bind(wxEVT_MENU, &GameViewer::RemoveGame, this, 2);

	PopupMenu(m_popup, event.GetPoint());
}
Example #12
0
void MainFrame::ShowPopupMenu( wxListEvent& event )
{
    PopupMenu(GetPopupMenu(), event.GetPoint());
}
Example #13
0
void CSharedFilesCtrl::OnRightClick(wxListEvent& event)
{
	long item_hit = CheckSelection(event);

	if ( (m_menu == NULL) && (item_hit != -1)) {
		m_menu = new wxMenu(_("Shared Files"));
		wxMenu* prioMenu = new wxMenu();
		prioMenu->AppendCheckItem(MP_PRIOVERYLOW, _("Very low"));
		prioMenu->AppendCheckItem(MP_PRIOLOW, _("Low"));
		prioMenu->AppendCheckItem(MP_PRIONORMAL, _("Normal"));
		prioMenu->AppendCheckItem(MP_PRIOHIGH, _("High"));
		prioMenu->AppendCheckItem(MP_PRIOVERYHIGH, _("Very High"));
		prioMenu->AppendCheckItem(MP_POWERSHARE, _("Release"));
		prioMenu->AppendCheckItem(MP_PRIOAUTO, _("Auto"));

		m_menu->Append(0,_("Priority"),prioMenu);
		m_menu->AppendSeparator();

		CKnownFile* file = (CKnownFile*)GetItemData(item_hit);
		if (file->GetFileComment().IsEmpty() && !file->GetFileRating()) {
			m_menu->Append(MP_CMT, _("Add Comment/Rating"));
		} else {
			m_menu->Append(MP_CMT, _("Edit Comment/Rating"));
		}
		
		m_menu->AppendSeparator();
		m_menu->Append(MP_RENAME, _("Rename"));
		m_menu->AppendSeparator();

		if (file->GetFileName().GetExt() == wxT("emulecollection")) {
			m_menu->Append( MP_ADDCOLLECTION, _("Add files in collection to transfer list"));
			m_menu->AppendSeparator();
		}
		m_menu->Append(MP_GETMAGNETLINK,_("Copy magnet &URI to clipboard"));
		m_menu->Append(MP_GETED2KLINK,_("Copy eD2k &link to clipboard"));
		m_menu->Append(MP_GETSOURCEED2KLINK,_("Copy eD2k link to clipboard (&Source)"));
		m_menu->Append(MP_GETCRYPTSOURCEDED2KLINK,_("Copy eD2k link to clipboard (Source) (&With Crypt options)"));
		m_menu->Append(MP_GETHOSTNAMESOURCEED2KLINK,_("Copy eD2k link to clipboard (&Hostname)"));
		m_menu->Append(MP_GETHOSTNAMECRYPTSOURCEED2KLINK,_("Copy eD2k link to clipboard (Hostname) (With &Crypt options)"));		
		m_menu->Append(MP_GETAICHED2KLINK,_("Copy eD2k link to clipboard (&AICH info)"));
		m_menu->Append(MP_WS,_("Copy feedback to clipboard"));
		
		m_menu->Enable(MP_GETAICHED2KLINK, file->HasProperAICHHashSet());
		m_menu->Enable(MP_GETHOSTNAMESOURCEED2KLINK, !thePrefs::GetYourHostname().IsEmpty());
		m_menu->Enable(MP_GETHOSTNAMECRYPTSOURCEED2KLINK, !thePrefs::GetYourHostname().IsEmpty());

		int priority = file->IsAutoUpPriority() ? PR_AUTO : file->GetUpPriority();

		prioMenu->Check(MP_PRIOVERYLOW,	priority == PR_VERYLOW);
		prioMenu->Check(MP_PRIOLOW,	priority == PR_LOW);
		prioMenu->Check(MP_PRIONORMAL,	priority == PR_NORMAL);
		prioMenu->Check(MP_PRIOHIGH,	priority == PR_HIGH);
		prioMenu->Check(MP_PRIOVERYHIGH,priority == PR_VERYHIGH);
		prioMenu->Check(MP_POWERSHARE,	priority == PR_POWERSHARE);
		prioMenu->Check(MP_PRIOAUTO,	priority == PR_AUTO);

		PopupMenu( m_menu, event.GetPoint() );

		delete m_menu;

		m_menu = NULL;
	}
}
Example #14
0
void bmx_wxlistevent_getpoint(wxListEvent & event, int * x, int * y) {
	wxPoint p = event.GetPoint();
	*x = p.x;
	*y = p.y;
}
Example #15
0
void MaterialSelector::OnMaterialRightClicked(wxListEvent& event)
{
	long item = mMaterialList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
	if(item >= 0)
	{
		wxString name = mMaterialList->GetItemText(item);
		Ogre::MaterialPtr pMaterial = Ogre::MaterialManager::getSingleton().getByName(name.c_str());
		if (!pMaterial.isNull())
		{
			
			int iSelectedPage = m_Frame->GetEditorNotebook()->GetSelection();

			if(iSelectedPage == 0)
			{
				Fairy::EffectElement* pEffectElement = dynamic_cast<Fairy::EffectElement*>(m_Frame->GetEffectObjectEditor()->GetSelectedObject());
				if(pEffectElement)
				{
					Ogre::String elementType = pEffectElement->getType();
					if(elementType == "Mesh" || elementType == "BillboardSet" || 
						elementType == "Projector" || elementType == "Beam")
					{
						wxPoint pt = event.GetPoint();
						wxMenu menu;
						wxString menuText = wxT("效果:");
						menuText.Append(elementType.c_str());
						menu.Append(feID_SET_EFFECT_MATERIAL,menuText);
						wxPoint clientpt = event.GetPoint();
						PopupMenu(&menu, pt);

					}
					
				}
				Ogre::ParticleSystem* pParticleSystem = dynamic_cast<Ogre::ParticleSystem*>(m_Frame->GetEffectObjectEditor()->GetSelectedObject());
				if(pParticleSystem)
				{
					wxPoint pt = event.GetPoint();
					wxMenu menu;
					wxString menuText = wxT("粒子:");
					menuText.Append(pParticleSystem->getName().c_str());
					menu.Append(feID_SET_EFFECT_MATERIAL,menuText);
					wxPoint clientpt = event.GetPoint();
					PopupMenu(&menu, pt);

				}
			}
			else if(iSelectedPage == 1)
			{
				Ogre::StringInterface* pElement = m_Frame->GetSkillObjectEidtor()->GetSelectedSkllElement();
				if(!pElement)
					return;
				Fairy::AnimationRibbon* pRibbon = dynamic_cast<Fairy::AnimationRibbon*>(pElement);
				if(pRibbon)
				{
					wxPoint pt = event.GetPoint();
					wxMenu menu;
					wxString menuText = wxT("技能:Ribbon ");
					menu.Append(feID_SET_SKILL_MATERIAL,menuText);
					wxPoint clientpt = event.GetPoint();
					PopupMenu(&menu, pt);
				}
			}

			//#if wxUSE_MENUS
			//	wxMenu menu(title);
			//	menu.Append(TreeTest_About, wxT("&About..."));
			//	menu.AppendSeparator();
			//	menu.Append(TreeTest_Highlight, wxT("&Highlight item"));
			//	menu.Append(TreeTest_Dump, wxT("&Dump"));
			//
			//	PopupMenu(&menu, pt);
			//#endif // wxUSE_MENUS
		}
	}
}