void MsgBubbleItem::PopupMenu( bool copy ) { if(!action_menu_) return; POINT point; ::GetCursorPos(&point); CMenuWnd* pMenu = new CMenuWnd(NULL); STRINGorID xml(L"bubble_menu.xml"); pMenu->Init(xml, _T("xml"), point); CMenuElementUI* cop = (CMenuElementUI*) pMenu->FindControl(L"copy"); cop->AttachSelect(nbase::Bind(&MsgBubbleItem::OnMenu, this, std::placeholders::_1)); cop->SetVisible(copy); CMenuElementUI* del = (CMenuElementUI*)pMenu->FindControl(L"delete"); del->AttachSelect(nbase::Bind(&MsgBubbleItem::OnMenu, this, std::placeholders::_1)); CMenuElementUI* transform = (CMenuElementUI*)pMenu->FindControl(L"transform"); transform->AttachSelect(nbase::Bind(&MsgBubbleItem::OnMenu, this, std::placeholders::_1)); transform->SetVisible(typeid(*this) == typeid(MsgBubbleAudio)); pMenu->Show(); }
void MsgBubbleItem::PopupMenu(bool copy, bool recall, bool retweet/* = true*/) { if(!action_menu_) return; POINT point; ::GetCursorPos(&point); CMenuWnd* pMenu = new CMenuWnd(NULL); STRINGorID xml(L"bubble_menu.xml"); pMenu->Init(xml, _T("xml"), point); CMenuElementUI* cop = (CMenuElementUI*) pMenu->FindControl(L"copy"); cop->AttachSelect(nbase::Bind(&MsgBubbleItem::OnMenu, this, std::placeholders::_1)); cop->SetVisible(copy); CMenuElementUI* del = (CMenuElementUI*)pMenu->FindControl(L"delete"); del->AttachSelect(nbase::Bind(&MsgBubbleItem::OnMenu, this, std::placeholders::_1)); CMenuElementUI* transform = (CMenuElementUI*)pMenu->FindControl(L"transform"); transform->AttachSelect(nbase::Bind(&MsgBubbleItem::OnMenu, this, std::placeholders::_1)); transform->SetVisible(typeid(*this) == typeid(MsgBubbleAudio)); CMenuElementUI* rec = (CMenuElementUI*)pMenu->FindControl(L"recall"); rec->AttachSelect(nbase::Bind(&MsgBubbleItem::OnMenu, this, std::placeholders::_1)); rec->SetVisible(my_msg_ && recall && msg_.receiver_accid_ != LoginManager::GetInstance()->GetAccount()); CMenuElementUI* ret = (CMenuElementUI*)pMenu->FindControl(L"retweet"); ret->AttachSelect(nbase::Bind(&MsgBubbleItem::OnMenu, this, std::placeholders::_1)); ret->SetVisible(retweet); pMenu->Show(); }
void MainForm::PopupMainMenu(POINT point) { //创建菜单窗口 CMenuWnd* pMenu = new CMenuWnd(NULL); STRINGorID xml(L"main_menu.xml"); pMenu->Init(xml, _T("xml"), point); //注册回调 CMenuElementUI* look_log = (CMenuElementUI*)pMenu->FindControl(L"look_log"); look_log->AttachSelect(nbase::Bind(&MainForm::LookLogMenuItemClick, this, std::placeholders::_1)); CMenuElementUI* file_trans = (CMenuElementUI*)pMenu->FindControl(L"file_helper"); file_trans->AttachSelect(nbase::Bind(&MainForm::FileTransMenuItemClick, this, std::placeholders::_1)); CMenuElementUI* address = (CMenuElementUI*)pMenu->FindControl(L"address"); address->AttachSelect(nbase::Bind(&MainForm::AddressMenuItemClick, this, std::placeholders::_1)); CMenuElementUI* export_msglog = (CMenuElementUI*)pMenu->FindControl(L"export_msglog"); export_msglog->AttachSelect(nbase::Bind(&MainForm::ExportMsglogMenuItemClick, this, std::placeholders::_1)); CMenuElementUI* import_msglog = (CMenuElementUI*)pMenu->FindControl(L"import_msglog"); import_msglog->AttachSelect(nbase::Bind(&MainForm::ImportMsglogMenuItemClick, this, std::placeholders::_1)); CMenuElementUI* clear_chat_record = (CMenuElementUI*)pMenu->FindControl(L"clear_chat_record"); clear_chat_record->AttachSelect(nbase::Bind(&MainForm::ClearChatRecordMenuItemClick, this, true, std::placeholders::_1)); CMenuElementUI* clear_chat_record_ex = (CMenuElementUI*)pMenu->FindControl(L"clear_chat_record_ex"); clear_chat_record_ex->AttachSelect(nbase::Bind(&MainForm::ClearChatRecordMenuItemClick, this, false, std::placeholders::_1)); CMenuElementUI* clear_chat_record_p2p = (CMenuElementUI*)pMenu->FindControl(L"clear_chat_record_p2p"); clear_chat_record_p2p->AttachSelect(nbase::Bind(&MainForm::ClearChatRecordBySessionTypeMenuItemClick, this, true, nim::kNIMSessionTypeP2P, std::placeholders::_1)); CMenuElementUI* clear_chat_record_p2p_ex = (CMenuElementUI*)pMenu->FindControl(L"clear_chat_record_p2p_ex"); clear_chat_record_p2p_ex->AttachSelect(nbase::Bind(&MainForm::ClearChatRecordBySessionTypeMenuItemClick, this, false, nim::kNIMSessionTypeP2P, std::placeholders::_1)); CMenuElementUI* clear_chat_record_team = (CMenuElementUI*)pMenu->FindControl(L"clear_chat_record_team"); clear_chat_record_team->AttachSelect(nbase::Bind(&MainForm::ClearChatRecordBySessionTypeMenuItemClick, this, true, nim::kNIMSessionTypeTeam, std::placeholders::_1)); CMenuElementUI* clear_chat_record_team_ex = (CMenuElementUI*)pMenu->FindControl(L"clear_chat_record_team_ex"); clear_chat_record_team_ex->AttachSelect(nbase::Bind(&MainForm::ClearChatRecordBySessionTypeMenuItemClick, this, false, nim::kNIMSessionTypeTeam, std::placeholders::_1)); CMenuElementUI* vchat_setting = (CMenuElementUI*)pMenu->FindControl(L"vchat_setting"); vchat_setting->AttachSelect(nbase::Bind(&MainForm::VChatSettingMenuItemClick, this, std::placeholders::_1)); CMenuElementUI* rts_replay = (CMenuElementUI*)pMenu->FindControl(L"rts_replay"); rts_replay->AttachSelect(nbase::Bind(&MainForm::RtsReplayMenuItemClick, this, std::placeholders::_1)); CMenuElementUI* about = (CMenuElementUI*)pMenu->FindControl(L"about"); about->AttachSelect(nbase::Bind(&MainForm::AboutMenuItemClick, this, std::placeholders::_1)); CMenuElementUI* logoff = (CMenuElementUI*)pMenu->FindControl(L"logoff"); logoff->AttachSelect(nbase::Bind(&MainForm::LogoffMenuItemClick, this, std::placeholders::_1)); CMenuElementUI* quit = (CMenuElementUI*)pMenu->FindControl(L"quit"); quit->AttachSelect(nbase::Bind(&MainForm::QuitMenuItemClick, this, std::placeholders::_1)); //显示 pMenu->Show(); }