1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include
"nsISupports.idl"
8 #include
"nsrootidl.idl"
9 /*#include "nsIWidget.idl" Boy this would be nice.*/
11 [ptr] native nsIWidget
(nsIWidget
);
16 typedef voidPtr nativeWindow
;
19 * The nsIBaseWindow describes a generic window and basic operations that
20 * can be performed on it. This is not to be a complete windowing interface
21 * but rather a common set that nearly all windowed objects support.
24 [scriptable
, uuid(ca635529
-a977
-4552-9b8a
-66187e54d882
)]
25 interface nsIBaseWindow
: nsISupports
28 Allows a client to initialize an object implementing this interface with
29 the usually required window setup information.
30 It is possible to pass null for both parentNativeWindow and parentWidget,
31 but only docshells support this.
33 @param parentNativeWindow - This allows a system to pass in the parenting
34 window as a native reference rather than relying on the calling
35 application to have created the parent window as an nsIWidget. This
36 value will be ignored (should be nullptr) if an nsIWidget is passed in to
37 the parentWidget parameter.
39 @param parentWidget - This allows a system to pass in the parenting widget.
40 This allows some objects to optimize themselves and rely on the view
41 system for event flow rather than creating numerous native windows. If
42 one of these is not available, nullptr should be passed.
44 @param x - This is the x co-ordinate relative to the parent to place the
47 @param y - This is the y co-ordinate relative to the parent to place the
50 @param cx - This is the width for the window to be.
52 @param cy - This is the height for the window to be.
54 @return NS_OK - Window Init succeeded without a problem.
55 NS_ERROR_UNEXPECTED - Call was unexpected at this time. Perhaps
56 initWindow() had already been called.
57 NS_ERROR_INVALID_ARG - controls that require either a parentNativeWindow
58 or a parentWidget may return invalid arg when they do not
59 receive what they are needing.
61 [noscript
]void initWindow
(in nativeWindow parentNativeWindow
,
62 in nsIWidget parentWidget
, in long x
, in long y
, in long cx
, in long cy
);
65 Tell the window that it should destroy itself. This call should not be
66 necessary as it will happen implictly when final release occurs on the
67 object. If for some reaons you want the window destroyed prior to release
68 due to cycle or ordering issues, then this call provides that ability.
70 @return NS_OK - Everything destroyed properly.
71 NS_ERROR_UNEXPECTED - This call was unexpected at this time.
72 Perhaps create() has not been called yet.
77 Sets the current x and y coordinates of the control. This is relative to
80 void setPosition
(in long x
, in long y
);
83 Ditto, with arguments in global desktop pixels rather than (potentially
84 ambiguous) device pixels
86 void setPositionDesktopPix
(in long x
, in long y
);
89 Gets the current x and y coordinates of the control. This is relatie to the
92 void getPosition
(out long x
, out long y
);
95 Sets the width and height of the control.
97 void setSize
(in long cx
, in long cy
, in boolean fRepaint
);
100 Gets the width and height of the control.
102 void getSize
(out long cx
, out long cy
);
105 * The 'flags' argument to setPositionAndSize is a set of these bits.
107 const unsigned long eRepaint
= 1;
108 const unsigned long eDelayResize
= 2;
111 Convenience function combining the SetPosition and SetSize into one call.
112 Also is more efficient than calling both.
114 void setPositionAndSize
(in long x
, in long y
, in long cx
, in long cy
,
115 in unsigned long flags
);
118 Convenience function combining the GetPosition and GetSize into one call.
119 Also is more efficient than calling both.
121 void getPositionAndSize
(out long x
, out long y
, out long cx
, out long cy
);
124 * Tell the window to repaint itself
125 * @param aForce - if true, repaint immediately
126 * if false, the window may defer repainting as it sees fit.
128 void repaint
(in boolean force
);
131 This is the parenting widget for the control. This may be null if the
132 native window was handed in for the parent during initialization.
133 If this is returned, it should refer to the same object as
136 Setting this after Create() has been called may not be supported by some
139 On controls that don't support widgets, setting this will return a
140 NS_ERROR_NOT_IMPLEMENTED error.
142 [noscript
] attribute nsIWidget parentWidget
;
145 This is the native window parent of the control.
147 Setting this after Create() has been called may not be supported by some
150 On controls that don't support setting nativeWindow parents, setting this
151 will return a NS_ERROR_NOT_IMPLEMENTED error.
153 attribute nativeWindow parentNativeWindow
;
156 This is the handle (HWND, GdkWindow*, ...) to the native window of the
157 control, exposed as an AString.
159 @return AString in hex format with "0x" prepended, or empty string if
162 @throws NS_ERROR_NOT_IMPLEMENTED for non-XULWindows
164 readonly attribute AString nativeHandle
;
167 Attribute controls the visibility of the object behind this interface.
168 Setting this attribute to false will hide the control. Setting it to
171 attribute
boolean visibility
;
174 a disabled window should accept no user interaction; it's a dead window,
175 like the parent of a modal window.
177 attribute
boolean enabled
;
180 Allows you to find out what the widget is of a given object. Depending
181 on the object, this may return the parent widget in which this object
182 lives if it has not had to create its own widget.
184 [noscript
] readonly attribute nsIWidget mainWidget
;
187 The number of device pixels per CSS pixel used on this window's current
188 screen at the default zoom level.
189 This is the value returned by GetDefaultScale() of the underlying widget.
190 Note that this may change if the window is moved between screens with
191 differing resolutions.
193 readonly attribute
double unscaledDevicePixelsPerCSSPixel
;
196 The number of device pixels per display pixel on this window's current
197 screen. (The meaning of "display pixel" varies across OS environments;
198 it is the pixel units used by the desktop environment to manage screen
199 real estate and window positioning, which may correspond to (per-screen)
200 device pixels, or may be a virtual coordinate space that covers a multi-
201 monitor, mixed-dpi desktop space.)
202 This is the value returned by DevicePixelsPerDesktopPixel() of the underlying
204 Note that this may change if the window is moved between screens with
205 differing resolutions.
207 readonly attribute
double devicePixelsPerDesktopPixel
;
212 attribute AString title
;