Merge mozilla-central and tracemonkey. (a=blockers)
[mozilla-central.git] / dom / base / nsBarProps.h
blob80cc6838dfb93733fc73e759b202cd2c540e6189
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
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
13 * License.
15 * The Original Code is mozilla.org 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.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or 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 MPL, 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 MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 /* BarProps are the collection of little properties of DOM windows whose
39 only property of their own is "visible". They describe the window
40 chrome which can be made visible or not through JavaScript by setting
41 the appropriate property (window.menubar.visible)
44 #ifndef nsBarProps_h___
45 #define nsBarProps_h___
47 #include "nscore.h"
48 #include "nsIScriptContext.h"
49 #include "nsIDOMBarProp.h"
50 #include "nsIWeakReference.h"
52 class nsGlobalWindow;
53 class nsIWebBrowserChrome;
55 // Script "BarProp" object
56 class nsBarProp : public nsIDOMBarProp
58 public:
59 nsBarProp();
60 virtual ~nsBarProp();
62 NS_DECL_ISUPPORTS
64 NS_IMETHOD SetWebBrowserChrome(nsIWebBrowserChrome* aBrowserChrome);
66 NS_IMETHOD GetVisibleByFlag(PRBool *aVisible, PRUint32 aChromeFlag);
67 NS_IMETHOD SetVisibleByFlag(PRBool aVisible, PRUint32 aChromeFlag);
69 protected:
70 // Weak Reference
71 nsIWebBrowserChrome* mBrowserChrome;
74 // Script "menubar" object
75 class nsMenubarProp : public nsBarProp
77 public:
78 nsMenubarProp();
79 virtual ~nsMenubarProp();
81 NS_DECL_NSIDOMBARPROP
84 // Script "toolbar" object
85 class nsToolbarProp : public nsBarProp
87 public:
88 nsToolbarProp();
89 virtual ~nsToolbarProp();
91 NS_DECL_NSIDOMBARPROP
94 // Script "locationbar" object
95 class nsLocationbarProp : public nsBarProp
97 public:
98 nsLocationbarProp();
99 virtual ~nsLocationbarProp();
101 NS_DECL_NSIDOMBARPROP
104 // Script "personalbar" object
105 class nsPersonalbarProp : public nsBarProp
107 public:
108 nsPersonalbarProp();
109 virtual ~nsPersonalbarProp();
111 NS_DECL_NSIDOMBARPROP
114 // Script "statusbar" object
115 class nsStatusbarProp : public nsBarProp
117 public:
118 nsStatusbarProp();
119 virtual ~nsStatusbarProp();
121 NS_DECL_NSIDOMBARPROP
124 // Script "scrollbars" object
125 class nsScrollbarsProp : public nsBarProp {
126 public:
127 nsScrollbarsProp(nsGlobalWindow *aWindow);
128 virtual ~nsScrollbarsProp();
130 NS_DECL_NSIDOMBARPROP
132 private:
133 nsGlobalWindow *mDOMWindow;
134 nsCOMPtr<nsIWeakReference> mDOMWindowWeakref;
135 /* Note the odd double reference to the owning global window.
136 Since the corresponding DOM window nominally owns this object,
137 yet refcounted ownership of this object can be handed off to
138 owners unknown, we need a weak ref to back to the DOM window.
139 However we also need access to properties of the DOM Window
140 that aren't available through interfaces. Then it's either
141 a weak ref and some skanky casting, or this funky double ref.
142 Funky beats skanky, so here we are. */
145 #endif /* nsBarProps_h___ */