void MyListCtrl::OnContextMenu(wxContextMenuEvent& event) { if (GetEditControl() == NULL) { wxPoint point = event.GetPosition(); // If from keyboard if ( (point.x == -1) && (point.y == -1) ) { wxSize size = GetSize(); point.x = size.x / 2; point.y = size.y / 2; } else { point = ScreenToClient(point); } ShowContextMenu(point); } else { // the user is editing: // allow the text control to display its context menu // if it has one (it has on Windows) rather than display our one event.Skip(); } }
void wxTextCtrl::OnContextMenu(wxContextMenuEvent& event) { if ( GetTextPeer()->HasOwnContextMenu() ) { event.Skip() ; return ; } #if wxUSE_MENUS if (m_privateContextMenu == NULL) { m_privateContextMenu = new wxMenu; m_privateContextMenu->Append(wxID_UNDO, _("&Undo")); m_privateContextMenu->Append(wxID_REDO, _("&Redo")); m_privateContextMenu->AppendSeparator(); m_privateContextMenu->Append(wxID_CUT, _("Cu&t")); m_privateContextMenu->Append(wxID_COPY, _("&Copy")); m_privateContextMenu->Append(wxID_PASTE, _("&Paste")); m_privateContextMenu->Append(wxID_CLEAR, _("&Delete")); m_privateContextMenu->AppendSeparator(); m_privateContextMenu->Append(wxID_SELECTALL, _("Select &All")); } PopupMenu(m_privateContextMenu); #endif }
void unFilterListCtrl::OnContextMenu( wxContextMenuEvent& event ) { wxPoint pt = event.GetPosition(); //wxLogMessage(wxT("OnContextMenu at screen coords (%i, %i)"), pt.x, pt.y); if( pt.x == -1 && pt.y == -1 ) { pt = wxWindow::FindFocus()->GetPosition(); } else { pt = ScreenToClient(pt); if( pt.y > List->GetPosition().y ) { event.Skip(); return; } } wxMenu menu(wxT("RegExp Options")); menu.AppendRadioItem(Menu_SyntaxExtended, wxT("&Extended Syntax")); menu.AppendRadioItem(Menu_SyntaxAdvanced, wxT("&Advanced Syntax")); menu.AppendRadioItem(Menu_SyntaxBasic, wxT("&Basic Syntax")); menu.AppendSeparator(); menu.AppendCheckItem(Menu_CaseSensitive, wxT("Ignore &Case")); menu.AppendCheckItem(Menu_BackReferences, wxT("Don't set Back &References")); menu.Check( Menu_SyntaxExtended + unFilterListCtrl::reSyntax, true ); menu.Check( Menu_CaseSensitive, !unFilterListCtrl::reCaseSensitive ); menu.Check( Menu_BackReferences, !unFilterListCtrl::reBackReferences ); PopupMenu(&menu, pt); }
void Notebook::OnMenu(wxContextMenuEvent& e) { int where = HitTest( ScreenToClient(::wxGetMousePosition()) ); if(where != wxNOT_FOUND && m_contextMenu) { SetSelection(where, false); // dont notify the user about changes PopupMenu(m_contextMenu); } e.Skip(); }
void TimeEdit::OnContextMenu(wxContextMenuEvent &evt) { if (byFrame || insert) { evt.Skip(); return; } wxMenu menu; menu.Append(Time_Edit_Copy, _("&Copy")); menu.Append(Time_Edit_Paste, _("&Paste")); PopupMenu(&menu); }
void ProjectPanel::OnContextMenu( wxContextMenuEvent& event ) { if ( !m_Project ) { event.Skip(); return; } wxPoint point = wxGetMousePosition(); PopupMenu( &m_ContextMenu ); }
void cbStyledTextCtrl::OnContextMenu(wxContextMenuEvent& event) { if (m_pParent) { if ( EditorBase* pParent = dynamic_cast<EditorBase*>(m_pParent) ) { const bool is_right_click = event.GetPosition() != wxDefaultPosition; const wxPoint mp(is_right_click ? event.GetPosition() : wxDefaultPosition); pParent->DisplayContextMenu(mp, mtEditorManager); } else event.Skip(); } }
void TimeTextCtrl::OnContext(wxContextMenuEvent &event) { wxMenu menu; int i; if (!mMenuEnabled) { event.Skip(); return; } SetFocus(); for(i=0; i<GetNumBuiltins(); i++) { menu.AppendCheckItem(ID_MENU+i, GetBuiltinName(i)); if (mFormatString == GetBuiltinFormat(i)) menu.Check(ID_MENU+i, true); } PopupMenu(&menu, wxPoint(0, 0)); }
void CSearchDialog::OnContextMenu(wxContextMenuEvent& event) { if (event.GetEventObject() != m_results) { event.Skip(); return; } wxMenu* pMenu = wxXmlResource::Get()->LoadMenu(_T("ID_MENU_SEARCH")); if (!pMenu) return; if (!m_pState->IsRemoteIdle()) { pMenu->Enable(XRCID("ID_MENU_SEARCH_DOWNLOAD"), false); pMenu->Enable(XRCID("ID_MENU_SEARCH_DELETE"), false); } PopupMenu(pMenu); delete pMenu; }
void wxGISFeatureDetailsPanel::OnContextMenu(wxContextMenuEvent& event) { wxRect rc = m_listCtrl->GetRect(); wxPoint point = event.GetPosition(); // If from keyboard if (point.x == -1 && point.y == -1) { wxSize size = GetSize(); point.x = rc.GetLeft() + rc.GetWidth() / 2; point.y = rc.GetTop() + rc.GetHeight() / 2; } else { point = m_listCtrl->ScreenToClient(point); } if(!rc.Contains(point)) { event.Skip(); return; } PopupMenu(m_pMenu, point.x, point.y); }
void HotkeyCtrl::onContextMenu(wxContextMenuEvent& e) { e.Skip(); }
void CLocalListView::OnContextMenu(wxContextMenuEvent& event) { if (GetEditControl()) { event.Skip(); return; } wxMenu* pMenu = wxXmlResource::Get()->LoadMenu(_T("ID_MENU_LOCALFILELIST")); if (!pMenu) return; const bool connected = m_pState->IsRemoteConnected(); if (!connected) { pMenu->Enable(XRCID("ID_EDIT"), COptions::Get()->GetOptionVal(OPTION_EDIT_TRACK_LOCAL) == 0); pMenu->Enable(XRCID("ID_UPLOAD"), false); pMenu->Enable(XRCID("ID_ADDTOQUEUE"), false); } int index = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); int count = 0; int fillCount = 0; bool selectedDir = false; while (index != -1) { count++; const CLocalFileData* const data = GetData(index); if (!data || (!index && m_hasParent)) { pMenu->Enable(XRCID("ID_OPEN"), false); pMenu->Enable(XRCID("ID_RENAME"), false); pMenu->Enable(XRCID("ID_EDIT"), false); } if ((data && data->flags == fill) || (!index && m_hasParent)) fillCount++; if (data && data->dir) selectedDir = true; index = GetNextItem(index, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); } if (!count || fillCount == count) { pMenu->Delete(XRCID("ID_ENTER")); pMenu->Enable(XRCID("ID_UPLOAD"), false); pMenu->Enable(XRCID("ID_ADDTOQUEUE"), false); pMenu->Enable(XRCID("ID_DELETE"), false); pMenu->Enable(XRCID("ID_RENAME"), false); pMenu->Enable(XRCID("ID_EDIT"), false); } else if (count > 1) { pMenu->Delete(XRCID("ID_ENTER")); pMenu->Enable(XRCID("ID_RENAME"), false); } else { // Exactly one item selected if (!selectedDir) pMenu->Delete(XRCID("ID_ENTER")); } if (selectedDir) pMenu->Enable(XRCID("ID_EDIT"), false); PopupMenu(pMenu); delete pMenu; }
void TreeviewSample::OnContextMenu( wxContextMenuEvent& event ) { event.Skip(); }