Пример #1
0
BOOL COXMulticlipboardDlg::GetProposedRect(UINT nNumber, CRect &rect)
{
	CRect rectDialog;
	CRect rectClient;

	//the function calculates the placement for the
	//specified pocket
	//this placement does not included edge offset
	//(borders of the pocket), just size of the icon
	//because COXClipPocket::Create() will increase
	//this rect on edge offset itself.
	GetClientRect(&rectClient);	

	rect.left=GetIconSpace()+GetStaticDimension()+
		GetEdgeOffset()+(GetIconWidth()+2*GetEdgeOffset()+
		GetIconSpace())*(nNumber%m_nPocketsInRow);
	rect.right=rect.left+GetIconWidth();
	rect.top=GetButtonsHeight()+GetIconSpace()+GetStaticDimension()+
		+GetEdgeOffset()+
		(GetIconSpace()+GetIconHeight()+GetEdgeOffset()*2)*
		(nNumber/m_nPocketsInRow);
	
	rect.bottom=rect.top+GetIconHeight();

	return TRUE;

}
Пример #2
0
BOOL COXMulticlipboardDlg::LoadImageList()
{
	//virtual function - override it to provide your
	//own image list
	return m_imgList.Create(IDB_OX_BITMAP_LIST,GetIconWidth(),2,(COLORREF) 0xFF00FF);

}
int EIconTextButtonProperty::GetPreferedWidth( CDC* pDC )
{
	int nWidth = 0;

	if( GetIconWidth() > 0 )
	{
		nWidth += s_nMargin;
		nWidth += GetIconWidth();
	}

	nWidth += s_nMargin;
	CString s = GetTextValue();
	CSize ext = pDC->GetTextExtent(s);
	nWidth += ext.cx;	//s.GetLength() * 10;		//inaccurate
	nWidth += s_nMargin;						//a little extra... was removed

	if( HasButton() )
	{
		nWidth += m_nButtonWidth;
		nWidth += s_nMargin;
	}

	return nWidth;
}
Пример #4
0
void COXMulticlipboardDlg::CalculateDesiredRect(int nPockets, CRect &rect)
{
	//the function calculates desired rect
	//for certain number of the pockets

	nPockets=nPockets?nPockets:1;

	UINT nRows=nPockets/m_nPocketsInRow;
	nRows+=(nPockets%m_nPocketsInRow)?1:0;
	UINT nCols=min(m_nPocketsInRow,nPockets);

	rect.left=rect.top=0;
	rect.right=GetIconSpace()+2*GetStaticDimension()+
		nCols*(GetIconWidth()+
		GetIconSpace()+2*GetEdgeOffset());

	rect.bottom=GetButtonsHeight()+GetIconSpace()+
		2*GetStaticDimension()+nRows*
		(GetIconHeight()+GetIconSpace()+2*GetEdgeOffset());

}
void EIconTextButtonProperty::Draw( CDC* pDC , EPropWnd* pParent )
{
//	m_Rect = r;
	m_nIconWidth   = GetIconWidth();

	//
	// 0   1      2   3                          4   5        6
	// +---+------+---+--------------------------+---+--------+
	// |   |      |   |                          |   |        |
	// |   | ICON |   | TEXT                     |   | BUTTON |
	// |   |      |   |                          |   |        |
	// +---+------+---+--------------------------+---+--------+
	//
	//

	int x0 = m_Rect.left;		//panel begin
	int x1 = x0 + s_nMargin;	//icon begin
	int x2 = x1;				//icon end (default for no icon)
	int x3 = x1;				//text begin (default for no icon)

	if( m_nIconWidth != 0 )		//if there's an icon..
	{
		x2 = x1 + m_nIconWidth;	//icon end
		x3 = x2 + s_nMargin;	//text begin
	}

	int x5 = m_Rect.right;		//button begin
	int x6 = m_Rect.right;		//button end

	if( HasButton() && m_bSelected )
	{
		CRect cr;
		pParent->GetClientRect(&cr);

		x6 = cr.right /*+ pCtrl->GetScrollPos(SB_HORZ)*/ ;

		if( x6 > m_Rect.right )
		{
			x6 = m_Rect.right;
		}

		x5 = x6 - m_nButtonWidth;
	}

	int x4 = x5 - s_nMargin;

	//
	//
	//

	int nFontHeight = pParent->GetFontHeight();
	int nPropHeight = m_Rect.Height();

//	int  = m_Rect.top;
//	int y1 = y0 + 3;				//(nPropHeight - nFontHeight)/2;
//	int y2 = y0 + nPropHeight - 3;
//	int y3 = y0 + nPropHeight;

	//
	//
	//

	m_IconRect.SetRect( x1 , m_Rect.top + 3 , x2 , m_Rect.top + 3 + m_nIconWidth );		//icon is square in upperleft corner
	m_TextRect.SetRect( x3 , m_Rect.top + 3 , x4 , m_Rect.top + nPropHeight - 3  );
	m_ButtRect.SetRect( x5 , m_Rect.top     , x6 , m_Rect.top + nPropHeight      );

	//
	// background
	//

	if( IsEnabled() )
	{
		if( m_bSelected )
		{
			pDC->FillSolidRect( &m_Rect , pParent->GetColorPaneValActive() );
		}
		else
		{
			pDC->FillSolidRect( &m_Rect , pParent->GetColorPaneVal() );
		}
	}
	else
	{
		pDC->FillSolidRect( &m_Rect , pParent->GetColorPaneKey() );
	}

	//
	// icon
	//

	if( GetIconWidth() > 0 )
	{
		DrawIcon( pDC , pParent, m_IconRect );
	}

	//
	// text
	//

	CPoint vpo = pDC->GetViewportOrg();
//	vpo.x = 0;//not set ..!!
//	vpo.y = 0;

	if( HasEdit() && m_bSelected && IsEnabled() )
	{
		ASSERT(m_pEdit!=NULL);
 		m_pEdit->SetWindowPos( NULL , x3 + vpo.x , m_TextRect.top + vpo.y , m_TextRect.Width()+1 , m_TextRect.Height() , SWP_NOZORDER );
		m_pEdit->SetWindowText( GetTextValue() );
		m_pEdit->SetSel(0,-1);
	}
	else
	{
		ASSERT(m_pEdit==NULL);

		if( IsEnabled()==false )
		{
			pDC->SetTextColor( pParent->GetColorPaneKeyActive() - 0x404040 );
		}

		CRect tr = m_TextRect;
		
		if( tr.Width() > 0 )
		{
			CString s1 = GetTextValue();

			if( s1.GetLength() > 0 )
			{
				CString s2 = EPropWnd::s_FitStringToWidth(s1,tr.Width(),pDC);

				UINT nFormat = DT_TOP | DT_NOCLIP;

				if( m_nTextAlignment == 1 ) { nFormat |= DT_CENTER;                }
				if( m_nTextAlignment == 2 ) { nFormat |= DT_RIGHT;  /*tr.right-=1;*/ }

				if( s1.GetLength()>s2.GetLength() )
				{
					nFormat &= ~DT_RIGHT;	//clear right flag!!
				}

				pDC->DrawText( s2 , tr , nFormat );
			}
		}

		if( IsEnabled()==false )
		{
			pDC->SetTextColor( 0x000000 );
		}
	}

	//
	// button
	//
	if( HasButton() && m_bSelected && IsEnabled() && m_pButton != NULL )
	{
		int w = m_ButtRect.Width();
		int h = m_ButtRect.Height();
		int x = m_ButtRect.left;
		int y = m_ButtRect.top;
		m_pButton->SetWindowPos( NULL , x  + vpo.x , y + vpo.y , w , h , SWP_NOZORDER );
	}

	if( m_bSelected == false )
	{
		ASSERT( m_pButton == NULL );
		ASSERT( m_pEdit   == NULL );
	}
}