本文整理汇总了C++中ShowContextMenu函数的典型用法代码示例。如果您正苦于以下问题:C++ ShowContextMenu函数的具体用法?C++ ShowContextMenu怎么用?C++ ShowContextMenu使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ShowContextMenu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_pidl
void SpecialFolderItem::Invoke(int button)
{
const struct _ITEMIDLIST * pidl = check_pidl();
if ((INVOKE_DBL|INVOKE_LEFT) == button)
{
m_pMenu->hide_on_click();
if (pidl) exec_folder_click(pidl);
return;
}
if (INVOKE_RIGHT & button)
{
ShowContextMenu(NULL, pidl);
return;
}
if (INVOKE_DRAG & button)
{
m_pMenu->start_drag(NULL, pidl);
return;
}
if (INVOKE_LEFT & button)
{
if (m_pSubMenu && (MENU_ID_SF != m_pSubMenu->m_MenuID))
m_pMenu->HideChild(); // hide contextmenu
}
FolderItem::Invoke(button);
}
示例2: QMenu
item_equipBag::item_equipBag(CPlayer *w_player)
:player(w_player)
{
ui.btn_sale->setVisible(true);
ui.btn_sort->setVisible(true);
ui.tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
m_item = player->get_bag_equip();
m_storageItem = player->get_storage_equip();
CurrentPage = 1;
ui.edit_page_all->setText(QString::number(4));
popMenu = new QMenu();
action_use = new QAction(QStringLiteral("装备"), this);
action_storage = new QAction(QStringLiteral("入库"), this);
action_sale = new QAction(QStringLiteral("销售"), this);
popMenu->addAction(action_use);
popMenu->addAction(action_storage);
popMenu->addAction(action_sale);
connect(ui.btn_sale, SIGNAL(clicked()), this, SLOT(on_btn_sale_clicked()));
connect(ui.btn_sort, SIGNAL(clicked()), this, SLOT(on_btn_sort_clicked()));
connect(ui.btn_pgUp, SIGNAL(clicked()), this, SLOT(on_btn_pgUp_clicked()));
connect(ui.btn_pgDn, SIGNAL(clicked()), this, SLOT(on_btn_pgDn_clicked()));
connect(ui.tableWidget, SIGNAL(cellEntered(int, int)), this, SLOT(ShowItemInfo(int, int)));
connect(ui.tableWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(ShowContextMenu(QPoint)));
connect(action_use, SIGNAL(triggered(bool)), this, SLOT(on_action_use(bool)));
connect(action_storage, SIGNAL(triggered(bool)), this, SLOT(on_action_storage(bool)));
connect(action_sale, SIGNAL(triggered(bool)), this, SLOT(on_action_sale(bool)));
}
示例3: switch
LRESULT TaskButton::HandleMessage(HWND window, UINT msg, WPARAM wParam, LPARAM lParam, NPARAM) {
switch (msg) {
case WM_MOUSEMOVE:
ActivateState(State::Hover);
return 0;
case WM_MOUSELEAVE:
ClearState(State::Hover);
return 0;
case WM_TIMER:
if (wParam == mFlashInterval) {
mPane->ToggleState(State::Flashing);
}
return 0;
case WM_LBUTTONUP:
SelectTask();
return 0;
case WM_RBUTTONUP:
ShowContextMenu();
return 0;
case WM_MBUTTONUP:
OpenTaskProcess();
return 0;
}
return mEventHandler->HandleMessage(window, msg, wParam, lParam, this);
};
示例4: OnContextMenu
void CEditFrameView::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
if (!ShowContextMenu (point))
{
Default ();
}
}
示例5: GetCursorPos
void CFileExplore::OnRclickFileList(NMHDR* pNMHDR, LRESULT* pResult)
{
CPoint point;
GetCursorPos(&point);
HTREEITEM hItem = m_DirTree.GetSelectedItem();
POSITION pos = m_FileList.GetFirstSelectedItemPosition();
if(hItem!=NULL&&pos!=NULL)
{
CString strDirPath;
while(hItem!=m_hRoot)
{
strDirPath = _T("\\") + m_DirTree.GetItemText(hItem)+strDirPath;
hItem = m_DirTree.GetParentItem(hItem);
}
int nItem = m_FileList.GetNextSelectedItem(pos);
strDirPath = m_strStartFolder + strDirPath + _T('\\') + m_FileList.GetItemText(nItem,0);
int RetCmd = ShowContextMenu(0,GetSafeHwnd(), strDirPath, point.x, point.y, NULL,&m_pContextMenu2, &m_pContextMenu3);
if(RetCmd==19)
{
m_FileList.EditLabel(nItem);
}
}
*pResult = 0;
}
示例6: switch
//-----------------------------------------------------------------------------
//! Reimplemented
//-----------------------------------------------------------------------------
void tSteerPanel::keyPressEvent( QKeyEvent* event )
{
switch( event->key() )
{
case Key::Plus:
{
if( m_pPanelWidget != 0)
{
m_pPanelWidget->StartZoomIn();
}
}
break;
case Key::Minus:
{
if( m_pPanelWidget != 0)
{
m_pPanelWidget->StartZoomOut();
}
}
break;
case Key::Menu:
{
if( event->isAutoRepeat() ) break;
ShowContextMenu();
}
break;
default:
{
tPanel::keyPressEvent( event );
}
break;
}
}
示例7: GetSize
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();
}
}
示例8: OnRightButtonDown
void OnRightButtonDown(HWND hwnd)
{
auto_track = false;//弹出菜单时禁用自动跟踪窗口
POINT pt;
GetCursorPos(&pt);
HMENU hMenu = CreatePopupMenu();
lua_getglobal(L, "OnRightButtonDown");
if(lua_isfunction(L, -1))
{
if(lua_pcall(L, 0, 1, 0))
{
error_handler(L);
}
}
ShowContextMenu(L, hMenu);
if(GetMenuItemCount(hMenu)==0)
{
AppendMenuW(hMenu, MF_BYPOSITION | MF_STRING, MENU_EXIT, L"退出程序(&E)");
}
//
SetForegroundWindow(hwnd);
TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
DestroyMenu(hMenu);
auto_track = true;
}
示例9: if
FReply SProfilerThreadView::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
FReply Reply = FReply::Unhandled();
if( IsReady() )
{
const FVector2D MousePositionOnButtonUp = MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() );
const bool bIsValidForMouseClick = MousePositionOnButtonUp.Equals( MousePositionOnButtonDown, MOUSE_SNAP_DISTANCE );
if( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton )
{
if( bIsLeftMousePressed )
{
// Release the mouse, we are no longer dragging.
Reply = FReply::Handled().ReleaseMouseCapture();
}
bIsLeftMousePressed = false;
}
else if( MouseEvent.GetEffectingButton() == EKeys::RightMouseButton )
{
if( bIsRightMousePressed )
{
if( bIsValidForMouseClick )
{
ShowContextMenu( MouseEvent.GetScreenSpacePosition() );
Reply = FReply::Handled();
}
}
bIsRightMousePressed = false;
}
}
return Reply;
}
示例10:
void CMSOffice2007DemoView::OnContextMenu(CWnd* pWnd, CPoint point)
{
if (!ShowContextMenu(point))
{
Default();
}
}
示例11: while
void CRepositoryBrowser::OnContextMenu_RepoList(CPoint point)
{
TShadowFilesTreeList selectedLeafs;
selectedLeafs.reserve(m_RepoList.GetSelectedCount());
bool folderSelected = false;
bool filesSelected = false;
bool submodulesSelected = false;
POSITION pos = m_RepoList.GetFirstSelectedItemPosition();
while (pos)
{
CShadowFilesTree * item = (CShadowFilesTree *)m_RepoList.GetItemData(m_RepoList.GetNextSelectedItem(pos));
if (item->m_bSubmodule)
submodulesSelected = true;
if (item->m_bFolder)
folderSelected = true;
else
filesSelected = true;
selectedLeafs.push_back(item);
}
eSelectionType selType = ONLY_FILES;
if (folderSelected && filesSelected)
selType = MIXED_FOLDERS_FILES;
else if (folderSelected)
selType = ONLY_FOLDERS;
else if (submodulesSelected)
selType = ONLY_FILESSUBMODULES;
ShowContextMenu(point, selectedLeafs, selType);
}
示例12: MainDlgProc
INT_PTR CALLBACK MainDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_INITDIALOG:
MainInitDialog(hWnd);
break;
case WM_DROPFILES:
MainDropFiles(hWnd, (HDROP) wParam);
break;
case WM_APP:
FireCommand(CommandDelayBuffer);
break;
case WM_COMMAND:
MainCommand(hWnd, LOWORD(wParam));
break;
case WM_NOTIFY:
return MainNotify(hWnd, (LPNMHDR) lParam);
break;
case WM_SIZE:
MainSize(hWnd, LOWORD(lParam), HIWORD(lParam));
break;
case WM_MENUSELECT:
MainMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam));
break;
case WM_TIMER:
RtfWindowTimer();;
break;
case WM_CONTEXTMENU:
{
HWND hParam = (HWND) wParam;
HWND hRtfChild = GetDlgItem(hWnd, ID_RTF);
if (hParam == hWnd || hParam == hRtfChild)
ShowContextMenu(LOWORD(lParam), HIWORD(lParam));
}
break;
case WM_HELP:
MainCommand(hWnd, ID_HELPCONTENTS);
break;
case WM_CLOSE:
RegistryWriteWindowPos(hWnd);
if (Running)
AbortExecution();
PostQuitMessage(0);
break;
}
return FALSE;
}
示例13: ShowContextMenu
void ChatPanel::OnMouseEvent(OpWidget *widget, INT32 pos, INT32 x, INT32 y, MouseButton button, BOOL down, UINT8 nclicks)
{
if (widget != m_rooms_view)
{
return;
}
if (!down && button == MOUSE_BUTTON_2)
{
ShowContextMenu(OpPoint(x+widget->GetRect().x,y+widget->GetRect().y),FALSE,FALSE);
return;
}
OpTreeModelItem* item;
item = m_rooms_view->GetItemByPosition(pos);
if (item == NULL)
{
return;
}
BOOL click_state_ok = (IsSingleClick() && !down && nclicks == 1) || nclicks == 2;
if (click_state_ok && button == MOUSE_BUTTON_1)
{
if (item->GetType() == OpTreeModelItem::CHATROOM_TYPE)
{
ChatRoom* chat_room = g_m2_engine->GetChatRoom(item->GetID());
if (chat_room)
{
OpString room;
chat_room->GetName(room);
ChatInfo chat_info(room, OpStringC());
g_application->GoToChat(chat_room->GetAccountID(),
chat_info, TRUE);
}
}
else if (item->GetType() == OpTreeModelItem::CHATTER_TYPE)
{
ChatRoom* chatter = g_m2_engine->GetChatter(item->GetID());
if (chatter)
{
OpString chatter_name;
chatter->GetName(chatter_name);
ChatInfo chat_info(chatter_name, OpStringC());
g_application->GoToChat(chatter->GetAccountID(),
chat_info, FALSE);
}
}
}
}
示例14: ShowContextMenu
BOOL CollectionNavigationPane::OnContextMenu(OpWidget* widget, INT32 child_index, const OpPoint &menu_point, const OpRect *avoid_rect, BOOL keyboard_invoked)
{
if (!widget || widget->GetType() != WIDGET_TYPE_TREEVIEW)
return FALSE;
// Needed for split view layout
int x = widget->GetRect(FALSE).x + menu_point.x;
int y = widget->GetRect(FALSE).y + menu_point.y;
return ShowContextMenu(OpPoint(x,y), FALSE, static_cast<OpTreeView*>(widget),FALSE);
}
示例15: QLabel
QLabel1::QLabel1(QWidget *parent) :
QLabel(parent)
{
this->type1 = "QLabel";
this->setContextMenuPolicy(Qt::CustomContextMenu);
connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(ShowContextMenu(QPoint)));
coder1 = new CodeEditor;
connect(coder1,SIGNAL(closed()),this,SLOT(changecode()));
}