void CMainFrame::OnPostCreate() { if(!this->InitFromXmlFile(_T("MainFrame.xml"),this)) throw CGJWndError::LOAD_ERROR; m_pBuddyList= static_cast<CBuddyListUI*>(m_pm.FindControl(pstrBuddyListName)); m_pRecentList=static_cast<CBuddyListUI*>(m_pm.FindControl(pstrRecentBuddyListName)); m_pOptTabBuddyList=static_cast<COptionUI*>(m_pm.FindControl(pstrOptTabBuddyListName)); m_pOptTabRecentList=static_cast<COptionUI*>(m_pm.FindControl(pstrOptTabRecentListName)); m_pListTable=static_cast<CTabLayoutUI*>(m_pm.FindControl(pstrListTableName)); m_pBtnHeader=static_cast<CButtonUI*>(m_pm.FindControl(pstrButtonHeaderName)); m_pBtnSearch=FindControl<CButtonUI>(pstrButtonSearchName); m_pBtnStatus=FindControl<CButtonUI>(pstrButtonStatusName); m_pEditSignaure=static_cast<CEditUI*>(m_pm.FindControl(pstrEditSignatureName)); m_pLabelName=static_cast<CLabelUI*>(m_pm.FindControl(pstrLabelNameName)); ASSERT(m_pOptTabBuddyList); ASSERT(m_pOptTabRecentList); ASSERT(m_pListTable); ASSERT(m_pBuddyList); ASSERT(m_pRecentList); ASSERT(m_pBtnHeader); ASSERT(m_pBtnStatus); ASSERT(m_pEditSignaure); ASSERT(m_pLabelName); m_pBuddyList->OnItemAction+= CDelegate<CMainFrame,CMainFrame>(this,&CMainFrame::OnBuddyItemAction); /*m_pBuddyList->AddGroup(_T("test")); m_pBuddyList->AddGroup(_T("test2")); CBuddyListItem *item; for (int i = 0; i < 10; i++) { item=new CBuddyListItem(); CString str; str.Format(_T("item %d"),i); item->SetName(str); item->SetHeader(_T("header.jpg")); str.Format(_T("signature %d"),i); item->SetSignature(str); JID jid; jid.setUsername(cstr_str(str)); item->SetJid(jid); m_pBuddyList->GetGroup(i%m_pBuddyList->GetCount()).Add(*item); }*/ ASSERT(GetContext()); LoadUser(); GetContext()->GetClient()->rosterManager()->registerRosterListener(this); ASSERT(GetContext()->GetSelfVCard()); auto vcard=GetContext()->GetSelfVCard(); m_pLabelName->SetText( utf8dec(vcard->nickname())); m_pEditSignaure->SetText(utf8dec(vcard->desc())); m_pBtnHeader->SetBkImage(GetContext()->GetHeaderManager().GetHeader(*GetContext()->GetSelf(),true)); UpdateDock(); }
LRESULT CMainFrame::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { if(uMsg==WM_CLOSE) { PostQuitMessage(0); } else if(uMsg==WM_MOVING) { m_bMoving=true; RECT* rc=(RECT* )lParam; UpdateDock(rc); StopAnimateDock(); } else if(uMsg==WM_EXITSIZEMOVE) { m_bMoving=false; } else if(uMsg==WM_TIMER&&wParam==m_uDockTimer) { DoAnimateDock(); return 0; } if(uMsg==WM_MOUSELEAVE||uMsg==WM_MOUSEHOVER ||uMsg==WM_NCMOUSELEAVE||uMsg==WM_NCMOUSEMOVE) { StartAnimateDock(); } return CGJWnd::HandleMessage(uMsg,wParam,lParam); }
/** Handle a resize request event. */ char HandleDockResizeRequest(const XResizeRequestEvent *event) { DockNode *np; Assert(event); if(!dock) { return 0; } for(np = dock->nodes; np; np = np->next) { if(np->window == event->window) { UpdateDock(); return 1; } } return 0; }
void CDock::MoveSplitter(CWindow* pSplitter, LONG x, LONG y) { // Find the splitter area and move it to the new position for(size_t i = 0; i < m_Areas.GetCount(); i++) { CArea* pArea = m_Areas.GetAt(i); if(pArea->m_pWindow == pSplitter) { if(pArea->m_MoveType == MOVE_HOR) { LONG newY = pArea->m_rc.top + y; pArea->m_posFixed.top = double(newY) / m_nHeight; } else { LONG newX = pArea->m_rc.left + x; pArea->m_posFixed.left = double(newX) / m_nWidth; } } } UpdateDock(); }
/** Handle a reparent notify event. */ char HandleDockReparentNotify(const XReparentEvent *event) { DockNode *np; char handled; Assert(event); /* Just return if there is no dock. */ if(!dock) { return 0; } /* Check each docked window. */ handled = 0; for(np = dock->nodes; np; np = np->next) { if(np->window == event->window) { if(event->parent != dock->cp->window) { /* For some reason the application reparented the window. * We make note of this condition and reparent every time * the dock is updated. Unfortunately we can't do this for * all applications because some won't deal with it. */ np->needs_reparent = 1; handled = 1; } } } /* Layout the stuff on the dock again if something happened. */ if(handled) { UpdateDock(); } return handled; }
/** Resize a dock component. */ void Resize(TrayComponentType *cp) { JXResizeWindow(display, cp->window, cp->width, cp->height); UpdateDock(); }