widget/nsIBaseWindow.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     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);
    12 %{ C++
    13 class nsIWidget;
    14 %}
    16 typedef voidPtr nativeWindow;
    18 /**
    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.    
    22  */
    24 [scriptable, uuid(9DA319F3-EEE6-4504-81A5-6A19CF6215BF)]
    25 interface nsIBaseWindow : nsISupports
    26 {
    27 	/*
    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
    45 		window.
    47 	@param y - This is the y co-ordinate relative to the parent to place the 
    48 		window.
    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.  Most likely
    56 					due to you calling it after create() has 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.
    60 	*/
    61 	[noscript]void initWindow(in nativeWindow parentNativeWindow, 
    62 		in nsIWidget parentWidget,	in long x, in long y, in long cx, in long cy);
    64 	/*
    65 	Tells the window that intialization and setup is complete.  When this is
    66 	called the window can actually create itself based on the setup
    67 	information handed to it.
    69 	@return	NS_OK - Creation was successfull.
    70 				NS_ERROR_UNEXPECTED - This call was unexpected at this time.
    71 					Perhaps create() had already been called or not all
    72 					required initialization had been done.
    73 	*/
    74 	void create();
    76 	/*
    77 	Tell the window that it should destroy itself.  This call should not be
    78 	necessary as it will happen implictly when final release occurs on the
    79 	object.  If for some reaons you want the window destroyed prior to release
    80 	due to cycle or ordering issues, then this call provides that ability.
    82 	@return	NS_OK - Everything destroyed properly.
    83 				NS_ERROR_UNEXPECTED - This call was unexpected at this time.
    84 					Perhaps create() has not been called yet.
    85 	*/
    86 	void destroy();
    88 	/*
    89 	Sets the current x and y coordinates of the control.  This is relative to
    90 	the parent window.
    91 	*/
    92 	void setPosition(in long x, in long y);
    94 	/*
    95 	Gets the current x and y coordinates of the control.  This is relatie to the
    96 	parent window.
    97 	*/
    98 	void getPosition(out long x, out long y);
   100 	/*
   101 	Sets the width and height of the control.
   102 	*/
   103 	void setSize(in long cx, in long cy, in boolean fRepaint);
   105 	/*
   106 	Gets the width and height of the control.
   107 	*/
   108 	void getSize(out long cx, out long cy);
   110 	/*
   111 	Convenience function combining the SetPosition and SetSize into one call.
   112 	Also is more efficient than calling both.
   113 	*/
   114 	void setPositionAndSize(in long x, in long y, in long cx, in long cy, 
   115 		in boolean fRepaint);
   117 	/*
   118 	Convenience function combining the GetPosition and GetSize into one call.
   119 	Also is more efficient than calling both.
   120 	*/
   121 	void getPositionAndSize(out long x, out long y, out long cx, out long cy);
   123 	/** 
   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.
   127 	 */
   128 	void repaint(in boolean force);
   130 	/*			  
   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
   134 	parentNativeWindow.
   136 	Setting this after Create() has been called may not be supported by some
   137 	implementations.
   139 	On controls that don't support widgets, setting this will return a 
   140 	NS_ERROR_NOT_IMPLEMENTED error.
   141 	*/
   142 	[noscript] attribute nsIWidget parentWidget;
   144 	/*
   145 	This is the native window parent of the control.
   147 	Setting this after Create() has been called may not be supported by some
   148 	implementations.
   150 	On controls that don't support setting nativeWindow parents, setting this
   151 	will return a NS_ERROR_NOT_IMPLEMENTED error.
   152 	*/
   153 	attribute nativeWindow parentNativeWindow;
   155 	/*
   156 	This is the handle (HWND, GdkWindow*, ...) to the native window of the
   157 	control, exposed as a DOMString.
   159 	@return DOMString in hex format with "0x" prepended, or empty string if
   160 	mainWidget undefined
   162 	@throws NS_ERROR_NOT_IMPLEMENTED for non-XULWindows
   163 	*/
   164 	readonly attribute DOMString nativeHandle;
   166 	/*
   167 	Attribute controls the visibility of the object behind this interface.
   168 	Setting this attribute to false will hide the control.  Setting it to 
   169 	true will show it.
   170 	*/
   171 	attribute boolean visibility;
   173     /*
   174     a disabled window should accept no user interaction; it's a dead window,
   175     like the parent of a modal window.
   176     */
   177     attribute boolean enabled;
   179 	/*
   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.
   183 	*/
   184 	[noscript] readonly attribute nsIWidget mainWidget;
   186 	/*
   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.
   192 	*/
   193 	readonly attribute double unscaledDevicePixelsPerCSSPixel;
   195 	/**
   196 	* Give the window focus.
   197 	*/
   198 	void setFocus();
   200 	/*
   201 	Title of the window.
   202 	*/
   203 	attribute wstring title;
   204 };

mercurial