Ejemplo n.º 1
0
bool SpyFrame::handleContextMenu(dwt::ScreenCoordinate pt) {
	if(searches->countSelected() == 1) {
		if(pt.x() == -1 && pt.y() == -1) {
			pt = searches->getContextMenuPos();
		}

		MenuPtr contextMenu = addChild(WinUtil::Seeds::menu);
		contextMenu->appendItem<Menu::SimpleDispatcher>(IDC_SEARCH, T_("&Search"), std::tr1::bind(&SpyFrame::handleSearch, this, searches->getText(searches->getSelected(), COLUMN_STRING)), dwt::BitmapPtr(new dwt::Bitmap(IDB_SEARCH)));

		contextMenu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON);
		return true;
	}
	return false;
}
bool AutoSearchFrame::handleContextMenu(dwt::ScreenCoordinate pt) {
	if(pt.x() == -1 && pt.y() == -1) {
		pt = items->getContextMenuPos();
	}

	MenuPtr contextMenu = addChild(WinUtil::Seeds::menu);
	contextMenu->appendItem(IDC_ADD, T_("&New..."), std::tr1::bind(&AutoSearchFrame::handleAdd, this));
	contextMenu->appendItem(IDC_EDIT, T_("&Properties"), std::tr1::bind(&AutoSearchFrame::handleProperties, this));
	contextMenu->appendItem(IDC_REMOVE, T_("&Remove"), std::tr1::bind(&AutoSearchFrame::handleRemove, this));

	bool status = items->hasSelected();
	contextMenu->setItemEnabled(IDC_EDIT, false, status);
	contextMenu->setItemEnabled(IDC_REMOVE, false, status);

	contextMenu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON);
	return true;
}
Ejemplo n.º 3
0
bool UsersFrame::handleContextMenu(dwt::ScreenCoordinate pt) {
	if (users->hasSelected()) {
		if(pt.x() == -1 && pt.y() == -1) {
			pt = users->getContextMenuPos();
		}

		MenuPtr menu = addChild(WinUtil::Seeds::menu);
		appendUserItems(getParent(), menu);
		menu->appendSeparatorItem();
		menu->appendItem(IDC_EDIT, T_("&Description"), std::tr1::bind(&UsersFrame::handleDescription, this));
		menu->appendItem(IDC_REMOVE, T_("&Remove"), std::tr1::bind(&UsersFrame::handleRemove, this));
		
		menu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON);

		return true;
	}
	return false;
}
Ejemplo n.º 4
0
bool UsersFrame::handleContextMenu(dwt::ScreenCoordinate pt) {
	size_t sel = users->countSelected();
	if(sel > 0) {
		if(pt.x() == -1 && pt.y() == -1) {
			pt = users->getContextMenuPos();
		}

		auto menu = addChild(WinUtil::Seeds::menu);
		menu->setTitle((sel == 1) ? escapeMenu(users->getSelectedData()->getText(COLUMN_NICK)) : str(TF_("%1% users") % sel));
		appendUserItems(getParent(), menu.get());
		menu->appendSeparator();
		menu->appendItem(T_("&Description"), [this] { handleDescription(); });
		menu->appendItem(T_("&Remove"), [this] { handleRemove(); });
		WinUtil::addCopyMenu(menu.get(), users);

		menu->open(pt);

		return true;
	}

	return false;
}