Bug 932076 - Add check for MediaExtractor creation failure. r=doublec
[gecko.git] / widget / MiscEvents.h
blob3d90a75ad8a75b34dc3921560795fb90c404f6f9
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__
9 #include <stdint.h>
11 #include "mozilla/BasicEvents.h"
12 #include "nsCOMPtr.h"
13 #include "nsIAtom.h"
14 #include "nsITransferable.h"
16 namespace mozilla {
18 /******************************************************************************
19 * mozilla::WidgetContentCommandEvent
20 ******************************************************************************/
22 class WidgetContentCommandEvent : public WidgetGUIEvent
24 public:
25 virtual WidgetContentCommandEvent* AsContentCommandEvent() MOZ_OVERRIDE
27 return this;
30 WidgetContentCommandEvent(bool aIsTrusted, uint32_t aMessage,
31 nsIWidget* aWidget,
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
42 // for mScroll.mUnit
43 enum
45 eCmdScrollUnit_Line,
46 eCmdScrollUnit_Page,
47 eCmdScrollUnit_Whole
50 struct ScrollInfo
52 ScrollInfo() :
53 mAmount(0), mUnit(eCmdScrollUnit_Line), mIsHorizontal(false)
57 int32_t mAmount; // [in]
58 uint8_t mUnit; // [in]
59 bool mIsHorizontal; // [in]
60 } mScroll;
62 bool mOnlyEnabledCheck; // [in]
64 bool mSucceeded; // [out]
65 bool mIsEnabled; // [out]
67 void AssignContentCommandEventData(const WidgetContentCommandEvent& aEvent,
68 bool aCopyTargets)
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
90 public:
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,
96 NS_COMMAND_EVENT),
97 command(aCommand)
99 userType = aEventType;
102 nsCOMPtr<nsIAtom> command;
104 // XXX Not tested by test_assign_event_data.html
105 void AssignCommandEventData(const WidgetCommandEvent& aEvent,
106 bool aCopyTargets)
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
122 public:
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__