本文整理汇总了C++中ChatPanel类的典型用法代码示例。如果您正苦于以下问题:C++ ChatPanel类的具体用法?C++ ChatPanel怎么用?C++ ChatPanel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ChatPanel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnFrameDestroy
void ChatControlerFrame::OnFrameDestroy(wxCloseEvent &event) {
//ChatPanel *chat(it->second);
if (m_controler) {
wxNotebook *panel = dynamic_cast<wxNotebook *>(*(GetChildren().begin()));
if (panel)
for(int i = panel->GetPageCount(); --i >= 0; ) {
ChatPanel *chat = dynamic_cast<ChatPanel *>(panel->GetPage(i));
if (chat)
m_controler->RemoveReference(chat->GetOtherJid());
}
m_controler->NullTabs();
}
//ChatPanel *panel = dynamic_cast<ChatPanel *>(*(GetChildren().begin()));
//if (panel){
// PRU_LOG2("OnFrameDestroy", panel->GetOtherJid().Str());
// //good
// if (m_comtroler)
// m_controler->RemoveReference(panel->GetOtherJid());
//} else{
// //bad
//}
//PRU_LOG2("OnFrameDestroy", others_jid.Str());
/*if (m_controler)
m_controler->RemoveReference(others_jid);*/
event.Skip();
}
示例2: RejoinChannels
void MainChatTab::RejoinChannels()
{
for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ )
{
ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i );
if ( tmp->GetPanelType() == CPT_Channel )
{
// TODO: This will not rejoin passworded channels.
wxString name = m_chat_tabs->GetPageText( i );
bool alreadyin = false;
try
{
serverSelector().GetServer().GetChannel( name ).GetMe();
alreadyin = true;
}
catch ( ... ) {}
if ( !alreadyin )
{
serverSelector().GetServer().JoinChannel( name, _T( "" ) );
tmp->SetChannel( &serverSelector().GetServer().GetChannel( name ) );
}
} else if ( tmp->GetPanelType() == CPT_User )
{
wxString name = m_chat_tabs->GetPageText( i );
if ( serverSelector().GetServer().UserExists( name ) ) tmp->SetUser( &serverSelector().GetServer().GetUser( name ) );
}
}
}
示例3: ASSERT_LOGIC
//! @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();
}
示例4: BroadcastMessage
void MainChatTab::BroadcastMessage( const wxString& message )
{
// spam the message in all channels
for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ )
{
ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i );
tmp->StatusMessage( message );
}
}
示例5: Reset
IServer::~IServer()
{
if (panel != nullptr) {
ChatPanel* tmp = panel;
panel = nullptr;
tmp->SetServer(NULL);
}
Reset();
delete battles_iter;
}
示例6: GetUserChatPanel
ChatPanel* MainChatTab::GetUserChatPanel( const wxString& user )
{
for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ ) {
ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i );
if ( tmp->GetPanelType() == CPT_User ) {
wxString name = m_chat_tabs->GetPageText( i );
if ( name.Lower() == user.Lower() ) return ( ChatPanel* )m_chat_tabs->GetPage( i );
}
}
return 0;
}
示例7: bare
ChatPanel *ChatControler::GetChatFor(buzz::Jid jid, bool create) {
std::string bare(jid.BareJid().Str());
ChatMap::iterator it = m_chat_map.find(bare);
bool exists = (it != m_chat_map.end());
if (exists) {
//////////////////////////////
// Tabs
ChatPanel *chat(it->second);
for(int i = m_tabs->GetPageCount(); --i >= 0; )
if (chat == m_tabs->GetPage(i)) {
// TODO: Set an image showing some kind of highlight
//m_tabs->SetSelection(i);
break;
}
m_tabs->Refresh();
return chat;
// Tabs
//////////////////////////////
//return it->second;
} else if (create) {
//////////////////////////////
// Tabs
if (!m_tabs) {
//wxFrame *frame = new wxFrame(m_parent, wxID_ANY, StdToWx(bare));
wxFrame *frame = new ChatControlerFrame(this, m_parent, wxID_ANY, StdToWx(bare));
m_tabs = new wxNotebook(frame, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN);
m_tabs->PushEventHandler(g_mouse_event_fowarder_delayed);
frame->SetIcon(wxIcon(wxT("imgs/icon/cim.png"), wxBITMAP_TYPE_PNG));
frame->Show(true);
}
// Tabs
//////////////////////////////
ChatPanel *chat = new ChatPanel(m_tabs, jid);
m_tabs->Connect(chat->GetId(), wxEVT_RIGHT_DOWN, wxMouseEventHandler(ChatControlerFrame::OnRightClick));
// TODO: Set an image showing some kind of highlight
m_tabs->AddPage(chat, StdToWx(bare));
//Connect(chat->GetId(), wxEVT_CLOSE_WINDOW, wxCloseEventHandler(ChatControler::OnFrameDestroy));
//chat->PushEventHandler(this);
m_chat_map[bare] = chat;
m_tabs->Refresh();
return chat;
} else {
return NULL;
}
}
示例8: OnTabClose
void MainChatTab::OnTabClose( wxAuiNotebookEvent& event )
{
int selection = event.GetSelection();
ChatPanel* panel = ( ChatPanel* )m_chat_tabs->GetPage( selection );
if ( panel )
{
panel->Part();
if( panel->IsServerPanel() )
m_server_chat = 0;
}
}
示例9: UpdateNicklistHighlights
void MainChatTab::UpdateNicklistHighlights()
{
for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ ) {
ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i );
if ( tmp->GetPanelType() == CPT_Channel ) {
tmp->UpdateNicklistHighlights();
}
}
if ( m_server_chat != 0 )
{
m_server_chat->UpdateNicklistHighlights();
}
}
示例10: ChatPanel
void GUI::Chat::OnChansClick(wxCommandEvent &e)
{
GUI::ChatChannelsDialog *channels = new GUI::ChatChannelsDialog(this);
if (channels->ShowModal() && !channels->channel.IsEmpty())
{
ChatPanel *p = new ChatPanel(this->tabs, -1, channels->channel);
this->tabs->AddPage(p, wxT(channels->channel), true);
p->DoJoin(this->info);
}
channels->Destroy();
}
示例11: ui
void MainWindow::OnTabsChanged(wxAuiNotebookEvent& event)
{
int newsel = event.GetSelection();
if (newsel == 0 || newsel == 1) {
if (!ui().IsConnected() && ui().IsMainWindowCreated())
ui().Connect();
}
ChatPanel* panel = ui().GetActiveChatPanel(); //set input focus to edit field on tab change
if (panel != NULL) {
panel->SetFocus();
}
}
示例12: OnRightClick
void ChatControlerFrame::OnRightClick(wxMouseEvent& event) {
if (m_controler) {
wxNotebook *tabs = m_controler->GetTabs();
if (tabs) {
int tab = tabs->HitTest(event.GetPosition());
if (tab != wxNOT_FOUND) {
ChatPanel *chat = dynamic_cast<ChatPanel *>(tabs->GetPage(tab));
if (chat) {
m_controler->RemoveReference(chat->GetOtherJid());
tabs->DeletePage(tab);
}
}
}
}
}
示例13: ChatPanel
ChatPanel* MainChatTab::AddChatPanel( const User& user )
{
for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ ) {
if ( m_chat_tabs->GetPageText( i ) == user.GetNick() ) {
ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i );
if ( tmp->GetPanelType() == CPT_User ) {
m_chat_tabs->SetSelection( i );
tmp->SetUser( &user );
return tmp;
}
}
}
int selection = m_chat_tabs->GetSelection();
ChatPanel* chat = new ChatPanel( m_chat_tabs, user, m_imagelist );
m_chat_tabs->InsertPage( m_chat_tabs->GetPageCount() - 1, chat, user.GetNick(), true, wxBitmap( userchat_xpm ) );
if ( selection > 0 ) m_chat_tabs->SetSelection( selection );
return chat;
}
示例14: switch
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);
}
示例15: LeaveChannels
void MainChatTab::LeaveChannels()
{
for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ ) {
ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i );
if ( tmp->GetPanelType() == CPT_Channel )
{
tmp->StatusMessage( _( "Disconnected from server, chat closed." ) );
tmp->SetChannel( 0 );
} else if ( tmp->GetPanelType() == CPT_User )
{
tmp->StatusMessage( _( "Disconnected from server, chat closed." ) );
tmp->SetUser( 0 );
}
}
}