CString CXTPDockingPaneSidePanel::GetTitle() const
{
	CXTPDockingPaneTabbedContainer* pContainer = GetTopContainer();
	if (!pContainer)
		return _T("");

	return pContainer->GetTitle();
}
void CXTPDockingPaneSidePanel::OnLButtonDblClk(UINT /*nFlags*/, CPoint point)
{
	if (HitTestCaptionButton(point))
		return;

	CRect rcCaption = GetPaintManager()->GetPaneCaptionRect(this);

	if (rcCaption.PtInRect(point))
	{
		GetDockingPaneManager()->ToggleDocking(GetTopContainer());
	}
}
void CXTPDockingPaneSidePanel::MovePanel(LENGTH* pLength, CRect rect)
{
	m_bInRecalcLayout = TRUE;

	if (m_bCollapsed && m_bSlideOut)
	{
		m_bSlideOut = FALSE;
		m_bExpanded = FALSE;
		m_nSlideStep = 0;
		KillTimer(TID_SLIDEOUT);
		OnAction(xtpPaneActionCollapsed);
	}

	BOOL bHorizontal = IsHorizontal();
	CSize sz = bHorizontal ? CSize(pLength->nSize, pLength->nHeight) : CSize(pLength->nHeight, pLength->nSize);

	int nMinHeight = GetMinHeight();

	if (m_bCollapsed && !m_bExpanded)
	{
		if (bHorizontal) sz.cy = nMinHeight; else sz.cx = nMinHeight;
	}
	else
	{
		if (bHorizontal) sz.cy = max(sz.cy, nMinHeight); else sz.cx = max(sz.cx, nMinHeight);
	}

	CPoint pt;

	switch (m_direction)
	{
	case xtpPaneDockLeft: pt = CPoint(rect.left, pLength->nPos + rect.top); break;
	case xtpPaneDockTop: pt = CPoint(rect.left + pLength->nPos, rect.top); break;
	case xtpPaneDockRight: pt = CPoint(rect.right - sz.cx, rect.top + pLength->nPos); break;
	case xtpPaneDockBottom: pt = CPoint(rect.left + pLength->nPos, rect.bottom - sz.cy); break;
	}

	SetWindowPos(&CWnd::wndTop, pt.x, pt.y, sz.cx, sz.cy, SWP_NOOWNERZORDER | SWP_SHOWWINDOW);

	CRect rcClient;
	GetClientRect(rcClient);

	GetPaintManager()->AdjustClientRect(this, rcClient);

	CXTPDockingPaneTabbedContainer* pContainer = GetTopContainer();
	if (pContainer)
	{
		pContainer->OnSizeParent(this, rcClient, NULL);
	}
	m_bInRecalcLayout = FALSE;
}
void CXTPDockingPaneSidePanel::OnCaptionLButtonDown(CPoint point)
{
	if (GetKeyState(VK_LBUTTON) < 0)
	{
		if (OnAction(xtpPaneActionDragging))
			return;

		CXTPDockingPaneContext* pContext = GetDockingPaneManager()->GetDockingContext();

		CRect rcWindow;
		GetWindowRect(rcWindow);

		pContext->Drag(GetTopContainer(), point, rcWindow);
	}
}
void CXTPDockingPaneSidePanel::OnFocusChanged()
{
	CXTPDockingPaneTabbedContainer* pContainer = GetTopContainer();
	if (pContainer)
	{
		pContainer->OnFocusChanged();
		BOOL bActive = pContainer->IsActive();

		if (bActive != m_bActive)
		{
			m_bActive = bActive;
			InvalidatePane(FALSE);
		}
	}
}
void CXTPDockingPaneSidePanel::DoSlideStep(BOOL bActivate)
{
	m_bInRecalcLayout = TRUE;

	int nMinHeight = GetMinHeight();
	BOOL bHorizontal = IsHorizontal();

	CXTPWindowRect rc(this);
	int nSize = max(nMinHeight, m_nSlideStep * ( bHorizontal ? m_rcWindow.Height() : m_rcWindow.Width()) / m_nStepsCount);

	switch (m_direction)
	{
		case xtpPaneDockLeft: rc.right = rc.left + nSize; break;
		case xtpPaneDockTop: rc.bottom = rc.top + nSize; break;
		case xtpPaneDockRight: rc.left = rc.right - nSize; break;
		case xtpPaneDockBottom: rc.top = rc.bottom - nSize; break;
	}

	GetParent()->ScreenToClient(rc);

	SetWindowPos(&CWnd::wndTop, rc.left, rc.top, rc.Width(), rc.Height(), (!bActivate ? SWP_NOZORDER | SWP_NOACTIVATE : SWP_NOACTIVATE));
	Invalidate(FALSE);

	CRect rcClient;
	GetClientRect(rcClient);

	GetPaintManager()->AdjustClientRect(this, rcClient);

	CXTPDockingPaneTabbedContainer* pContainer = GetTopContainer();
	if (pContainer)
	{
		pContainer->OnSizeParent(this, rcClient, NULL);
	}


	m_bInRecalcLayout = FALSE;
}
void CXTPDockingPaneSidePanel::GetMinMaxInfo(LPMINMAXINFO pMinMaxInfo) const
{
	CXTPDockingPaneBase::GetMinMaxInfo(pMinMaxInfo);

	if (IsEmpty())
		return;

	GetTopContainer()->GetMinMaxInfo(pMinMaxInfo);

	CSize szBorder(6, 6);

	int nCaptionHeight = GetPaintManager()->GetCaptionHeight();
	if (IsHorizontal()) szBorder.cy += nCaptionHeight; else szBorder.cx += nCaptionHeight;

	pMinMaxInfo->ptMinTrackSize.x += szBorder.cx;
	pMinMaxInfo->ptMinTrackSize.y += szBorder.cy;

	pMinMaxInfo->ptMaxTrackSize.x += szBorder.cx;
	pMinMaxInfo->ptMaxTrackSize.y += szBorder.cy;

	pMinMaxInfo->ptMinTrackSize.x = max(pMinMaxInfo->ptMinTrackSize.x, nCaptionHeight * 2);
	pMinMaxInfo->ptMinTrackSize.y = max(pMinMaxInfo->ptMinTrackSize.y, nCaptionHeight * 2);

}
void CXTPDockingPaneSidePanel::_RestoreFocus()
{
	CXTPDockingPaneTabbedContainer* pContainer = GetTopContainer();
	if (pContainer) pContainer->_RestoreFocus();
}
CXTPDockingPane* CXTPDockingPaneSidePanel::GetSelectedPane() const
{
	if (GetTopContainer())
		return GetTopContainer()->GetSelected();
	return NULL;
}
Пример #10
0
BOOL CVecPolygon::Track(CDPoint point, UINT uiTool, CUndoManager* pUndoMan, CSnapper* pSnapper)
{
   if(m_bTrackAsShape)
   {
      CPtrList list;
      list.AddHead(this);
      CSuperTracker st(list);
      if(HasPicture())
         st.SetTrackRetainProportions();
      if(st.Track(GetTopContainer()->GetWnd(), point, 
         HitTest(point) == HT_ON_POINT ? CSuperTracker::Style_Size: CSuperTracker::Style_Move, pSnapper))
      {
         pUndoMan->AddToStack(this, UAT_RESTORE_OB_FROM_LIGHT_DUMP);
         SetRectScaleAndOffsetByScreen(st.m_rect, st.m_rectOrigianl);
         return TRUE;
      }
   }
   else
   {
      CPolygonTracker rt(m_t_lpPoints, m_uiNumOfPoints, TRACKER_STYLE);
      int iHit = rt.HitTestPoints(point);
      BOOL bTrackResoult;
      if(iHit >= CPolygonTracker::hitDot)
      {//track only the selected point and the points next to it
         ASSERT(m_uiNumOfPoints>=3);
         int aPointLocation[3];
         CDPOINT aPointsData[3];
         if(iHit == 0)
         {  
            aPointLocation[0] = m_uiNumOfPoints-1;
            aPointLocation[1] = 0;
            aPointLocation[2] = 1;
         }
         else if(iHit == (int)m_uiNumOfPoints-1)
         {
            aPointLocation[0] = m_uiNumOfPoints-2;
            aPointLocation[1] = m_uiNumOfPoints-1;
            aPointLocation[2] = 0;
         }
         else
         {
            aPointLocation[0] = iHit-1;
            aPointLocation[1] = iHit;
            aPointLocation[2] = iHit+1;
         }

         for(int i=0; i<3; i++)
            aPointsData[i] = m_t_lpPoints[aPointLocation[i]];

         CLineTracker localTracker(aPointsData, 3);
         bTrackResoult = localTracker.Track(GetTopContainer()->GetWnd(), point, pSnapper);
         if(bTrackResoult)
         {
            for(int i=0; i<3; i++)
               m_t_lpPoints[aPointLocation[i]] = aPointsData[i];
         }
      }
      else
      {
         if(HasPicture())
            rt.SetTrackRetainProportions();
         bTrackResoult = rt.Track(GetTopContainer()->GetWnd(), point, pSnapper);
      }

      if(bTrackResoult)
      {
         pUndoMan->AddToStack(this, UAT_RESTORE_OB_FROM_LIGHT_DUMP);
         LPCDPOINT dpoints = new CDPOINT[m_uiNumOfPoints];
         for(UINT ui = 0; ui < m_uiNumOfPoints; ui++)
         {
            dpoints[ui].x = m_t_lpPoints[ui].x;
            dpoints[ui].y = m_t_lpPoints[ui].y;
            dpoints[ui] -= m_t_Offset;
            dpoints[ui] /= m_t_Scaler;
         }
         SetPoints(dpoints, m_uiNumOfPoints);

         delete []dpoints;

         return TRUE;
      }
   }

   return FALSE;
}