1999-11-17 06:19:56 +03: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/. */
|
1999-11-17 06:19:56 +03:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
#include "nsrootidl.idl"
|
|
|
|
/*#include "nsIWidget.idl" Boy this would be nice.*/
|
|
|
|
|
|
|
|
[ptr] native nsIWidget(nsIWidget);
|
|
|
|
%{ C++
|
2001-07-16 06:40:48 +04:00
|
|
|
class nsIWidget;
|
1999-11-17 06:19:56 +03:00
|
|
|
%}
|
|
|
|
|
2000-06-03 13:46:12 +04:00
|
|
|
typedef voidPtr nativeWindow;
|
1999-11-17 06:19:56 +03:00
|
|
|
|
|
|
|
/**
|
2019-05-23 01:37:14 +03:00
|
|
|
* The nsIBaseWindow describes a generic window and basic operations that
|
1999-11-17 06:19:56 +03:00
|
|
|
* can be performed on it. This is not to be a complete windowing interface
|
2019-05-23 01:37:14 +03:00
|
|
|
* but rather a common set that nearly all windowed objects support.
|
1999-11-17 06:19:56 +03:00
|
|
|
*/
|
|
|
|
|
2015-11-25 22:12:07 +03:00
|
|
|
[scriptable, uuid(ca635529-a977-4552-9b8a-66187e54d882)]
|
1999-11-17 06:19:56 +03:00
|
|
|
interface nsIBaseWindow : nsISupports
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
Allows a client to initialize an object implementing this interface with
|
|
|
|
the usually required window setup information.
|
2009-07-22 04:45:10 +04:00
|
|
|
It is possible to pass null for both parentNativeWindow and parentWidget,
|
|
|
|
but only docshells support this.
|
1999-11-17 06:19:56 +03:00
|
|
|
|
|
|
|
@param parentNativeWindow - This allows a system to pass in the parenting
|
|
|
|
window as a native reference rather than relying on the calling
|
2019-05-23 01:37:14 +03:00
|
|
|
application to have created the parent window as an nsIWidget. This
|
2012-07-30 18:20:58 +04:00
|
|
|
value will be ignored (should be nullptr) if an nsIWidget is passed in to
|
2009-07-22 04:45:10 +04:00
|
|
|
the parentWidget parameter.
|
1999-11-17 06:19:56 +03:00
|
|
|
|
|
|
|
@param parentWidget - This allows a system to pass in the parenting widget.
|
|
|
|
This allows some objects to optimize themselves and rely on the view
|
|
|
|
system for event flow rather than creating numerous native windows. If
|
2012-07-30 18:20:58 +04:00
|
|
|
one of these is not available, nullptr should be passed.
|
1999-11-17 06:19:56 +03:00
|
|
|
|
|
|
|
@param x - This is the x co-ordinate relative to the parent to place the
|
|
|
|
window.
|
|
|
|
|
2019-05-23 01:37:14 +03:00
|
|
|
@param y - This is the y co-ordinate relative to the parent to place the
|
1999-11-17 06:19:56 +03:00
|
|
|
window.
|
|
|
|
|
|
|
|
@param cx - This is the width for the window to be.
|
|
|
|
|
|
|
|
@param cy - This is the height for the window to be.
|
|
|
|
|
|
|
|
@return NS_OK - Window Init succeeded without a problem.
|
|
|
|
NS_ERROR_UNEXPECTED - Call was unexpected at this time. Most likely
|
|
|
|
due to you calling it after create() has been called.
|
|
|
|
NS_ERROR_INVALID_ARG - controls that require either a parentNativeWindow
|
2019-05-23 01:37:14 +03:00
|
|
|
or a parentWidget may return invalid arg when they do not
|
1999-11-17 06:19:56 +03:00
|
|
|
receive what they are needing.
|
|
|
|
*/
|
2019-05-23 01:37:14 +03:00
|
|
|
[noscript]void initWindow(in nativeWindow parentNativeWindow,
|
1999-11-17 06:19:56 +03:00
|
|
|
in nsIWidget parentWidget, in long x, in long y, in long cx, in long cy);
|
|
|
|
|
|
|
|
/*
|
|
|
|
Tells the window that intialization and setup is complete. When this is
|
|
|
|
called the window can actually create itself based on the setup
|
|
|
|
information handed to it.
|
|
|
|
|
|
|
|
@return NS_OK - Creation was successfull.
|
|
|
|
NS_ERROR_UNEXPECTED - This call was unexpected at this time.
|
|
|
|
Perhaps create() had already been called or not all
|
|
|
|
required initialization had been done.
|
|
|
|
*/
|
|
|
|
void create();
|
|
|
|
|
|
|
|
/*
|
2000-01-26 09:24:04 +03:00
|
|
|
Tell the window that it should destroy itself. This call should not be
|
|
|
|
necessary as it will happen implictly when final release occurs on the
|
|
|
|
object. If for some reaons you want the window destroyed prior to release
|
|
|
|
due to cycle or ordering issues, then this call provides that ability.
|
1999-11-17 06:19:56 +03:00
|
|
|
|
|
|
|
@return NS_OK - Everything destroyed properly.
|
2000-01-26 09:24:04 +03:00
|
|
|
NS_ERROR_UNEXPECTED - This call was unexpected at this time.
|
|
|
|
Perhaps create() has not been called yet.
|
1999-11-17 06:19:56 +03:00
|
|
|
*/
|
|
|
|
void destroy();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Sets the current x and y coordinates of the control. This is relative to
|
|
|
|
the parent window.
|
|
|
|
*/
|
|
|
|
void setPosition(in long x, in long y);
|
|
|
|
|
2016-02-18 13:46:16 +03:00
|
|
|
/*
|
|
|
|
Ditto, with arguments in global desktop pixels rather than (potentially
|
|
|
|
ambiguous) device pixels
|
|
|
|
*/
|
|
|
|
void setPositionDesktopPix(in long x, in long y);
|
|
|
|
|
1999-11-17 06:19:56 +03:00
|
|
|
/*
|
|
|
|
Gets the current x and y coordinates of the control. This is relatie to the
|
|
|
|
parent window.
|
|
|
|
*/
|
|
|
|
void getPosition(out long x, out long y);
|
|
|
|
|
|
|
|
/*
|
|
|
|
Sets the width and height of the control.
|
|
|
|
*/
|
|
|
|
void setSize(in long cx, in long cy, in boolean fRepaint);
|
|
|
|
|
|
|
|
/*
|
|
|
|
Gets the width and height of the control.
|
|
|
|
*/
|
|
|
|
void getSize(out long cx, out long cy);
|
|
|
|
|
2016-05-12 03:07:45 +03:00
|
|
|
/**
|
|
|
|
* The 'flags' argument to setPositionAndSize is a set of these bits.
|
|
|
|
*/
|
|
|
|
const unsigned long eRepaint = 1;
|
|
|
|
const unsigned long eDelayResize = 2;
|
|
|
|
|
1999-11-17 06:19:56 +03:00
|
|
|
/*
|
|
|
|
Convenience function combining the SetPosition and SetSize into one call.
|
1999-11-27 05:49:57 +03:00
|
|
|
Also is more efficient than calling both.
|
1999-11-17 06:19:56 +03:00
|
|
|
*/
|
2019-05-23 01:37:14 +03:00
|
|
|
void setPositionAndSize(in long x, in long y, in long cx, in long cy,
|
2016-05-12 03:07:45 +03:00
|
|
|
in unsigned long flags);
|
2019-05-23 01:37:14 +03:00
|
|
|
|
1999-11-27 05:49:57 +03:00
|
|
|
/*
|
|
|
|
Convenience function combining the GetPosition and GetSize into one call.
|
|
|
|
Also is more efficient than calling both.
|
|
|
|
*/
|
|
|
|
void getPositionAndSize(out long x, out long y, out long cx, out long cy);
|
2019-05-23 01:37:14 +03:00
|
|
|
|
|
|
|
/**
|
1999-11-17 06:19:56 +03:00
|
|
|
* Tell the window to repaint itself
|
|
|
|
* @param aForce - if true, repaint immediately
|
|
|
|
* if false, the window may defer repainting as it sees fit.
|
|
|
|
*/
|
|
|
|
void repaint(in boolean force);
|
|
|
|
|
2019-05-23 01:37:14 +03:00
|
|
|
/*
|
2009-07-22 04:45:10 +04:00
|
|
|
This is the parenting widget for the control. This may be null if the
|
|
|
|
native window was handed in for the parent during initialization.
|
|
|
|
If this is returned, it should refer to the same object as
|
|
|
|
parentNativeWindow.
|
1999-11-17 06:19:56 +03:00
|
|
|
|
|
|
|
Setting this after Create() has been called may not be supported by some
|
|
|
|
implementations.
|
|
|
|
|
2019-05-23 01:37:14 +03:00
|
|
|
On controls that don't support widgets, setting this will return a
|
1999-11-17 06:19:56 +03:00
|
|
|
NS_ERROR_NOT_IMPLEMENTED error.
|
|
|
|
*/
|
2000-03-18 02:47:48 +03:00
|
|
|
[noscript] attribute nsIWidget parentWidget;
|
1999-11-17 06:19:56 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
This is the native window parent of the control.
|
|
|
|
|
|
|
|
Setting this after Create() has been called may not be supported by some
|
|
|
|
implementations.
|
|
|
|
|
|
|
|
On controls that don't support setting nativeWindow parents, setting this
|
|
|
|
will return a NS_ERROR_NOT_IMPLEMENTED error.
|
|
|
|
*/
|
|
|
|
attribute nativeWindow parentNativeWindow;
|
|
|
|
|
2012-07-25 05:35:32 +04:00
|
|
|
/*
|
|
|
|
This is the handle (HWND, GdkWindow*, ...) to the native window of the
|
2018-09-06 11:02:43 +03:00
|
|
|
control, exposed as an AString.
|
2012-07-25 05:35:32 +04:00
|
|
|
|
2018-09-06 11:02:43 +03:00
|
|
|
@return AString in hex format with "0x" prepended, or empty string if
|
2012-07-25 05:35:32 +04:00
|
|
|
mainWidget undefined
|
|
|
|
|
|
|
|
@throws NS_ERROR_NOT_IMPLEMENTED for non-XULWindows
|
|
|
|
*/
|
2018-09-06 11:02:43 +03:00
|
|
|
readonly attribute AString nativeHandle;
|
2012-07-25 05:35:32 +04:00
|
|
|
|
1999-11-17 06:19:56 +03:00
|
|
|
/*
|
|
|
|
Attribute controls the visibility of the object behind this interface.
|
2019-05-23 01:37:14 +03:00
|
|
|
Setting this attribute to false will hide the control. Setting it to
|
1999-11-17 06:19:56 +03:00
|
|
|
true will show it.
|
|
|
|
*/
|
|
|
|
attribute boolean visibility;
|
|
|
|
|
2002-03-01 02:19:04 +03:00
|
|
|
/*
|
|
|
|
a disabled window should accept no user interaction; it's a dead window,
|
|
|
|
like the parent of a modal window.
|
|
|
|
*/
|
|
|
|
attribute boolean enabled;
|
|
|
|
|
1999-11-17 06:19:56 +03:00
|
|
|
/*
|
|
|
|
Allows you to find out what the widget is of a given object. Depending
|
|
|
|
on the object, this may return the parent widget in which this object
|
2002-03-01 02:19:04 +03:00
|
|
|
lives if it has not had to create its own widget.
|
1999-11-17 06:19:56 +03:00
|
|
|
*/
|
2000-03-18 02:47:48 +03:00
|
|
|
[noscript] readonly attribute nsIWidget mainWidget;
|
2012-10-16 23:41:19 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
The number of device pixels per CSS pixel used on this window's current
|
|
|
|
screen at the default zoom level.
|
|
|
|
This is the value returned by GetDefaultScale() of the underlying widget.
|
|
|
|
Note that this may change if the window is moved between screens with
|
|
|
|
differing resolutions.
|
|
|
|
*/
|
|
|
|
readonly attribute double unscaledDevicePixelsPerCSSPixel;
|
|
|
|
|
2015-11-25 22:12:07 +03:00
|
|
|
/*
|
|
|
|
The number of device pixels per display pixel on this window's current
|
|
|
|
screen. (The meaning of "display pixel" varies across OS environments;
|
|
|
|
it is the pixel units used by the desktop environment to manage screen
|
|
|
|
real estate and window positioning, which may correspond to (per-screen)
|
|
|
|
device pixels, or may be a virtual coordinate space that covers a multi-
|
|
|
|
monitor, mixed-dpi desktop space.)
|
|
|
|
This is the value returned by DevicePixelsPerDesktopPixel() of the underlying
|
|
|
|
widget.
|
|
|
|
Note that this may change if the window is moved between screens with
|
|
|
|
differing resolutions.
|
|
|
|
*/
|
|
|
|
readonly attribute double devicePixelsPerDesktopPixel;
|
|
|
|
|
1999-11-17 06:19:56 +03:00
|
|
|
/**
|
|
|
|
* Give the window focus.
|
|
|
|
*/
|
|
|
|
void setFocus();
|
|
|
|
|
1999-12-02 12:41:21 +03:00
|
|
|
/*
|
|
|
|
Title of the window.
|
|
|
|
*/
|
2017-09-25 06:10:51 +03:00
|
|
|
attribute AString title;
|
1999-11-17 06:19:56 +03:00
|
|
|
};
|