Ejemplo n.º 1
0
void DefaultDecorator::Render( const Rect & cUpdateRect )
{
	if( m_nFlags & WND_NO_BORDER )
	{
		return;
	}

	Color32_s sFillColor = m_bHasFocus ? get_default_color( COL_SEL_WND_BORDER ) : get_default_color( COL_NORMAL_WND_BORDER );

	Layer *pcView = GetLayer();

	Rect cOBounds = pcView->GetBounds();
	Rect cIBounds = cOBounds;

	cIBounds.left += m_vLeftBorder - 1;
	cIBounds.right -= m_vRightBorder - 1;
	cIBounds.top += m_vTopBorder - 1;
	cIBounds.bottom -= m_vBottomBorder - 1;

	pcView->DrawFrame( cOBounds, FRAME_RAISED | FRAME_THIN | FRAME_TRANSPARENT );
	pcView->DrawFrame( cIBounds, FRAME_RECESSED | FRAME_THIN | FRAME_TRANSPARENT );

	// Bottom
	pcView->FillRect( Rect( cOBounds.left + 1, cIBounds.bottom + 1, cOBounds.right - 1, cOBounds.bottom - 1 ), sFillColor );
	// Left
	pcView->FillRect( Rect( cOBounds.left + 1, cOBounds.top + m_vTopBorder, cIBounds.left - 1, cIBounds.bottom ), sFillColor );
	// Right
	pcView->FillRect( Rect( cIBounds.right + 1, cOBounds.top + m_vTopBorder, cOBounds.right - 1, cIBounds.bottom ), sFillColor );

	if( ( m_nFlags & WND_NO_TITLE ) == 0 )
	{
		DrawButton( HIT_DRAG, sFillColor );
	}
	else
	{
		pcView->FillRect( Rect( cOBounds.left + 1, cOBounds.top - 1, cOBounds.right - 1, cIBounds.top + 1 ), sFillColor );
	}

	DrawButton( HIT_ZOOM, sFillColor );
	DrawButton( HIT_MINIMIZE, sFillColor );
	DrawButton( HIT_DEPTH, sFillColor );
	DrawButton( HIT_CLOSE, sFillColor );
}
Ejemplo n.º 2
0
void BlueDecorator::FillBackGround(void )
{
    Layer* pcView = GetLayer();

    Rect  cOBounds = pcView->GetBounds();

    Color32_s sFillColor =  m_bHasFocus ? Color32_s(62,101,172,255):Color32_s(191,191,191,255) ;


    Color32_s col_Light  = m_bHasFocus ? Color32_s (32,71,142,255):Color32_s(191,191,191,255) ;
    Color32_s col_Dark   = m_bHasFocus ? Color32_s (62,101,172,255):Color32_s(221,221,221,255);

    Point Left  = Point(cOBounds.left+1,  cOBounds.top+1);
    Point Right = Point(cOBounds.right-1, cOBounds.top+1);

    Color32_s col_Grad = col_Light;
    Color32_s col_Step = Color32_s( (col_Light.red-col_Dark.red)/15,
                                    (col_Light.green-col_Dark.green)/15,
                                    (col_Light.blue-col_Dark.blue)/15, 0 );

    for (int i=0; i<25; i++)
    {
        pcView->SetFgColor( col_Grad );
        pcView->DrawLine( Left, Right );
        Left.y  += 1;
        Right.y += 1;
        col_Grad.red   -= col_Step.red;
        col_Grad.green -= col_Step.green;
        col_Grad.blue  -= col_Step.blue;
    }


    // left
    pcView->FillRect( Rect(cOBounds.left,cOBounds.top+m_vTopBorder,
                           cOBounds.left+m_vLeftBorder,cOBounds.bottom+m_vLeftBorder),sFillColor);
    // right
    pcView->FillRect( Rect(cOBounds.right-m_vRightBorder,cOBounds.top+m_vTopBorder,
                           cOBounds.right,cOBounds.bottom),sFillColor);
    // bottom
    pcView->FillRect( Rect(cOBounds.left,cOBounds.bottom-m_vBottomBorder,
                           cOBounds.right,cOBounds.bottom),sFillColor);
}
Ejemplo n.º 3
0
void DefaultDecorator::DrawButton( uint32 nButton, const Color32_s & sFillColor )
{
	Layer *pcView = GetLayer();

	nButton = CheckIndex( nButton );
	Rect cFrame = m_cObjectFrame[nButton];
	bool bState = m_bObjectState[nButton];
	font_height fh;

	fh = pcView->GetFontHeight();
	Rect r;
	Point cScale( cFrame.Size() );

	if( cFrame.Width() < 1 )
		return;

	pcView->FillRect( cFrame, sFillColor );
	pcView->DrawFrame( cFrame, FRAME_TRANSPARENT | ( bState ? FRAME_RECESSED : FRAME_RAISED ) );

	switch ( nButton )
	{
	case WindowDecorator::HIT_DRAG:
		pcView->SetFgColor( 255, 255, 255, 0 );
		pcView->SetBgColor( sFillColor );
		pcView->MovePenTo( cFrame.left + 5, ( cFrame.Height() + 1.0f ) / 2 - ( fh.ascender + fh.descender ) / 2 + fh.ascender );
		pcView->DrawString( m_cTitle.c_str(), -1 );
		break;
	case WindowDecorator::HIT_CLOSE:
		SetRect( 0.33, 0.33, 0.67, 0.67 );
		pcView->DrawFrame( r, FRAME_TRANSPARENT | ( bState ? FRAME_RAISED : FRAME_RECESSED ) );
		break;
	case WindowDecorator::HIT_MINIMIZE:
		SetRect( 0.2, 0.2, 0.8, 0.8 );
		pcView->DrawFrame( r, FRAME_TRANSPARENT | ( bState ? FRAME_RAISED : FRAME_RECESSED ) );
		SetRect( 0.2, 0.6, 0.4, 0.8 );
		r.left++;
		r.right += 2;
		r.top--;
		r.bottom -= 2;
		pcView->DrawFrame( r, FRAME_TRANSPARENT | ( bState ? FRAME_RECESSED : FRAME_RAISED ) );
		break;
	case WindowDecorator::HIT_DEPTH:
		if( bState )
		{
			SetRect( 0.2, 0.2, 0.6, 0.6 );
			pcView->DrawFrame( r, FRAME_TRANSPARENT | ( FRAME_RAISED ) );
			SetRect( 0.4, 0.4, 0.8, 0.8 );
			pcView->FillRect( r, sFillColor );
			pcView->DrawFrame( r, FRAME_TRANSPARENT | ( FRAME_RAISED ) );
		}
		else
		{
			SetRect( 0.4, 0.4, 0.8, 0.8 );
			pcView->DrawFrame( r, FRAME_TRANSPARENT | ( FRAME_RECESSED ) );
			SetRect( 0.2, 0.2, 0.6, 0.6 );
			pcView->FillRect( r, sFillColor );
			pcView->DrawFrame( r, FRAME_TRANSPARENT | ( FRAME_RECESSED ) );
		}
		break;
	case WindowDecorator::HIT_ZOOM:
		SetRect( 0.2, 0.2, 0.8, 0.8 );
		pcView->DrawFrame( r, FRAME_TRANSPARENT | ( bState ? FRAME_RAISED : FRAME_RECESSED ) );
		SetRect( 0.2, 0.2, 0.6, 0.6 );
		r.left += 2;
		r.top += 2;
		pcView->DrawFrame( r, FRAME_TRANSPARENT | ( bState ? FRAME_RECESSED : FRAME_RAISED ) );
		break;
	}
}