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/. */
6 #ifndef mozilla_MiscEvents_h__
7 #define mozilla_MiscEvents_h__
11 #include "mozilla/BasicEvents.h"
14 #include "nsITransferable.h"
18 /******************************************************************************
19 * mozilla::WidgetContentCommandEvent
20 ******************************************************************************/
22 class WidgetContentCommandEvent
: public WidgetGUIEvent
25 virtual WidgetContentCommandEvent
* AsContentCommandEvent() MOZ_OVERRIDE
30 WidgetContentCommandEvent(bool aIsTrusted
, uint32_t aMessage
,
32 bool aOnlyEnabledCheck
= false) :
33 WidgetGUIEvent(aIsTrusted
, aMessage
, aWidget
, NS_CONTENT_COMMAND_EVENT
),
34 mOnlyEnabledCheck(aOnlyEnabledCheck
), mSucceeded(false), mIsEnabled(false)
38 // NS_CONTENT_COMMAND_PASTE_TRANSFERABLE
39 nsCOMPtr
<nsITransferable
> mTransferable
; // [in]
41 // NS_CONTENT_COMMAND_SCROLL
53 mAmount(0), mUnit(eCmdScrollUnit_Line
), mIsHorizontal(false)
57 int32_t mAmount
; // [in]
58 uint8_t mUnit
; // [in]
59 bool mIsHorizontal
; // [in]
62 bool mOnlyEnabledCheck
; // [in]
64 bool mSucceeded
; // [out]
65 bool mIsEnabled
; // [out]
67 void AssignContentCommandEventData(const WidgetContentCommandEvent
& aEvent
,
70 AssignGUIEventData(aEvent
, aCopyTargets
);
72 mScroll
= aEvent
.mScroll
;
73 mOnlyEnabledCheck
= aEvent
.mOnlyEnabledCheck
;
74 mSucceeded
= aEvent
.mSucceeded
;
75 mIsEnabled
= aEvent
.mIsEnabled
;
79 /******************************************************************************
80 * mozilla::WidgetCommandEvent
82 * This sends a command to chrome. If you want to request what is performed
83 * in focused content, you should use WidgetContentCommandEvent instead.
85 * XXX Should be |WidgetChromeCommandEvent|?
86 ******************************************************************************/
88 class WidgetCommandEvent
: public WidgetGUIEvent
91 virtual WidgetCommandEvent
* AsCommandEvent() MOZ_OVERRIDE
{ return this; }
93 WidgetCommandEvent(bool aIsTrusted
, nsIAtom
* aEventType
,
94 nsIAtom
* aCommand
, nsIWidget
* aWidget
) :
95 WidgetGUIEvent(aIsTrusted
, NS_USER_DEFINED_EVENT
, aWidget
,
99 userType
= aEventType
;
102 nsCOMPtr
<nsIAtom
> command
;
104 // XXX Not tested by test_assign_event_data.html
105 void AssignCommandEventData(const WidgetCommandEvent
& aEvent
,
108 AssignGUIEventData(aEvent
, aCopyTargets
);
110 // command must have been initialized with the constructor.
114 /******************************************************************************
115 * mozilla::WidgetPluginEvent
117 * This event delivers only a native event to focused plugin.
118 ******************************************************************************/
120 class WidgetPluginEvent
: public WidgetGUIEvent
123 virtual WidgetPluginEvent
* AsPluginEvent() MOZ_OVERRIDE
{ return this; }
125 WidgetPluginEvent(bool aIsTrusted
, uint32_t aMessage
, nsIWidget
* aWidget
) :
126 WidgetGUIEvent(aIsTrusted
, aMessage
, aWidget
, NS_PLUGIN_EVENT
),
127 retargetToFocusedDocument(false)
131 // If true, this event needs to be retargeted to focused document.
132 // Otherwise, never retargeted. Defaults to false.
133 bool retargetToFocusedDocument
;
136 } // namespace mozilla
138 #endif // mozilla_MiscEvents_h__