Beispiel #1
0
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();
}
Beispiel #2
0
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);
                }
            }
        }
    }
}