LCOV - code coverage report
Current view: top level - source/gui/ObjectTypes - CSlider.h (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 0 1 0.0 %
Date: 2026-12-03 01:19:39 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /* Copyright (C) 2025 Wildfire Games.
       2             :  * This file is part of 0 A.D.
       3             :  *
       4             :  * 0 A.D. is free software: you can redistribute it and/or modify
       5             :  * it under the terms of the GNU General Public License as published by
       6             :  * the Free Software Foundation, either version 2 of the License, or
       7             :  * (at your option) any later version.
       8             :  *
       9             :  * 0 A.D. is distributed in the hope that it will be useful,
      10             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12             :  * GNU General Public License for more details.
      13             :  *
      14             :  * You should have received a copy of the GNU General Public License
      15             :  * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
      16             :  */
      17             : 
      18             : #ifndef INCLUDED_CSLIDER
      19             : #define INCLUDED_CSLIDER
      20             : 
      21             : #include "gui/CGUISetting.h"
      22             : #include "gui/CGUISprite.h"
      23             : #include "gui/ObjectBases/IGUIButtonBehavior.h"
      24             : #include "gui/ObjectBases/IGUIObject.h"
      25             : #include "maths/Vector2D.h"
      26             : #include "ps/CStr.h"
      27             : 
      28             : class CGUI;
      29             : class CRect;
      30             : 
      31             : class CSlider : public IGUIObject, public IGUIButtonBehavior
      32             : {
      33           0 :     GUI_OBJECT(CSlider)
      34             : 
      35             : public:
      36             :     CSlider(CGUI& pGUI);
      37             : 
      38             : protected:
      39             :     static const CStr EventNameValueChange;
      40             : 
      41             :     /**
      42             :      * @see IGUIObject#ResetStates()
      43             :      */
      44             :     virtual void ResetStates();
      45             : 
      46             :     /**
      47             :      * @see IGUIObject#HandleMessage()
      48             :      */
      49             :     virtual void HandleMessage(SGUIMessage& Message);
      50             : 
      51             :     virtual void Draw(CCanvas2D& canvas);
      52             : 
      53             :     /**
      54             :      * Change settings and send the script event
      55             :      */
      56             :     void UpdateValue();
      57             : 
      58             :     CRect GetButtonRect() const;
      59             : 
      60             :     /**
      61             :      * @return ratio between the value of the slider and its actual size in the GUI
      62             :      */
      63             :     float GetSliderRatio() const;
      64             : 
      65             :     void IncrementallyChangeValue(const float value);
      66             : 
      67             :     // Settings
      68             :     CGUISimpleSetting<float> m_ButtonSide;
      69             :     CGUISimpleSetting<float> m_MinValue;
      70             :     CGUISimpleSetting<float> m_MaxValue;
      71             :     CGUISimpleSetting<CGUISpriteInstance> m_Sprite, m_SpriteDisabled;
      72             :     CGUISimpleSetting<CGUISpriteInstance> m_SpriteBar, m_SpriteBarDisabled;
      73             :     CGUISimpleSetting<float> m_Value;
      74             : 
      75             : private:
      76             :     CVector2D m_Mouse;
      77             : };
      78             : 
      79             : #endif // INCLUDED_CSLIDER

Generated by: LCOV version 1.16