本文整理汇总了C++中PopupMenu函数的典型用法代码示例。如果您正苦于以下问题:C++ PopupMenu函数的具体用法?C++ PopupMenu怎么用?C++ PopupMenu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PopupMenu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WXUNUSED
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);
}
示例2: PopupMenu
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);
}
}
示例3: wxString
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
);
}
示例4: conf
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));
}
示例5: wxMenu
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);
}
示例6: wxDELETE
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);
}
示例7: dc
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);
}
}
}
示例8: PopupMenu
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;
}
示例9: ev
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();
}
示例10: ClearStatusBar
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);
}
}
示例11: slLogDebugFunc
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();
}
}
示例12: AddMenuZoom
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;
}
示例13: GetOppositePoint
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;
}
示例14: WXUNUSED
//----------------------------------------------------------------------------------------
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))
示例15: switch
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();
}
}