LCOV - code coverage report
Current view: top level - source/gui/SettingTypes - MouseEventMask.h (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 0 1 0.0 %
Date: 2023-01-19 00:18:29 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /* Copyright (C) 2021 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_GUI_MOUSE_EVENT_MASK
      19             : #define INCLUDED_GUI_MOUSE_EVENT_MASK
      20             : 
      21             : #include "gui/CGUISetting.h"
      22             : #include "ps/CStr.h"
      23             : 
      24             : #include <string>
      25             : #include <memory>
      26             : 
      27             : class CRect;
      28             : class CVector2D;
      29             : class IGUIObject;
      30             : class ScriptRequest;
      31             : 
      32             : /**
      33             :  * A custom shape that changes the object's "over-ability", and thus where one can click on it.
      34             :  * Supported:
      35             :  *  - "texture:[path]" loads a texture and uses either the alpha or the red channel. Any non-0 is clickable.
      36             :  *    The texture is always 'stretched' in sprite terminology.
      37             :  *
      38             :  * TODO:
      39             :  *  - the minimap circular shape should be moved here.
      40             :  */
      41             : class CGUIMouseEventMask : public IGUISetting
      42             : {
      43             : public:
      44             :     CGUIMouseEventMask(IGUIObject* owner);
      45             :     ~CGUIMouseEventMask();
      46             : 
      47             :     /**
      48             :      * @return true if the mask is initialised <=> its spec is not ""
      49             :      */
      50           0 :     explicit operator bool() const { return !!m_Impl; }
      51             : 
      52             :     /**
      53             :      * @return true if the mouse pointer is over the mask. False if the mask is not initialised.
      54             :      */
      55             :     bool IsMouseOver(const CVector2D& mousePos, const CRect& objectSize) const;
      56             : 
      57             :     void ToJSVal(const ScriptRequest& rq, JS::MutableHandleValue value) override;
      58             : 
      59             :     class Impl;
      60             : protected:
      61             :     bool DoFromString(const CStrW& value) override;
      62             :     bool DoFromJSVal(const ScriptRequest& rq, JS::HandleValue value) override;
      63             :     CStr GetName() const override;
      64             : 
      65             :     std::string m_Spec;
      66             :     std::unique_ptr<Impl> m_Impl;
      67             : };
      68             : 
      69             : #endif // INCLUDED_GUI_MOUSE_EVENT_MASK

Generated by: LCOV version 1.13