示例#1
0
void NickListCtrl::OnShowMenu(wxContextMenuEvent& /*unused*/)
{
	slLogDebugFunc("");
	if (m_menu != 0) {
		//no need to popup the menu when there's no user selected
		int selected = GetSelectedIndex();
		if (selected != -1 && m_data[selected]) {
			const User& user = *m_data[selected];
			wxString nick = TowxString(user.GetNick());
			SL_GENERIC::UserMenu<ChatPanelMenu>* popup = m_menu->GetUserMenu();
			popup->EnableItems((selected != -1), nick);
			PopupMenu(popup);
		}
	}
}
void NickDataViewCtrl::OnContextMenuEvent(wxDataViewEvent& /*event*/)
{
	if (m_menu != nullptr) {
		//no need to popup the menu when there's no user selected
		const User* user = GetSelectedItem();
		if (user == nullptr) {
			return;
		}

		wxString nick = wxString(user->GetNick());
		SL_GENERIC::UserMenu<ChatPanelMenu>* popup = m_menu->GetUserMenu();
		popup->EnableItems(true, nick);
		PopupMenu(popup);
	}
}