Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 nsIWidget_h__
7 #define nsIWidget_h__
9 #include "nsISupports.h"
10 #include "nsColor.h"
11 #include "nsRect.h"
12 #include "nsStringGlue.h"
14 #include "nsCOMPtr.h"
15 #include "nsAutoPtr.h"
16 #include "nsWidgetInitData.h"
17 #include "nsTArray.h"
18 #include "nsITimer.h"
19 #include "nsXULAppAPI.h"
20 #include "mozilla/EventForwards.h"
21 #include "mozilla/layers/LayersTypes.h"
22 #include "mozilla/RefPtr.h"
23 #include "mozilla/TimeStamp.h"
24 #include "Units.h"
26 // forward declarations
27 class nsFontMetrics;
28 class nsRenderingContext;
29 class nsDeviceContext;
30 struct nsFont;
31 class nsIRollupListener;
32 class imgIContainer;
33 class gfxASurface;
34 class nsIContent;
35 class ViewWrapper;
36 class nsIWidgetListener;
37 class nsIntRegion;
39 namespace mozilla {
40 namespace dom {
41 class TabChild;
42 }
43 namespace layers {
44 class Composer2D;
45 class CompositorChild;
46 class LayerManager;
47 class LayerManagerComposite;
48 class PLayerTransactionChild;
49 }
50 namespace gfx {
51 class DrawTarget;
52 }
53 }
55 /**
56 * Callback function that processes events.
57 *
58 * The argument is actually a subtype (subclass) of WidgetEvent which carries
59 * platform specific information about the event. Platform specific code
60 * knows how to deal with it.
61 *
62 * The return value determines whether or not the default action should take
63 * place.
64 */
65 typedef nsEventStatus (* EVENT_CALLBACK)(mozilla::WidgetGUIEvent* aEvent);
67 // Hide the native window system's real window type so as to avoid
68 // including native window system types and APIs. This is necessary
69 // to ensure cross-platform code.
70 typedef void* nsNativeWidget;
72 /**
73 * Flags for the getNativeData function.
74 * See getNativeData()
75 */
76 #define NS_NATIVE_WINDOW 0
77 #define NS_NATIVE_GRAPHIC 1
78 #define NS_NATIVE_TMP_WINDOW 2
79 #define NS_NATIVE_WIDGET 3
80 #define NS_NATIVE_DISPLAY 4
81 #define NS_NATIVE_REGION 5
82 #define NS_NATIVE_OFFSETX 6
83 #define NS_NATIVE_OFFSETY 7
84 #define NS_NATIVE_PLUGIN_PORT 8
85 #define NS_NATIVE_SCREEN 9
86 // The toplevel GtkWidget containing this nsIWidget:
87 #define NS_NATIVE_SHELLWIDGET 10
88 // Has to match to NPNVnetscapeWindow, and shareable across processes
89 // HWND on Windows and XID on X11
90 #define NS_NATIVE_SHAREABLE_WINDOW 11
91 #ifdef XP_MACOSX
92 #define NS_NATIVE_PLUGIN_PORT_QD 100
93 #define NS_NATIVE_PLUGIN_PORT_CG 101
94 #endif
95 #ifdef XP_WIN
96 #define NS_NATIVE_TSF_THREAD_MGR 100
97 #define NS_NATIVE_TSF_CATEGORY_MGR 101
98 #define NS_NATIVE_TSF_DISPLAY_ATTR_MGR 102
99 #define NS_NATIVE_ICOREWINDOW 103 // winrt specific
100 #endif
102 #define NS_IWIDGET_IID \
103 { 0x87d80888, 0x9917, 0x4bfb, \
104 { 0x81, 0xa9, 0x1c, 0x5e, 0x30, 0x9c, 0x78, 0xb4 } }
106 /*
107 * Window shadow styles
108 * Also used for the -moz-window-shadow CSS property
109 */
111 #define NS_STYLE_WINDOW_SHADOW_NONE 0
112 #define NS_STYLE_WINDOW_SHADOW_DEFAULT 1
113 #define NS_STYLE_WINDOW_SHADOW_MENU 2
114 #define NS_STYLE_WINDOW_SHADOW_TOOLTIP 3
115 #define NS_STYLE_WINDOW_SHADOW_SHEET 4
117 /**
118 * Transparency modes
119 */
121 enum nsTransparencyMode {
122 eTransparencyOpaque = 0, // Fully opaque
123 eTransparencyTransparent, // Parts of the window may be transparent
124 eTransparencyGlass, // Transparent parts of the window have Vista AeroGlass effect applied
125 eTransparencyBorderlessGlass // As above, but without a border around the opaque areas when there would otherwise be one with eTransparencyGlass
126 };
128 /**
129 * Cursor types.
130 */
132 enum nsCursor { ///(normal cursor, usually rendered as an arrow)
133 eCursor_standard,
134 ///(system is busy, usually rendered as a hourglass or watch)
135 eCursor_wait,
136 ///(Selecting something, usually rendered as an IBeam)
137 eCursor_select,
138 ///(can hyper-link, usually rendered as a human hand)
139 eCursor_hyperlink,
140 ///(north/south/west/east edge sizing)
141 eCursor_n_resize,
142 eCursor_s_resize,
143 eCursor_w_resize,
144 eCursor_e_resize,
145 ///(corner sizing)
146 eCursor_nw_resize,
147 eCursor_se_resize,
148 eCursor_ne_resize,
149 eCursor_sw_resize,
150 eCursor_crosshair,
151 eCursor_move,
152 eCursor_help,
153 eCursor_copy, // CSS3
154 eCursor_alias,
155 eCursor_context_menu,
156 eCursor_cell,
157 eCursor_grab,
158 eCursor_grabbing,
159 eCursor_spinning,
160 eCursor_zoom_in,
161 eCursor_zoom_out,
162 eCursor_not_allowed,
163 eCursor_col_resize,
164 eCursor_row_resize,
165 eCursor_no_drop,
166 eCursor_vertical_text,
167 eCursor_all_scroll,
168 eCursor_nesw_resize,
169 eCursor_nwse_resize,
170 eCursor_ns_resize,
171 eCursor_ew_resize,
172 eCursor_none,
173 // This one better be the last one in this list.
174 eCursorCount
175 };
177 enum nsTopLevelWidgetZPlacement { // for PlaceBehind()
178 eZPlacementBottom = 0, // bottom of the window stack
179 eZPlacementBelow, // just below another widget
180 eZPlacementTop // top of the window stack
181 };
183 /**
184 * Before the OS goes to sleep, this topic is notified.
185 */
186 #define NS_WIDGET_SLEEP_OBSERVER_TOPIC "sleep_notification"
188 /**
189 * After the OS wakes up, this topic is notified.
190 */
191 #define NS_WIDGET_WAKE_OBSERVER_TOPIC "wake_notification"
193 /**
194 * Before the OS suspends the current process, this topic is notified. Some
195 * OS will kill processes that are suspended instead of resuming them.
196 * For that reason this topic may be useful to safely close down resources.
197 */
198 #define NS_WIDGET_SUSPEND_PROCESS_OBSERVER_TOPIC "suspend_process_notification"
200 /**
201 * After the current process resumes from being suspended, this topic is
202 * notified.
203 */
204 #define NS_WIDGET_RESUME_PROCESS_OBSERVER_TOPIC "resume_process_notification"
206 /**
207 * Preference for receiving IME updates
208 *
209 * If mWantUpdates is not NOTIFY_NOTHING, nsTextStateManager will observe text
210 * change and/or selection change and call nsIWidget::NotifyIME() with
211 * NOTIFY_IME_OF_SELECTION_CHANGE and/or NOTIFY_IME_OF_TEXT_CHANGE.
212 * Please note that the text change observing cost is very expensive especially
213 * on an HTML editor has focus.
214 * If the IME implementation on a particular platform doesn't care about
215 * NOTIFY_IME_OF_SELECTION_CHANGE and/or NOTIFY_IME_OF_TEXT_CHANGE,
216 * they should set mWantUpdates to NOTIFY_NOTHING to avoid the cost.
217 * If the IME implementation needs notifications even while our process is
218 * deactive, it should also set NOTIFY_DURING_DEACTIVE.
219 */
220 struct nsIMEUpdatePreference {
222 typedef uint8_t Notifications;
224 enum MOZ_ENUM_TYPE(Notifications)
225 {
226 NOTIFY_NOTHING = 0,
227 NOTIFY_SELECTION_CHANGE = 1 << 0,
228 NOTIFY_TEXT_CHANGE = 1 << 1,
229 NOTIFY_POSITION_CHANGE = 1 << 2,
230 // Following values indicate when widget needs or doesn't need notification.
231 NOTIFY_CHANGES_CAUSED_BY_COMPOSITION = 1 << 6,
232 // NOTE: NOTIFY_DURING_DEACTIVE isn't supported in environments where two
233 // or more compositions are possible. E.g., Mac and Linux (GTK).
234 NOTIFY_DURING_DEACTIVE = 1 << 7,
235 // Changes are notified in following conditions if the instance is
236 // just constructed. If some platforms don't need change notifications
237 // in some of following conditions, the platform should remove following
238 // flags before returing the instance from nsIWidget::GetUpdatePreference().
239 DEFAULT_CONDITIONS_OF_NOTIFYING_CHANGES =
240 NOTIFY_CHANGES_CAUSED_BY_COMPOSITION
241 };
243 nsIMEUpdatePreference()
244 : mWantUpdates(DEFAULT_CONDITIONS_OF_NOTIFYING_CHANGES)
245 {
246 }
248 nsIMEUpdatePreference(Notifications aWantUpdates)
249 : mWantUpdates(aWantUpdates | DEFAULT_CONDITIONS_OF_NOTIFYING_CHANGES)
250 {
251 }
253 void DontNotifyChangesCausedByComposition()
254 {
255 mWantUpdates &= ~DEFAULT_CONDITIONS_OF_NOTIFYING_CHANGES;
256 }
258 bool WantSelectionChange() const
259 {
260 return !!(mWantUpdates & NOTIFY_SELECTION_CHANGE);
261 }
263 bool WantTextChange() const
264 {
265 return !!(mWantUpdates & NOTIFY_TEXT_CHANGE);
266 }
268 bool WantPositionChanged() const
269 {
270 return !!(mWantUpdates & NOTIFY_POSITION_CHANGE);
271 }
273 bool WantChanges() const
274 {
275 return WantSelectionChange() || WantTextChange();
276 }
278 bool WantChangesCausedByComposition() const
279 {
280 return WantChanges() &&
281 !!(mWantUpdates & NOTIFY_CHANGES_CAUSED_BY_COMPOSITION);
282 }
284 bool WantDuringDeactive() const
285 {
286 return !!(mWantUpdates & NOTIFY_DURING_DEACTIVE);
287 }
289 Notifications mWantUpdates;
290 };
293 /*
294 * Contains IMEStatus plus information about the current
295 * input context that the IME can use as hints if desired.
296 */
298 namespace mozilla {
299 namespace widget {
301 struct IMEState {
302 /**
303 * IME enabled states, the mEnabled value of
304 * SetInputContext()/GetInputContext() should be one value of following
305 * values.
306 *
307 * WARNING: If you change these values, you also need to edit:
308 * nsIDOMWindowUtils.idl
309 * nsContentUtils::GetWidgetStatusFromIMEStatus
310 */
311 enum Enabled {
312 /**
313 * 'Disabled' means the user cannot use IME. So, the IME open state should
314 * be 'closed' during 'disabled'.
315 */
316 DISABLED,
317 /**
318 * 'Enabled' means the user can use IME.
319 */
320 ENABLED,
321 /**
322 * 'Password' state is a special case for the password editors.
323 * E.g., on mac, the password editors should disable the non-Roman
324 * keyboard layouts at getting focus. Thus, the password editor may have
325 * special rules on some platforms.
326 */
327 PASSWORD,
328 /**
329 * This state is used when a plugin is focused.
330 * When a plug-in is focused content, we should send native events
331 * directly. Because we don't process some native events, but they may
332 * be needed by the plug-in.
333 */
334 PLUGIN
335 };
336 Enabled mEnabled;
338 /**
339 * IME open states the mOpen value of SetInputContext() should be one value of
340 * OPEN, CLOSE or DONT_CHANGE_OPEN_STATE. GetInputContext() should return
341 * OPEN, CLOSE or OPEN_STATE_NOT_SUPPORTED.
342 */
343 enum Open {
344 /**
345 * 'Unsupported' means the platform cannot return actual IME open state.
346 * This value is used only by GetInputContext().
347 */
348 OPEN_STATE_NOT_SUPPORTED,
349 /**
350 * 'Don't change' means the widget shouldn't change IME open state when
351 * SetInputContext() is called.
352 */
353 DONT_CHANGE_OPEN_STATE = OPEN_STATE_NOT_SUPPORTED,
354 /**
355 * 'Open' means that IME should compose in its primary language (or latest
356 * input mode except direct ASCII character input mode). Even if IME is
357 * opened by this value, users should be able to close IME by theirselves.
358 * Web contents can specify this value by |ime-mode: active;|.
359 */
360 OPEN,
361 /**
362 * 'Closed' means that IME shouldn't handle key events (or should handle
363 * as ASCII character inputs on mobile device). Even if IME is closed by
364 * this value, users should be able to open IME by theirselves.
365 * Web contents can specify this value by |ime-mode: inactive;|.
366 */
367 CLOSED
368 };
369 Open mOpen;
371 IMEState() : mEnabled(ENABLED), mOpen(DONT_CHANGE_OPEN_STATE) { }
373 IMEState(Enabled aEnabled, Open aOpen = DONT_CHANGE_OPEN_STATE) :
374 mEnabled(aEnabled), mOpen(aOpen)
375 {
376 }
377 };
379 struct InputContext {
380 InputContext() : mNativeIMEContext(nullptr) {}
382 bool IsPasswordEditor() const
383 {
384 return mHTMLInputType.LowerCaseEqualsLiteral("password");
385 }
387 IMEState mIMEState;
389 /* The type of the input if the input is a html input field */
390 nsString mHTMLInputType;
392 /* The type of the inputmode */
393 nsString mHTMLInputInputmode;
395 /* A hint for the action that is performed when the input is submitted */
396 nsString mActionHint;
398 /* Native IME context for the widget. This doesn't come from the argument of
399 SetInputContext(). If there is only one context in the process, this may
400 be nullptr. */
401 void* mNativeIMEContext;
402 };
404 struct InputContextAction {
405 /**
406 * mCause indicates what action causes calling nsIWidget::SetInputContext().
407 * It must be one of following values.
408 */
409 enum Cause {
410 // The cause is unknown but originated from content. Focus might have been
411 // changed by content script.
412 CAUSE_UNKNOWN,
413 // The cause is unknown but originated from chrome. Focus might have been
414 // changed by chrome script.
415 CAUSE_UNKNOWN_CHROME,
416 // The cause is user's keyboard operation.
417 CAUSE_KEY,
418 // The cause is user's mouse operation.
419 CAUSE_MOUSE
420 };
421 Cause mCause;
423 /**
424 * mFocusChange indicates what happened for focus.
425 */
426 enum FocusChange {
427 FOCUS_NOT_CHANGED,
428 // A content got focus.
429 GOT_FOCUS,
430 // Focused content lost focus.
431 LOST_FOCUS,
432 // Menu got pseudo focus that means focused content isn't changed but
433 // keyboard events will be handled by menu.
434 MENU_GOT_PSEUDO_FOCUS,
435 // Menu lost pseudo focus that means focused content will handle keyboard
436 // events.
437 MENU_LOST_PSEUDO_FOCUS
438 };
439 FocusChange mFocusChange;
441 bool ContentGotFocusByTrustedCause() const {
442 return (mFocusChange == GOT_FOCUS &&
443 mCause != CAUSE_UNKNOWN);
444 }
446 bool UserMightRequestOpenVKB() const {
447 return (mFocusChange == FOCUS_NOT_CHANGED &&
448 mCause == CAUSE_MOUSE);
449 }
451 InputContextAction() :
452 mCause(CAUSE_UNKNOWN), mFocusChange(FOCUS_NOT_CHANGED)
453 {
454 }
456 InputContextAction(Cause aCause,
457 FocusChange aFocusChange = FOCUS_NOT_CHANGED) :
458 mCause(aCause), mFocusChange(aFocusChange)
459 {
460 }
461 };
463 /**
464 * Size constraints for setting the minimum and maximum size of a widget.
465 * Values are in device pixels.
466 */
467 struct SizeConstraints {
468 SizeConstraints()
469 : mMaxSize(NS_MAXSIZE, NS_MAXSIZE)
470 {
471 }
473 SizeConstraints(nsIntSize aMinSize,
474 nsIntSize aMaxSize)
475 : mMinSize(aMinSize),
476 mMaxSize(aMaxSize)
477 {
478 }
480 nsIntSize mMinSize;
481 nsIntSize mMaxSize;
482 };
484 // IMEMessage is shared by IMEStateManager and TextComposition.
485 // Update values in GeckoEditable.java if you make changes here.
486 // XXX Negative values are used in Android...
487 enum IMEMessage MOZ_ENUM_TYPE(int8_t)
488 {
489 // XXX We should replace NOTIFY_IME_OF_CURSOR_POS_CHANGED with
490 // NOTIFY_IME_OF_SELECTION_CHANGE later.
491 NOTIFY_IME_OF_CURSOR_POS_CHANGED,
492 // An editable content is getting focus
493 NOTIFY_IME_OF_FOCUS,
494 // An editable content is losing focus
495 NOTIFY_IME_OF_BLUR,
496 // Selection in the focused editable content is changed
497 NOTIFY_IME_OF_SELECTION_CHANGE,
498 // Text in the focused editable content is changed
499 NOTIFY_IME_OF_TEXT_CHANGE,
500 // Composition string has been updated
501 NOTIFY_IME_OF_COMPOSITION_UPDATE,
502 // Position or size of focused element may be changed.
503 NOTIFY_IME_OF_POSITION_CHANGE,
504 // Request to commit current composition to IME
505 // (some platforms may not support)
506 REQUEST_TO_COMMIT_COMPOSITION,
507 // Request to cancel current composition to IME
508 // (some platforms may not support)
509 REQUEST_TO_CANCEL_COMPOSITION
510 };
512 struct IMENotification
513 {
514 IMENotification(IMEMessage aMessage)
515 : mMessage(aMessage)
516 {
517 switch (aMessage) {
518 case NOTIFY_IME_OF_SELECTION_CHANGE:
519 mSelectionChangeData.mCausedByComposition = false;
520 break;
521 case NOTIFY_IME_OF_TEXT_CHANGE:
522 mTextChangeData.mStartOffset = 0;
523 mTextChangeData.mOldEndOffset = 0;
524 mTextChangeData.mNewEndOffset = 0;
525 mTextChangeData.mCausedByComposition = false;
526 break;
527 default:
528 break;
529 }
530 }
532 IMEMessage mMessage;
534 union
535 {
536 // NOTIFY_IME_OF_SELECTION_CHANGE specific data
537 struct
538 {
539 bool mCausedByComposition;
540 } mSelectionChangeData;
542 // NOTIFY_IME_OF_TEXT_CHANGE specific data
543 struct
544 {
545 uint32_t mStartOffset;
546 uint32_t mOldEndOffset;
547 uint32_t mNewEndOffset;
549 bool mCausedByComposition;
551 uint32_t OldLength() const { return mOldEndOffset - mStartOffset; }
552 uint32_t NewLength() const { return mNewEndOffset - mStartOffset; }
553 int32_t AdditionalLength() const
554 {
555 return static_cast<int32_t>(mNewEndOffset - mOldEndOffset);
556 }
557 bool IsInInt32Range() const
558 {
559 return mStartOffset <= INT32_MAX &&
560 mOldEndOffset <= INT32_MAX &&
561 mNewEndOffset <= INT32_MAX;
562 }
563 } mTextChangeData;
564 };
566 bool IsCausedByComposition() const
567 {
568 switch (mMessage) {
569 case NOTIFY_IME_OF_SELECTION_CHANGE:
570 return mSelectionChangeData.mCausedByComposition;
571 case NOTIFY_IME_OF_TEXT_CHANGE:
572 return mTextChangeData.mCausedByComposition;
573 default:
574 return false;
575 }
576 }
578 private:
579 IMENotification();
580 };
582 } // namespace widget
583 } // namespace mozilla
585 /**
586 * The base class for all the widgets. It provides the interface for
587 * all basic and necessary functionality.
588 */
589 class nsIWidget : public nsISupports {
590 protected:
591 typedef mozilla::dom::TabChild TabChild;
593 public:
594 typedef mozilla::layers::Composer2D Composer2D;
595 typedef mozilla::layers::CompositorChild CompositorChild;
596 typedef mozilla::layers::LayerManager LayerManager;
597 typedef mozilla::layers::LayerManagerComposite LayerManagerComposite;
598 typedef mozilla::layers::LayersBackend LayersBackend;
599 typedef mozilla::layers::PLayerTransactionChild PLayerTransactionChild;
600 typedef mozilla::widget::IMEMessage IMEMessage;
601 typedef mozilla::widget::IMENotification IMENotification;
602 typedef mozilla::widget::IMEState IMEState;
603 typedef mozilla::widget::InputContext InputContext;
604 typedef mozilla::widget::InputContextAction InputContextAction;
605 typedef mozilla::widget::SizeConstraints SizeConstraints;
607 // Used in UpdateThemeGeometries.
608 struct ThemeGeometry {
609 // The -moz-appearance value for the themed widget
610 uint8_t mWidgetType;
611 // The device-pixel rect within the window for the themed widget
612 nsIntRect mRect;
614 ThemeGeometry(uint8_t aWidgetType, const nsIntRect& aRect)
615 : mWidgetType(aWidgetType)
616 , mRect(aRect)
617 { }
618 };
620 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWIDGET_IID)
622 nsIWidget()
623 : mLastChild(nullptr)
624 , mPrevSibling(nullptr)
625 , mOnDestroyCalled(false)
626 , mWindowType(eWindowType_child)
627 , mZIndex(0)
629 {
630 ClearNativeTouchSequence();
631 }
634 /**
635 * Create and initialize a widget.
636 *
637 * All the arguments can be null in which case a top level window
638 * with size 0 is created. The event callback function has to be
639 * provided only if the caller wants to deal with the events this
640 * widget receives. The event callback is basically a preprocess
641 * hook called synchronously. The return value determines whether
642 * the event goes to the default window procedure or it is hidden
643 * to the os. The assumption is that if the event handler returns
644 * false the widget does not see the event. The widget should not
645 * automatically clear the window to the background color. The
646 * calling code must handle paint messages and clear the background
647 * itself.
648 *
649 * In practice at least one of aParent and aNativeParent will be null. If
650 * both are null the widget isn't parented (e.g. context menus or
651 * independent top level windows).
652 *
653 * The dimensions given in aRect are specified in the parent's
654 * coordinate system, or for parentless widgets such as top-level
655 * windows, in global CSS pixels.
656 *
657 * @param aParent parent nsIWidget
658 * @param aNativeParent native parent widget
659 * @param aRect the widget dimension
660 * @param aContext
661 * @param aInitData data that is used for widget initialization
662 *
663 */
664 NS_IMETHOD Create(nsIWidget *aParent,
665 nsNativeWidget aNativeParent,
666 const nsIntRect &aRect,
667 nsDeviceContext *aContext,
668 nsWidgetInitData *aInitData = nullptr) = 0;
670 /**
671 * Allocate, initialize, and return a widget that is a child of
672 * |this|. The returned widget (if nonnull) has gone through the
673 * equivalent of CreateInstance(widgetCID) + Create(...).
674 *
675 * |CreateChild()| lets widget backends decide whether to parent
676 * the new child widget to this, nonnatively parent it, or both.
677 * This interface exists to support the PuppetWidget backend,
678 * which is entirely non-native. All other params are the same as
679 * for |Create()|.
680 *
681 * |aForceUseIWidgetParent| forces |CreateChild()| to only use the
682 * |nsIWidget*| this, not its native widget (if it exists), when
683 * calling |Create()|. This is a timid hack around poorly
684 * understood code, and shouldn't be used in new code.
685 */
686 virtual already_AddRefed<nsIWidget>
687 CreateChild(const nsIntRect &aRect,
688 nsDeviceContext *aContext,
689 nsWidgetInitData *aInitData = nullptr,
690 bool aForceUseIWidgetParent = false) = 0;
692 /**
693 * Attach to a top level widget.
694 *
695 * In cases where a top level chrome widget is being used as a content
696 * container, attach a secondary listener and update the device
697 * context. The primary widget listener will continue to be called for
698 * notifications relating to the top-level window, whereas other
699 * notifications such as painting and events will instead be called via
700 * the attached listener. SetAttachedWidgetListener should be used to
701 * assign the attached listener.
702 *
703 * aUseAttachedEvents if true, events are sent to the attached listener
704 * instead of the normal listener.
705 * aContext The new device context for the view
706 */
707 NS_IMETHOD AttachViewToTopLevel(bool aUseAttachedEvents,
708 nsDeviceContext *aContext) = 0;
710 /**
711 * Accessor functions to get and set the attached listener. Used by
712 * nsView in connection with AttachViewToTopLevel above.
713 */
714 virtual void SetAttachedWidgetListener(nsIWidgetListener* aListener) = 0;
715 virtual nsIWidgetListener* GetAttachedWidgetListener() = 0;
717 /**
718 * Accessor functions to get and set the listener which handles various
719 * actions for the widget.
720 */
721 //@{
722 virtual nsIWidgetListener* GetWidgetListener() = 0;
723 virtual void SetWidgetListener(nsIWidgetListener* alistener) = 0;
724 //@}
726 /**
727 * Close and destroy the internal native window.
728 * This method does not delete the widget.
729 */
731 NS_IMETHOD Destroy(void) = 0;
733 /**
734 * Destroyed() returns true if Destroy() has been called already.
735 * Otherwise, false.
736 */
737 bool Destroyed() const { return mOnDestroyCalled; }
740 /**
741 * Reparent a widget
742 *
743 * Change the widget's parent. Null parents are allowed.
744 *
745 * @param aNewParent new parent
746 */
747 NS_IMETHOD SetParent(nsIWidget* aNewParent) = 0;
749 NS_IMETHOD RegisterTouchWindow() = 0;
750 NS_IMETHOD UnregisterTouchWindow() = 0;
752 /**
753 * Return the parent Widget of this Widget or nullptr if this is a
754 * top level window
755 *
756 * @return the parent widget or nullptr if it does not have a parent
757 *
758 */
759 virtual nsIWidget* GetParent(void) = 0;
761 /**
762 * Return the top level Widget of this Widget
763 *
764 * @return the top level widget
765 */
766 virtual nsIWidget* GetTopLevelWidget() = 0;
768 /**
769 * Return the top (non-sheet) parent of this Widget if it's a sheet,
770 * or nullptr if this isn't a sheet (or some other error occurred).
771 * Sheets are only supported on some platforms (currently only OS X).
772 *
773 * @return the top (non-sheet) parent widget or nullptr
774 *
775 */
776 virtual nsIWidget* GetSheetWindowParent(void) = 0;
778 /**
779 * Return the physical DPI of the screen containing the window ...
780 * the number of device pixels per inch.
781 */
782 virtual float GetDPI() = 0;
784 /**
785 * Return the default scale factor for the window. This is the
786 * default number of device pixels per CSS pixel to use. This should
787 * depend on OS/platform settings such as the Mac's "UI scale factor"
788 * or Windows' "font DPI". This will take into account Gecko preferences
789 * overriding the system setting.
790 */
791 mozilla::CSSToLayoutDeviceScale GetDefaultScale();
793 /**
794 * Return the Gecko override of the system default scale, if any;
795 * returns <= 0.0 if the system scale should be used as-is.
796 * nsIWidget::GetDefaultScale() [above] takes this into account.
797 * It is exposed here so that code that wants to check for a
798 * default-scale override without having a widget on hand can
799 * easily access the same value.
800 * Note that any scale override is a browser-wide value, whereas
801 * the default GetDefaultScale value (when no override is present)
802 * may vary between widgets (or screens).
803 */
804 static double DefaultScaleOverride();
806 /**
807 * Return the first child of this widget. Will return null if
808 * there are no children.
809 */
810 nsIWidget* GetFirstChild() const {
811 return mFirstChild;
812 }
814 /**
815 * Return the last child of this widget. Will return null if
816 * there are no children.
817 */
818 nsIWidget* GetLastChild() const {
819 return mLastChild;
820 }
822 /**
823 * Return the next sibling of this widget
824 */
825 nsIWidget* GetNextSibling() const {
826 return mNextSibling;
827 }
829 /**
830 * Set the next sibling of this widget
831 */
832 void SetNextSibling(nsIWidget* aSibling) {
833 mNextSibling = aSibling;
834 }
836 /**
837 * Return the previous sibling of this widget
838 */
839 nsIWidget* GetPrevSibling() const {
840 return mPrevSibling;
841 }
843 /**
844 * Set the previous sibling of this widget
845 */
846 void SetPrevSibling(nsIWidget* aSibling) {
847 mPrevSibling = aSibling;
848 }
850 /**
851 * Show or hide this widget
852 *
853 * @param aState true to show the Widget, false to hide it
854 *
855 */
856 NS_IMETHOD Show(bool aState) = 0;
858 /**
859 * Make the window modal
860 *
861 */
862 NS_IMETHOD SetModal(bool aModal) = 0;
864 /**
865 * The maximum number of simultaneous touch contacts supported by the device.
866 * In the case of devices with multiple digitizers (e.g. multiple touch screens),
867 * the value will be the maximum of the set of maximum supported contacts by
868 * each individual digitizer.
869 */
870 virtual uint32_t GetMaxTouchPoints() const = 0;
872 /**
873 * Returns whether the window is visible
874 *
875 */
876 virtual bool IsVisible() const = 0;
878 /**
879 * Perform platform-dependent sanity check on a potential window position.
880 * This is guaranteed to work only for top-level windows.
881 *
882 * @param aAllowSlop: if true, allow the window to slop offscreen;
883 * the window should be partially visible. if false,
884 * force the entire window onscreen (or at least
885 * the upper-left corner, if it's too large).
886 * @param aX in: an x position expressed in screen coordinates.
887 * out: the x position constrained to fit on the screen(s).
888 * @param aY in: an y position expressed in screen coordinates.
889 * out: the y position constrained to fit on the screen(s).
890 * @return vapid success indication. but see also the parameters.
891 *
892 **/
893 NS_IMETHOD ConstrainPosition(bool aAllowSlop,
894 int32_t *aX,
895 int32_t *aY) = 0;
897 /**
898 * NOTE:
899 *
900 * For a top-level window widget, the "parent's coordinate system" is the
901 * "global" display pixel coordinate space, *not* device pixels (which
902 * may be inconsistent between multiple screens, at least in the Mac OS
903 * case with mixed hi-dpi and lo-dpi displays). This applies to all the
904 * following Move and Resize widget APIs.
905 *
906 * The display-/device-pixel distinction becomes important for (at least)
907 * Mac OS X with Hi-DPI (retina) displays, and Windows when the UI scale
908 * factor is set to other than 100%.
909 *
910 * The Move and Resize methods take floating-point parameters, rather than
911 * integer ones. This is important when manipulating top-level widgets,
912 * where the coordinate system may not be an integral multiple of the
913 * device-pixel space.
914 **/
916 /**
917 * Move this widget.
918 *
919 * Coordinates refer to the top-left of the widget. For toplevel windows
920 * with decorations, this is the top-left of the titlebar and frame .
921 *
922 * @param aX the new x position expressed in the parent's coordinate system
923 * @param aY the new y position expressed in the parent's coordinate system
924 *
925 **/
926 NS_IMETHOD Move(double aX, double aY) = 0;
928 /**
929 * Reposition this widget so that the client area has the given offset.
930 *
931 * @param aX the new x offset of the client area expressed as an
932 * offset from the origin of the client area of the parent
933 * widget (for root widgets and popup widgets it is in
934 * screen coordinates)
935 * @param aY the new y offset of the client area expressed as an
936 * offset from the origin of the client area of the parent
937 * widget (for root widgets and popup widgets it is in
938 * screen coordinates)
939 *
940 **/
941 NS_IMETHOD MoveClient(double aX, double aY) = 0;
943 /**
944 * Resize this widget. Any size constraints set for the window by a
945 * previous call to SetSizeConstraints will be applied.
946 *
947 * @param aWidth the new width expressed in the parent's coordinate system
948 * @param aHeight the new height expressed in the parent's coordinate system
949 * @param aRepaint whether the widget should be repainted
950 *
951 */
952 NS_IMETHOD Resize(double aWidth,
953 double aHeight,
954 bool aRepaint) = 0;
956 /**
957 * Move or resize this widget. Any size constraints set for the window by
958 * a previous call to SetSizeConstraints will be applied.
959 *
960 * @param aX the new x position expressed in the parent's coordinate system
961 * @param aY the new y position expressed in the parent's coordinate system
962 * @param aWidth the new width expressed in the parent's coordinate system
963 * @param aHeight the new height expressed in the parent's coordinate system
964 * @param aRepaint whether the widget should be repainted if the size changes
965 *
966 */
967 NS_IMETHOD Resize(double aX,
968 double aY,
969 double aWidth,
970 double aHeight,
971 bool aRepaint) = 0;
973 /**
974 * Resize the widget so that the inner client area has the given size.
975 *
976 * @param aWidth the new width of the client area.
977 * @param aHeight the new height of the client area.
978 * @param aRepaint whether the widget should be repainted
979 *
980 */
981 NS_IMETHOD ResizeClient(double aWidth,
982 double aHeight,
983 bool aRepaint) = 0;
985 /**
986 * Resize and reposition the widget so tht inner client area has the given
987 * offset and size.
988 *
989 * @param aX the new x offset of the client area expressed as an
990 * offset from the origin of the client area of the parent
991 * widget (for root widgets and popup widgets it is in
992 * screen coordinates)
993 * @param aY the new y offset of the client area expressed as an
994 * offset from the origin of the client area of the parent
995 * widget (for root widgets and popup widgets it is in
996 * screen coordinates)
997 * @param aWidth the new width of the client area.
998 * @param aHeight the new height of the client area.
999 * @param aRepaint whether the widget should be repainted
1000 *
1001 */
1002 NS_IMETHOD ResizeClient(double aX,
1003 double aY,
1004 double aWidth,
1005 double aHeight,
1006 bool aRepaint) = 0;
1008 /**
1009 * Sets the widget's z-index.
1010 */
1011 virtual void SetZIndex(int32_t aZIndex) = 0;
1013 /**
1014 * Gets the widget's z-index.
1015 */
1016 int32_t GetZIndex()
1017 {
1018 return mZIndex;
1019 }
1021 /**
1022 * Position this widget just behind the given widget. (Used to
1023 * control z-order for top-level widgets. Get/SetZIndex by contrast
1024 * control z-order for child widgets of other widgets.)
1025 * @param aPlacement top, bottom, or below a widget
1026 * (if top or bottom, param aWidget is ignored)
1027 * @param aWidget widget to place this widget behind
1028 * (only if aPlacement is eZPlacementBelow).
1029 * null is equivalent to aPlacement of eZPlacementTop
1030 * @param aActivate true to activate the widget after placing it
1031 */
1032 NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
1033 nsIWidget *aWidget, bool aActivate) = 0;
1035 /**
1036 * Minimize, maximize or normalize the window size.
1037 * Takes a value from nsSizeMode (see nsIWidgetListener.h)
1038 */
1039 NS_IMETHOD SetSizeMode(int32_t aMode) = 0;
1041 /**
1042 * Return size mode (minimized, maximized, normalized).
1043 * Returns a value from nsSizeMode (see nsIWidgetListener.h)
1044 */
1045 virtual int32_t SizeMode() = 0;
1047 /**
1048 * Enable or disable this Widget
1049 *
1050 * @param aState true to enable the Widget, false to disable it.
1051 *
1052 */
1053 NS_IMETHOD Enable(bool aState) = 0;
1055 /**
1056 * Ask whether the widget is enabled
1057 */
1058 virtual bool IsEnabled() const = 0;
1060 /**
1061 * Request activation of this window or give focus to this widget.
1062 *
1063 * @param aRaise If true, this function requests activation of this
1064 * widget's toplevel window.
1065 * If false, the appropriate toplevel window (which in
1066 * the case of popups may not be this widget's toplevel
1067 * window) is already active.
1068 */
1069 NS_IMETHOD SetFocus(bool aRaise = false) = 0;
1071 /**
1072 * Get this widget's outside dimensions relative to its parent widget. For
1073 * popup widgets the returned rect is in screen coordinates and not
1074 * relative to its parent widget.
1075 *
1076 * @param aRect On return it holds the x, y, width and height of
1077 * this widget.
1078 */
1079 NS_IMETHOD GetBounds(nsIntRect &aRect) = 0;
1081 /**
1082 * Get this widget's outside dimensions in global coordinates. This
1083 * includes any title bar on the window.
1084 *
1085 * @param aRect On return it holds the x, y, width and height of
1086 * this widget.
1087 */
1088 NS_IMETHOD GetScreenBounds(nsIntRect &aRect) = 0;
1090 /**
1091 * Get this widget's client area bounds, if the window has a 3D border
1092 * appearance this returns the area inside the border. The position is the
1093 * position of the client area relative to the client area of the parent
1094 * widget (for root widgets and popup widgets it is in screen coordinates).
1095 *
1096 * @param aRect On return it holds the x. y, width and height of
1097 * the client area of this widget.
1098 */
1099 NS_IMETHOD GetClientBounds(nsIntRect &aRect) = 0;
1101 /**
1102 * Get the non-client area dimensions of the window.
1103 *
1104 */
1105 NS_IMETHOD GetNonClientMargins(nsIntMargin &margins) = 0;
1107 /**
1108 * Sets the non-client area dimensions of the window. Pass -1 to restore
1109 * the system default frame size for that border. Pass zero to remove
1110 * a border, or pass a specific value adjust a border. Units are in
1111 * pixels. (DPI dependent)
1112 *
1113 * Platform notes:
1114 * Windows: shrinking top non-client height will remove application
1115 * icon and window title text. Glass desktops will refuse to set
1116 * dimensions between zero and size < system default.
1117 *
1118 */
1119 NS_IMETHOD SetNonClientMargins(nsIntMargin &margins) = 0;
1121 /**
1122 * Get the client offset from the window origin.
1123 *
1124 * @return the x and y of the offset.
1125 *
1126 */
1127 virtual nsIntPoint GetClientOffset() = 0;
1129 /**
1130 * Set the background color for this widget
1131 *
1132 * @param aColor the new background color
1133 *
1134 */
1136 virtual void SetBackgroundColor(const nscolor &aColor) { }
1138 /**
1139 * Get the cursor for this widget.
1140 *
1141 * @return this widget's cursor.
1142 */
1144 virtual nsCursor GetCursor(void) = 0;
1146 /**
1147 * Set the cursor for this widget
1148 *
1149 * @param aCursor the new cursor for this widget
1150 */
1152 NS_IMETHOD SetCursor(nsCursor aCursor) = 0;
1154 /**
1155 * Sets an image as the cursor for this widget.
1156 *
1157 * @param aCursor the cursor to set
1158 * @param aX the X coordinate of the hotspot (from left).
1159 * @param aY the Y coordinate of the hotspot (from top).
1160 * @retval NS_ERROR_NOT_IMPLEMENTED if setting images as cursors is not
1161 * supported
1162 */
1163 NS_IMETHOD SetCursor(imgIContainer* aCursor,
1164 uint32_t aHotspotX, uint32_t aHotspotY) = 0;
1166 /**
1167 * Get the window type of this widget.
1168 */
1169 nsWindowType WindowType() { return mWindowType; }
1171 /**
1172 * Set the transparency mode of the top-level window containing this widget.
1173 * So, e.g., if you call this on the widget for an IFRAME, the top level
1174 * browser window containing the IFRAME actually gets set. Be careful.
1175 *
1176 * This can fail if the platform doesn't support
1177 * transparency/glass. By default widgets are not
1178 * transparent. This will also fail if the toplevel window is not
1179 * a Mozilla window, e.g., if the widget is in an embedded
1180 * context.
1181 *
1182 * After transparency/glass has been enabled, the initial alpha channel
1183 * value for all pixels is 1, i.e., opaque.
1184 * If the window is resized then the alpha channel values for
1185 * all pixels are reset to 1.
1186 * Pixel RGB color values are already premultiplied with alpha channel values.
1187 */
1188 virtual void SetTransparencyMode(nsTransparencyMode aMode) = 0;
1190 /**
1191 * Get the transparency mode of the top-level window that contains this
1192 * widget.
1193 */
1194 virtual nsTransparencyMode GetTransparencyMode() = 0;
1196 /**
1197 * This represents a command to set the bounds and clip region of
1198 * a child widget.
1199 */
1200 struct Configuration {
1201 nsIWidget* mChild;
1202 nsIntRect mBounds;
1203 nsTArray<nsIntRect> mClipRegion;
1204 };
1206 /**
1207 * Sets the clip region of each mChild (which must actually be a child
1208 * of this widget) to the union of the pixel rects given in
1209 * mClipRegion, all relative to the top-left of the child
1210 * widget. Clip regions are not implemented on all platforms and only
1211 * need to actually work for children that are plugins.
1212 *
1213 * Also sets the bounds of each child to mBounds.
1214 *
1215 * This will invalidate areas of the children that have changed, but
1216 * does not need to invalidate any part of this widget.
1217 *
1218 * Children should be moved in the order given; the array is
1219 * sorted so to minimize unnecessary invalidation if children are
1220 * moved in that order.
1221 */
1222 virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) = 0;
1224 /**
1225 * Appends to aRects the rectangles constituting this widget's clip
1226 * region. If this widget is not clipped, appends a single rectangle
1227 * (0, 0, bounds.width, bounds.height).
1228 */
1229 virtual void GetWindowClipRegion(nsTArray<nsIntRect>* aRects) = 0;
1231 /**
1232 * Set the shadow style of the window.
1233 *
1234 * Ignored on child widgets and on non-Mac platforms.
1235 */
1236 NS_IMETHOD SetWindowShadowStyle(int32_t aStyle) = 0;
1238 /*
1239 * On Mac OS X, this method shows or hides the pill button in the titlebar
1240 * that's used to collapse the toolbar.
1241 *
1242 * Ignored on child widgets and on non-Mac platforms.
1243 */
1244 virtual void SetShowsToolbarButton(bool aShow) = 0;
1246 /*
1247 * On Mac OS X Lion, this method shows or hides the full screen button in
1248 * the titlebar that handles native full screen mode.
1249 *
1250 * Ignored on child widgets, non-Mac platforms, & pre-Lion Mac.
1251 */
1252 virtual void SetShowsFullScreenButton(bool aShow) = 0;
1254 enum WindowAnimationType {
1255 eGenericWindowAnimation,
1256 eDocumentWindowAnimation
1257 };
1259 /**
1260 * Sets the kind of top-level window animation this widget should have. On
1261 * Mac OS X, this causes a particular kind of animation to be shown when the
1262 * window is first made visible.
1263 *
1264 * Ignored on child widgets and on non-Mac platforms.
1265 */
1266 virtual void SetWindowAnimationType(WindowAnimationType aType) = 0;
1268 /**
1269 * Specifies whether the window title should be drawn even if the window
1270 * contents extend into the titlebar. Ignored on windows that don't draw
1271 * in the titlebar. Only implemented on OS X.
1272 */
1273 virtual void SetDrawsTitle(bool aDrawTitle) {}
1275 /**
1276 * Hide window chrome (borders, buttons) for this widget.
1277 *
1278 */
1279 NS_IMETHOD HideWindowChrome(bool aShouldHide) = 0;
1281 /**
1282 * Put the toplevel window into or out of fullscreen mode.
1283 *
1284 */
1285 NS_IMETHOD MakeFullScreen(bool aFullScreen) = 0;
1287 /**
1288 * Invalidate a specified rect for a widget so that it will be repainted
1289 * later.
1290 */
1291 NS_IMETHOD Invalidate(const nsIntRect & aRect) = 0;
1293 enum LayerManagerPersistence
1294 {
1295 LAYER_MANAGER_CURRENT = 0,
1296 LAYER_MANAGER_PERSISTENT
1297 };
1299 /**
1300 * Return the widget's LayerManager. The layer tree for that
1301 * LayerManager is what gets rendered to the widget.
1302 *
1303 * @param aAllowRetaining an outparam that states whether the returned
1304 * layer manager should be used for retained layers
1305 */
1306 inline LayerManager* GetLayerManager(bool* aAllowRetaining = nullptr)
1307 {
1308 return GetLayerManager(nullptr, mozilla::layers::LayersBackend::LAYERS_NONE,
1309 LAYER_MANAGER_CURRENT, aAllowRetaining);
1310 }
1312 inline LayerManager* GetLayerManager(LayerManagerPersistence aPersistence,
1313 bool* aAllowRetaining = nullptr)
1314 {
1315 return GetLayerManager(nullptr, mozilla::layers::LayersBackend::LAYERS_NONE,
1316 aPersistence, aAllowRetaining);
1317 }
1319 /**
1320 * Like GetLayerManager(), but prefers creating a layer manager of
1321 * type |aBackendHint| instead of what would normally be created.
1322 * LayersBackend::LAYERS_NONE means "no hint".
1323 */
1324 virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager,
1325 LayersBackend aBackendHint,
1326 LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
1327 bool* aAllowRetaining = nullptr) = 0;
1329 /**
1330 * Called before each layer manager transaction to allow any preparation
1331 * for DrawWindowUnderlay/Overlay that needs to be on the main thread.
1332 *
1333 * Always called on the main thread.
1334 */
1335 virtual void PrepareWindowEffects() = 0;
1337 /**
1338 * Called when shutting down the LayerManager to clean-up any cached resources.
1339 *
1340 * Always called from the compositing thread, which may be the main-thread if
1341 * OMTC is not enabled.
1342 */
1343 virtual void CleanupWindowEffects() = 0;
1345 /**
1346 * Called before rendering using OMTC. Returns false when the widget is
1347 * not ready to be rendered (for example while the window is closed).
1348 *
1349 * Always called from the compositing thread, which may be the main-thread if
1350 * OMTC is not enabled.
1351 */
1352 virtual bool PreRender(LayerManagerComposite* aManager) = 0;
1354 /**
1355 * Called after rendering using OMTC. Not called when rendering was
1356 * cancelled by a negative return value from PreRender.
1357 *
1358 * Always called from the compositing thread, which may be the main-thread if
1359 * OMTC is not enabled.
1360 */
1361 virtual void PostRender(LayerManagerComposite* aManager) = 0;
1363 /**
1364 * Called before the LayerManager draws the layer tree.
1365 *
1366 * Always called from the compositing thread.
1367 */
1368 virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) = 0;
1370 /**
1371 * Called after the LayerManager draws the layer tree
1372 *
1373 * Always called from the compositing thread.
1374 */
1375 virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) = 0;
1377 /**
1378 * Return a DrawTarget for the window which can be composited into.
1379 *
1380 * Called by BasicCompositor on the compositor thread for OMTC drawing
1381 * before each composition.
1382 */
1383 virtual mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing() = 0;
1385 /**
1386 * Ensure that what was painted into the DrawTarget returned from
1387 * StartRemoteDrawing reaches the screen.
1388 *
1389 * Called by BasicCompositor on the compositor thread for OMTC drawing
1390 * after each composition.
1391 */
1392 virtual void EndRemoteDrawing() = 0;
1394 /**
1395 * Clean up any resources used by Start/EndRemoteDrawing.
1396 *
1397 * Called by BasicCompositor on the compositor thread for OMTC drawing
1398 * when the compositor is destroyed.
1399 */
1400 virtual void CleanupRemoteDrawing() = 0;
1402 /**
1403 * Called when Gecko knows which themed widgets exist in this window.
1404 * The passed array contains an entry for every themed widget of the right
1405 * type (currently only NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR and
1406 * NS_THEME_TOOLBAR) within the window, except for themed widgets which are
1407 * transformed or have effects applied to them (e.g. CSS opacity or
1408 * filters).
1409 * This could sometimes be called during display list construction
1410 * outside of painting.
1411 * If called during painting, it will be called before we actually
1412 * paint anything.
1413 */
1414 virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) = 0;
1416 /**
1417 * Informs the widget about the region of the window that is opaque.
1418 *
1419 * @param aOpaqueRegion the region of the window that is opaque.
1420 */
1421 virtual void UpdateOpaqueRegion(const nsIntRegion &aOpaqueRegion) {}
1423 /**
1424 * Internal methods
1425 */
1427 //@{
1428 virtual void AddChild(nsIWidget* aChild) = 0;
1429 virtual void RemoveChild(nsIWidget* aChild) = 0;
1430 virtual void* GetNativeData(uint32_t aDataType) = 0;
1431 virtual void FreeNativeData(void * data, uint32_t aDataType) = 0;//~~~
1433 // GetDeviceContext returns a weak pointer to this widget's device context
1434 virtual nsDeviceContext* GetDeviceContext() = 0;
1436 //@}
1438 /**
1439 * Set the widget's title.
1440 * Must be called after Create.
1441 *
1442 * @param aTitle string displayed as the title of the widget
1443 */
1445 NS_IMETHOD SetTitle(const nsAString& aTitle) = 0;
1447 /**
1448 * Set the widget's icon.
1449 * Must be called after Create.
1450 *
1451 * @param anIconSpec string specifying the icon to use; convention is to pass
1452 * a resource: URL from which a platform-dependent resource
1453 * file name will be constructed
1454 */
1456 NS_IMETHOD SetIcon(const nsAString& anIconSpec) = 0;
1458 /**
1459 * Return this widget's origin in screen coordinates.
1460 *
1461 * @return screen coordinates stored in the x,y members
1462 */
1464 virtual nsIntPoint WidgetToScreenOffset() = 0;
1466 /**
1467 * Given the specified client size, return the corresponding window size,
1468 * which includes the area for the borders and titlebar. This method
1469 * should work even when the window is not yet visible.
1470 */
1471 virtual nsIntSize ClientToWindowSize(const nsIntSize& aClientSize) = 0;
1473 /**
1474 * Dispatches an event to the widget
1475 *
1476 */
1477 NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* event,
1478 nsEventStatus & aStatus) = 0;
1480 /**
1481 * Enables the dropping of files to a widget (XXX this is temporary)
1482 *
1483 */
1484 NS_IMETHOD EnableDragDrop(bool aEnable) = 0;
1486 /**
1487 * Enables/Disables system mouse capture.
1488 * @param aCapture true enables mouse capture, false disables mouse capture
1489 *
1490 */
1491 NS_IMETHOD CaptureMouse(bool aCapture) = 0;
1493 /**
1494 * Classify the window for the window manager. Mostly for X11.
1495 */
1496 NS_IMETHOD SetWindowClass(const nsAString& xulWinType) = 0;
1498 /**
1499 * Enables/Disables system capture of any and all events that would cause a
1500 * popup to be rolled up. aListener should be set to a non-null value for
1501 * any popups that are not managed by the popup manager.
1502 * @param aDoCapture true enables capture, false disables capture
1503 *
1504 */
1505 NS_IMETHOD CaptureRollupEvents(nsIRollupListener* aListener, bool aDoCapture) = 0;
1507 /**
1508 * Bring this window to the user's attention. This is intended to be a more
1509 * gentle notification than popping the window to the top or putting up an
1510 * alert. See, for example, Win32 FlashWindow or the NotificationManager on
1511 * the Mac. The notification should be suppressed if the window is already
1512 * in the foreground and should be dismissed when the user brings this window
1513 * to the foreground.
1514 * @param aCycleCount Maximum number of times to animate the window per system
1515 * conventions. If set to -1, cycles indefinitely until
1516 * window is brought into the foreground.
1517 */
1518 NS_IMETHOD GetAttention(int32_t aCycleCount) = 0;
1520 /**
1521 * Ask whether there user input events pending. All input events are
1522 * included, including those not targeted at this nsIwidget instance.
1523 */
1524 virtual bool HasPendingInputEvent() = 0;
1526 /**
1527 * Set the background color of the window titlebar for this widget. On Mac,
1528 * for example, this will remove the grey gradient and bottom border and
1529 * instead show a single, solid color.
1530 *
1531 * Ignored on any platform that does not support it. Ignored by widgets that
1532 * do not represent windows.
1533 *
1534 * @param aColor The color to set the title bar background to. Alpha values
1535 * other than fully transparent (0) are respected if possible
1536 * on the platform. An alpha of 0 will cause the window to
1537 * draw with the default style for the platform.
1538 *
1539 * @param aActive Whether the color should be applied to active or inactive
1540 * windows.
1541 */
1542 NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, bool aActive) = 0;
1544 /**
1545 * If set to true, the window will draw its contents into the titlebar
1546 * instead of below it.
1547 *
1548 * Ignored on any platform that does not support it. Ignored by widgets that
1549 * do not represent windows.
1550 * May result in a resize event, so should only be called from places where
1551 * reflow and painting is allowed.
1552 *
1553 * @param aState Whether drawing into the titlebar should be activated.
1554 */
1555 virtual void SetDrawsInTitlebar(bool aState) = 0;
1557 /*
1558 * Determine whether the widget shows a resize widget. If it does,
1559 * aResizerRect returns the resizer's rect.
1560 *
1561 * Returns false on any platform that does not support it.
1562 *
1563 * @param aResizerRect The resizer's rect in device pixels.
1564 * @return Whether a resize widget is shown.
1565 */
1566 virtual bool ShowsResizeIndicator(nsIntRect* aResizerRect) = 0;
1568 /**
1569 * Get the Thebes surface associated with this widget.
1570 */
1571 virtual gfxASurface *GetThebesSurface() = 0;
1573 /**
1574 * Return the popup that was last rolled up, or null if there isn't one.
1575 */
1576 virtual nsIContent* GetLastRollup() = 0;
1578 /**
1579 * Begin a window resizing drag, based on the event passed in.
1580 */
1581 NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
1582 int32_t aHorizontal,
1583 int32_t aVertical) = 0;
1585 /**
1586 * Begin a window moving drag, based on the event passed in.
1587 */
1588 NS_IMETHOD BeginMoveDrag(mozilla::WidgetMouseEvent* aEvent) = 0;
1590 enum Modifiers {
1591 CAPS_LOCK = 0x01, // when CapsLock is active
1592 NUM_LOCK = 0x02, // when NumLock is active
1593 SHIFT_L = 0x0100,
1594 SHIFT_R = 0x0200,
1595 CTRL_L = 0x0400,
1596 CTRL_R = 0x0800,
1597 ALT_L = 0x1000, // includes Option
1598 ALT_R = 0x2000,
1599 COMMAND_L = 0x4000,
1600 COMMAND_R = 0x8000,
1601 HELP = 0x10000,
1602 FUNCTION = 0x100000,
1603 NUMERIC_KEY_PAD = 0x01000000 // when the key is coming from the keypad
1604 };
1605 /**
1606 * Utility method intended for testing. Dispatches native key events
1607 * to this widget to simulate the press and release of a key.
1608 * @param aNativeKeyboardLayout a *platform-specific* constant.
1609 * On Mac, this is the resource ID for a 'uchr' or 'kchr' resource.
1610 * On Windows, it is converted to a hex string and passed to
1611 * LoadKeyboardLayout, see
1612 * http://msdn.microsoft.com/en-us/library/ms646305(VS.85).aspx
1613 * @param aNativeKeyCode a *platform-specific* keycode.
1614 * On Windows, this is the virtual key code.
1615 * @param aModifiers some combination of the above 'Modifiers' flags;
1616 * not all flags will apply to all platforms. Mac ignores the _R
1617 * modifiers. Windows ignores COMMAND, NUMERIC_KEY_PAD, HELP and
1618 * FUNCTION.
1619 * @param aCharacters characters that the OS would decide to generate
1620 * from the event. On Windows, this is the charCode passed by
1621 * WM_CHAR.
1622 * @param aUnmodifiedCharacters characters that the OS would decide
1623 * to generate from the event if modifier keys (other than shift)
1624 * were assumed inactive. Needed on Mac, ignored on Windows.
1625 * @return NS_ERROR_NOT_AVAILABLE to indicate that the keyboard
1626 * layout is not supported and the event was not fired
1627 */
1628 virtual nsresult SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
1629 int32_t aNativeKeyCode,
1630 uint32_t aModifierFlags,
1631 const nsAString& aCharacters,
1632 const nsAString& aUnmodifiedCharacters) = 0;
1634 /**
1635 * Utility method intended for testing. Dispatches native mouse events
1636 * may even move the mouse cursor. On Mac the events are guaranteed to
1637 * be sent to the window containing this widget, but on Windows they'll go
1638 * to whatever's topmost on the screen at that position, so for
1639 * cross-platform testing ensure that your window is at the top of the
1640 * z-order.
1641 * @param aPoint screen location of the mouse, in device
1642 * pixels, with origin at the top left
1643 * @param aNativeMessage *platform-specific* event type (e.g. on Mac,
1644 * NSMouseMoved; on Windows, MOUSEEVENTF_MOVE, MOUSEEVENTF_LEFTDOWN etc)
1645 * @param aModifierFlags *platform-specific* modifier flags (ignored
1646 * on Windows)
1647 */
1648 virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
1649 uint32_t aNativeMessage,
1650 uint32_t aModifierFlags) = 0;
1652 /**
1653 * A shortcut to SynthesizeNativeMouseEvent, abstracting away the native message.
1654 * aPoint is location in device pixels to which the mouse pointer moves to.
1655 */
1656 virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint) = 0;
1658 /**
1659 * Utility method intended for testing. Dispatching native mouse scroll
1660 * events may move the mouse cursor.
1661 *
1662 * @param aPoint Mouse cursor position in screen coordinates.
1663 * In device pixels, the origin at the top left of
1664 * the primary display.
1665 * @param aNativeMessage Platform native message.
1666 * @param aDeltaX The delta value for X direction. If the native
1667 * message doesn't indicate X direction scrolling,
1668 * this may be ignored.
1669 * @param aDeltaY The delta value for Y direction. If the native
1670 * message doesn't indicate Y direction scrolling,
1671 * this may be ignored.
1672 * @param aDeltaZ The delta value for Z direction. If the native
1673 * message doesn't indicate Z direction scrolling,
1674 * this may be ignored.
1675 * @param aModifierFlags Must be values of Modifiers, or zero.
1676 * @param aAdditionalFlags See nsIDOMWidnowUtils' consts and their
1677 * document.
1678 */
1679 virtual nsresult SynthesizeNativeMouseScrollEvent(nsIntPoint aPoint,
1680 uint32_t aNativeMessage,
1681 double aDeltaX,
1682 double aDeltaY,
1683 double aDeltaZ,
1684 uint32_t aModifierFlags,
1685 uint32_t aAdditionalFlags) = 0;
1687 /*
1688 * TouchPointerState states for SynthesizeNativeTouchPoint. Match
1689 * touch states in nsIDOMWindowUtils.idl.
1690 */
1691 enum TouchPointerState {
1692 // The pointer is in a hover state above the digitizer
1693 TOUCH_HOVER = 0x01,
1694 // The pointer is in contact with the digitizer
1695 TOUCH_CONTACT = 0x02,
1696 // The pointer has been removed from the digitizer detection area
1697 TOUCH_REMOVE = 0x04,
1698 // The pointer has been canceled. Will cancel any pending os level
1699 // gestures that would triggered as a result of completion of the
1700 // input sequence. This may not cancel moz platform related events
1701 // that might get tirggered by input already delivered.
1702 TOUCH_CANCEL = 0x08
1703 };
1705 /*
1706 * Create a new or update an existing touch pointer on the digitizer.
1707 * To trigger os level gestures, individual touch points should
1708 * transition through a complete set of touch states which should be
1709 * sent as individual messages.
1710 *
1711 * @param aPointerId The touch point id to create or update.
1712 * @param aPointerState one or more of the touch states listed above
1713 * @param aScreenX, aScreenY screen coords of this event
1714 * @param aPressure 0.0 -> 1.0 float val indicating pressure
1715 * @param aOrientation 0 -> 359 degree value indicating the
1716 * orientation of the pointer. Use 90 for normal taps.
1717 */
1718 virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
1719 TouchPointerState aPointerState,
1720 nsIntPoint aPointerScreenPoint,
1721 double aPointerPressure,
1722 uint32_t aPointerOrientation) = 0;
1724 /*
1725 * Cancels all active simulated touch input points and pending long taps.
1726 * Native widgets should track existing points such that they can clear the
1727 * digitizer state when this call is made.
1728 */
1729 virtual nsresult ClearNativeTouchSequence();
1731 /*
1732 * Helper for simulating a simple tap event with one touch point. When
1733 * aLongTap is true, simulates a native long tap with a duration equal to
1734 * ui.click_hold_context_menus.delay. This pref is compatible with the
1735 * apzc long tap duration. Defaults to 1.5 seconds.
1736 */
1737 nsresult SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint,
1738 bool aLongTap);
1740 private:
1741 class LongTapInfo
1742 {
1743 public:
1744 LongTapInfo(int32_t aPointerId, nsIntPoint& aPoint,
1745 mozilla::TimeDuration aDuration) :
1746 mPointerId(aPointerId),
1747 mPosition(aPoint),
1748 mDuration(aDuration),
1749 mStamp(mozilla::TimeStamp::Now())
1750 {
1751 }
1753 int32_t mPointerId;
1754 nsIntPoint mPosition;
1755 mozilla::TimeDuration mDuration;
1756 mozilla::TimeStamp mStamp;
1757 };
1759 static void OnLongTapTimerCallback(nsITimer* aTimer, void* aClosure);
1761 nsAutoPtr<LongTapInfo> mLongTapTouchPoint;
1762 nsCOMPtr<nsITimer> mLongTapTimer;
1763 static int32_t sPointerIdCounter;
1765 public:
1766 /**
1767 * Activates a native menu item at the position specified by the index
1768 * string. The index string is a string of positive integers separated
1769 * by the "|" (pipe) character. The last integer in the string represents
1770 * the item index in a submenu located using the integers preceding it.
1771 *
1772 * Example: 1|0|4
1773 * In this string, the first integer represents the top-level submenu
1774 * in the native menu bar. Since the integer is 1, it is the second submeu
1775 * in the native menu bar. Within that, the first item (index 0) is a
1776 * submenu, and we want to activate the 5th item within that submenu.
1777 */
1778 virtual nsresult ActivateNativeMenuItemAt(const nsAString& indexString) = 0;
1780 /**
1781 * This is used for native menu system testing.
1782 *
1783 * Updates a native menu at the position specified by the index string.
1784 * The index string is a string of positive integers separated by the "|"
1785 * (pipe) character.
1786 *
1787 * Example: 1|0|4
1788 * In this string, the first integer represents the top-level submenu
1789 * in the native menu bar. Since the integer is 1, it is the second submeu
1790 * in the native menu bar. Within that, the first item (index 0) is a
1791 * submenu, and we want to update submenu at index 4 within that submenu.
1792 *
1793 * If this is called with an empty string it forces a full reload of the
1794 * menu system.
1795 */
1796 virtual nsresult ForceUpdateNativeMenuAt(const nsAString& indexString) = 0;
1798 /**
1799 * Notify IME of the specified notification.
1800 */
1801 NS_IMETHOD NotifyIME(const IMENotification& aIMENotification) = 0;
1803 /*
1804 * Notifies the input context changes.
1805 */
1806 NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
1807 const InputContextAction& aAction) = 0;
1809 /*
1810 * Get current input context.
1811 */
1812 NS_IMETHOD_(InputContext) GetInputContext() = 0;
1814 /*
1815 * Given a WidgetKeyboardEvent, this method synthesizes a corresponding
1816 * native (OS-level) event for it. This method allows tests to simulate
1817 * keystrokes that trigger native key bindings (which require a native
1818 * event).
1819 */
1820 NS_IMETHOD AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent) = 0;
1822 /*
1823 * Execute native key bindings for aType.
1824 */
1825 typedef void (*DoCommandCallback)(mozilla::Command, void*);
1826 enum NativeKeyBindingsType
1827 {
1828 NativeKeyBindingsForSingleLineEditor,
1829 NativeKeyBindingsForMultiLineEditor,
1830 NativeKeyBindingsForRichTextEditor
1831 };
1832 NS_IMETHOD_(bool) ExecuteNativeKeyBinding(
1833 NativeKeyBindingsType aType,
1834 const mozilla::WidgetKeyboardEvent& aEvent,
1835 DoCommandCallback aCallback,
1836 void* aCallbackData) = 0;
1838 /**
1839 * Set layers acceleration to 'True' or 'False'
1840 */
1841 NS_IMETHOD SetLayersAcceleration(bool aEnabled) = 0;
1843 /*
1844 * Get toggled key states.
1845 * aKeyCode should be NS_VK_CAPS_LOCK or NS_VK_NUM_LOCK or
1846 * NS_VK_SCROLL_LOCK.
1847 * aLEDState is the result for current LED state of the key.
1848 * If the LED is 'ON', it returns TRUE, otherwise, FALSE.
1849 * If the platform doesn't support the LED state (or we cannot get the
1850 * state), this method returns NS_ERROR_NOT_IMPLEMENTED.
1851 */
1852 NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState) = 0;
1854 /*
1855 * Retrieves preference for IME updates
1856 */
1857 virtual nsIMEUpdatePreference GetIMEUpdatePreference() = 0;
1859 /*
1860 * Call this method when a dialog is opened which has a default button.
1861 * The button's rectangle should be supplied in aButtonRect.
1862 */
1863 NS_IMETHOD OnDefaultButtonLoaded(const nsIntRect &aButtonRect) = 0;
1865 /**
1866 * Compute the overridden system mouse scroll speed on the root content of
1867 * web pages. The widget may set the same value as aOriginalDelta. E.g.,
1868 * when the system scrolling settings were customized, widget can respect
1869 * the will of the user.
1870 *
1871 * This is called only when the mouse wheel event scrolls the root content
1872 * of the web pages by line. In other words, this isn't called when the
1873 * mouse wheel event is used for zoom, page scroll and other special
1874 * actions. And also this isn't called when the user doesn't use the
1875 * system wheel speed settings.
1876 *
1877 * @param aOriginalDeltaX The X delta value of the current mouse wheel
1878 * scrolling event.
1879 * @param aOriginalDeltaX The Y delta value of the current mouse wheel
1880 * scrolling event.
1881 * @param aOverriddenDeltaX The overridden mouse scrolling speed along X
1882 * axis. This value may be same as aOriginalDeltaX.
1883 * @param aOverriddenDeltaY The overridden mouse scrolling speed along Y
1884 * axis. This value may be same as aOriginalDeltaY.
1885 */
1886 NS_IMETHOD OverrideSystemMouseScrollSpeed(double aOriginalDeltaX,
1887 double aOriginalDeltaY,
1888 double& aOverriddenDeltaX,
1889 double& aOverriddenDeltaY) = 0;
1891 /**
1892 * Return true if this process shouldn't use platform widgets, and
1893 * so should use PuppetWidgets instead. If this returns true, the
1894 * result of creating and using a platform widget is undefined,
1895 * and likely to end in crashes or other buggy behavior.
1896 */
1897 static bool
1898 UsePuppetWidgets()
1899 {
1900 return XRE_GetProcessType() == GeckoProcessType_Content;
1901 }
1903 /**
1904 * Allocate and return a "puppet widget" that doesn't directly
1905 * correlate to a platform widget; platform events and data must
1906 * be fed to it. Currently used in content processes. NULL is
1907 * returned if puppet widgets aren't supported in this build
1908 * config, on this platform, or for this process type.
1909 *
1910 * This function is called "Create" to match CreateInstance().
1911 * The returned widget must still be nsIWidget::Create()d.
1912 */
1913 static already_AddRefed<nsIWidget>
1914 CreatePuppetWidget(TabChild* aTabChild);
1916 /**
1917 * Reparent this widget's native widget.
1918 * @param aNewParent the native widget of aNewParent is the new native
1919 * parent widget
1920 */
1921 NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) = 0;
1923 /**
1924 * Return the internal format of the default framebuffer for this
1925 * widget.
1926 */
1927 virtual uint32_t GetGLFrameBufferFormat() { return 0; /*GL_NONE*/ }
1929 /**
1930 * Return true if widget has it's own GL context
1931 */
1932 virtual bool HasGLContext() { return false; }
1934 /**
1935 * Returns true to indicate that this widget paints an opaque background
1936 * that we want to be visible under the page, so layout should not force
1937 * a default background.
1938 */
1939 virtual bool WidgetPaintsBackground() { return false; }
1941 virtual bool NeedsPaint() {
1942 if (!IsVisible()) {
1943 return false;
1944 }
1945 nsIntRect bounds;
1946 nsresult rv = GetBounds(bounds);
1947 NS_ENSURE_SUCCESS(rv, false);
1948 return !bounds.IsEmpty();
1949 }
1951 /**
1952 * Get the natural bounds of this widget. This method is only
1953 * meaningful for widgets for which Gecko implements screen
1954 * rotation natively. When this is the case, GetBounds() returns
1955 * the widget bounds taking rotation into account, and
1956 * GetNaturalBounds() returns the bounds *not* taking rotation
1957 * into account.
1958 *
1959 * No code outside of the composition pipeline should know or care
1960 * about this. If you're not an agent of the compositor, you
1961 * probably shouldn't call this method.
1962 */
1963 virtual nsIntRect GetNaturalBounds() {
1964 nsIntRect bounds;
1965 GetBounds(bounds);
1966 return bounds;
1967 }
1969 /**
1970 * Set size constraints on the window size such that it is never less than
1971 * the specified minimum size and never larger than the specified maximum
1972 * size. The size constraints are sizes of the outer rectangle including
1973 * the window frame and title bar. Use 0 for an unconstrained minimum size
1974 * and NS_MAXSIZE for an unconstrained maximum size. Note that this method
1975 * does not necessarily change the size of a window to conform to this size,
1976 * thus Resize should be called afterwards.
1977 *
1978 * @param aConstraints: the size constraints in device pixels
1979 */
1980 virtual void SetSizeConstraints(const SizeConstraints& aConstraints) = 0;
1982 /**
1983 * Return the size constraints currently observed by the widget.
1984 *
1985 * @return the constraints in device pixels
1986 */
1987 virtual const SizeConstraints& GetSizeConstraints() const = 0;
1989 /**
1990 * If this is owned by a TabChild, return that. Otherwise return
1991 * null.
1992 */
1993 virtual TabChild* GetOwningTabChild() { return nullptr; }
1995 /**
1996 * If this isn't directly compositing to its window surface,
1997 * return the compositor which is doing that on our behalf.
1998 */
1999 virtual CompositorChild* GetRemoteRenderer()
2000 { return nullptr; }
2002 /**
2003 * If this widget has a more efficient composer available for its
2004 * native framebuffer, return it.
2005 *
2006 * This can be called from a non-main thread, but that thread must
2007 * hold a strong reference to this.
2008 */
2009 virtual Composer2D* GetComposer2D()
2010 { return nullptr; }
2012 /**
2013 * Some platforms (only cocoa right now) round widget coordinates to the
2014 * nearest even pixels (see bug 892994), this function allows us to
2015 * determine how widget coordinates will be rounded.
2016 */
2017 virtual int32_t RoundsWidgetCoordinatesTo() { return 1; }
2019 protected:
2020 /**
2021 * Like GetDefaultScale, but taking into account only the system settings
2022 * and ignoring Gecko preferences.
2023 */
2024 virtual double GetDefaultScaleInternal() { return 1.0; }
2026 // keep the list of children. We also keep track of our siblings.
2027 // The ownership model is as follows: parent holds a strong ref to
2028 // the first element of the list, and each element holds a strong
2029 // ref to the next element in the list. The prevsibling and
2030 // lastchild pointers are weak, which is fine as long as they are
2031 // maintained properly.
2032 nsCOMPtr<nsIWidget> mFirstChild;
2033 nsIWidget* mLastChild;
2034 nsCOMPtr<nsIWidget> mNextSibling;
2035 nsIWidget* mPrevSibling;
2036 // When Destroy() is called, the sub class should set this true.
2037 bool mOnDestroyCalled;
2038 nsWindowType mWindowType;
2039 int32_t mZIndex;
2040 };
2042 NS_DEFINE_STATIC_IID_ACCESSOR(nsIWidget, NS_IWIDGET_IID)
2044 #endif // nsIWidget_h__