Pyrogenesis  trunk
SGUIMessage.h
Go to the documentation of this file.
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  */
28 {
38  GUIM_MOUSE_DBLCLICK_LEFT_ITEM, // Triggered when doubleclicking on a list item
44  GUIM_SETTINGS_UPDATED, // SGUIMessage.m_Value = name of setting
50  GUIM_LOAD, // Called after all objects were added to the GUI.
58  GUIM_TAB, // Used by CInput
60 };
61 
62 /**
63  * Message send to IGUIObject::HandleMessage() in order
64  * to give life to Objects manually with
65  * a derived HandleMessage().
66  */
68 {
69  // This should be passed as a const reference or pointer.
71 
72  SGUIMessage(EGUIMessageType _type) : type(_type), skipped(false) {}
73  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  void Skip(bool skip = true) { skipped = skip; }
82 
83  /**
84  * Describes what the message regards
85  */
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
Definition: SGUIMessage.h:42
static char * skip(char **buf, const char *delimiters)
Definition: mongoose.cpp:753
Definition: SGUIMessage.h:35
Definition: SGUIMessage.h:38
Definition: SGUIMessage.h:59
Definition: SGUIMessage.h:45
Definition: SGUIMessage.h:40
CStr value
Optional data.
Definition: SGUIMessage.h:91
SGUIMessage(EGUIMessageType _type, const CStr &_value)
Definition: SGUIMessage.h:73
Definition: SGUIMessage.h:51
Definition: SGUIMessage.h:32
Definition: SGUIMessage.h:50
Definition: SGUIMessage.h:30
Definition: SGUIMessage.h:44
Definition: SGUIMessage.h:48
Definition: SGUIMessage.h:31
EGUIMessageType
Message types.
Definition: SGUIMessage.h:27
Definition: SGUIMessage.h:34
Definition: SGUIMessage.h:33
Definition: SGUIMessage.h:36
Definition: SGUIMessage.h:41
Definition: SGUIMessage.h:57
SGUIMessage(EGUIMessageType _type)
Definition: SGUIMessage.h:72
Definition: SGUIMessage.h:37
void Skip(bool skip=true)
This method can be used to allow other event handlers to process this GUI event, by default an event ...
Definition: SGUIMessage.h:81
Definition: SGUIMessage.h:47
Definition: SGUIMessage.h:56
Definition: SGUIMessage.h:49
bool skipped
Flag that specifies if object skipped handling the event.
Definition: SGUIMessage.h:96
Definition: SGUIMessage.h:52
Definition: SGUIMessage.h:54
Definition: SGUIMessage.h:29
Definition: SGUIMessage.h:43
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
Definition: SGUIMessage.h:67
Definition: SGUIMessage.h:46
EGUIMessageType type
Describes what the message regards.
Definition: SGUIMessage.h:86
Definition: SGUIMessage.h:53
Definition: SGUIMessage.h:39
NONCOPYABLE(SGUIMessage)
Definition: SGUIMessage.h:55
Definition: SGUIMessage.h:58