Example #1
0
void BackgroundImage::setBackgroundImage (const std::string& image, bool fixedRatio, bool stretch)
{
    if (mChild)
    {
        MyGUI::Gui::getInstance().destroyWidget(mChild);
        mChild = NULL;
    }
    if (!stretch)
    {
        setImageTexture("black.png");

        if (fixedRatio)
            mAspect = 4.0/3.0;
        else
            mAspect = 0; // TODO

        mChild = createWidgetReal<MyGUI::ImageBox>("ImageBox",
            MyGUI::FloatCoord(0,0,1,1), MyGUI::Align::Default);
        mChild->setImageTexture(image);

        adjustSize();
    }
    else
    {
        mAspect = 0;
        setImageTexture(image);
    }
}
Example #2
0
    void ImageButton::onMouseButtonReleased(int _left, int _top, MyGUI::MouseButton _id)
    {
        if (_id == MyGUI::MouseButton::Left)
            setImageTexture(mImageHighlighted);

        ImageBox::onMouseButtonReleased(_left, _top, _id);
    }
Example #3
0
    void ImageButton::onMouseButtonPressed(int _left, int _top, MyGUI::MouseButton _id)
    {
        if (_id == MyGUI::MouseButton::Left)
            setImageTexture(mImagePushed);

        ImageBox::onMouseButtonPressed(_left, _top, _id);
    }
Example #4
0
void VideoWidget::playVideo(const std::string &video)
{
    mPlayer->setAudioFactory(new MWSound::MovieAudioFactory());
    mPlayer->playVideo(video);

    setImageTexture(mPlayer->getTextureName());
}
Example #5
0
 void ImageButton::setPropertyOverride(const std::string &_key, const std::string &_value)
 {
     if (_key == "ImageHighlighted")
         mImageHighlighted = _value;
     else if (_key == "ImagePushed")
         mImagePushed = _value;
     else if (_key == "ImageNormal")
     {
         if (mImageNormal == "")
         {
             setImageTexture(_value);
         }
         mImageNormal = _value;
     }
     else
         ImageBox::setPropertyOverride(_key, _value);
 }
Example #6
0
	void ImageBox::setPropertyOverride(const std::string& _key, const std::string& _value)
	{
		/// @wproperty{ImageBox, ImageTexture, string} Текстура для виджета.
		if (_key == "ImageTexture")
			setImageTexture(_value);

		/// @wproperty{ImageBox, ImageCoord, int int int int} Координаты в текстуре.
		else if (_key == "ImageCoord")
			setImageCoord(utility::parseValue<IntCoord>(_value));

		/// @wproperty{ImageBox, ImageTile, int int} Размер тайла текстуры.
		else if (_key == "ImageTile")
			setImageTile(utility::parseValue<IntSize>(_value));

		/// @wproperty{ImageBox, ImageIndex, size_t} Индекс тайла в текстуре.
		else if (_key == "ImageIndex")
			setItemSelect(utility::parseValue<size_t>(_value));

		/// @wproperty{ImageBox, ImageResource, string} Имя ресурса картинки.
		else if (_key == "ImageResource")
			setItemResource(_value);

		/// @wproperty{ImageBox, ImageGroup, string} Имя группы картинки в ресурсе.
		else if (_key == "ImageGroup")
			setItemGroup(_value);

		/// @wproperty{ImageBox, ImageName, string} Имя картинки в группе ресурса.
		else if (_key == "ImageName")
			setItemName(_value);

		else
		{
			Base::setPropertyOverride(_key, _value);
			return;
		}

		eventChangeProperty(this, _key, _value);
	}
Example #7
0
 void ImageButton::onMouseLostFocus(Widget* _new)
 {
     setImageTexture(mImageNormal);
     ImageBox::onMouseLostFocus(_new);
 }
Example #8
0
 void ImageButton::onMouseSetFocus(Widget* _old)
 {
     setImageTexture(mImageHighlighted);
     ImageBox::onMouseSetFocus(_old);
 }