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