Bug 453883, ensure true/false marcos are available, r=joshmoz, sr=jst
[wine-gecko.git] / embedding / base / nsEmbedAPI.h
bloba50a766274898f299ea402e1ad58ca9048b2930d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
16 * The Original Code is the Mozilla browser.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications, Inc.
20 * Portions created by the Initial Developer are Copyright (C) 1999
21 * the Initial Developer. All Rights Reserved.
23 * Contributor(s):
24 * Adam Lock <adamlock@netscape.com>
25 * Benjamin Smedberg <benjamin@smedbergs.us>
27 * Alternatively, the contents of this file may be used under the terms of
28 * either the GNU General Public License Version 2 or later (the "GPL"), or
29 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
39 * ***** END LICENSE BLOCK ***** */
41 #ifndef NSEMBEDAPI_H
42 #define NSEMBEDAPI_H
44 #include "nscore.h"
45 #include "nsXPCOM.h"
46 #include "nsILocalFile.h"
47 #include "nsIDirectoryService.h"
49 /**
50 * @file
51 * @brief The Gecko embedding API functions, structures and definitions.
54 /**
55 * Initialises the Gecko embedding layer. You <I>must</I>
56 * call this method before proceeding to use Gecko. This function ensures
57 * XPCOM is started, creates the component registry if necessary and
58 * starts global services.
60 * @status FROZEN
62 * @note Use <CODE>NS_NewLocalFile</CODE> to create the file object you
63 * supply as the bin directory path in this call. The function
64 * may be safely called before the rest of XPCOM or embedding has
65 * been initialised.
67 * @param aMozBinDirectory The Gecko directory containing the component
68 * registry and runtime libraries;
69 * or use <CODE>nsnull</CODE> to use the working
70 * directory.
71 * @param aAppFileLocProvider The object to be used by Gecko that specifies
72 * to Gecko where to find profiles, the component
73 * registry preferences and so on; or use
74 * <CODE>nsnull</CODE> for the default behaviour.
75 * @param aStaticComponents An array of static components (see NS_InitXPCOM3).
76 * may be null.
77 * @param aStaticComponentCount Number of static components in the
78 * aStaticComponents array.
80 * @see NS_NewLocalFile
81 * @see nsILocalFile
82 * @see nsIDirectoryServiceProvider
84 * @return NS_OK for success;
85 * other error codes indicate a failure during initialisation.
88 extern "C" NS_HIDDEN NS_METHOD
89 NS_InitEmbedding(nsILocalFile *aMozBinDirectory,
90 nsIDirectoryServiceProvider *aAppFileLocProvider,
91 nsStaticModuleInfo const *aStaticComponents = nsnull,
92 PRUint32 aStaticComponentCount = 0);
95 /**
96 * Terminates the Gecko embedding layer. Call this function during shutdown to
97 * ensure that global services are unloaded, files are closed and
98 * XPCOM is shutdown.
100 * @status FROZEN
102 * @note Release any XPCOM objects within Gecko that you may be holding a
103 * reference to before calling this function.
105 * @return NS_OK
107 extern "C" NS_HIDDEN NS_METHOD
108 NS_TermEmbedding();
110 /*---------------------------------------------------------------------------*/
111 /* Event processing APIs. The native OS dependencies mean you must be */
112 /* building on a supported platform to get the functions below. */
113 /*---------------------------------------------------------------------------*/
115 #undef MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING
117 /* Win32 specific stuff */
118 #if defined (WIN32) || defined (WINCE)
119 #include "windows.h"
121 * @var typedef MSG nsEmbedNativeEvent
123 * Embedding events are native <CODE>MSG</CODE> structs on Win32.
125 typedef MSG nsEmbedNativeEvent;
126 #define MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING
127 #endif
129 /* OS/2 specific stuff */
130 #ifdef XP_OS2
131 #include "os2.h"
134 * @var typedef MSG nsEmbedNativeEvent
136 * Embedding events are native <CODE>QMSG</CODE> structs on OS/2.
138 typedef QMSG nsEmbedNativeEvent;
139 #define MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING
140 #endif
142 /* Mac specific stuff */
143 /* TODO implementation left as an exercise for the reader */
145 /* GTK specific stuff */
146 /* TODO implementation left as an exercise for the reader */
149 #ifdef MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING
152 * @fn nsresult NS_HandleEmbeddingEvent(nsEmbedNativeEvent &aEvent, PRBool &aWasHandled)
154 * This function gives Gecko the chance to process a native window events.
155 * Call this function from your message processing loop.
157 * @status UNDER_REVIEW
159 * @param aEvent The native UI event
160 * @param aWasHandled Returns with <CODE>PR_TRUE</CODE> if the end was
161 * handled; in which case it should not be handled by your
162 * application.
164 * @return NS_OK
166 extern "C" NS_HIDDEN NS_METHOD
167 NS_HandleEmbeddingEvent(nsEmbedNativeEvent &aEvent, PRBool &aWasHandled);
169 #endif /* MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING */
171 #endif /* NSEMBEDAPI_H */