예제 #1
0
WgBorder WgMenu::_getPadding() const
{
	//TODO: This is ugly and doesn't take ContentShift of various states into account.

	if( m_pSkin )
	{
		WgRect r = m_pSkin->ContentRect( WgRect(0,0,1000,1000), WG_STATE_NORMAL );
		return WgBorder(r.x, r.y, 1000-r.w, 1000-r.h);
	}
	else
		return WgBorder(0);
}
예제 #2
0
WgBorder WgMenubar::_getEntryBorder() const
{
	//TODO: This doesn't take ContentShift for different states into account.

	if( m_pEntrySkin )
	{
		WgRect r = m_pEntrySkin->ContentRect( WgRect(0,0,1000,1000), WG_STATE_NORMAL );

		return WgBorder(r.x,r.y,1000-r.w,1000-r.h);
	}
	else
		return WgBorder(10,0,10,0);		// 10 pixels on each side as default margin. Should do something more intelligent here, like taking fonts avgSpacing into account...
}
예제 #3
0
void WgGfxDevice::_drawUnderline( const WgRect& clip, const WgLegacyTextField * pText, int _x, int _y, int ofs, int maxChars )
{
    Uint32 hProp = 0xFFFF;

    WgPen pen;
    const WgChar * pChars = pText->getText();

    for( int i = ofs ; i < ofs + maxChars && !pChars[i].IsEndOfLine() ; i++ )
    {
        if( pChars[i].PropHandle() != hProp )
        {
            WgTextAttr attr;
            pText->GetCharAttr( attr, i );

            if( attr.bUnderlined )
            {
                hProp = pChars[i].PropHandle();
                pen.SetAttributes( attr );
            }
            else
                break;
        }

        pen.SetChar( pChars[i].Glyph() );
        pen.ApplyKerning();
        pen.AdvancePos();
    }

    const WgUnderline * pUnderline = pen.GetFont()->GetUnderline( pen.GetSize() );

    ClipBlitHorrBar( clip, pUnderline->pSurf, pUnderline->rect, WgBorder( pUnderline->leftBorder, pUnderline->rightBorder, 0, 0 ), false,
                     _x + pUnderline->bearingX, _y + pUnderline->bearingY, pen.GetPosX() );
}
예제 #4
0
WgRoot * setupGUI( WgGfxDevice * pDevice )
{
	WgResDB * pDB = sdl_wglib::LoadStdGizmos( "../resources/blocks.png", WgSurfaceFactorySoft() );
	if( !pDB )
		return 0;

	WgRoot * pRoot = new WgRoot( pDevice );

	WgGizmoFlexgeo * pMainContainer = new WgGizmoFlexgeo();

	int hAnchorLeft = pMainContainer->AddAnchor( 0.f, 0.f, WgCoord(0,100) );
	int hAnchorRight = pMainContainer->AddAnchor( 1.f, 0.f, WgCoord(0,100) );

	pRoot->SetChild(pMainContainer);



	WgGizmoStack * pPanelStack = new WgGizmoStack();
	pMainContainer->AddChild( pPanelStack, WG_NORTHWEST, hAnchorRight );

//	WgGizmo * pCheckeredBack = pDB->CloneGizmo( "bg_blue_gradient" );
	WgGizmo * pCheckeredBack = pDB->CloneGizmo( "bg_checkered_grey" );
	pMainContainer->AddChild( pCheckeredBack, hAnchorLeft, WG_SOUTHEAST );


	WgGizmo * pPanelBack = pDB->CloneGizmo( "plate" );
	pPanelStack->AddChild( pPanelBack );

	WgGizmoFill * pFill = new WgGizmoFill();
	pFill->SetColor( WgColor(255,0,0) );
	pMainContainer->AddChild( pFill, WgRect(100,100,100,100) );

	WgGizmoFill * pFill2 = new WgGizmoFill();
	pFill2->SetColor( WgColor(0,255,0) );
	pMainContainer->AddChild( pFill2, WgRect(200,100,100,100) );

	WgGizmoFill * pFill3 = new WgGizmoFill();
	pFill3->SetColor( WgColor(0,0,255) );
	pMainContainer->AddChild( pFill3, WgRect(300,100,100,100) );

	WgGizmoText * pText = new WgGizmoText();
	pText->SetTextProperties( WgBase::GetDefaultTextprop() );
	pText->SetText( "TESTING" );
	pPanelStack->AddChild( pText );

	WgGizmo * pSlider = pDB->CloneGizmo( "hslider" );
	WgStackHook * pSliderHook = pPanelStack->AddChild( pSlider );
//	pSliderHook->SetOrientation( WG_SOUTH );
	pSliderHook->SetBorder( WgBorder(0,0,81,0) );

	//

	return pRoot;
}