widget/nsIBaseWindow.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/nsIBaseWindow.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,204 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "nsISupports.idl"
    1.11 +#include "nsrootidl.idl"
    1.12 +/*#include "nsIWidget.idl"  Boy this would be nice.*/
    1.13 +
    1.14 +[ptr] native nsIWidget(nsIWidget);
    1.15 +%{ C++
    1.16 +class nsIWidget;
    1.17 +%}
    1.18 +
    1.19 +typedef voidPtr nativeWindow;
    1.20 +
    1.21 +/**
    1.22 + * The nsIBaseWindow describes a generic window and basic operations that 
    1.23 + * can be performed on it.  This is not to be a complete windowing interface
    1.24 + * but rather a common set that nearly all windowed objects support.    
    1.25 + */
    1.26 +
    1.27 +[scriptable, uuid(9DA319F3-EEE6-4504-81A5-6A19CF6215BF)]
    1.28 +interface nsIBaseWindow : nsISupports
    1.29 +{
    1.30 +	/*
    1.31 +	Allows a client to initialize an object implementing this interface with
    1.32 +	the usually required window setup information.
    1.33 +	It is possible to pass null for both parentNativeWindow and parentWidget,
    1.34 +	but only docshells support this.
    1.35 +
    1.36 +	@param parentNativeWindow - This allows a system to pass in the parenting
    1.37 +		window as a native reference rather than relying on the calling
    1.38 +		application to have created the parent window as an nsIWidget.  This 
    1.39 +		value will be ignored (should be nullptr) if an nsIWidget is passed in to
    1.40 +		the parentWidget parameter.
    1.41 +
    1.42 +	@param parentWidget - This allows a system to pass in the parenting widget.
    1.43 +		This allows some objects to optimize themselves and rely on the view
    1.44 +		system for event flow rather than creating numerous native windows.  If
    1.45 +		one of these is not available, nullptr should be passed.
    1.46 +
    1.47 +	@param x - This is the x co-ordinate relative to the parent to place the
    1.48 +		window.
    1.49 +
    1.50 +	@param y - This is the y co-ordinate relative to the parent to place the 
    1.51 +		window.
    1.52 +
    1.53 +	@param cx - This is the width	for the window to be.
    1.54 +
    1.55 +	@param cy - This is the height for the window to be.
    1.56 +
    1.57 +	@return	NS_OK - Window Init succeeded without a problem.
    1.58 +				NS_ERROR_UNEXPECTED - Call was unexpected at this time.  Most likely
    1.59 +					due to you calling it after create() has been called.
    1.60 +				NS_ERROR_INVALID_ARG - controls that require either a parentNativeWindow
    1.61 +					or a parentWidget may return invalid arg when they do not 
    1.62 +					receive what they are needing.
    1.63 +	*/
    1.64 +	[noscript]void initWindow(in nativeWindow parentNativeWindow, 
    1.65 +		in nsIWidget parentWidget,	in long x, in long y, in long cx, in long cy);
    1.66 +
    1.67 +	/*
    1.68 +	Tells the window that intialization and setup is complete.  When this is
    1.69 +	called the window can actually create itself based on the setup
    1.70 +	information handed to it.
    1.71 +
    1.72 +	@return	NS_OK - Creation was successfull.
    1.73 +				NS_ERROR_UNEXPECTED - This call was unexpected at this time.
    1.74 +					Perhaps create() had already been called or not all
    1.75 +					required initialization had been done.
    1.76 +	*/
    1.77 +	void create();
    1.78 +
    1.79 +	/*
    1.80 +	Tell the window that it should destroy itself.  This call should not be
    1.81 +	necessary as it will happen implictly when final release occurs on the
    1.82 +	object.  If for some reaons you want the window destroyed prior to release
    1.83 +	due to cycle or ordering issues, then this call provides that ability.
    1.84 +
    1.85 +	@return	NS_OK - Everything destroyed properly.
    1.86 +				NS_ERROR_UNEXPECTED - This call was unexpected at this time.
    1.87 +					Perhaps create() has not been called yet.
    1.88 +	*/
    1.89 +	void destroy();
    1.90 +
    1.91 +	/*
    1.92 +	Sets the current x and y coordinates of the control.  This is relative to
    1.93 +	the parent window.
    1.94 +	*/
    1.95 +	void setPosition(in long x, in long y);
    1.96 +
    1.97 +	/*
    1.98 +	Gets the current x and y coordinates of the control.  This is relatie to the
    1.99 +	parent window.
   1.100 +	*/
   1.101 +	void getPosition(out long x, out long y);
   1.102 +
   1.103 +	/*
   1.104 +	Sets the width and height of the control.
   1.105 +	*/
   1.106 +	void setSize(in long cx, in long cy, in boolean fRepaint);
   1.107 +
   1.108 +	/*
   1.109 +	Gets the width and height of the control.
   1.110 +	*/
   1.111 +	void getSize(out long cx, out long cy);
   1.112 +
   1.113 +	/*
   1.114 +	Convenience function combining the SetPosition and SetSize into one call.
   1.115 +	Also is more efficient than calling both.
   1.116 +	*/
   1.117 +	void setPositionAndSize(in long x, in long y, in long cx, in long cy, 
   1.118 +		in boolean fRepaint);
   1.119 +		
   1.120 +	/*
   1.121 +	Convenience function combining the GetPosition and GetSize into one call.
   1.122 +	Also is more efficient than calling both.
   1.123 +	*/
   1.124 +	void getPositionAndSize(out long x, out long y, out long cx, out long cy);
   1.125 +	 
   1.126 +	/** 
   1.127 +	 * Tell the window to repaint itself
   1.128 +	 * @param aForce - if true, repaint immediately
   1.129 +	 *                 if false, the window may defer repainting as it sees fit.
   1.130 +	 */
   1.131 +	void repaint(in boolean force);
   1.132 +
   1.133 +	/*			  
   1.134 +	This is the parenting widget for the control.  This may be null if the
   1.135 +	native window was handed in for the parent during initialization.
   1.136 +	If this	is returned, it should refer to the same object as
   1.137 +	parentNativeWindow.
   1.138 +
   1.139 +	Setting this after Create() has been called may not be supported by some
   1.140 +	implementations.
   1.141 +
   1.142 +	On controls that don't support widgets, setting this will return a 
   1.143 +	NS_ERROR_NOT_IMPLEMENTED error.
   1.144 +	*/
   1.145 +	[noscript] attribute nsIWidget parentWidget;
   1.146 +
   1.147 +	/*
   1.148 +	This is the native window parent of the control.
   1.149 +
   1.150 +	Setting this after Create() has been called may not be supported by some
   1.151 +	implementations.
   1.152 +
   1.153 +	On controls that don't support setting nativeWindow parents, setting this
   1.154 +	will return a NS_ERROR_NOT_IMPLEMENTED error.
   1.155 +	*/
   1.156 +	attribute nativeWindow parentNativeWindow;
   1.157 +
   1.158 +	/*
   1.159 +	This is the handle (HWND, GdkWindow*, ...) to the native window of the
   1.160 +	control, exposed as a DOMString.
   1.161 +
   1.162 +	@return DOMString in hex format with "0x" prepended, or empty string if
   1.163 +	mainWidget undefined
   1.164 +
   1.165 +	@throws NS_ERROR_NOT_IMPLEMENTED for non-XULWindows
   1.166 +	*/
   1.167 +	readonly attribute DOMString nativeHandle;
   1.168 +
   1.169 +	/*
   1.170 +	Attribute controls the visibility of the object behind this interface.
   1.171 +	Setting this attribute to false will hide the control.  Setting it to 
   1.172 +	true will show it.
   1.173 +	*/
   1.174 +	attribute boolean visibility;
   1.175 +
   1.176 +    /*
   1.177 +    a disabled window should accept no user interaction; it's a dead window,
   1.178 +    like the parent of a modal window.
   1.179 +    */
   1.180 +    attribute boolean enabled;
   1.181 +
   1.182 +	/*
   1.183 +	Allows you to find out what the widget is of a given object.  Depending
   1.184 +	on the object, this may return the parent widget in which this object
   1.185 +	lives if it has not had to create its own widget.
   1.186 +	*/
   1.187 +	[noscript] readonly attribute nsIWidget mainWidget;
   1.188 +
   1.189 +	/*
   1.190 +	The number of	device pixels per CSS pixel used on this window's current
   1.191 +	screen at the default zoom level.
   1.192 +	This is the value returned by GetDefaultScale() of the underlying widget.
   1.193 +	Note that this may change if the window is moved between screens with
   1.194 +	differing resolutions.
   1.195 +	*/
   1.196 +	readonly attribute double unscaledDevicePixelsPerCSSPixel;
   1.197 +
   1.198 +	/**
   1.199 +	* Give the window focus.
   1.200 +	*/
   1.201 +	void setFocus();
   1.202 +
   1.203 +	/*
   1.204 +	Title of the window.
   1.205 +	*/
   1.206 +	attribute wstring title;
   1.207 +};

mercurial