示例#1
0
void DockCamera::Paint( const Rect &cUpdateRect )
{
	os::Color32_s sCurrentColor = BlendColours(get_default_color(os::COL_SHINE),  get_default_color(os::COL_NORMAL_WND_BORDER), 0.5f);
	SetFgColor( Tint( get_default_color( os::COL_SHADOW ), 0.5f ) );
	os::Color32_s sBottomColor = BlendColours(get_default_color(os::COL_SHADOW), get_default_color(os::COL_NORMAL_WND_BORDER), 0.5f);
	
	os::Color32_s sColorStep = os::Color32_s( ( sCurrentColor.red-sBottomColor.red ) / 30, 
											( sCurrentColor.green-sBottomColor.green ) / 30, 
											( sCurrentColor.blue-sBottomColor.blue ) / 30, 0 );
	
	if( cUpdateRect.DoIntersect( os::Rect( 0, 0, GetBounds().right, 29 ) ) )
	{
		sCurrentColor.red -= (int)cUpdateRect.top * sColorStep.red;
		sCurrentColor.green -= (int)cUpdateRect.top * sColorStep.green;
		sCurrentColor.blue -= (int)cUpdateRect.top * sColorStep.blue;
		for( int i = (int)cUpdateRect.top; i < ( (int)cUpdateRect.bottom < 30 ? (int)cUpdateRect.bottom + 1 : 30 ); i++ )
		{
			SetFgColor( sCurrentColor );
			DrawLine( os::Point( cUpdateRect.left, i ), os::Point( cUpdateRect.right, i ) );
			sCurrentColor.red -= sColorStep.red;
			sCurrentColor.green -= sColorStep.green;
			sCurrentColor.blue -= sColorStep.blue;
		}
	}

	SetDrawingMode( os::DM_BLEND );
	if (pcPaint && !m_bHover)	
		pcPaint->Draw( Point(0,0), this );
	else
	{
		m_pcIcon->Draw(Point(0,0),this);
	}

	SetDrawingMode(DM_COPY);
}
示例#2
0
void IconList::InnerView::MouseDown( const Point &cPosition, uint32 nButtons )
{
	if( m_vIcons.size() > 0 )
		for( uint i = 0; i < m_vIcons.size(); i++ )
		{
			Rect cIconFrame = m_vIcons[i]->GetFrame();
			cIconFrame.bottom = cIconFrame.top + m_vIcons[i]->GetPreferredSize( false ).y;
			if( cIconFrame.DoIntersect( cPosition ) )
				Select( i );
		}
}