/** @file * @author Edouard DUPIN * @copyright 2011, Edouard DUPIN, all right reserved * @license MPL v2.0 (see license file) */ #pragma once #include #include #include #include #include #include #include #include namespace appl { namespace widget { class VolumeBar; using VolumeBarShared = ememory::SharedPtr; using VolumeBarWeak = ememory::WeakPtr; /** * @ingroup ewolWidgetGroup */ class VolumeBar : public ewol::Widget { public: // signals esignal::Signal signalChange; esignal::Signal signalHide; //!< Hide value [0..1] ==> 0 is hidden public: //eproperty::Value propertyShape; //!< name of the shape used eproperty::Value propertyValue; //!< current value of the VolumeBar eproperty::Value propertyStep; //!< Up and down step value eproperty::Value propertyMinimum; //!< minimum value of the VolumeBar eproperty::Value propertyMaximum; //!< maximum value of the VolumeBar eproperty::Value propertyDanger; //!< change color value private: bool m_isHidden; echrono::Time m_lastEventTime; esignal::Connection m_PCH; //!< Periodic Call Handle to remove it when needed /** * @brief Periodic call to update grapgic display * @param[in] _event Time generic event */ void periodicCall(const ewol::event::Time& _event); protected: VolumeBar(); public: DECLARE_WIDGET_FACTORY(VolumeBar, "appl_VolumeBar"); virtual ~VolumeBar(); public: // TODO : Rewoek the color in the theme ... void setColor(etk::Color<> _newColor) { m_textColorFg = _newColor; }; protected: ewol::compositing::Drawing m_draw; //!< drawing tool. etk::Color<> m_textColorFg; //!< Text color etk::Color<> m_textColorBg; //!< Background color etk::Color<> m_textColorDone; etk::Color<> m_textColorLoaded; void updateValue(float _newValue); public: // Derived function void onDraw() override; void calculateMinMaxSize() override; void onRegenerateDisplay() override; bool onEventInput(const ewol::event::Input& _event) override; private: std::vector> m_listAvaillable; public: void setRangeAvaillable(std::vector>& _values) { m_listAvaillable = _values; } protected: virtual void onChangePropertyValue(); virtual void onChangePropertyMinimum(); virtual void onChangePropertyMaximum(); }; } }