1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef mozilla_EventForwards_h__ 7 #define mozilla_EventForwards_h__ 8 9 #include <stdint.h> 10 11 #include "nsStringFwd.h" 12 #include "nsTArray.h" 13 14 /** 15 * XXX Following enums should be in BasicEvents.h. However, currently, it's 16 * impossible to use foward delearation for enum. 17 */ 18 19 /** 20 * Return status for event processors. 21 */ 22 enum nsEventStatus { 23 // The event is ignored, do default processing 24 nsEventStatus_eIgnore, 25 // The event is consumed, don't do default processing 26 nsEventStatus_eConsumeNoDefault, 27 // The event is consumed, but do default processing 28 nsEventStatus_eConsumeDoDefault, 29 // Value is not for use, only for serialization 30 nsEventStatus_eSentinel 31 }; 32 33 namespace mozilla { 34 35 /** 36 * Event messages 37 */ 38 39 typedef uint16_t EventMessageType; 40 41 enum EventMessage : EventMessageType { 42 43 #define NS_EVENT_MESSAGE(aMessage) aMessage, 44 #define NS_EVENT_MESSAGE_FIRST_LAST(aMessage, aFirst, aLast) \ 45 aMessage##First = aFirst, aMessage##Last = aLast, 46 47 #include "mozilla/EventMessageList.h" 48 49 #undef NS_EVENT_MESSAGE 50 #undef NS_EVENT_MESSAGE_FIRST_LAST 51 52 // For preventing bustage due to "," after the last item. 53 eEventMessage_MaxValue 54 }; 55 56 const char* ToChar(EventMessage aEventMessage); 57 58 /** 59 * Event class IDs 60 */ 61 62 typedef uint8_t EventClassIDType; 63 64 enum EventClassID : EventClassIDType { 65 // The event class name will be: 66 // eBasicEventClass for WidgetEvent 67 // eFooEventClass for WidgetFooEvent or InternalFooEvent 68 #define NS_ROOT_EVENT_CLASS(aPrefix, aName) eBasic##aName##Class 69 #define NS_EVENT_CLASS(aPrefix, aName) , e##aName##Class 70 71 #include "mozilla/EventClassList.h" 72 73 #undef NS_EVENT_CLASS 74 #undef NS_ROOT_EVENT_CLASS 75 }; 76 77 const char* ToChar(EventClassID aEventClassID); 78 79 typedef uint16_t Modifiers; 80 81 #define NS_DEFINE_KEYNAME(aCPPName, aDOMKeyName) KEY_NAME_INDEX_##aCPPName, 82 83 typedef uint16_t KeyNameIndexType; 84 enum KeyNameIndex : KeyNameIndexType { 85 #include "mozilla/KeyNameList.h" 86 // If a DOM keyboard event is synthesized by script, this is used. Then, 87 // specified key name should be stored and use it as .key value. 88 KEY_NAME_INDEX_USE_STRING 89 }; 90 91 #undef NS_DEFINE_KEYNAME 92 93 const nsCString ToString(KeyNameIndex aKeyNameIndex); 94 95 #define NS_DEFINE_PHYSICAL_KEY_CODE_NAME(aCPPName, aDOMCodeName) \ 96 CODE_NAME_INDEX_##aCPPName, 97 98 typedef uint8_t CodeNameIndexType; 99 enum CodeNameIndex : CodeNameIndexType { 100 #include "mozilla/PhysicalKeyCodeNameList.h" 101 // If a DOM keyboard event is synthesized by script, this is used. Then, 102 // specified code name should be stored and use it as .code value. 103 CODE_NAME_INDEX_USE_STRING 104 }; 105 106 #undef NS_DEFINE_PHYSICAL_KEY_CODE_NAME 107 108 const nsCString ToString(CodeNameIndex aCodeNameIndex); 109 110 #define NS_DEFINE_COMMAND(aName, aCommandStr) , Command##aName 111 #define NS_DEFINE_COMMAND_NO_EXEC_COMMAND(aName) , Command##aName 112 113 typedef int8_t CommandInt; 114 enum Command : CommandInt { 115 CommandDoNothing 116 117 #include "mozilla/CommandList.h" 118 }; 119 #undef NS_DEFINE_COMMAND 120 #undef NS_DEFINE_COMMAND_NO_EXEC_COMMAND 121 122 const char* ToChar(Command aCommand); 123 124 } // namespace mozilla 125 126 /** 127 * All header files should include this header instead of *Events.h. 128 */ 129 130 namespace mozilla { 131 132 #define NS_EVENT_CLASS(aPrefix, aName) class aPrefix##aName; 133 #define NS_ROOT_EVENT_CLASS(aPrefix, aName) NS_EVENT_CLASS(aPrefix, aName) 134 135 #include "mozilla/EventClassList.h" 136 137 #undef NS_EVENT_CLASS 138 #undef NS_ROOT_EVENT_CLASS 139 140 // BasicEvents.h 141 struct BaseEventFlags; 142 struct EventFlags; 143 144 class WidgetEventTime; 145 146 class NativeEventData; 147 148 // TextEvents.h 149 enum class AccessKeyType; 150 151 struct AlternativeCharCode; 152 struct ShortcutKeyCandidate; 153 154 typedef nsTArray<ShortcutKeyCandidate> ShortcutKeyCandidateArray; 155 typedef AutoTArray<ShortcutKeyCandidate, 10> AutoShortcutKeyCandidateArray; 156 157 // TextRange.h 158 typedef uint8_t RawTextRangeType; 159 enum class TextRangeType : RawTextRangeType; 160 161 struct TextRangeStyle; 162 struct TextRange; 163 164 class EditCommands; 165 class TextRangeArray; 166 167 // FontRange.h 168 struct FontRange; 169 170 } // namespace mozilla 171 172 #endif // mozilla_EventForwards_h__ 173