void FindResultsTab::OnRecentSearches(wxAuiToolBarEvent& e) { // Show the menu wxMenu menu; clAuiToolStickness s(m_tb, e.GetId()); const int firstID = 8000; int counter = 0; std::map<int, History> entries; std::for_each(m_history.Begin(), m_history.End(), [&](const std::pair<wxString, History>& p) { menu.Prepend(firstID + counter, p.first, "", wxITEM_CHECK)->Check(m_searchTitle == p.first); entries.insert(std::make_pair(firstID + counter, p.second)); ++counter; }); menu.AppendSeparator(); int clearHistory = ::wxNewId(); menu.Append(clearHistory, _("Clear History")); int sel = GetPopupMenuSelectionFromUser(menu, e.GetItemRect().GetBottomLeft()); if(sel == wxID_NONE) return; if(sel == clearHistory) { m_history.Clear(); } else if(entries.count(sel)) { const History& h = entries.find(sel)->second; LoadSearch(h); } }
void CommandProcessorBase::OnTBUnRedo(wxAuiToolBarEvent& event) { wxPoint pt = event.GetItemRect().GetBottomLeft(); pt.y++; wxWindow* win = wxDynamicCast(event.GetEventObject(), wxWindow); // We must use the toolbar as 'win', in case it's not in its default location wxCHECK_RET(win, "No toolbar?"); PopulateUnRedoMenu(win, pt, event.GetId() == wxID_UNDO); }
void SFTPTreeView::OnAddBookmark(wxAuiToolBarEvent& event) { if ( event.IsDropDownClicked() ) { // Show the menu const wxArrayString &bookmarks = m_account.GetBookmarks(); wxMenu menu; for(size_t i=0; i<bookmarks.GetCount(); ++i) { menu.Append(ID_SFTP_BOOKMARK_FIRST+i, bookmarks.Item(i)); } menu.AppendSeparator(); menu.Append(ID_SFTP_BOOKMARK_SETTINGS, _("Manage bookmarks...")); wxPoint pt = event.GetItemRect().GetBottomLeft(); pt.y++; int sel = m_auibar->GetPopupMenuSelectionFromUser( menu, pt ); if ( sel >= ID_SFTP_BOOKMARK_FIRST && sel <= ID_SFTP_BOOKMARK_LAST ) { // A bookmark was selected CallAfter( &SFTPTreeView::DoBuildTree, bookmarks.Item(sel - ID_SFTP_BOOKMARK_FIRST) ); } else if ( sel == ID_SFTP_BOOKMARK_SETTINGS ) { // Bookmark settings CallAfter( &SFTPTreeView::ManageBookmarks ); } } else { try { // sanity if ( !m_sftp || !m_sftp->IsConnected() ) { return; } // Get the current selection MyClientDataVect_t selections = GetSelectionsItemData(); if ( selections.size() != 1 ) return; MyClientData* cd = selections.at(0); CHECK_PTR_RET( cd ); if ( !cd->IsFolder() ) return; m_account.AddBookmark( cd->GetFullPath() ); SFTPSettings settings; settings.Load(); settings.UpdateAccount( m_account ); settings.Save(); } catch (clException &e) { ::wxMessageBox(e.What(), "SFTP", wxICON_ERROR|wxOK|wxCENTER); } } }
void DbViewerPanel::OnERDSelected(wxAuiToolBarEvent& event) { wxMenu menu; menu.Append(XRCID("IDM_DBE_ERD_SQLITE"), _("SQLite")); menu.Append(XRCID("IDM_DBE_ERD_MYSQL"), _("MySQL")); menu.Append(XRCID("IDM_DBE_ERD_POSTGRESQL"), _("PostgreSQL")); int selection = GetPopupMenuSelectionFromUser(menu, event.GetItemRect().GetBottomLeft()); if(selection == XRCID("IDM_DBE_ERD_SQLITE")) { m_mgr->AddEditorPage(new ErdPanel(m_pNotebook, new SQLiteDbAdapter(), m_pConnections), _("SQLite ERD")); } else if(selection == XRCID("IDM_DBE_ERD_MYSQL")) { m_mgr->AddEditorPage(new ErdPanel(m_pNotebook, new MySqlDbAdapter(), m_pConnections), _("MySQL ERD")); } else if(selection == XRCID("IDM_DBE_ERD_POSTGRESQL")) { m_mgr->AddEditorPage(new ErdPanel(m_pNotebook, new PostgreSqlDbAdapter(), m_pConnections), _("PostgreSQL ERD")); } }
void DiffSideBySidePanelBase::ShowAuiToolMenu(wxAuiToolBarEvent& event) { event.Skip(); if (event.IsDropDownClicked()) { wxAuiToolBar* toolbar = wxDynamicCast(event.GetEventObject(), wxAuiToolBar); if (toolbar) { wxAuiToolBarItem* item = toolbar->FindTool(event.GetId()); if (item) { std::map<int, wxMenu*>::iterator iter = m_dropdownMenus.find(item->GetId()); if (iter != m_dropdownMenus.end()) { event.Skip(false); wxPoint pt = event.GetItemRect().GetBottomLeft(); pt.y++; toolbar->PopupMenu(iter->second, pt); } } } } }
void wxGISApplication::OnToolDropDown(wxAuiToolBarEvent& event) { if(event.IsDropDownClicked()) { wxGISCommand* pCmd = GetCommand(event.GetToolId()); m_pDropDownCommand = dynamic_cast<IDropDownCommand*>(pCmd); if(m_pDropDownCommand) { wxMenu* pMenu = m_pDropDownCommand->GetDropDownMenu(); if(pMenu) { PushEventHandler(pMenu); PopupMenu(pMenu, event.GetItemRect().GetBottomLeft()); PopEventHandler(); delete pMenu; return; } } } event.Skip(); }
void CommandProcessorBase::OnTBUnRedo(wxAuiToolBarEvent& event) { wxPoint pt = event.GetItemRect().GetBottomLeft(); pt.y++; PopulateUnRedoMenu(wxTheApp->GetTopWindow(), pt, event.GetId() == wxID_UNDO); }