//! Reads attributes of the element
	void CGUIButton::deserializeAttributes(IAttributes* in, SAttributeReadWriteOptions* options = 0)
	{
		IGUIButton::deserializeAttributes(in, options);

		IsPushButton = in->getAttributeAsBool("PushButton");
		Pressed = IsPushButton ? in->getAttributeAsBool("Pressed") : false;

		rect<SINT32> rec = in->getAttributeAsRect("ImageRect");
		if (rec.isValid())
			setImage(in->getAttributeAsTexture("Image"), rec);
		else
			setImage(in->getAttributeAsTexture("Image"));

		rec = in->getAttributeAsRect("PressedImageRect");
		if (rec.isValid())
			setPressedImage(in->getAttributeAsTexture("PressedImage"), rec);
		else
			setPressedImage(in->getAttributeAsTexture("PressedImage"));

		setDrawBorder(in->getAttributeAsBool("Border"));
		setUseAlphaChannel(in->getAttributeAsBool("UseAlphaChannel"));
		setScaleImage(in->getAttributeAsBool("ScaleImage"));

		//   setOverrideFont(in->getAttributeAsString("OverrideFont"));

		updateAbsolutePosition();
	}
	//! Sets an image which should be displayed on the button when it is in normal state.
	void CGUIButton::setImage(ITexture* image)
	{
		if (image)
			image->grab();
		if (Image)
			Image->drop();

		Image = image;
		if (image)
			ImageRect = rect<SINT32>(Position2d(0, 0), image->getOriginalSize());

		if (!PressedImage)
			setPressedImage(Image);
	}
Example #3
0
//! Sets the image which should be displayed on the button when it is in its normal state.
void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos)
{
    if (Image)
        Image->drop();

    Image = image;
    ImageRect = pos;

    if (Image)
        Image->grab();

    if (!PressedImage)
        setPressedImage(Image, pos);
}
Example #4
0
//! Sets an image which should be displayed on the button when it is in normal state.
void CGUIButton::setImage(video::ITexture* image)
{
	if (image)
		image->grab();
	if (Image)
		Image->drop();

	Image = image;
	if (image)
		ImageRect = core::rect<s32>(core::position2d<s32>(0,0), image->getOriginalSize());

	if (!PressedImage)
		setPressedImage(Image);
}
	//! Sets the image which should be displayed on the button when it is in its pressed state.
	void CGUIButton::setPressedImage(ITexture* image, const rect<SINT32>& pos)
	{
		setPressedImage(image);
		PressedImageRect = pos;
	}
Example #6
0
//! Sets the image which should be displayed on the button when it is in its pressed state.
void CGUIButton::setPressedImage(video::ITexture* image, const core::rect<s32>& pos)
{
	setPressedImage(image);
	PressedImageRect = pos;
}