Back to index

lightning-sunbird  0.9+nobinonly
nsIBaseWindow.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is the Mozilla browser.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications, Inc.
00020  * Portions created by the Initial Developer are Copyright (C) 1999
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Travis Bogard <travis@netscape.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either the GNU General Public License Version 2 or later (the "GPL"), or
00028  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #include "nsISupports.idl"
00041 #include "nsrootidl.idl"
00042 /*#include "nsIWidget.idl"  Boy this would be nice.*/
00043 
00044 [ptr] native nsIWidget(nsIWidget);
00045 %{ C++
00046 class nsIWidget;
00047 %}
00048 
00049 typedef voidPtr nativeWindow;
00050 
00057 [scriptable, uuid(046BC8A0-8015-11d3-AF70-00A024FFC08C)]
00058 interface nsIBaseWindow : nsISupports
00059 {
00060        /*
00061        Allows a client to initialize an object implementing this interface with
00062        the usually required window setup information.
00063 
00064        @param parentNativeWindow - This allows a system to pass in the parenting
00065               window as a native reference rather than relying on the calling
00066               application to have created the parent window as an nsIWidget.  This 
00067               value will be ignored (should be nsnull) if an nsIWidget is passed in to
00068               the parentWidget parameter.  One of the two parameters however must be
00069               passed.
00070 
00071        @param parentWidget - This allows a system to pass in the parenting widget.
00072               This allows some objects to optimize themselves and rely on the view
00073               system for event flow rather than creating numerous native windows.  If
00074               one of these is not available, nsnull should be passed and a 
00075               valid native window should be passed to the parentNativeWindow parameter.
00076 
00077        @param x - This is the x co-ordinate relative to the parent to place the
00078               window.
00079 
00080        @param y - This is the y co-ordinate relative to the parent to place the 
00081               window.
00082 
00083        @param cx - This is the width      for the window to be.
00084 
00085        @param cy - This is the height for the window to be.
00086 
00087        @return       NS_OK - Window Init succeeded without a problem.
00088                             NS_ERROR_UNEXPECTED - Call was unexpected at this time.  Most likely
00089                                    due to you calling it after create() has been called.
00090                             NS_ERROR_INVALID_ARG - controls that require either a parentNativeWindow
00091                                    or a parentWidget may return invalid arg when they do not 
00092                                    receive what they are needing.
00093        */
00094        [noscript]void initWindow(in nativeWindow parentNativeWindow, 
00095               in nsIWidget parentWidget,  in long x, in long y, in long cx, in long cy);
00096 
00097        /*
00098        Tells the window that intialization and setup is complete.  When this is
00099        called the window can actually create itself based on the setup
00100        information handed to it.
00101 
00102        @return       NS_OK - Creation was successfull.
00103                             NS_ERROR_UNEXPECTED - This call was unexpected at this time.
00104                                    Perhaps create() had already been called or not all
00105                                    required initialization had been done.
00106        */
00107        void create();
00108 
00109        /*
00110        Tell the window that it should destroy itself.  This call should not be
00111        necessary as it will happen implictly when final release occurs on the
00112        object.  If for some reaons you want the window destroyed prior to release
00113        due to cycle or ordering issues, then this call provides that ability.
00114 
00115        @return       NS_OK - Everything destroyed properly.
00116                             NS_ERROR_UNEXPECTED - This call was unexpected at this time.
00117                                    Perhaps create() has not been called yet.
00118        */
00119        void destroy();
00120 
00121        /*
00122        Sets the current x and y coordinates of the control.  This is relative to
00123        the parent window.
00124        */
00125        void setPosition(in long x, in long y);
00126 
00127        /*
00128        Gets the current x and y coordinates of the control.  This is relatie to the
00129        parent window.
00130        */
00131        void getPosition(out long x, out long y);
00132 
00133        /*
00134        Sets the width and height of the control.
00135        */
00136        void setSize(in long cx, in long cy, in boolean fRepaint);
00137 
00138        /*
00139        Gets the width and height of the control.
00140        */
00141        void getSize(out long cx, out long cy);
00142 
00143        /*
00144        Convenience function combining the SetPosition and SetSize into one call.
00145        Also is more efficient than calling both.
00146        */
00147        void setPositionAndSize(in long x, in long y, in long cx, in long cy, 
00148               in boolean fRepaint);
00149               
00150        /*
00151        Convenience function combining the GetPosition and GetSize into one call.
00152        Also is more efficient than calling both.
00153        */
00154        void getPositionAndSize(out long x, out long y, out long cx, out long cy);
00155         
00161        void repaint(in boolean force);
00162 
00163        /*                     
00164        This is the parenting widget for the control.  This may be null if only the
00165        native window was handed in for the parent during initialization.  If this
00166        is returned, it should refer to the same object as parentNativeWindow.
00167 
00168        Setting this after Create() has been called may not be supported by some
00169        implementations.
00170 
00171        On controls that don't support widgets, setting this will return a 
00172        NS_ERROR_NOT_IMPLEMENTED error.
00173        */
00174        [noscript] attribute nsIWidget parentWidget;
00175 
00176        /*
00177        This is the native window parent of the control.
00178 
00179        Setting this after Create() has been called may not be supported by some
00180        implementations.
00181 
00182        On controls that don't support setting nativeWindow parents, setting this
00183        will return a NS_ERROR_NOT_IMPLEMENTED error.
00184        */
00185        attribute nativeWindow parentNativeWindow;
00186 
00187        /*
00188        Attribute controls the visibility of the object behind this interface.
00189        Setting this attribute to false will hide the control.  Setting it to 
00190        true will show it.
00191        */
00192        attribute boolean visibility;
00193 
00194     /*
00195     a disabled window should accept no user interaction; it's a dead window,
00196     like the parent of a modal window.
00197     */
00198     attribute boolean enabled;
00199 
00205     attribute boolean blurSuppression;
00206 
00207        /*
00208        Allows you to find out what the widget is of a given object.  Depending
00209        on the object, this may return the parent widget in which this object
00210        lives if it has not had to create its own widget.
00211        */
00212        [noscript] readonly attribute nsIWidget mainWidget;
00213        
00217        void setFocus();
00218 
00219        /*
00220        Title of the window.
00221        */
00222        attribute wstring title;
00223 };