/** * @author Edouard DUPIN * * @copyright 2011, Edouard DUPIN, all right reserved * * @license APACHE v2.0 (see license file) */ #pragma once #include #include #include #include #include #include #include namespace ewol { namespace widget { /** * @ingroup ewolWidgetGroup */ class Image :public ewol::Widget { public: // signals esignal::ISignal<> signalPressed; public: // properties eproperty::Value propertySource; //!< file name of the image. eproperty::Value propertyBorder; //!< border to add at the image. eproperty::Value propertyImageSize; //!< border to add at the image. eproperty::Value propertyKeepRatio; //!< keep the image ratio between width and hight eproperty::Range propertyPosStart; //!< position in the image to start the sisplay (when we want not to display all the image) eproperty::Range propertyPosStop; //!< position in the image to start the sisplay (when we want not to display all the image) eproperty::Value propertyDistanceFieldMode; //!< to have a parameter eproperty::Value propertySmooth; //!< display is done in the pixed approximation if false protected: ewol::compositing::Image m_compositing; //!< compositing element of the image. std::shared_ptr m_colorProperty; //!< theme color property int32_t m_colorId; //!< Color of the image. public: /** * @brief */ Image(); void init(const std::string& _file="", const gale::Dimension& _border=gale::Dimension(vec2(0,0),gale::Dimension::Millimeter)); public: DECLARE_WIDGET_FACTORY(Image, "Image"); /** * @brief */ virtual ~Image(); /** * @brief set All the configuration of the current image * @param[in] _file Filaneme of the new image * @param[in] _border New border size to set */ void set(const std::string& _file, const gale::Dimension& _border); protected: vec2 m_imageRenderSize; //!< size of the image when we render it protected: // Derived function virtual void onDraw(); public: // Derived function virtual void calculateMinMaxSize(); virtual void onRegenerateDisplay(); virtual bool onEventInput(const ewol::event::Input& _event); virtual bool loadXML(const std::shared_ptr& _node); protected: virtual void onChangePropertySource(); virtual void onChangePropertyImageSize(); virtual void onChangePropertyGlobalSize(); virtual void onChangePropertySmooth(); virtual void onChangePropertyDistanceFieldMode(); }; }; };