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); } }
void ImageButton::onMouseButtonReleased(int _left, int _top, MyGUI::MouseButton _id) { if (_id == MyGUI::MouseButton::Left) setImageTexture(mImageHighlighted); ImageBox::onMouseButtonReleased(_left, _top, _id); }
void ImageButton::onMouseButtonPressed(int _left, int _top, MyGUI::MouseButton _id) { if (_id == MyGUI::MouseButton::Left) setImageTexture(mImagePushed); ImageBox::onMouseButtonPressed(_left, _top, _id); }
void VideoWidget::playVideo(const std::string &video) { mPlayer->setAudioFactory(new MWSound::MovieAudioFactory()); mPlayer->playVideo(video); setImageTexture(mPlayer->getTextureName()); }
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); }
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); }
void ImageButton::onMouseLostFocus(Widget* _new) { setImageTexture(mImageNormal); ImageBox::onMouseLostFocus(_new); }
void ImageButton::onMouseSetFocus(Widget* _old) { setImageTexture(mImageHighlighted); ImageBox::onMouseSetFocus(_old); }