Esempio n. 1
0
//! @brief Open a new chat tab with a private chat
//!
//! @param nick The user to whom the chatwindow should be opened to
void MainWindow::OpenPrivateChat(const User& user, bool doFocus)
{
	ASSERT_LOGIC(m_chat_tab != 0, "m_chat_tab");
	m_func_tabs->SetSelection(PAGE_CHAT);
	ChatPanel* cp = m_chat_tab->AddChatPanel(user);
	if (doFocus)
		cp->FocusInputBox();
}
Esempio n. 2
0
void MainWindow::ShowTab(const unsigned int idx)
{
	if (idx < m_tab_names.GetCount()) {
		m_func_tabs->SetSelection(idx);
		switch (idx) {
			case PAGE_JOIN: {
				GetJoinTab().SetFocus();
				ChatPanel* p = GetJoinTab().GetActiveChatPanel();
				if (p != NULL) {
					p->FocusInputBox();
				}
				return;
			}
			default:
				break;
		};
	} else
		wxLogError(_T("tab selection oob: %d"), idx);
}
ChatPanel* MainChatTab::AddChatPanel( Channel& channel, bool doFocus )
{

	for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ ) {
		if ( m_chat_tabs->GetPageText( i ) == channel.GetName() ) {
			ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i );
			if ( tmp->GetPanelType() == CPT_Channel ) {
				if ( doFocus )
					m_chat_tabs->SetSelection( i );
				tmp->SetChannel( &channel );
				return tmp;
			}
		}
	}

	ChatPanel* chat = new ChatPanel( m_chat_tabs, channel, m_imagelist );
	m_chat_tabs->InsertPage( m_chat_tabs->GetPageCount() - 1, chat, channel.GetName(), doFocus, wxBitmap( channel_xpm ) );
	if ( doFocus )
		chat->FocusInputBox();
	return chat;
}