Interface nsIBaseWindowType

The nsIBaseWindow describes a generic window and basic operations that can be performed on it. This is not to be a complete windowing interface but rather a common set that nearly all windowed objects support.

Hierarchy

Properties

devicePixelsPerDesktopPixel: number

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 GetDesktopToDeviceScale() of the underlying widget. Note that this may change if the window is moved between screens with differing resolutions.

enabled: boolean

a disabled window should accept no user interaction; it's a dead window, like the parent of a modal window.

mainWidget: nsIWidget

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 lives if it has not had to create its own widget.

nativeHandle: string

This is the handle (HWND, GdkWindow*, ...) to the native window of the control, exposed as an AString.

Returns

AString in hex format with "0x" prepended, or empty string if mainWidget undefined

Throws

NS_ERROR_NOT_IMPLEMENTED for non-XULWindows

parentNativeWindow: nativeWindow

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.

parentWidget: nsIWidget

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.

Setting this after Create() has been called may not be supported by some implementations.

On controls that don't support widgets, setting this will return a NS_ERROR_NOT_IMPLEMENTED error.

title: string

Title of the window.

visibility: boolean

Attribute controls the visibility of the object behind this interface. Setting this attribute to false will hide the control. Setting it to true will show it.

widgetCSSToDeviceScale: number

The number of device pixels per CSS pixel used by this window's widget at the default full 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. NOTE: This is mostly an implementation detail of UnscaledDevicePixelsPerCSSPixel, which is what you probably want to use.

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • 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.

    Returns

    NS_OK - Everything destroyed properly. NS_ERROR_UNEXPECTED - This call was unexpected at this time. Perhaps create() has not been called yet.

    Returns void

  • Gets the dimensions of the window. The caller may pass nullptr for any value it is uninterested in receiving.

    See

    DimensionRequest

    Parameters

    • aDimensionKind: DimensionKind

      Specifies whether the dimensions are in reference to the inner or outer dimensions.

    • aX: number

      Left hand corner of the outer area; or nullptr.

    • aY: number

      Top corner of the outer area; or nullptr.

    • aCX: number

      Width of the inner or outer area; or nullptr.

    • aCY: number

      Height of the inner or outer area; or nullptr.

      Note: Inner position is not supported.

    Returns void

  • Gets the current x and y coordinates of the control. This is relative to the parent window.

    Parameters

    • x: number
    • y: number

    Returns void

  • Convenience function combining the GetPosition and GetSize into one call. Also is more efficient than calling both.

    Parameters

    • x: number
    • y: number
    • cx: number
    • cy: number

    Returns void

  • Gets the width and height of the control.

    Parameters

    • cx: number
    • cy: number

    Returns void

  • Allows a client to initialize an object implementing this interface with the usually required window setup information. It is possible to pass null for both parentNativeWindow and parentWidget, but only docshells support this.

    Returns

    NS_OK - Window Init succeeded without a problem. NS_ERROR_UNEXPECTED - Call was unexpected at this time. Perhaps initWindow() had already been called. NS_ERROR_INVALID_ARG - controls that require either a parentNativeWindow or a parentWidget may return invalid arg when they do not receive what they are needing.

    Parameters

    • parentNativeWindow: nativeWindow

      This allows a system to pass in the parenting window as a native reference rather than relying on the calling application to have created the parent window as an nsIWidget. This value will be ignored (should be nullptr) if an nsIWidget is passed in to the parentWidget parameter.

    • parentWidget: nsIWidget

      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 one of these is not available, nullptr should be passed.

    • x: number

      This is the x co-ordinate relative to the parent to place the window.

    • y: number

      This is the y co-ordinate relative to the parent to place the window.

    • cx: number

      This is the width for the window to be.

    • cy: number

      This is the height for the window to be.

    Returns void

  • Tell the window to repaint itself

    Parameters

    • force: boolean

    Returns void

  • Allows to request the change of individual dimensions without specifying the other components.

    See

    DimensionRequest

    Parameters

    • aRequest: DimensionRequest

      The requested change. A request to change only the width may look like: {DimensionKind::Outer, Nothing(), Nothing(), Some(20), Nothing()}

      Note: Inner position is not supported.

    Returns void

  • Sets the current x and y coordinates of the control. This is relative to the parent window.

    Parameters

    • x: number
    • y: number

    Returns void

  • Convenience function combining the SetPosition and SetSize into one call. Also is more efficient than calling both.

    Parameters

    • x: number
    • y: number
    • cx: number
    • cy: number
    • flags: number

    Returns void

  • Ditto, with arguments in global desktop pixels rather than (potentially ambiguous) device pixels

    Parameters

    • x: number
    • y: number

    Returns void

  • Sets the width and height of the control.

    Parameters

    • cx: number
    • cy: number
    • fRepaint: boolean

    Returns void

Generated using TypeDoc