Bug 1073336 part 5 - Add AnimationPlayerCollection::PlayerUpdated; r=dbaron
[gecko.git] / widget / qt / nsWidgetFactory.cpp
blobdfdc7de93cc34de982ca86f8b60e18e83344ab33
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* Copyright 2012 Mozilla Foundation and Mozilla contributors
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "base/basictypes.h"
19 #include "mozilla/ModuleUtils.h"
21 #include "nsCOMPtr.h"
22 #include "nsWidgetsCID.h"
23 #include "nsAppShell.h"
25 #include "nsWindow.h"
26 #include "nsLookAndFeel.h"
27 #include "nsAppShellSingleton.h"
28 #include "nsScreenManagerQt.h"
29 #include "nsIdleServiceQt.h"
30 #include "nsTransferable.h"
31 #include "nsBidiKeyboard.h"
33 #include "nsHTMLFormatConverter.h"
34 #include "nsXULAppAPI.h"
36 #ifdef NS_PRINTING
37 #include "nsDeviceContextSpecQt.h"
38 #include "nsPrintSession.h"
39 #include "nsPrintOptionsQt.h"
40 #include "nsPrintDialogQt.h"
41 #endif
43 #include "nsClipboard.h"
44 #include "nsClipboardHelper.h"
46 #if defined(MOZ_X11)
47 #include "GfxInfoX11.h"
48 #endif
50 using namespace mozilla::widget;
52 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
53 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
54 NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerQt)
55 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
56 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceQt, nsIdleServiceQt::GetInstance)
57 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
58 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
59 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
60 #ifdef NS_PRINTING
61 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecQt)
62 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsQt, Init)
63 NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorQt)
64 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
65 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceQt, Init)
66 #endif
68 #if defined(MOZ_X11)
69 namespace mozilla {
70 namespace widget {
71 // This constructor should really be shared with all platforms.
72 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init)
75 #endif
78 NS_DEFINE_NAMED_CID(NS_APPSHELL_CID);
79 NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID);
80 NS_DEFINE_NAMED_CID(NS_WINDOW_CID);
81 NS_DEFINE_NAMED_CID(NS_CHILD_CID);
82 NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
83 NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID);
84 NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID);
85 NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID);
86 NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
87 NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID);
88 #if defined(MOZ_X11)
89 NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);
90 #endif
91 #ifdef NS_PRINTING
92 NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID);
93 NS_DEFINE_NAMED_CID(NS_PRINTER_ENUMERATOR_CID);
94 NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID);
95 NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID);
96 NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID);
97 #endif
99 static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
100 { &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor },
101 { &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor },
102 { &kNS_CHILD_CID, false, nullptr, nsWindowConstructor },
103 { &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor },
104 { &kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor },
105 { &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor },
106 { &kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceQtConstructor },
107 { &kNS_SCREENMANAGER_CID, false, nullptr, nsScreenManagerQtConstructor },
108 { &kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor },
109 { &kNS_WINDOW_CID, false, nullptr, nsWindowConstructor },
110 #if defined(MOZ_X11)
111 { &kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor },
112 #endif
113 #ifdef NS_PRINTING
114 { &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecQtConstructor },
115 { &kNS_PRINTDIALOGSERVICE_CID, false, nullptr, nsPrintDialogServiceQtConstructor },
116 { &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorQtConstructor },
117 { &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor },
118 { &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintOptionsQtConstructor },
119 #endif
120 { nullptr }
123 static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
124 { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID },
125 { "@mozilla.org/widget/appshell/qt;1", &kNS_APPSHELL_CID },
126 { "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID },
127 { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID },
128 { "@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID },
129 { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID },
130 { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID },
131 { "@mozilla.org/widgets/child_window/qt;1", &kNS_CHILD_CID },
132 { "@mozilla.org/widgets/window/qt;1", &kNS_WINDOW_CID },
133 { "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID },
134 #if defined(MOZ_X11)
135 { "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID },
136 #endif
137 #ifdef NS_PRINTING
138 { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID },
139 { "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID },
140 { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID },
141 { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID },
142 { NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID },
143 #endif
144 { nullptr }
147 static void
148 nsWidgetQtModuleDtor()
150 nsLookAndFeel::Shutdown();
151 nsAppShellShutdown();
154 static const mozilla::Module kWidgetModule = {
155 mozilla::Module::kVersion,
156 kWidgetCIDs,
157 kWidgetContracts,
158 nullptr,
159 nullptr,
160 nsAppShellInit,
161 nsWidgetQtModuleDtor
164 NSMODULE_DEFN(nsWidgetQtModule) = &kWidgetModule;