示例#1
0
BOOL CGuiControlBar::IsLegal(UINT uAlin)
{
	m_First=GetFirstPos();
//	if (IsFloating()) return FALSE;
	switch(uAlin)
	{
		case HTLEFT:
			if (IsHorz() && m_pos >0 && (m_pos != m_Last && m_pos != m_First)) return TRUE;
			if (IsVert() && m_pos <= m_Last && IsRight() ) return TRUE;
			return FALSE;
			break;
		case HTTOP:
			if (m_pos != m_First && IsVert()) return TRUE;
			if (IsHorz() && m_pos <= m_Last && IsBottom() ) return TRUE;
			return FALSE;
			break;
		case HTRIGHT:
			if (m_pos <= m_Last && IsVert() && IsLeft() ) return TRUE;
			if (IsHorz() && m_pos >0 &&  m_pos != m_Last) return TRUE;
			return FALSE;
		case HTBOTTOM:
			if ((m_pos != m_Last && m_pos != m_First) && IsHorz() && IsBottom()) return TRUE;
			if (m_pos <= m_Last && IsHorz() && IsTop()) return TRUE;
			//if (IsVert() && m_pos >0 ) return TRUE;
			return FALSE;
			break;
	}
	return FALSE;
}
void CXTPSkinObjectTab::DrawTabIcon(CDC* pDC, CRect& rcItem, int iItem)
{
	CTabCtrl* pTabCtrl = (CTabCtrl*)this;

	TC_ITEM tci;
	tci.mask = TCIF_IMAGE;

	BOOL bResult = pTabCtrl->GetItem(iItem, &tci);

#ifdef _UNICODE
	if (!bResult)
	{
		TC_ITEMA tcia;
		::ZeroMemory(&tcia, sizeof(TC_ITEMA));

		tcia.mask = TCIF_IMAGE;

		bResult = (BOOL)::SendMessage(pTabCtrl->m_hWnd, TCM_GETITEMA, iItem, (LPARAM)&tcia);
		tci.iImage = tcia.iImage;
	}
#endif
	if (!bResult)
		return;

	CImageList* pImageList = pTabCtrl->GetImageList();
	if (!pImageList || tci.iImage < 0)
		return;

	CPoint point = rcItem.TopLeft();

	DWORD dwStyle = GetStyle();

	if (IsHorz(dwStyle))
	{
		point.Offset(GetMetrics()->m_cxEdge * 2, IsTop(dwStyle) ? GetMetrics()->m_cyEdge : 1);
	}
	else
	{
		point.Offset(IsLeft(dwStyle) ? GetMetrics()->m_cxEdge : 1, GetMetrics()->m_cyEdge * 2);
	}

	// Draw any associated icons.
	pImageList->Draw(pDC, tci.iImage, point, ILD_TRANSPARENT);

	IMAGEINFO info;
	::ZeroMemory(&info, sizeof(info));

	pImageList->GetImageInfo(tci.iImage, &info);
	CRect rcImage(info.rcImage);

	if (IsHorz(dwStyle))
	{
		rcItem.left += rcImage.Width() + GetMetrics()->m_cxEdge;
	}
	else
	{
		rcItem.top += rcImage.Height() + GetMetrics()->m_cyEdge;
	}
}
示例#3
0
	void CloseGroup()
	{
		if (!IsTop()) {
			BView* box = GetView();
			Pop();
			UpdateParentHeight(box->Bounds().Height());
		}
	}
示例#4
0
	BView* GetView()
	{
		if (IsTop()) {
			return fView;
		} else {
			return (BView*)fNestedBoxes.ItemAt(fNestedBoxes.CountItems()-1);
		}
	}
示例#5
0
	void UpdateParentHeight(float height)
	{
		if (IsTop()) {
			fBounds.OffsetBy(0, height);
		} else {
			BView* parent = GetView();
			parent->ResizeBy(0, height);
		}
	}
示例#6
0
	void AddUIGroup(const char* text, Statement* statement)
	{
		if (statement->GetChildren() == NULL) return;
		DetailsBuilder builder(fParent, GetView(), GetControlBounds(), statement, fSettings);
		builder.Visit(statement->GetChildren());
		
		if (IsTop()) {
			fBounds.OffsetTo(fBounds.left, builder.GetBounds().top);
		} else {
			BView* box = GetView();
			box->ResizeTo(box->Bounds().Width(), builder.GetBounds().top + kBoxBottomMargin);
		}
	}
示例#7
0
	BRect GetControlBounds()
	{
		if (IsTop()) {
			BRect bounds(fBounds);
			bounds.left  += kItemLeftMargin /** GetLevel()*/;
			bounds.right -= kItemRightMargin /** GetLevel()*/;
			return bounds;
		}
		
		BView* box = GetView();
		BRect bounds(box->Bounds());
		bounds.top = bounds.bottom - kBoxBottomMargin;
		bounds.bottom = bounds.top + kBoxHeight;
		bounds.left += kBoxLeftMargin;
		bounds.right -= kBoxRightMargin;
		return bounds;
	}
示例#8
0
void CGuiControlBar::OnInvertTracker(const CRect& rect)
{
	ASSERT_VALID(this);
	ASSERT(!rect.IsRectEmpty());
		
	CRect rcWin=GetDockRect();
	
	CDC *pDC = m_pDockSite->GetDCEx(NULL,
        DCX_WINDOW|DCX_CACHE|DCX_LOCKWINDOWUPDATE);
	CRect rcBar;
	GetWindowRect(rcBar);
	if (IsVert())  //el sentido de las barras es vertical
	{

		
		
		if (m_SideMove==HTLEFT || m_SideMove==HTRIGHT) //el mouse esta en el borde izquierdo o derecho
		{
			rcWin.OffsetRect(-rect.left,-rect.top);
			rcWin.top+=10;
			rcWin.left=rect.left+2;
			rcWin.right=rect.right+2;
		}
		else  //el mouse esta el borde de arriba pero de una barra vertical
		{
			rcBar.OffsetRect(-rect.TopLeft());
			rcWin=rcBar;
			if (IsLeft() || IsRight())   //a la izquierda
			{
				
				rcWin.top=rect.top-2;
				rcWin.bottom=rect.bottom-2;
			}
			//
			
		}
	}
	else  //el sentido de las barras es horizontal
	{
		
		if (m_SideMove==HTTOP || m_SideMove==HTBOTTOM) //el mouse esta en el borde de arriba o abajo
		{
			rcWin.OffsetRect(-rect.left,-rect.top);
			rcWin.top=rect.top-2;
			rcWin.bottom=rect.bottom-2;
		}
		else		//el mouse esta en el borde derecho
		{
			rcBar.OffsetRect(-rect.TopLeft());
			rcWin=rcBar;
			if (IsBottom() || IsTop())	//abajo
			{		
				rcWin.left=rect.left+2;
				rcWin.right=rect.right+2;
			}
		}
	}
	ClientToScreen(&rcWin);
	GetParentFrame()->ScreenToClient(&rcWin);
	// invert the brush pattern (looks just like frame window sizing)
	CBrush* pBrush = CDC::GetHalftoneBrush();
	HBRUSH hOldBrush = NULL;
	if (pBrush != NULL)
		hOldBrush = (HBRUSH)SelectObject(pDC->m_hDC, pBrush->m_hObject);
	pDC->PatBlt(rcWin.left, rcWin.top, rcWin.Width(), rcWin.Height(), PATINVERT);
	if (hOldBrush != NULL)
		SelectObject(pDC->m_hDC, hOldBrush);
	m_pDockSite->ReleaseDC(pDC);
}
示例#9
0
BOOL CGuiControlBar::IsHorz()
{
	if (IsTop() || IsBottom())	return TRUE;
	return FALSE;
}
示例#10
0
AFX_INLINE BOOL IsHorz(DWORD dwStyle)
{
	return (IsTop(dwStyle) || IsBottom(dwStyle));
}
示例#11
0
BOOL CGuiToolBarWnd::IsHorz()
{
	if (IsTop() || IsBottom())	return TRUE;
	return FALSE;
}