LCOV - code coverage report
Current view: top level - source/gui/ObjectTypes - CScrollPanel.h (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 0 3 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_CSCROLLPANEL
      19             : #define INCLUDED_CSCROLLPANEL
      20             : 
      21             : #include "gui/CGUISetting.h"
      22             : #include "gui/ObjectBases/IGUIObject.h"
      23             : #include "gui/ObjectBases/IGUIPanel.h"
      24             : #include "gui/ObjectBases/IGUIScrollBarOwner.h"
      25             : #include "gui/SettingTypes/EScrollOrientation.h"
      26             : #include "ps/CStr.h"
      27             : 
      28             : #include <vector>
      29             : 
      30             : class CGUI;
      31             : 
      32             : class CScrollPanel : public IGUIPanel, public IGUIScrollBarOwner
      33             : {
      34           0 :     GUI_OBJECT(CScrollPanel)
      35             : public:
      36             :     CScrollPanel(CGUI& pGUI);
      37             : 
      38             :     virtual void ResetStates();
      39             : 
      40             :     void ResetScrollPosition(EScrollOrientation orientation = EScrollOrientation::BOTH);
      41             : 
      42             : protected:
      43             :     /**
      44             :      * @see IGUIObject#HandleMessage()
      45             :      */
      46             :     virtual void HandleMessage(SGUIMessage& Message);
      47             : 
      48             :     virtual void RecalculateActualSize() const;
      49             : 
      50             :     void UpdateScrollBars();
      51             : 
      52           0 :     bool HasHorizontalScrollBar() const { return *m_Orientation == EScrollOrientation::HORIZONTAL || *m_Orientation == EScrollOrientation::BOTH; };
      53           0 :     bool HasVerticalScrollBar() const { return *m_Orientation == EScrollOrientation::VERTICAL || *m_Orientation == EScrollOrientation::BOTH; };
      54             : 
      55             :     virtual void Draw(CCanvas2D& canvas);
      56             : 
      57             :     virtual void CreateJSObject();
      58             : 
      59             :     CGUISimpleSetting<EScrollOrientation> m_Orientation;
      60             :     CGUISimpleSetting<CStr> m_ScrollBarStyle;
      61             :     CGUISimpleSetting<int> m_MinWidth;
      62             :     CGUISimpleSetting<int> m_MinHeight;
      63             : };
      64             : 
      65             : #endif // INCLUDED_CSCROLLPANEL

Generated by: LCOV version 1.16