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

          Line data    Source code
       1             : /* Copyright (C) 2020 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_SGUIMESSAGE
      19             : #define INCLUDED_SGUIMESSAGE
      20             : 
      21             : #include "ps/CStr.h"
      22             : 
      23             : /**
      24             :  * Message types.
      25             :  * @see SGUIMessage
      26             :  */
      27             : enum EGUIMessageType
      28             : {
      29             :     GUIM_MOUSE_OVER,
      30             :     GUIM_MOUSE_ENTER,
      31             :     GUIM_MOUSE_LEAVE,
      32             :     GUIM_MOUSE_PRESS_LEFT,
      33             :     GUIM_MOUSE_PRESS_LEFT_ITEM,
      34             :     GUIM_MOUSE_PRESS_RIGHT,
      35             :     GUIM_MOUSE_DOWN_LEFT,
      36             :     GUIM_MOUSE_DOWN_RIGHT,
      37             :     GUIM_MOUSE_DBLCLICK_LEFT,
      38             :     GUIM_MOUSE_DBLCLICK_LEFT_ITEM, // Triggered when doubleclicking on a list item
      39             :     GUIM_MOUSE_DBLCLICK_RIGHT,
      40             :     GUIM_MOUSE_RELEASE_LEFT,
      41             :     GUIM_MOUSE_RELEASE_RIGHT,
      42             :     GUIM_MOUSE_WHEEL_UP,
      43             :     GUIM_MOUSE_WHEEL_DOWN,
      44             :     GUIM_SETTINGS_UPDATED,  // SGUIMessage.m_Value = name of setting
      45             :     GUIM_PRESSED,
      46             :     GUIM_KEYDOWN,
      47             :     GUIM_RELEASED,
      48             :     GUIM_DOUBLE_PRESSED,
      49             :     GUIM_MOUSE_MOTION,
      50             :     GUIM_LOAD, // Called after all objects were added to the GUI.
      51             :     GUIM_GOT_FOCUS,
      52             :     GUIM_LOST_FOCUS,
      53             :     GUIM_PRESSED_MOUSE_RIGHT,
      54             :     GUIM_PRESSED_MOUSE_RIGHT_DISABLED,
      55             :     GUIM_DOUBLE_PRESSED_MOUSE_RIGHT,
      56             :     GUIM_PRESSED_MOUSE_RELEASE,
      57             :     GUIM_PRESSED_MOUSE_RELEASE_RIGHT,
      58             :     GUIM_TAB,               // Used by CInput
      59             :     GUIM_TEXTEDIT
      60             : };
      61             : 
      62             : /**
      63             :  * Message send to IGUIObject::HandleMessage() in order
      64             :  * to give life to Objects manually with
      65             :  * a derived HandleMessage().
      66             :  */
      67           6 : struct SGUIMessage
      68             : {
      69             :     // This should be passed as a const reference or pointer.
      70             :     NONCOPYABLE(SGUIMessage);
      71             : 
      72           6 :     SGUIMessage(EGUIMessageType _type) : type(_type), skipped(false) {}
      73           0 :     SGUIMessage(EGUIMessageType _type, const CStr& _value) : type(_type), value(_value), skipped(false) {}
      74             : 
      75             :     /**
      76             :      * This method can be used to allow other event handlers to process this GUI event,
      77             :      * by default an event is not skipped (only the first handler will process it).
      78             :      *
      79             :      * @param skip true to allow further event handling, false to prevent it
      80             :      */
      81           0 :     void Skip(bool skip = true) { skipped = skip; }
      82             : 
      83             :     /**
      84             :      * Describes what the message regards
      85             :      */
      86             :     EGUIMessageType type;
      87             : 
      88             :     /**
      89             :      * Optional data
      90             :      */
      91             :     CStr value;
      92             : 
      93             :     /**
      94             :      * Flag that specifies if object skipped handling the event
      95             :      */
      96             :     bool skipped;
      97             : };
      98             : 
      99             : #endif // INCLUDED_SGUIMESSAGE

Generated by: LCOV version 1.13