1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Netscape Public License
6
* Version 1.1 (the "License"); you may not use this file except in
7
* compliance with the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/NPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
15
* The Original Code is Mozilla Communicator client code.
17
* The Initial Developer of the Original Code is
18
* Netscape Communications Corporation.
19
* Portions created by the Initial Developer are Copyright (C) 1998
20
* the Initial Developer. All Rights Reserved.
24
* Alternatively, the contents of this file may be used under the terms of
25
* either the GNU General Public License Version 2 or later (the "GPL"), or
26
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
* in which case the provisions of the GPL or the LGPL are applicable instead
28
* of those above. If you wish to allow use of your version of this file only
29
* under the terms of either the GPL or the LGPL, and not to allow others to
30
* use your version of this file under the terms of the NPL, indicate your
31
* decision by deleting the provisions above and replace them with the notice
32
* and other provisions required by the GPL or the LGPL. If you do not delete
33
* the provisions above, a recipient may use your version of this file under
34
* the terms of any one of the NPL, the GPL or the LGPL.
36
* ***** END LICENSE BLOCK ***** */
37
#ifndef nsIXPBaseWindow_h___
38
#define nsIXPBaseWindow_h___
40
#include "nsISupports.h"
49
class nsIWindowListener;
50
class nsIDOMHTMLDocument;
54
#define NS_IXPBASE_WINDOW_IID \
55
{ 0x36c1fe51, 0x6f3e, 0x11d2, { 0x8d, 0xca, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
57
#define NS_XPBASE_WINDOW_CID \
58
{ 0x36c1fe51, 0x6f3e, 0x11d2, { 0x8d, 0xca, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
60
enum nsXPBaseWindowType {
62
eXPBaseWindowType_window,
64
eXPBaseWindowType_dialog,
65
///creates a modal dialog
66
eXPBaseWindowType_modalDialog
71
* BaseWindow for HTML Dialog Boxes and Windows. The desciption of the dialog box
72
* or window is encoded in a HTML File. The Contents of the HTML file and the current
73
* settings for form elements are accessed through the W3C DOM interfaces.
74
* Access to the nsIDOM classes is done through C++ rather than JavaScript. However,
75
* JavaScript event handlers can be used with the HTML File as well.
76
* The BaseWindow contains methods for:
78
* 1) loading a HTML file
79
* 2) Initializing the default values for form elements.
80
* 3) attaching an event listener to process click events.
81
* 4) Getting a handle to the HTMLDocumentElement to access nsIDOMElements.
84
class nsIXPBaseWindow : public nsISupports {
88
* Initialize the window or dialog box.
89
* @param aType see nsXPBaseWindowType's above
90
* @param aAppShell application shell
91
* @param aPref Preferences
92
* @param aDialogURL URL of HTML file describing the dialog or window
93
* @param aTitle Title of the dialog box or window
94
* @param aBounds x, y, width, and height of the window or dialog box
95
* XXX: aChrome is probably not needed for dialog boxes and windows, this is a holdover
96
* from the nsBrowserWindow.
97
* @param aChrome Chrome mask for toolbars and statusbars.
98
* @param aAllowPlugins if TRUE then plugins can be referenced in the HTML file.
101
NS_IMETHOD Init(nsXPBaseWindowType aType,
102
nsIAppShell* aAppShell,
103
const nsString& aDialogURL,
104
const nsString& aTitle,
105
const nsRect& aBounds,
106
PRUint32 aChromeMask,
107
PRBool aAllowPlugins = PR_TRUE) = 0;
110
* Set the location the window or dialog box on the screen
111
* @param aX horizontal location of the upper left
112
* corner of the window in pixels from the screen.
113
* @param aY vertical location of the upper left
114
* corner of the window in pixels from the screen.
117
NS_IMETHOD SetLocation(PRInt32 aX, PRInt32 aY) = 0;
120
* Set the width and height of the window or dialog box in pixels
121
* @param aWidth width of the window or dialog box in pixels.
122
* @param aHeight height of the window or dialog box in pixels.
125
NS_IMETHOD SetDimensions(PRInt32 aWidth, PRInt32 aHeight) = 0;
127
NS_IMETHOD GetBounds(nsRect& aResult) = 0;
129
NS_IMETHOD GetWindowBounds(nsRect& aResult) = 0;
131
NS_IMETHOD SetVisible(PRBool aIsVisible) = 0;
133
NS_IMETHOD Close() = 0;
135
NS_IMETHOD SetTitle(const PRUnichar* aTitle) = 0;
137
NS_IMETHOD GetTitle(const PRUnichar** aResult) = 0;
139
NS_IMETHOD GetWebShell(nsIWebShell*& aResult) = 0;
141
NS_IMETHOD LoadURL(const nsString &aURL) = 0;
143
NS_IMETHOD GetPresShell(nsIPresShell*& aPresShell) = 0;
145
NS_IMETHOD GetDocument(nsIDOMHTMLDocument *& aDocument) = 0;
147
NS_IMETHOD AddEventListener(nsIDOMNode * aNode) = 0;
149
NS_IMETHOD RemoveEventListener(nsIDOMNode * aNode) = 0;
151
NS_IMETHOD AddWindowListener(nsIWindowListener * aWindowListener) = 0;
153
// XXX minimize, maximize
154
// XXX event control: enable/disable window close box, stick to glass, modal
157
#endif /* nsIXPBaseWindow_h___ */