LCOV - code coverage report
Current view: top level - source/gui/ObjectTypes - CButton.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) 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_CBUTTON
      19             : #define INCLUDED_CBUTTON
      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 "gui/ObjectBases/IGUITextOwner.h"
      26             : #include "gui/SettingTypes/CGUIColor.h"
      27             : #include "gui/SettingTypes/CGUIString.h"
      28             : #include "gui/SettingTypes/MouseEventMask.h"
      29             : #include "maths/Vector2D.h"
      30             : #include "ps/CStr.h"
      31             : 
      32             : class CGUI;
      33             : class CSize2D;
      34             : 
      35             : class CButton : public IGUIObject, public IGUITextOwner, public IGUIButtonBehavior
      36             : {
      37           0 :     GUI_OBJECT(CButton)
      38             : public:
      39             :     CButton(CGUI& pGUI);
      40             : 
      41             :     /**
      42             :      * @see IGUIObject#ResetStates()
      43             :      */
      44             :     virtual void ResetStates();
      45             : 
      46             :     /**
      47             :      * @see IGUIObject#HandleSizeChanged()
      48             :      */
      49             :     virtual void HandleSizeChanged();
      50             : 
      51             :     /**
      52             :      * @return the object text size.
      53             :      */
      54             :     CSize2D GetTextSize();
      55             : 
      56             :     CSize2D GetPreferredTextSize();
      57             : 
      58             :     /**
      59             :      * @see IGUIObject#HandleMessage()
      60             :      */
      61             :     virtual void HandleMessage(SGUIMessage& Message);
      62             : 
      63             :     /**
      64             :      * Draws the Button
      65             :      */
      66             :     virtual void Draw(CCanvas2D& canvas);
      67             : 
      68             :     /**
      69             :      * @see IGUIObject#IsMouseOver()
      70             :      */
      71             :     virtual bool IsMouseOver() const;
      72             : 
      73             : protected:
      74             :     /**
      75             :      * Sets up text, should be called every time changes has been
      76             :      * made that can change the visual.
      77             :      */
      78             :     void SetupText();
      79             : 
      80             :     /**
      81             :      * Picks the text color depending on current object settings.
      82             :      */
      83             :     const CGUIColor& ChooseColor();
      84             : 
      85             :     /**
      86             :      * Placement of text.
      87             :      */
      88             :     CVector2D m_TextPos;
      89             : 
      90             :     virtual void CreateJSObject();
      91             : 
      92             :     // Settings
      93             :     CGUISimpleSetting<float> m_BufferZone;
      94             :     CGUISimpleSetting<CGUIString> m_Caption;
      95             :     CGUISimpleSetting<CStrW> m_Font;
      96             :     CGUISimpleSetting<CGUISpriteInstance> m_Sprite;
      97             :     CGUISimpleSetting<CGUISpriteInstance> m_SpriteOver;
      98             :     CGUISimpleSetting<CGUISpriteInstance> m_SpritePressed;
      99             :     CGUISimpleSetting<CGUISpriteInstance> m_SpriteDisabled;
     100             :     CGUISimpleSetting<CGUIColor> m_TextColor;
     101             :     CGUISimpleSetting<CGUIColor> m_TextColorOver;
     102             :     CGUISimpleSetting<CGUIColor> m_TextColorPressed;
     103             :     CGUISimpleSetting<CGUIColor> m_TextColorDisabled;
     104             :     CGUIMouseEventMask m_MouseEventMask;
     105             : };
     106             : 
     107             : #endif // INCLUDED_CBUTTON

Generated by: LCOV version 1.16