2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-07-16 02:57:29 +04:00
|
|
|
|
2013-09-24 14:04:14 +04:00
|
|
|
#ifndef mozilla_EventForwards_h__
|
|
|
|
#define mozilla_EventForwards_h__
|
2001-07-16 02:57:29 +04:00
|
|
|
|
2013-07-30 18:25:31 +04:00
|
|
|
#include <stdint.h>
|
2012-08-09 01:08:17 +04:00
|
|
|
|
2017-08-17 02:48:52 +03:00
|
|
|
#include "nsStringFwd.h"
|
2016-03-18 05:22:37 +03:00
|
|
|
#include "nsTArray.h"
|
|
|
|
|
2001-07-16 02:57:29 +04:00
|
|
|
/**
|
2013-09-24 14:04:14 +04:00
|
|
|
* XXX Following enums should be in BasicEvents.h. However, currently, it's
|
|
|
|
* impossible to use foward delearation for enum.
|
2001-07-16 02:57:29 +04:00
|
|
|
*/
|
|
|
|
|
2009-04-02 01:59:02 +04:00
|
|
|
/**
|
2013-09-24 14:04:14 +04:00
|
|
|
* Return status for event processors.
|
2009-04-02 01:59:02 +04:00
|
|
|
*/
|
2013-09-24 14:04:14 +04:00
|
|
|
enum nsEventStatus
|
|
|
|
{
|
|
|
|
// The event is ignored, do default processing
|
|
|
|
nsEventStatus_eIgnore,
|
|
|
|
// The event is consumed, don't do default processing
|
|
|
|
nsEventStatus_eConsumeNoDefault,
|
|
|
|
// The event is consumed, but do default processing
|
2015-05-14 15:16:00 +03:00
|
|
|
nsEventStatus_eConsumeDoDefault,
|
|
|
|
// Value is not for use, only for serialization
|
|
|
|
nsEventStatus_eSentinel
|
2009-04-02 01:59:02 +04:00
|
|
|
};
|
|
|
|
|
2015-08-26 15:56:59 +03:00
|
|
|
namespace mozilla {
|
|
|
|
|
2015-08-22 04:34:51 +03:00
|
|
|
/**
|
|
|
|
* Event messages
|
|
|
|
*/
|
|
|
|
|
2015-08-26 15:56:59 +03:00
|
|
|
typedef uint16_t EventMessageType;
|
|
|
|
|
|
|
|
enum EventMessage : EventMessageType
|
2015-08-22 04:34:51 +03:00
|
|
|
{
|
|
|
|
|
2015-09-17 06:05:44 +03:00
|
|
|
#define NS_EVENT_MESSAGE(aMessage) aMessage,
|
|
|
|
#define NS_EVENT_MESSAGE_FIRST_LAST(aMessage, aFirst, aLast) \
|
|
|
|
aMessage##First = aFirst, aMessage##Last = aLast,
|
2015-08-22 04:34:51 +03:00
|
|
|
|
|
|
|
#include "mozilla/EventMessageList.h"
|
|
|
|
|
|
|
|
#undef NS_EVENT_MESSAGE
|
2015-09-17 06:05:44 +03:00
|
|
|
#undef NS_EVENT_MESSAGE_FIRST_LAST
|
2015-08-22 04:34:51 +03:00
|
|
|
|
|
|
|
// For preventing bustage due to "," after the last item.
|
|
|
|
eEventMessage_MaxValue
|
|
|
|
};
|
|
|
|
|
2015-09-17 06:05:44 +03:00
|
|
|
const char* ToChar(EventMessage aEventMessage);
|
|
|
|
|
2015-08-22 04:34:51 +03:00
|
|
|
/**
|
|
|
|
* Event class IDs
|
|
|
|
*/
|
|
|
|
|
2014-08-04 09:28:58 +04:00
|
|
|
typedef uint8_t EventClassIDType;
|
|
|
|
|
2015-01-21 16:35:19 +03:00
|
|
|
enum EventClassID : EventClassIDType
|
2014-08-04 09:28:58 +04:00
|
|
|
{
|
|
|
|
// The event class name will be:
|
|
|
|
// eBasicEventClass for WidgetEvent
|
|
|
|
// eFooEventClass for WidgetFooEvent or InternalFooEvent
|
|
|
|
#define NS_ROOT_EVENT_CLASS(aPrefix, aName) eBasic##aName##Class
|
|
|
|
#define NS_EVENT_CLASS(aPrefix, aName) , e##aName##Class
|
|
|
|
|
|
|
|
#include "mozilla/EventClassList.h"
|
|
|
|
|
|
|
|
#undef NS_EVENT_CLASS
|
|
|
|
#undef NS_ROOT_EVENT_CLASS
|
|
|
|
};
|
|
|
|
|
2015-09-17 06:05:44 +03:00
|
|
|
const char* ToChar(EventClassID aEventClassID);
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
typedef uint16_t Modifiers;
|
2012-04-25 07:00:01 +04:00
|
|
|
|
2013-04-24 07:49:46 +04:00
|
|
|
#define NS_DEFINE_KEYNAME(aCPPName, aDOMKeyName) \
|
|
|
|
KEY_NAME_INDEX_##aCPPName,
|
|
|
|
|
2016-05-12 13:18:36 +03:00
|
|
|
typedef uint16_t KeyNameIndexType;
|
|
|
|
enum KeyNameIndex : KeyNameIndexType
|
2013-09-24 14:04:14 +04:00
|
|
|
{
|
2014-04-01 15:42:11 +04:00
|
|
|
#include "mozilla/KeyNameList.h"
|
2013-10-29 08:14:42 +04:00
|
|
|
// If a DOM keyboard event is synthesized by script, this is used. Then,
|
|
|
|
// specified key name should be stored and use it as .key value.
|
|
|
|
KEY_NAME_INDEX_USE_STRING
|
2013-04-24 07:49:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#undef NS_DEFINE_KEYNAME
|
|
|
|
|
Bug 1297013 part.2 Implement some helper methods to log constants related to event handling r=smaug
This patch implements some helper methods to log constants related to event handling.
ToString(KeyNameIndex) and ToString(CodeNameIndex) converts the enum itmes to human readable string. They use WidgetKeyboardEvent's helper class which returns Unicode text. Therefore, this need to convert from UTF16 to UTF8. That's the reason why these methods don't return |const char*|.
GetDOMKeyCodeName(uint32_t) returns DOM keycode name if it's defined. Otherwise, returns hexadecimal value. For generating switch-case statement, VirtualKeyCodeList.h shouldn't include ",". Therefore, this patch removes "," from VirtualKeyCodeList.h and append it at defining NS_DEFINE_VK. Additionally, the last item of enum and array should not end with ",". Therefore, this adds dummy last item at each of them. Finally, some of the keyCode values are shared between 2 keys. Therefore, it needs to support NS_DISALLOW_SAME_KEYCODE for switch-case generator. See the comment in the file for more detail.
GetModifiersName(Modifiers) returns all modifier names included in the given value.
MozReview-Commit-ID: 9i2ftFOTpDn
--HG--
extra : rebase_source : 458a4d28624dc10dd4454f2e7708d746d1fcb045
2016-09-14 18:48:47 +03:00
|
|
|
const nsCString ToString(KeyNameIndex aKeyNameIndex);
|
|
|
|
|
2014-05-25 06:08:58 +04:00
|
|
|
#define NS_DEFINE_PHYSICAL_KEY_CODE_NAME(aCPPName, aDOMCodeName) \
|
|
|
|
CODE_NAME_INDEX_##aCPPName,
|
|
|
|
|
2016-05-12 13:18:36 +03:00
|
|
|
typedef uint8_t CodeNameIndexType;
|
|
|
|
enum CodeNameIndex : CodeNameIndexType
|
2014-05-25 06:08:58 +04:00
|
|
|
{
|
|
|
|
#include "mozilla/PhysicalKeyCodeNameList.h"
|
|
|
|
// If a DOM keyboard event is synthesized by script, this is used. Then,
|
|
|
|
// specified code name should be stored and use it as .code value.
|
|
|
|
CODE_NAME_INDEX_USE_STRING
|
|
|
|
};
|
|
|
|
|
|
|
|
#undef NS_DEFINE_PHYSICAL_KEY_CODE_NAME
|
|
|
|
|
Bug 1297013 part.2 Implement some helper methods to log constants related to event handling r=smaug
This patch implements some helper methods to log constants related to event handling.
ToString(KeyNameIndex) and ToString(CodeNameIndex) converts the enum itmes to human readable string. They use WidgetKeyboardEvent's helper class which returns Unicode text. Therefore, this need to convert from UTF16 to UTF8. That's the reason why these methods don't return |const char*|.
GetDOMKeyCodeName(uint32_t) returns DOM keycode name if it's defined. Otherwise, returns hexadecimal value. For generating switch-case statement, VirtualKeyCodeList.h shouldn't include ",". Therefore, this patch removes "," from VirtualKeyCodeList.h and append it at defining NS_DEFINE_VK. Additionally, the last item of enum and array should not end with ",". Therefore, this adds dummy last item at each of them. Finally, some of the keyCode values are shared between 2 keys. Therefore, it needs to support NS_DISALLOW_SAME_KEYCODE for switch-case generator. See the comment in the file for more detail.
GetModifiersName(Modifiers) returns all modifier names included in the given value.
MozReview-Commit-ID: 9i2ftFOTpDn
--HG--
extra : rebase_source : 458a4d28624dc10dd4454f2e7708d746d1fcb045
2016-09-14 18:48:47 +03:00
|
|
|
const nsCString ToString(CodeNameIndex aCodeNameIndex);
|
|
|
|
|
2014-03-14 17:13:30 +04:00
|
|
|
#define NS_DEFINE_COMMAND(aName, aCommandStr) , Command##aName
|
|
|
|
|
|
|
|
typedef int8_t CommandInt;
|
2015-01-21 16:35:19 +03:00
|
|
|
enum Command : CommandInt
|
2014-03-14 17:13:30 +04:00
|
|
|
{
|
|
|
|
CommandDoNothing
|
|
|
|
|
|
|
|
#include "mozilla/CommandList.h"
|
|
|
|
};
|
|
|
|
#undef NS_DEFINE_COMMAND
|
|
|
|
|
2012-04-25 07:00:01 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2013-09-24 14:04:14 +04:00
|
|
|
/**
|
|
|
|
* All header files should include this header instead of *Events.h.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2013-10-18 10:10:20 +04:00
|
|
|
#define NS_EVENT_CLASS(aPrefix, aName) class aPrefix##aName;
|
|
|
|
#define NS_ROOT_EVENT_CLASS(aPrefix, aName) NS_EVENT_CLASS(aPrefix, aName)
|
|
|
|
|
|
|
|
#include "mozilla/EventClassList.h"
|
|
|
|
|
|
|
|
#undef NS_EVENT_CLASS
|
|
|
|
#undef NS_ROOT_EVENT_CLASS
|
|
|
|
|
|
|
|
// BasicEvents.h
|
2014-11-25 08:02:31 +03:00
|
|
|
struct BaseEventFlags;
|
2013-10-18 10:10:20 +04:00
|
|
|
struct EventFlags;
|
2013-09-24 14:04:14 +04:00
|
|
|
|
2016-03-16 07:47:48 +03:00
|
|
|
class WidgetEventTime;
|
|
|
|
|
2016-04-05 08:23:13 +03:00
|
|
|
class NativeEventData;
|
|
|
|
|
2013-09-24 14:04:14 +04:00
|
|
|
// TextEvents.h
|
2017-07-06 11:36:19 +03:00
|
|
|
enum class AccessKeyType;
|
|
|
|
|
2013-09-24 14:04:15 +04:00
|
|
|
struct AlternativeCharCode;
|
2016-03-18 05:22:37 +03:00
|
|
|
struct ShortcutKeyCandidate;
|
|
|
|
|
|
|
|
typedef nsTArray<ShortcutKeyCandidate> ShortcutKeyCandidateArray;
|
|
|
|
typedef AutoTArray<ShortcutKeyCandidate, 10> AutoShortcutKeyCandidateArray;
|
2013-10-22 17:27:36 +04:00
|
|
|
|
|
|
|
// TextRange.h
|
2016-06-04 03:49:21 +03:00
|
|
|
typedef uint8_t RawTextRangeType;
|
|
|
|
enum class TextRangeType : RawTextRangeType;
|
|
|
|
|
2013-09-24 14:04:15 +04:00
|
|
|
struct TextRangeStyle;
|
|
|
|
struct TextRange;
|
|
|
|
|
2017-05-19 10:50:30 +03:00
|
|
|
class EditCommands;
|
2014-03-04 17:48:26 +04:00
|
|
|
class TextRangeArray;
|
2013-09-24 14:04:14 +04:00
|
|
|
|
2015-01-31 10:17:12 +03:00
|
|
|
// FontRange.h
|
|
|
|
struct FontRange;
|
|
|
|
|
2013-09-24 14:04:16 +04:00
|
|
|
} // namespace mozilla
|
2013-09-24 14:04:14 +04:00
|
|
|
|
|
|
|
#endif // mozilla_EventForwards_h__
|