void PeakMeter::OnRepeat(wxCommandEvent& WXUNUSED(event)) { if ( m_menu ) delete m_menu; wxMenuItem* item; m_menu = new wxMenu(); item = new wxMenuItem(m_menu, ID_REPEAT_NO, wxT("No Repeat")); m_menu->Append(item); item = new wxMenuItem(m_menu, ID_REPEAT_THIS, wxT("Repeat This")); m_menu->Append(item); item = new wxMenuItem(m_menu, ID_REPEAT_ALL, wxT("Repeat All")); m_menu->Append(item); PopupMenu(m_menu); }
void mxVarWindow::OnTreeClick2 (wxTreeEvent & evt) { if (debug->debugging) { // cuando se depura, sirve para inspeccionar if (!debug->paused) return; wxTreeItemId it=evt.GetItem(); if (it.IsOk() && tree->GetItemParent(it)!=tree_root) { tree->SelectItem(it); debug_panel->ShowInEvaluateDialog(tree->GetItemText(it).BeforeFirst('[')); } } else { // cuando no se depura muestra un menu contextual if (tree->GetItemParent(evt.GetItem())==tree_root) return; wxMenu menu; menu.Append(mxID_VARS_DEFINIR,_Z("Definir variable...")); // para mostrar en el dialogo menu.Append(mxID_VARS_ADD_TO_DESKTOP_TEST,_Z("Agregar la variable a la Prueba de Escritorio...")); // para mostrar en el dialogo PopupMenu(&menu); } }
void wxAreaChartCtrl::CreateContextMenu() { m_contextMenu.Append(wxID_SAVEAS, wxString("Save as")); Bind(wxEVT_CONTEXT_MENU, [this](wxContextMenuEvent& evt) { PopupMenu(&m_contextMenu, ScreenToClient(evt.GetPosition())); } ); m_contextMenu.Bind(wxEVT_MENU, [this](wxCommandEvent &) { wxFileDialog saveFileDialog(this, _("Save file"), "", "", "JPEG files (*.jpg;*.jpeg)|*.jpg;*.jpeg|PNG files (*.png)|*.png", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (saveFileDialog.ShowModal() == wxID_CANCEL) return; wxString filename = saveFileDialog.GetPath(); wxBitmapType type = wxBitmapType::wxBITMAP_TYPE_INVALID; switch (saveFileDialog.GetFilterIndex()) { case 0: type = wxBitmapType::wxBITMAP_TYPE_JPEG; if (wxImage::FindHandler(wxBitmapType::wxBITMAP_TYPE_JPEG) == 0) { wxImage::AddHandler(new wxJPEGHandler()); } break; case 1: type = wxBitmapType::wxBITMAP_TYPE_PNG; if (wxImage::FindHandler(wxBitmapType::wxBITMAP_TYPE_PNG) == 0) { wxImage::AddHandler(new wxPNGHandler()); } break; } m_areaChart.Save(filename, type, GetSize()); }, wxID_SAVEAS ); }
void GitConsole::DoOnDropdown(wxAuiToolBarEvent& e, const wxString& commandName, int id) { if(!e.IsDropDownClicked()) { e.Skip(); return; } GitEntry data; { clConfig conf("git.conf"); conf.ReadItem(&data); } // Force conf out of scope, else its dtor clobbers the GitConsole::OnDropDownMenuEvent Save() GitCommandsEntries& ce = data.GetGitCommandsEntries(commandName); vGitLabelCommands_t entries = ce.GetCommands(); int lastUsed = ce.GetLastUsedCommandIndex(); wxArrayString arr; wxMenu menu; for(size_t n = 0; n < entries.size(); ++n) { wxMenuItem* item = menu.AppendRadioItem(n, entries.at(n).label); item->Check(n == (size_t)lastUsed); arr.Add(entries.at(n).command); } menu.Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(GitConsole::OnDropDownMenuEvent), this, 0, arr.GetCount(), new GitCommandData(arr, commandName, id)); wxAuiToolBar* auibar = dynamic_cast<wxAuiToolBar*>(e.GetEventObject()); if(auibar) { clAuiToolStickness ts(auibar, e.GetToolId()); wxRect rect = auibar->GetToolRect(e.GetId()); wxPoint pt = auibar->ClientToScreen(rect.GetBottomLeft()); pt = ScreenToClient(pt); PopupMenu(&menu, pt); } menu.Unbind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(GitConsole::OnDropDownMenuEvent), this, 0, arr.GetCount(), new GitCommandData(arr, commandName, id)); }
void VHDDExplorer::OnContextMenu(wxMouseEvent& event) { wxMenu* menu = new wxMenu(); int idx = m_list->GetFirstSelected(); menu->Append(id_open, "Open")->Enable(idx != wxNOT_FOUND && m_entries[idx].type == vfsHDD_Entry_Dir); menu->Append(id_rename, "Rename")->Enable(idx != wxNOT_FOUND && m_names[idx] != "." && m_names[idx] != ".."); menu->Append(id_remove, "Remove")->Enable(idx != wxNOT_FOUND && m_names[idx] != "." && m_names[idx] != ".."); menu->AppendSeparator(); menu->Append(id_create_dir, "Create dir"); menu->Append(id_create_file, "Create file"); menu->AppendSeparator(); menu->Append(id_import, "Import"); menu->Append(id_export, "Export")->Enable(idx != wxNOT_FOUND); PopupMenu(menu); }
void ElementsCtrlBase::show_element_popup( bool only_insert /*=false*/, const wxPoint& p /*=wxDefaultPosition*/ ) { // we only display if there is exactly one element selected if( m_selels.size() == 0 ) return; wxDELETE(m_elpopup); m_elpopup = new wxMenu(); const notuniqs_type& notuniqs = wxGetApp().hudfile()->notuniq_elements(); int i=0; wxMenuItem *item; ElementBase *el; for( cit_notuniqs cit = notuniqs.begin(); cit != notuniqs.end() && i <= (ID_INSERT_NOTUNIQ_END - ID_INSERT_NOTUNIQ); ++cit, ++i ) { el = wxGetApp().hudfile()->find_element(*cit); item = m_elpopup->Append(ID_INSERT_NOTUNIQ+i, wxString::Format(_("Insert %s"), cit->c_str()), el ? el->desc() : wxT("HELP")); item->Enable( m_selels.size() == 1); } if( !only_insert ) { m_elpopup->AppendSeparator(); item = m_elpopup->Append( wxID_COPY, _("Copy") ); // only for 1 element selected item->Enable( m_selels.size() == 1 ); item = m_elpopup->Append( wxID_PASTE, _("Paste") ); // only if there is something to copy from item->Enable( m_copyfrom != 0 ); m_elpopup->AppendSeparator(); // only enable delete if we actually can delete the element (i.e. it's a notuniq one) item = m_elpopup->Append( wxID_DELETE, _("Remove") ); // only for removable elements item->Enable( m_selels.size() > 0 ); // only display if all selected elements are notuniqs! for( cit_elements cit = m_selels.begin(); cit != m_selels.end(); ++cit ) if( !(*cit)->is_removable() ) { item->Enable(false); break; } item = m_elpopup->Append( wxID_CLEAR, _("Reset") ); // always if something is selected } PopupMenu(m_elpopup, wxDefaultPosition); }
void AStatus::OnMouseEvent(wxMouseEvent & event) { if (event.ButtonDown() && mRateField.Inside(event.m_x, event.m_y)) { { wxClientDC dc(this); AColor::Bevel(dc, false, mRateField); } PopupMenu(mRateMenu, mRateField.x, mRateField.y + mRateField.height); { wxClientDC dc(this); AColor::Bevel(dc, true, mRateField); } } }
int VtxCloudsTabs::showMenu(bool expanded){ menu_action=TABS_NONE; wxMenu menu; menu.AppendCheckItem(OBJ_SHOW,wxT("Show")); menu.AppendSeparator(); menu.Append(OBJ_DELETE,wxT("Delete")); menu.Append(OBJ_SAVE,wxT("Save..")); wxMenu *addmenu=getAddMenu(object()); if(addmenu){ menu.AppendSeparator(); menu.AppendSubMenu(addmenu,"Add"); } PopupMenu(&menu); return menu_action; }
void mmMainCurrencyDialog::OnItemRightClick(wxDataViewEvent& event) { wxCommandEvent ev(wxEVT_COMMAND_MENU_SELECTED, wxID_ANY) ; ev.SetEventObject( this ); wxMenu* mainMenu = new wxMenu; mainMenu->Append(new wxMenuItem(mainMenu, MENU_ITEM1, _("Set as Base Currency"))); mainMenu->Append(new wxMenuItem(mainMenu, MENU_ITEM2, _("Online Update Currency Rate"))); int baseCurrencyID = Option::instance().BaseCurrency(); if (baseCurrencyID == currencyID_) mainMenu->Enable(MENU_ITEM1, false); PopupMenu(mainMenu); delete mainMenu; event.Skip(); }
void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event) { event.Skip(); ClearStatusBar(); if (event.IsDropDownClicked()) { wxAuiToolBar* tb = static_cast<wxAuiToolBar*>(event.GetEventObject()); tb->SetToolSticky(event.GetId(), true); // create the popup menu wxMenu* menuPopup = new wxMenu; wxMenuItem* Item = new wxMenuItem(menuPopup, IDM_ADD_PERSPECTIVE, _("Create new perspective")); menuPopup->Append(Item); if (Perspectives.size() > 0) { menuPopup->Append(new wxMenuItem(menuPopup)); for (u32 i = 0; i < Perspectives.size(); i++) { wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i, StrToWxStr(Perspectives[i].Name), wxT(""), wxITEM_CHECK); menuPopup->Append(mItem); if (i == ActivePerspective) { mItem->Check(true); } } } // line up our menu with the button wxRect rect = tb->GetToolRect(event.GetId()); wxPoint pt = tb->ClientToScreen(rect.GetBottomLeft()); pt = ScreenToClient(pt); // show PopupMenu(menuPopup, pt); // make sure the button is "un-stuck" tb->SetToolSticky(event.GetId(), false); } }
void ChatPanel::OnMouseDown(wxMouseEvent& event) { slLogDebugFunc(""); wxTextCoord row; wxTextCoord col; wxTextCtrlHitTestResult ht = m_chatlog_text->HitTest(event.GetPosition(), &col, &row); if (ht != wxTE_HT_UNKNOWN) { long pos = m_chatlog_text->XYToPosition(col, row); m_url_at_pos = FindUrl(pos); } CreatePopup(); if (m_popup_menu != NULL) { PopupMenu(m_popup_menu->GetMenu()); } else { event.Skip(); } }
void WinEDA_DrawPanel::OnRightClick(wxMouseEvent& event) /*******************************************************/ /* Construit et affiche un menu Popup lorsque on actionne le bouton droit de la souris */ { wxPoint pos; wxMenu MasterMenu; pos.x = event.GetX(); pos.y = event.GetY(); m_Parent->OnRightClick(pos, &MasterMenu); AddMenuZoom(&MasterMenu); m_IgnoreMouseEvents = TRUE; PopupMenu( &MasterMenu, pos); MouseToCursorSchema(); m_IgnoreMouseEvents = FALSE; }
BOOL CElcSkinFrameBase::NcLButtonDown(UINT nHitTest, CPoint point) { GetOppositePoint(point); m_nLBDownItem = ESNWT_NONE; if (HTMENU == nHitTest) { int nIndex = PtInMenuItem(point); if (nIndex != -1) { m_bMenuActivated = !m_bMenuActivated; m_nActiveItem = nIndex; if (m_bMenuActivated) { RedrawMenuBar(); //m_bSelfCancelMenu = TRUE; PopupMenu(nIndex); } else { m_bSelfCancelMenu = TRUE; ::SendMessage(m_hDerive, WM_CANCELMODE, 0, 0); RedrawMenuBar(); } } } else if (HTSYSMENU == nHitTest) { PopupSysMenu(); } else { int nItem = FindButton(nHitTest); if (nItem != -1) { m_nLBDownItem = nHitTest; RedrawButton(m_arrButton[nItem].pButton); return TRUE; } m_nActiveItem = -1; m_bMenuActivated = FALSE; m_nActiveButton = -1; m_nLBDownItem = ESNWT_NONE; RedrawMenuBar(); return FALSE; } return TRUE; }
//---------------------------------------------------------------------------------------- void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event)) { int i; Temp0.Empty(); // Get the Information that we need wxTreeItemId itemId = GetSelection(); DBTreeData *item = (DBTreeData *)GetItemData(itemId); SaveDSN.Empty(); if ( item != NULL ) { int Treffer = 0; Temp1.Printf(_T("%s"),item->m_desc.c_str()); //-------------------------------------------------------------------------------------- if (Temp1.Contains(_T("ODBC-"))) { Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN); for (i=0;i<pDoc->i_DSN;i++) { if (Temp1 == (pDoc->p_DSN+i)->Dsn) { SaveDSN = Temp1; PopupMenu(popupMenu1,TreePos.x,TreePos.y); } } Treffer++; } //-------------------------------------------------------------------------------------- if (Treffer == 0) { /* Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold," "%u children (%u immediately under this item)."), item->m_desc.c_str(), bool2String(IsSelected(itemId)), bool2String(IsExpanded(itemId)), bool2String(IsBold(itemId)), GetChildrenCount(itemId), GetChildrenCount(itemId)); LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str()); wxLogMessage( "%s", LogBuf.c_str() ); */ } //-------------------------------------------------------------------------------------- } } // void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event))
void CtrlRegisterList::gridEvent(wxGridEvent& evt) { // Mouse events if (evt.GetEventType() == wxEVT_GRID_CELL_RIGHT_CLICK || evt.GetEventType() == wxEVT_GRID_LABEL_RIGHT_CLICK) { wxMenu menu; int bits = cpu->getRegisterSize(getCurrentCategory()); menu.AppendRadioItem(ID_REGISTERLIST_DISPLAY32, L"Display 32 bit"); menu.AppendRadioItem(ID_REGISTERLIST_DISPLAY64, L"Display 64 bit"); menu.AppendRadioItem(ID_REGISTERLIST_DISPLAY128, L"Display 128 bit"); menu.AppendSeparator(); if (bits >= 64) { menu.Append(ID_REGISTERLIST_CHANGELOWER, L"Change lower 64 bit"); menu.Append(ID_REGISTERLIST_CHANGEUPPER, L"Change upper 64 bit"); } else { menu.Append(ID_REGISTERLIST_CHANGEVALUE, L"Change value"); } switch (maxBits) { case 128: menu.Check(ID_REGISTERLIST_DISPLAY128, true); break; case 64: menu.Check(ID_REGISTERLIST_DISPLAY64, true); break; case 32: menu.Check(ID_REGISTERLIST_DISPLAY32, true); break; } menu.Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(CtrlRegisterList::onPopupClick), nullptr, this); PopupMenu(&menu, evt.GetPosition()); needsValueUpdating = true; } else { evt.Skip(); } }
void mmWebAppDialog::OnItemRightClick(wxDataViewEvent& event) { wxDataViewItemArray Selected; webtranListBox_->GetSelections(Selected); wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, wxID_ANY); evt.SetEventObject(this); wxMenu* mainMenu = new wxMenu; mainMenu->Append(new wxMenuItem(mainMenu, MENU_OPEN_ATTACHMENT, _("Open Attachment"))); mainMenu->Append(new wxMenuItem(mainMenu, MENU_IMPORT_WEBTRAN, _("Import"))); mainMenu->Append(new wxMenuItem(mainMenu, MENU_DELETE_WEBTRAN, _("Delete"))); if (Selected.size() != 1) mainMenu->Enable(MENU_OPEN_ATTACHMENT, false); PopupMenu(mainMenu); delete mainMenu; event.Skip(); }
void ConsoleCanvas::OnContextMenu( wxContextMenuEvent& event ) { wxMenu* contextMenu = new wxMenu(); wxMenuItem* btnLeg = new wxMenuItem(contextMenu, ID_NAVLEG, _("This Leg"), _T(""), wxITEM_RADIO ); wxMenuItem* btnRoute = new wxMenuItem(contextMenu, ID_NAVROUTE, _("Full Route"), _T(""), wxITEM_RADIO ); wxMenuItem* btnHighw = new wxMenuItem(contextMenu, ID_NAVHIGHWAY, _("Show Highway"), _T(""), wxITEM_CHECK ); contextMenu->Append( btnLeg ); contextMenu->Append( btnRoute ); contextMenu->AppendSeparator(); contextMenu->Append( btnHighw ); btnLeg->Check( ! g_bShowRouteTotal ); btnRoute->Check( g_bShowRouteTotal ); btnHighw->Check( g_bShowActiveRouteHighway ); PopupMenu( contextMenu ); delete contextMenu; }
void ValueListCtrl::OnRightDown(wxMouseEvent& event) { int Flags = wxLIST_HITTEST_ONITEM; long ItemID = HitTest(wxPoint(event.m_x, event.m_y), Flags); if(ItemID < 0) { return; } SelectItem(ItemID); wxMenu* pMenu = new wxMenu; pMenu->Append(VALUEMODIFY, "Modify"); pMenu->AppendSeparator(); pMenu->Append(VALUEDELETE, "Delete"); pMenu->Append(VALUERENAME, "Rename"); PopupMenu(pMenu, event.m_x, event.m_y); delete pMenu; }
void SQLCommandPanel::OnTemplatesBtnClick(wxAuiToolBarEvent& event) { wxMenu menu; menu.Append(XRCID("IDR_SQLCOMMAND_SELECT"),_("Insert SELECT SQL template"),_("Insert SELECT SQL statement template into editor.")); menu.Append(XRCID("IDR_SQLCOMMAND_INSERT"),_("Insert INSERT SQL template"),_("Insert INSERT SQL statement template into editor.")); menu.Append(XRCID("IDR_SQLCOMMAND_UPDATE"),_("Insert UPDATE SQL template"),_("Insert UPDATE SQL statement template into editor.")); menu.Append(XRCID("IDR_SQLCOMMAND_DELETE"),_("Insert DELETE SQL template"),_("Insert DELETE SQL statement template into editor.")); menu.Connect(wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction)&SQLCommandPanel::OnPopupClick, NULL, this); wxAuiToolBar* auibar = dynamic_cast<wxAuiToolBar*>(event.GetEventObject()); if ( auibar ) { clAuiToolStickness ts(auibar, event.GetToolId()); wxRect rect = auibar->GetToolRect(event.GetId()); wxPoint pt = auibar->ClientToScreen(rect.GetBottomLeft()); pt = ScreenToClient(pt); PopupMenu(&menu, pt); } }
void exclusion_listctrl::popup_menu( wxMouseEvent& event ) { wxMenu a_menu; a_menu.Append( PU_ADD_EXCLUSION, _( "Add a new exclusion...") ); a_menu.Append( PU_EDIT_EXCLUSION, _( "Edit selected exclusion..." ) ); a_menu.Append( PU_DELETE_EXCLUSION, _( "Delete selected exclusion" ) ); // If no listctrl rows selected, then disable the menu items that require selection if ( GetSelectedItemCount() == 0 ) { a_menu.Enable( PU_EDIT_EXCLUSION, FALSE ); a_menu.Enable( PU_DELETE_EXCLUSION, FALSE ); } // Show the popup menu (wxWindow::PopupMenu ), at the x,y position of the click event PopupMenu( &a_menu, event.GetPosition() ); }
void StatusBar::PopupSyntaxMenu(wxRect& menuPos) { const wxString& current = m_editorCtrl->GetSyntaxName(); // Get syntaxes and sort std::vector<cxSyntaxInfo*> syntaxes = m_syntax_handler->GetSyntaxes(); sort(syntaxes.begin(), syntaxes.end(), tmActionCmp()); // Syntax submenu wxMenu syntaxMenu; for (unsigned int i = 0; i < syntaxes.size(); ++i) { const cxSyntaxInfo& si = *syntaxes[i]; wxMenuItem* item = syntaxMenu.Append(new BundleMenuItem(&syntaxMenu, 1000+i, si, wxITEM_CHECK)); if (si.name == current) item->Check(); } PopupMenu(&syntaxMenu, menuPos.x, menuPos.y); }
void OutputViewControlBarToggleButton::DoShowPopupMenu() { wxRect rr = GetSize(); wxMenu popupMenu; #ifdef __WXMSW__ wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); #endif OutputViewControlBar *bar = (OutputViewControlBar *)GetParent(); for (size_t i=0; i<bar->m_buttons.size(); i++) { #ifndef __WXGTK__ OutputViewControlBarButton *button = bar->m_buttons.at(i); #else OutputViewControlBarToggleButton *button = bar->m_buttons.at(i); #endif wxString text = button->GetText(); #ifndef __WXGTK__ bool selected = button->GetState() == OutputViewControlBarButton::Button_Pressed; #else bool selected = button->GetValue(); #endif wxMenuItem *item = new wxMenuItem(&popupMenu, wxXmlResource::GetXRCID(button->GetText().c_str()), text, text, wxITEM_CHECK); //set the font #ifdef __WXMSW__ if (selected) { font.SetWeight(wxBOLD); } item->SetFont(font); #endif popupMenu.Append(item); //mark the selected item item->Check(selected); //restore font #ifdef __WXMSW__ font.SetWeight(wxNORMAL); #endif } popupMenu.Connect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(OutputViewControlBar::OnMenuSelection), NULL, bar); PopupMenu( &popupMenu, rr.x, rr.y ); }
void BattleroomListCtrl::OnListRightClick( wxListEvent& event ) { wxLogDebugFunc( _T("") ); if ( m_ro ) return; int index = event.GetIndex(); if ( index == -1 || index >= (long)m_data.size()) return; User& user = *GetDataFromIndex( event.GetIndex() ); m_sel_user = &user; //this is set for event handlers if ( user.BattleStatus().IsBot() ) { wxLogMessage(_T("Bot")); int item = m_popup->FindItem( _("Spectator") ); m_popup->Enable( item, false ); m_popup->Check( item, false ); m_popup->Enable( m_popup->FindItem( _("Ring") ), false ); m_popup->Enable( m_popup->FindItem( _("Kick") ),true); } else { wxLogMessage(_T("User")); assert( m_popup ); int item = m_popup->FindItem( _("Spectator") ); m_popup->Check( item, m_sel_user->BattleStatus().spectator ); m_popup->Enable( item, true ); m_popup->Enable( m_popup->FindItem( _("Ring") ), true ); bool isSelUserMe = ( ui().IsThisMe(user) ); m_popup->Enable( m_popup->FindItem( _("Kick") ),!isSelUserMe); } wxLogMessage(_T("Popup")); m_popup->EnableItems( !user.BattleStatus().IsBot(), GetSelectedUserNick() );//this updates groups, therefore we need to update the connection to evt handlers too std::vector<int> groups_ids = m_popup->GetGroupIds(); for (std::vector<int>::const_iterator it = groups_ids.begin(); it != groups_ids.end(); ++it) { Connect( *it, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( BattleroomListCtrl::OnUserMenuAddToGroup ), 0, this ); } Connect( GROUP_ID_NEW, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( BattleroomListCtrl::OnUserMenuCreateGroup), 0, this ); PopupMenu( m_popup ); wxLogMessage(_T("Done")); }
//--------------------------------------------------------- void CVIEW_Table_Control::On_RClick(wxGridEvent &event) { SetGridCursor(event.GetRow(), event.GetCol()); int iField = m_Field_Offset + event.GetCol(); CSG_Table_Record *pRecord = m_pRecords[event.GetRow()]; //----------------------------------------------------- if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String ) { wxMenu Menu; CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_OPEN_APP); CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_OPEN_DATA); PopupMenu(&Menu, event.GetPosition()); // PopupMenu(&Menu, GetParent()->ScreenToClient(ClientToScreen(event.GetPosition()))); } }
void browsers::CellBrowser::ShowMenu(wxTreeItemId id, const wxPoint& pt) { wxMenu menu; RBcellID = id; if ( id.IsOk() && (id != GetRootItem())) { wxString RBcellname = GetItemText(id); menu.Append(CELLTREEOPENCELL, wxT("Open " + RBcellname)); menu.Append(tui::TMCELL_REF_B , wxT("Add reference to " + RBcellname)); menu.Append(tui::TMCELL_AREF_B, wxT("Add array of " + RBcellname)); wxString ost; ost << wxT("export ") << RBcellname << wxT(" to GDS"); menu.Append(tui::TMGDS_EXPORTC, ost); menu.Append(tui::TMCELL_REPORTLAY, wxT("Report layers used in " + RBcellname)); } else { menu.Append(tui::TMCELL_NEW, wxT("New cell")); // will be catched up in toped.cpp menu.Append(tui::TMGDS_EXPORTL, wxT("GDS export")); } PopupMenu(&menu, pt); }
void CMemoryView::OnMouseDownR(wxMouseEvent& event) { // popup menu wxMenu* menu = new wxMenu; //menu.Append(IDM_GOTOINMEMVIEW, _("&Goto in mem view")); #if wxUSE_CLIPBOARD menu->Append(IDM_COPYADDRESS, _("Copy &address")); menu->Append(IDM_COPYHEX, _("Copy &hex")); #endif menu->Append(IDM_TOGGLEMEMORY, _("Toggle &memory")); wxMenu* viewAsSubMenu = new wxMenu; viewAsSubMenu->Append(IDM_VIEWASFP, _("FP value")); viewAsSubMenu->Append(IDM_VIEWASASCII, "ASCII"); viewAsSubMenu->Append(IDM_VIEWASHEX, _("Hex")); menu->AppendSubMenu(viewAsSubMenu, _("View As:")); PopupMenu(menu); }
void OnChar(wxKeyEvent &evt) { if (evt.GetKeyCode()==WXK_TAB) { if (debug->CanTalkToGDB()) { comp_options.Clear(); wxString ans = debug->SendCommand("complete ",GetValue()); while (ans.Contains("\n")) { wxString line=ans.BeforeFirst('\n'); ans=ans.AfterFirst('\n'); if (line.StartsWith("~\"")) { wxString ue=mxUT::UnEscapeString(line.Mid(1)); while (ue.Len() && (ue.Last()=='\n'||ue.Last()=='\r')) ue.RemoveLast(); comp_options.Add(ue); } } if (!comp_options.GetCount()) return; if (comp_options.GetCount()==1) { SetText(comp_options[0]); return; } else { wxString common_part=comp_options[0]; for(unsigned int i=1;i<comp_options.GetCount();i++) { int j=0, l1=comp_options[i].Len(), l2=common_part.Len(); while (j<l1 && j<l2 && comp_options[i][j]==common_part[j]) j++; if (j<l2) common_part=common_part.Mid(0,j); } if (common_part!=GetValue()) SetValue(common_part); } wxMenu menu(""); for(unsigned int i=0;i<comp_options.GetCount();i++) menu.Append(wxID_HIGHEST+1000+i, comp_options[i]); wxRect r = GetScreenRect(); PopupMenu(&menu,0,r.height); } } else if (evt.GetKeyCode()==WXK_UP) { if (input_history_pos>0) SetText(input_history[--input_history_pos]); } else if (evt.GetKeyCode()==WXK_DOWN) { if (input_history_pos+1==input_history.GetCount()) SetText(""); else if (input_history_pos+1<input_history.GetCount()) SetText(input_history[++input_history_pos]); } else { evt.Skip(); } }
void CQueueViewFailed::OnContextMenu(wxContextMenuEvent& event) { wxMenu* pMenu = wxXmlResource::Get()->LoadMenu(_T("ID_MENU_QUEUE_FAILED")); if (!pMenu) return; #ifndef __WXMSW__ // GetNextItem is O(n) if nothing is selected, GetSelectedItemCount() is O(1) const bool has_selection = GetSelectedItemCount() != 0; #else const bool has_selection = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED) != -1; #endif pMenu->Enable(XRCID("ID_REMOVE"), has_selection); pMenu->Enable(XRCID("ID_REQUEUE"), has_selection); PopupMenu(pMenu); delete pMenu; }
void wxFlatButton::DoShowContextMenu() { if(!HasMenu()) { return; } wxPoint pt = GetClientRect().GetBottomLeft(); pt.y += 1; // Notify about menu is about to be shown wxFlatButtonEvent event(wxEVT_CMD_FLATBUTTON_MENU_SHOWING); event.SetMenu(m_contextMenu); event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); PopupMenu(m_contextMenu, pt); m_state = kStateNormal; m_isChecked = false; Refresh(); }
void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event ) { wxMenu menu; // menu text is capitalized: // http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_COPPERS, _( "Show All Copper Layers" ) ) ); menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS_BUT_ACTIVE, _( "Hide All Copper Layers But Active" ) ) ); menu.Append( new wxMenuItem( &menu, ID_ALWAYS_SHOW_NO_COPPERS_BUT_ACTIVE, _( "Always Hide All Copper Layers But Active" ) ) ); menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS, _( "Hide All Copper Layers" ) ) ); PopupMenu( &menu ); passOnFocus(); }