void CGuiTabWnd::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CWnd::OnLButtonDown(nFlags, point); for (int iCont=0; iCont< m_Numtabs;iCont++) { CGuiTab* ct=(CGuiTab*) m_pArray[iCont]; if (ct->rect.PtInRect(point) != 0) { SetCurtab(iCont); ShowTitle(ct->lpMsg); return; } } }
BOOL CContainer::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default for (int iCont=0; iCont< m_Numtabs;iCont++) { CTab* ct=(CTab*) m_pArray[iCont]; if (ct->rect.PtInRect(point) != 0) { SetCurtab(iCont); m_InTab=TRUE; m_DragTab=TRUE; //DragTab m_TabMove=iCont; //This is moved SetCapture(); break; } } return TRUE; }
void CGuiMDITabbed::UpdateWindows() { /* Modified by SunZhenyu SetTimer(1,200,NULL); */ KillTimer(1); CWnd* pWnd=CWnd::FromHandle(::GetTopWindow(GetParentFrame()->GetSafeHwnd())); char ClassName[32]; while (pWnd != NULL) { ::GetClassName(pWnd->GetSafeHwnd(),ClassName,32); CString szClassName=ClassName; if(szClassName=="MDIClient") break; pWnd=pWnd->GetNextWindow(); } ASSERT(::IsWindow(pWnd->GetSafeHwnd())); //primero adicionar los nuevos CWnd* pChild= CWnd::FromHandle(::GetTopWindow(pWnd->GetSafeHwnd())); while(pChild != NULL) { CString m_Caption; pChild->GetWindowText(m_Caption); if (!m_Caption.IsEmpty()) { if (!FindItem(pChild->GetSafeHwnd())) Addtab(pChild,m_Caption,-1); else UpdateCaption(pChild,m_Caption); } pChild= CWnd::FromHandle(::GetNextWindow(pChild->GetSafeHwnd(), GW_HWNDNEXT)); } /* Modified by SunZhenyu */ // get active child frame, modified 2003/6/19 CMDIFrameWnd* pFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, GetParentFrame()); CMDIChildWnd* pActiveChild = NULL; if( pFrame ) pActiveChild = pFrame->MDIGetActive(); // get active child frame, modified 2003/6/19 //---eliminar las ventanas borradas int nNumtabs=GetCount(); for (int i=0; i< nNumtabs; i++) { CWnd* pWnd=GetNumWnd(i); if (!::IsWindow(HWND(pWnd->GetSafeHwnd()))) { DeleteTab(i); UpdateWindow(); break; } /* Modified by SunZhenyu */ // set cur tab by active child frame, modified 2003/6/19 else if( pWnd->GetSafeHwnd() == pActiveChild->GetSafeHwnd() ) { SetCurtab(i); } // set cur tab by active child frame, modified 2003/6/19 } SetTimer(1,200,NULL); }
void CContainer::OnMouseMove(UINT nHitTest, CPoint point) { if (m_NCDragWindow) { if( ((nHitTest != HTCAPTION) && (m_DOCKFLOAT !=BS_FLOATING)) && m_TypeTab != TYPE_MDI) { if (!m_NCDragWindow) return; CRect rcw; GetWindowRect(rcw); ClientToScreen(&point); ReleaseCapture(); m_DOCKFLOAT=BS_FLOATING; m_DragTab=FALSE; m_NCDragWindow=FALSE; UINT uFirstTab=0; int iCont=0; for (iCont=0; iCont< m_Numtabs;iCont++) { CTab* ct=(CTab*) m_pArray[iCont]; if (ct->rect.PtInRect(point) != 0) { if (iCont==0) uFirstTab=((CDockPanelBase*)ct->pParent)->GetDlgCtrlID(); ((CDockPanelBase*)ct->pParent)->uAling=BS_FLOATING; ((CDockPanelBase*)ct->pParent)->iLasPosition=iCont; ((CDockPanelBase*)ct->pParent)->bIsPartOfTabbed=iCont==0? FALSE:TRUE; ((CDockPanelBase*)ct->pParent)->bIsShow=TRUE; ((CDockPanelBase*)ct->pParent)->m_IdCtrlParent=iCont==0? 0:uFirstTab; } } theApp->m_WinMain->FloatWindow(this,point,rcw); DockManager* mDoc; if (m_DOCKSITE == BS_ALIGN_BOTTOM) mDoc=(DockManager*)theApp->m_WinMain->m_DockBottom; if (m_DOCKSITE == BS_ALIGN_LEFT) mDoc=(DockManager*)theApp->m_WinMain->m_DockLeft; if (m_DOCKSITE == BS_ALIGN_RIGHT) mDoc=(DockManager*)theApp->m_WinMain->m_DockRight; mDoc->DeleteWindow( mDoc->FindItem(GetSafeHwnd()) ); theApp->m_WinMain->UpdateFrame(); } return ; } if (m_DragTab) { CTab* ct=(CTab*) m_pArray[m_TabMove]; if (ct->rect.PtInRect(point) != 0) { // we are in the same tab so don't do nothing return; } else { int iCont; for (iCont=0; iCont< m_Numtabs;iCont++) { CTab* ct=(CTab*) m_pArray[iCont]; if (ct->rect.PtInRect(point) != 0) { m_InTab=TRUE; m_DragTab=TRUE; //DragTab //umm interchange the pointers NewBValArray<CTab*> m_pTemp; CTab* Temp=(CTab*) m_pArray[m_TabMove]; m_pArray.SetAt(m_TabMove,ct); m_pArray.SetAt(iCont,Temp); SetCurtab(iCont); CToolTip.UpdateTipText(GetSafeHwnd(), ct->lpMsg,CRect(0,0,0,0), m_TabMove+1); CToolTip.UpdateTipText(GetSafeHwnd(), Temp->lpMsg,CRect(0,0,0,0), iCont+1); m_TabMove=iCont; //This is moved ReleaseCapture(); break; } } if ((iCont >= m_Numtabs) && (m_TypeTab != TYPE_MDI)) { CRect rcClient; GetClientRect(&rcClient); CContainer* ctn= new CContainer; CTab* ct=(CTab*) m_pArray[m_TabMove]; ctn->m_pContainer=this; rcClient.top=ct->rect.top; rcClient.bottom=ct->rect.bottom; if (rcClient.PtInRect(point)) { return; } if (!ctn->Create(WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,ct->pParent->GetDlgCtrlID())) return; ctn->Addtab(ct->pParent,ct->lpMsg,ct->nMenu); ct->pParent->SetParent(ctn); //ctn->SetImageList(Image); ClientToScreen(&point); ctn->m_DOCKFLOAT=BS_FLOATING; ctn->m_DOCKSITE=GetWindowLong(GetSafeHwnd(),GWL_ID); HWND hwnd=(HWND)GetWindowLong(ct->pParent->GetSafeHwnd(),GWL_HWNDPARENT); HWND hWnd1=ctn->GetSafeHwnd(); CRect rcw; GetWindowRect(rcw); theApp->m_WinMain->FloatWindow(ctn,point,rcw); m_DragTab=FALSE; DeleteTab(m_TabMove); if (m_pArray.GetSize() > 0) { ct=(CTab*) m_pArray[0]; ct->pParent->ShowWindow(SW_SHOW); ct->pParent->SetFocus(); } m_TabMove=-1; ReleaseCapture(); } } } }