Make optional compilation with Qt cairo-xlib surface (for comparing and bugfixing)
[mozilla-central.git] / widget / src / qt / nsWidgetFactory.cpp
blob4ed4c9cd40f087402e38648501b3931b8c6af182
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 * John C. Griggs <johng@corel.com>.
19 * Portions created by the Initial Developer are Copyright (C) 2000
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * Zack Rusin <zack@kde.org>
24 * Lars Knoll <knoll@kde.org>
25 * John C. Griggs <johng@corel.com>
26 * Dan Rosen <dr@netscape.com>
28 * Alternatively, the contents of this file may be used under the terms of
29 * either the GNU General Public License Version 2 or later (the "GPL"), or
30 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 * in which case the provisions of the GPL or the LGPL are applicable instead
32 * of those above. If you wish to allow use of your version of this file only
33 * under the terms of either the GPL or the LGPL, and not to allow others to
34 * use your version of this file under the terms of the MPL, indicate your
35 * decision by deleting the provisions above and replace them with the notice
36 * and other provisions required by the GPL or the LGPL. If you do not delete
37 * the provisions above, a recipient may use your version of this file under
38 * the terms of any one of the MPL, the GPL or the LGPL.
40 * ***** END LICENSE BLOCK ***** */
42 #include "nsIGenericFactory.h"
43 #include "nsIModule.h"
45 #include "nsCOMPtr.h"
46 #include "nsWidgetsCID.h"
47 #include "nsAppShell.h"
48 #include "nsWindow.h"
49 #include "nsToolkit.h"
50 #include "nsHTMLFormatConverter.h"
51 #include "nsTransferable.h"
52 #include "nsLookAndFeel.h"
53 #include "nsAppShellSingleton.h"
54 #include "nsScreenManagerQt.h"
56 // #include "nsIComponentRegistrar.h"
57 // #include "nsComponentManagerUtils.h"
58 // #include "nsAutoPtr.h"
59 //
62 #include "nsFilePicker.h"
63 #include "nsClipboard.h"
64 #include "nsClipboardHelper.h"
65 #include "nsIdleServiceQt.h"
66 #include "nsDragService.h"
67 #include "nsSound.h"
68 #include "nsBidiKeyboard.h"
69 #include "nsNativeThemeQt.h"
70 // #include "nsScrollbar.h"
71 //
72 // #include "nsGUIEvent.h"
73 // #include "nsQtEventDispatcher.h"
74 // #include "nsIRenderingContext.h"
75 // #include "nsIServiceManager.h"
76 // #include "nsGfxCIID.h"
77 // #include "nsIPrefBranch.h"
78 // #include "nsIPrefService.h"
79 //
81 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
82 NS_GENERIC_FACTORY_CONSTRUCTOR(nsChildWindow)
83 NS_GENERIC_FACTORY_CONSTRUCTOR(nsPopupWindow)
84 NS_GENERIC_FACTORY_CONSTRUCTOR(nsToolkit)
85 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
86 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
87 NS_GENERIC_FACTORY_CONSTRUCTOR(nsLookAndFeel)
88 NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerQt)
91 static NS_DEFINE_CID(kNativeScrollCID, NS_NATIVESCROLLBAR_CID);
96 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
97 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
98 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
99 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
100 NS_GENERIC_FACTORY_CONSTRUCTOR(nsIdleServiceQt)
101 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
102 #ifndef QT_XLIB_SURFACE
103 NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeThemeQt)
104 #endif
105 //NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeScrollbar)
106 NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
109 static const nsModuleComponentInfo components[] =
111 { "Qt nsWindow",
112 NS_WINDOW_CID,
113 "@mozilla.org/widgets/window/qt;1",
114 nsWindowConstructor },
115 { "Qt Child nsWindow",
116 NS_CHILD_CID,
117 "@mozilla.org/widgets/child_window/qt;1",
118 nsChildWindowConstructor },
119 { "Qt AppShell",
120 NS_APPSHELL_CID,
121 "@mozilla.org/widget/appshell/qt;1",
122 nsAppShellConstructor },
123 { "Qt Look And Feel",
124 NS_LOOKANDFEEL_CID,
125 "@mozilla.org/widget/lookandfeel/qt;1",
126 nsLookAndFeelConstructor },
127 { "Qt Popup nsWindow",
128 NS_POPUP_CID,
129 "@mozilla.org/widgets/popup_window/qt;1",
130 nsPopupWindowConstructor },
131 { "HTML Format Converter",
132 NS_HTMLFORMATCONVERTER_CID,
133 "@mozilla.org/widget/htmlformatconverter/qt;1",
134 nsHTMLFormatConverterConstructor },
135 { "Qt Toolkit",
136 NS_TOOLKIT_CID,
137 "@mozilla.org/widget/toolkit/qt;1",
138 nsToolkitConstructor },
139 { "Transferrable",
140 NS_TRANSFERABLE_CID,
141 "@mozilla.org/widget/transferable;1",
142 nsTransferableConstructor },
143 { "Qt Screen Manager",
144 NS_SCREENMANAGER_CID,
145 "@mozilla.org/gfx/screenmanager;1",
146 nsScreenManagerQtConstructor },
147 { "Qt Clipboard",
148 NS_CLIPBOARD_CID,
149 "@mozilla.org/widget/clipboard;1",
150 nsClipboardConstructor },
151 { "Clipboard Helper",
152 NS_CLIPBOARDHELPER_CID,
153 "@mozilla.org/widget/clipboardhelper;1",
154 nsClipboardHelperConstructor },
155 { "Qt Drag Service",
156 NS_DRAGSERVICE_CID,
157 "@mozilla.org/widget/dragservice;1",
158 nsDragServiceConstructor },
159 { "Qt Bidi Keyboard",
160 NS_BIDIKEYBOARD_CID,
161 "@mozilla.org/widget/bidikeyboard;1",
162 nsBidiKeyboardConstructor },
163 { "Qt Idle Service",
164 NS_IDLE_SERVICE_CID,
165 "@mozilla.org/widget/idleservice;1",
166 nsIdleServiceQtConstructor },
167 { "Qt Sound",
168 NS_SOUND_CID,
169 "@mozilla.org/sound;1",
170 nsSoundConstructor },
171 #ifndef QT_XLIB_SURFACE
172 { "Native Theme Renderer",
173 NS_THEMERENDERER_CID,
174 "@mozilla.org/chrome/chrome-native-theme;1",
175 nsNativeThemeQtConstructor },
176 #endif
177 { "Qt File Picker",
178 NS_FILEPICKER_CID,
179 "@mozilla.org/filepicker;1",
180 nsFilePickerConstructor }
184 PR_STATIC_CALLBACK(void)
185 nsWidgetQtModuleDtor(nsIModule *aSelf)
187 nsSound::Shutdown();
188 nsAppShellShutdown(aSelf);
191 NS_IMPL_NSGETMODULE_WITH_CTOR_DTOR(nsWidgetQtModule,
192 components,
193 nsAppShellInit,
194 nsWidgetQtModuleDtor)