michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* Copyright 2012 Mozilla Foundation and Mozilla contributors michael@0: * michael@0: * Licensed under the Apache License, Version 2.0 (the "License"); michael@0: * you may not use this file except in compliance with the License. michael@0: * You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, software michael@0: * distributed under the License is distributed on an "AS IS" BASIS, michael@0: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. michael@0: * See the License for the specific language governing permissions and michael@0: * limitations under the License. michael@0: */ michael@0: michael@0: #include "base/basictypes.h" michael@0: michael@0: #include "mozilla/ModuleUtils.h" michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsWidgetsCID.h" michael@0: #include "nsAppShell.h" michael@0: michael@0: #include "nsWindow.h" michael@0: #include "nsLookAndFeel.h" michael@0: #include "nsAppShellSingleton.h" michael@0: #include "nsScreenManagerQt.h" michael@0: #include "nsIdleServiceQt.h" michael@0: #include "nsTransferable.h" michael@0: #include "nsBidiKeyboard.h" michael@0: michael@0: #include "nsHTMLFormatConverter.h" michael@0: #include "nsXULAppAPI.h" michael@0: michael@0: #ifdef NS_PRINTING michael@0: #include "nsDeviceContextSpecQt.h" michael@0: #include "nsPrintSession.h" michael@0: #include "nsPrintOptionsQt.h" michael@0: #include "nsPrintDialogQt.h" michael@0: #endif michael@0: michael@0: #include "nsClipboard.h" michael@0: #include "nsClipboardHelper.h" michael@0: michael@0: #if defined(MOZ_X11) michael@0: #include "GfxInfoX11.h" michael@0: #endif michael@0: michael@0: using namespace mozilla::widget; michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerQt) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter) michael@0: NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceQt, nsIdleServiceQt::GetInstance) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper) michael@0: #ifdef NS_PRINTING michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecQt) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsQt, Init) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorQt) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceQt, Init) michael@0: #endif michael@0: michael@0: #if defined(MOZ_X11) michael@0: namespace mozilla { michael@0: namespace widget { michael@0: // This constructor should really be shared with all platforms. michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init) michael@0: } michael@0: } michael@0: #endif michael@0: michael@0: michael@0: NS_DEFINE_NAMED_CID(NS_APPSHELL_CID); michael@0: NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID); michael@0: NS_DEFINE_NAMED_CID(NS_WINDOW_CID); michael@0: NS_DEFINE_NAMED_CID(NS_CHILD_CID); michael@0: NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID); michael@0: NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID); michael@0: #if defined(MOZ_X11) michael@0: NS_DEFINE_NAMED_CID(NS_GFXINFO_CID); michael@0: #endif michael@0: #ifdef NS_PRINTING michael@0: NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_PRINTER_ENUMERATOR_CID); michael@0: NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID); michael@0: NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID); michael@0: NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID); michael@0: #endif michael@0: michael@0: static const mozilla::Module::CIDEntry kWidgetCIDs[] = { michael@0: { &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor }, michael@0: { &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor }, michael@0: { &kNS_CHILD_CID, false, nullptr, nsWindowConstructor }, michael@0: { &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor }, michael@0: { &kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor }, michael@0: { &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor }, michael@0: { &kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceQtConstructor }, michael@0: { &kNS_SCREENMANAGER_CID, false, nullptr, nsScreenManagerQtConstructor }, michael@0: { &kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor }, michael@0: { &kNS_WINDOW_CID, false, nullptr, nsWindowConstructor }, michael@0: #if defined(MOZ_X11) michael@0: { &kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor }, michael@0: #endif michael@0: #ifdef NS_PRINTING michael@0: { &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecQtConstructor }, michael@0: { &kNS_PRINTDIALOGSERVICE_CID, false, nullptr, nsPrintDialogServiceQtConstructor }, michael@0: { &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorQtConstructor }, michael@0: { &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor }, michael@0: { &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintOptionsQtConstructor }, michael@0: #endif michael@0: { nullptr } michael@0: }; michael@0: michael@0: static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { michael@0: { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID }, michael@0: { "@mozilla.org/widget/appshell/qt;1", &kNS_APPSHELL_CID }, michael@0: { "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID }, michael@0: { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID }, michael@0: { "@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID }, michael@0: { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID }, michael@0: { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID }, michael@0: { "@mozilla.org/widgets/child_window/qt;1", &kNS_CHILD_CID }, michael@0: { "@mozilla.org/widgets/window/qt;1", &kNS_WINDOW_CID }, michael@0: { "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID }, michael@0: #if defined(MOZ_X11) michael@0: { "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID }, michael@0: #endif michael@0: #ifdef NS_PRINTING michael@0: { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID }, michael@0: { "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID }, michael@0: { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID }, michael@0: { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID }, michael@0: { NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID }, michael@0: #endif michael@0: { nullptr } michael@0: }; michael@0: michael@0: static void michael@0: nsWidgetQtModuleDtor() michael@0: { michael@0: nsLookAndFeel::Shutdown(); michael@0: nsAppShellShutdown(); michael@0: } michael@0: michael@0: static const mozilla::Module kWidgetModule = { michael@0: mozilla::Module::kVersion, michael@0: kWidgetCIDs, michael@0: kWidgetContracts, michael@0: nullptr, michael@0: nullptr, michael@0: nsAppShellInit, michael@0: nsWidgetQtModuleDtor michael@0: }; michael@0: michael@0: NSMODULE_DEFN(nsWidgetQtModule) = &kWidgetModule;