Back to index

lightning-sunbird  0.9+nobinonly
nsWidgetFactory.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; 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 mozilla.org code.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK *****
00038  *
00039  * This Original Code has been modified by IBM Corporation.
00040  * Modifications made by IBM described herein are
00041  * Copyright (c) International Business Machines
00042  * Corporation, 2000
00043  *
00044  * Modifications to Mozilla code or documentation
00045  * identified per MPL Section 3.3
00046  *
00047  * Date             Modified by            Description of modification
00048  * 03/23/2000       IBM Corp.              Added support for directory picker dialog.
00049  * 03/24/2000       IBM Corp.              Updated based on nsWinWidgetFactory.cpp.
00050  * 05/31/2000       IBM Corp.              Enabled timer stuff
00051  * 06/30/2000       sobotka@axess.com      Added nsFilePicker
00052  * 03/11/2001       achimha@innotek.de     converted to XPCOM module
00053  * 03/20/2001       achimha@innotek.de     Added class for embedded module init
00054  * 12/16/2001       pavlov@netscape.com    Removed timer stuff
00055  */
00056 
00057 #include "nsIGenericFactory.h"
00058 #include "nsIModule.h"
00059 #include "nsCOMPtr.h"
00060 #include "nsWidgetsCID.h"
00061 
00062 //#include "nsWidgetDefs.h"
00063 
00064 // class definition headers
00065 #include "nsAppShell.h"
00066 #include "nsBidiKeyboard.h"
00067 #include "nsWindow.h"
00068 #include "nsDragService.h"
00069 #include "nsILocalFile.h"
00070 #include "nsFilePicker.h"
00071 #include "nsLookAndFeel.h"
00072 #include "nsSound.h"
00073 #include "nsToolkit.h"
00074 
00075 // Drag & Drop, Clipboard
00076 #include "nsClipboard.h"
00077 #include "nsClipboardHelper.h"
00078 #include "nsTransferable.h"
00079 #include "nsHTMLFormatConverter.h"
00080 
00081 #include "nsFrameWindow.h" // OS/2 only
00082 
00083 // objects that just require generic constructors
00084 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
00085 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
00086 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
00087 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
00088 NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
00089 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShell)
00090 NS_GENERIC_FACTORY_CONSTRUCTOR(nsFrameWindow)
00091 NS_GENERIC_FACTORY_CONSTRUCTOR(nsLookAndFeel)
00092 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
00093 NS_GENERIC_FACTORY_CONSTRUCTOR(nsToolkit)
00094 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
00095 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
00096 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
00097 
00098 // component definition, will be exported using XPCOM
00099 static const nsModuleComponentInfo components[] =
00100 {
00101   { "OS/2 AppShell",
00102     NS_APPSHELL_CID,
00103     "@mozilla.org/widget/appshell/os2;1",
00104     nsAppShellConstructor },
00105   { "OS/2 Bidi Keyboard",
00106     NS_BIDIKEYBOARD_CID,
00107     "@mozilla.org/widget/bidikeyboard;1",
00108     nsBidiKeyboardConstructor },
00109   { "OS/2 Child Window",
00110     NS_CHILD_CID,
00111     "@mozilla.org/widget/child_window/os2;1",
00112     nsWindowConstructor },
00113   { "OS/2 Clipboard",
00114     NS_CLIPBOARD_CID,
00115     "@mozilla.org/widget/clipboard;1",
00116     nsClipboardConstructor },
00117   { "Clipboard Helper",
00118     NS_CLIPBOARDHELPER_CID,
00119     "@mozilla.org/widget/clipboardhelper;1",
00120     nsClipboardHelperConstructor },
00121   { "OS/2 Drag Service",
00122     NS_DRAGSERVICE_CID,
00123     "@mozilla.org/widget/dragservice;1",
00124     nsDragServiceConstructor },
00125   { "OS/2 File Picker",
00126     NS_FILEPICKER_CID,
00127     "@mozilla.org/filepicker;1",
00128     nsFilePickerConstructor },
00129   { "OS/2 Look And Feel",
00130     NS_LOOKANDFEEL_CID,
00131     "@mozilla.org/widget/lookandfeel;1",
00132     nsLookAndFeelConstructor },
00133   { "OS/2 Sound",
00134     NS_SOUND_CID,
00135     "@mozilla.org/sound;1",
00136     nsSoundConstructor },
00137   { "OS/2 Toolkit",
00138     NS_TOOLKIT_CID,
00139     "@mozilla.org/widget/toolkit/os2;1",
00140     nsToolkitConstructor },
00141   { "OS/2 Frame Window",
00142     NS_WINDOW_CID,
00143     "@mozilla.org/widget/window/os2;1",
00144     nsFrameWindowConstructor },
00145   { "OS/2 Transferable",
00146     NS_TRANSFERABLE_CID,
00147     "@mozilla.org/widget/transferable;1",
00148     nsTransferableConstructor },
00149   { "OS/2 HTML Format Converter",
00150     NS_HTMLFORMATCONVERTER_CID,
00151     "@mozilla.org/widget/htmlformatconverter;1",
00152     nsHTMLFormatConverterConstructor }
00153 };
00154 
00155 PR_STATIC_CALLBACK(void)
00156 nsWidgetOS2ModuleDtor(nsIModule *self)
00157 {
00158   nsWindow::ReleaseGlobals();
00159   nsFilePicker::ReleaseGlobals();
00160 }
00161 
00162 NS_IMPL_NSGETMODULE_WITH_DTOR(nsWidgetOS2Module,
00163                               components,
00164                               nsWidgetOS2ModuleDtor)