Nez.UI.Button.draw C# (CSharp) Method

draw() public method

public draw ( Graphics graphics, float parentAlpha ) : void
graphics Graphics
parentAlpha float
return void
		public override void draw( Graphics graphics, float parentAlpha )
		{
			validate();

			if( _isDisabled && style.disabled != null )
				_background = style.disabled;
			else if( _mouseDown && style.down != null )
				_background = style.down;
			else if( _isChecked && style.checkked != null )
				_background = ( style.checkedOver != null && _mouseOver ) ? style.checkedOver : style.checkked;
			else if( _mouseOver && style.over != null )
				_background = style.over;
			else if( style.up != null ) //
				_background = style.up;
			setBackground( _background );

			float offsetX = 0, offsetY = 0;
			if( _mouseDown && !_isDisabled )
			{
				offsetX = style.pressedOffsetX;
				offsetY = style.pressedOffsetY;
			}
			else if( _isChecked && !_isDisabled )
			{
				offsetX = style.checkedOffsetX;
				offsetY = style.checkedOffsetY;
			}
			else
			{
				offsetX = style.unpressedOffsetX;
				offsetY = style.unpressedOffsetY;
			}
				
			for( var i = 0; i < children.Count; i++ )
				children[i].moveBy( offsetX, offsetY );

			base.draw( graphics, parentAlpha );

			for( int i = 0; i < children.Count; i++ )
				children[i].moveBy( -offsetX, -offsetY );
		}