Add copy of .ttf font with .eot extension for testing
[wine-gecko.git] / widget / src / xpwidgets / nsAppShellSingleton.h
blob43748b270f936c4418bb690cac471021ea280c85
1 /* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
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 Widget code.
17 * The Initial Developer of the Original Code is Google Inc.
18 * Portions created by the Initial Developer are Copyright (C) 2006
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
22 * Darin Fisher <darin@meer.net> (original author)
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 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 #ifndef nsAppShellSingleton_h__
39 #define nsAppShellSingleton_h__
41 /**
42 * This file is designed to be included into the file that provides the
43 * nsIModule implementation for a particular widget toolkit.
45 * The following functions are defined:
46 * nsAppShellInit
47 * nsAppShellShutdown
48 * nsAppShellConstructor
50 * The nsAppShellInit function is designed to be used as a module constructor.
51 * If you already have a module constructor, then call nsAppShellInit from your
52 * module constructor.
54 * The nsAppShellShutdown function is designed to be used as a module
55 * destructor. If you already have a module destructor, then call
56 * nsAppShellShutdown from your module destructor.
58 * The nsAppShellConstructor function is designed to be used as a factory
59 * method for the nsAppShell class.
62 static nsAppShell *sAppShell;
64 static nsresult
65 nsAppShellInit(nsIModule *module)
67 NS_ASSERTION(!sAppShell, "already initialized");
69 sAppShell = new nsAppShell();
70 if (!sAppShell)
71 return NS_ERROR_OUT_OF_MEMORY;
72 NS_ADDREF(sAppShell);
74 nsresult rv = sAppShell->Init();
75 if (NS_FAILED(rv)) {
76 NS_RELEASE(sAppShell);
77 return rv;
80 return NS_OK;
83 static void
84 nsAppShellShutdown(nsIModule *module)
86 NS_RELEASE(sAppShell);
89 static NS_METHOD
90 nsAppShellConstructor(nsISupports *outer, const nsIID &iid, void **result)
92 NS_ENSURE_TRUE(!outer, NS_ERROR_NO_AGGREGATION);
93 NS_ENSURE_TRUE(sAppShell, NS_ERROR_NOT_INITIALIZED);
95 return sAppShell->QueryInterface(iid, result);
98 #endif // nsAppShellSingleton_h__