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

          Line data    Source code
       1             : /* Copyright (C) 2026 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_IGUISCROLLBAROWNER
      19             : #define INCLUDED_IGUISCROLLBAROWNER
      20             : 
      21             : #include "lib/code_annotation.h"
      22             : 
      23             : #include <memory>
      24             : #include <vector>
      25             : 
      26             : class CCanvas2D;
      27             : class CStr8;
      28             : class IGUIObject;
      29             : class IGUIScrollBar;
      30             : struct SGUIMessage;
      31             : struct SGUIScrollBarStyle;
      32             : 
      33             : /**
      34             :  * Base-class this if you want an object to contain
      35             :  * one, or several, scroll-bars.
      36             :  */
      37             : class IGUIScrollBarOwner
      38             : {
      39             :     NONCOPYABLE(IGUIScrollBarOwner);
      40             : 
      41             :     friend class IGUIScrollBar;
      42             : 
      43             : public:
      44             :     IGUIScrollBarOwner(IGUIObject& m_pObject);
      45             :     virtual ~IGUIScrollBarOwner();
      46             : 
      47             :     virtual void Draw(CCanvas2D& canvas);
      48             : 
      49             :     /**
      50             :      * @see IGUIObject#HandleMessage()
      51             :      */
      52             :     virtual void HandleMessage(SGUIMessage& Message);
      53             : 
      54             :     /**
      55             :      * @see IGUIObject#ResetStates()
      56             :      */
      57             :     virtual void ResetStates();
      58             : 
      59             :     /**
      60             :      * Interface for the m_ScrollBar to use.
      61             :      */
      62             :     virtual const SGUIScrollBarStyle* GetScrollBarStyle(const CStr8& style) const;
      63             : 
      64             :     /**
      65             :      * Add a scroll-bar
      66             :      */
      67             :     virtual void AddScrollBar(std::unique_ptr<IGUIScrollBar> scrollbar);
      68             : 
      69             :     /**
      70             :      * Get Scroll Bar reference (it should be transparent it's actually
      71             :      * pointers).
      72             :      */
      73           0 :     virtual IGUIScrollBar& GetScrollBar(const int& index) const
      74             :     {
      75           0 :         return *m_ScrollBars[index];
      76             :     }
      77             : 
      78             :     /**
      79             :      * Get the position of the scroll bar at @param index.
      80             :      * Equivalent to GetScrollbar(index).GetPos().
      81             :      */
      82             :     virtual float GetScrollBarPos(const int index) const;
      83             : 
      84             : protected:
      85             :     /**
      86             :      * Predominately you will only have one, but you can have
      87             :      * as many as you like.
      88             :      */
      89             :     std::vector<std::unique_ptr<IGUIScrollBar>> m_ScrollBars;
      90             : 
      91             : private:
      92             :     /**
      93             :      * Reference to the IGUIObject.
      94             :      * Private, because we don't want to inherit it in multiple classes.
      95             :      */
      96             :     IGUIObject& m_pObject;
      97             : };
      98             : 
      99             : #endif // INCLUDED_IGUISCROLLBAROWNER

Generated by: LCOV version 1.16