Back to index

lightning-sunbird  0.9+nobinonly
nsWidgetFactory.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Christopher Blizzard.
00019  * Portions created by the Initial Developer are Copyright (C) 2000
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Christopher Blizzzard <blizzard@mozilla.org>
00024  *   Stuart Parmenter <pavlov@netscape.com>
00025  *   Dan Rosen <dr@netscape.com>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either the GNU General Public License Version 2 or later (the "GPL"), or
00029  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #include "nsIGenericFactory.h"
00042 #include "nsIModule.h"
00043 #include "nsCOMPtr.h"
00044 #include "nsWidgetsCID.h"
00045 
00046 #include "nsWindow.h"
00047 #include "nsButton.h"
00048 #include "nsCheckButton.h"
00049 #include "nsTextWidget.h"
00050 #include "nsAppShell.h"
00051 #include "nsToolkit.h"
00052 #include "nsLookAndFeel.h"
00053 #include "nsLabel.h"
00054 #include "nsTransferable.h"
00055 #include "nsClipboard.h"
00056 #include "nsClipboardHelper.h"
00057 #include "nsHTMLFormatConverter.h"
00058 #include "nsDragService.h"
00059 #include "nsSound.h"
00060 #include "nsBidiKeyboard.h"
00061 
00062 #include "nsGtkIMEHelper.h"
00063 
00064 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
00065 NS_GENERIC_FACTORY_CONSTRUCTOR(ChildWindow)
00066 NS_GENERIC_FACTORY_CONSTRUCTOR(nsButton)
00067 NS_GENERIC_FACTORY_CONSTRUCTOR(nsCheckButton)
00068 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextWidget)
00069 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShell)
00070 NS_GENERIC_FACTORY_CONSTRUCTOR(nsToolkit)
00071 NS_GENERIC_FACTORY_CONSTRUCTOR(nsLookAndFeel)
00072 NS_GENERIC_FACTORY_CONSTRUCTOR(nsLabel)
00073 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
00074 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
00075 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
00076 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
00077 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
00078 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
00079 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
00080 
00081 static const nsModuleComponentInfo components[] =
00082 {
00083   { "Gtk nsWindow",
00084     NS_WINDOW_CID,
00085     "@mozilla.org/widgets/window/gtk;1",
00086     nsWindowConstructor },
00087   { "Gtk Child nsWindow",
00088     NS_CHILD_CID,
00089     "@mozilla.org/widgets/child_window/gtk;1",
00090     ChildWindowConstructor },
00091   { "Gtk Button",
00092     NS_BUTTON_CID,
00093     "@mozilla.org/widgets/button/gtk;1",
00094     nsButtonConstructor },
00095   { "Gtk Check Button",
00096     NS_CHECKBUTTON_CID,
00097     "@mozilla.org/widgets/checkbutton/gtk;1",
00098     nsCheckButtonConstructor },
00099   { "Gtk Text Widget",
00100     NS_TEXTFIELD_CID,
00101     "@mozilla.org/widgets/textwidget/gtk;1",
00102     nsTextWidgetConstructor },
00103   { "Gtk AppShell",
00104     NS_APPSHELL_CID,
00105     "@mozilla.org/widget/appshell/gtk;1",
00106     nsAppShellConstructor },
00107   { "Gtk Toolkit",
00108     NS_TOOLKIT_CID,
00109     "@mozilla.org/widget/toolkit/gtk;1",
00110     nsToolkitConstructor },
00111   { "Gtk Look And Feel",
00112     NS_LOOKANDFEEL_CID,
00113     "@mozilla.org/widget/lookandfeel;1",
00114     nsLookAndFeelConstructor },
00115   { "Gtk Label",
00116     NS_LABEL_CID,
00117     "@mozilla.org/widget/label/gtk;1",
00118     nsLabelConstructor },
00119   { "Gtk Sound",
00120     NS_SOUND_CID,
00121     //    "@mozilla.org/widget/sound/gtk;1"
00122     "@mozilla.org/sound;1",
00123     nsSoundConstructor },
00124   { "Transferable",
00125     NS_TRANSFERABLE_CID,
00126     //    "@mozilla.org/widget/transferable/gtk;1",
00127     "@mozilla.org/widget/transferable;1",
00128     nsTransferableConstructor },
00129   { "Gtk Clipboard",
00130     NS_CLIPBOARD_CID,
00131     //    "@mozilla.org/widget/clipboard/gtk;1",
00132     "@mozilla.org/widget/clipboard;1",
00133     nsClipboardConstructor },
00134   { "Clipboard Helper",
00135     NS_CLIPBOARDHELPER_CID,
00136     "@mozilla.org/widget/clipboardhelper;1",
00137     nsClipboardHelperConstructor },
00138   { "HTML Format Converter",
00139     NS_HTMLFORMATCONVERTER_CID,
00140     "@mozilla.org/widget/htmlformatconverter;1",
00141     nsHTMLFormatConverterConstructor },
00142   { "Gtk Drag Service",
00143     NS_DRAGSERVICE_CID,
00144     //    "@mozilla.org/widget/dragservice/gtk;1",
00145     "@mozilla.org/widget/dragservice;1",
00146     nsDragServiceConstructor },
00147   { "Gtk Bidi Keyboard",
00148     NS_BIDIKEYBOARD_CID,
00149     "@mozilla.org/widget/bidikeyboard;1",
00150     nsBidiKeyboardConstructor }
00151 };
00152 
00153 PR_STATIC_CALLBACK(void)
00154 nsWidgetGTKModuleDtor(nsIModule *self)
00155 {
00156   nsWindow::ReleaseGlobals();
00157   nsAppShell::ReleaseGlobals();
00158   nsGtkIMEHelper::Shutdown();
00159 }
00160 
00161 NS_IMPL_NSGETMODULE_WITH_DTOR(nsWidgetGTKModule,
00162                               components,
00163                               nsWidgetGTKModuleDtor)