/** * @author Edouard DUPIN * * @copyright 2010, Edouard DUPIN, all right reserved * * @license BSD v3 (see license file) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #undef __class__ #define __class__ "TestImage" appl::TestImage::TestImage() { addObjectType("appl::TestImage"); } void appl::TestImage::init() { ewol::widget::Composer::init(); APPL_INFO("Create " __class__ " (start)"); std::string myDescription = std::string("") + "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + ""; loadFromString(myDescription); setExpand(bvec2(true,true)); setFill(bvec2(true,true)); subBind(ewol::widget::Button, "[TEST]Button:Expand-x", signalValue, shared_from_this(), &appl::TestImage::onCallbackExpendX); subBind(ewol::widget::Button, "[TEST]Button:Expand-y", signalValue, shared_from_this(), &appl::TestImage::onCallbackExpendY); subBind(ewol::widget::Button, "[TEST]Button:Fill-x", signalValue, shared_from_this(), &appl::TestImage::onCallbackFillX); subBind(ewol::widget::Button, "[TEST]Button:Fill-y", signalValue, shared_from_this(), &appl::TestImage::onCallbackFillY); subBind(ewol::widget::Button, "[TEST]Button:ChangeImage", signalPressed, shared_from_this(), &appl::TestImage::onCallbackChangeImage); m_testWidget = std::dynamic_pointer_cast(getSubObjectNamed("[TEST]TO-TEST")); if (m_testWidget == nullptr) { APPL_CRITICAL("Can not get the pointer of the widget button pointer"); } APPL_INFO("Create " __class__ " (end)"); } void appl::TestImage::onCallbackExpendX(const bool& _value) { if (m_testWidget == nullptr) { return; } m_testWidget->setExpand(bvec2(_value, m_testWidget->getExpand().y())); } void appl::TestImage::onCallbackExpendY(const bool& _value) { if (m_testWidget == nullptr) { return; } m_testWidget->setExpand(bvec2(m_testWidget->getExpand().x(), _value)); } void appl::TestImage::onCallbackFillX(const bool& _value) { if (m_testWidget == nullptr) { return; } m_testWidget->setFill(bvec2(_value, m_testWidget->getFill().y())); } void appl::TestImage::onCallbackFillY(const bool& _value) { if (m_testWidget == nullptr) { return; } m_testWidget->setFill(bvec2(m_testWidget->getFill().x(), _value)); } void appl::TestImage::onCallbackChangeImage() { if (m_testWidget == nullptr) { return; } static int32_t countID = 1; switch (countID) { case 0: m_testWidget->setFile("DATA:stone.png"); break; case 1: m_testWidget->setFile("DATA:grass.png"); break; default: m_testWidget->setFile("DATA:sphere.png"); countID=-1; break; } countID++; }