2008-04-19 19:02:52 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2014-02-21 06:09:02 +04: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-05 00:51:42 +03:00
|
|
|
|
2010-07-02 17:51:58 +04:00
|
|
|
#include "mozilla/ModuleUtils.h"
|
2015-02-19 09:50:19 +03:00
|
|
|
#include "mozilla/WidgetUtils.h"
|
2008-04-19 19:05:49 +04:00
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsWidgetsCID.h"
|
2014-02-21 06:09:02 +04:00
|
|
|
#include "nsAppShell.h"
|
|
|
|
|
|
|
|
#include "nsWindow.h"
|
2008-04-19 19:13:35 +04:00
|
|
|
#include "nsLookAndFeel.h"
|
2008-04-19 19:13:59 +04:00
|
|
|
#include "nsAppShellSingleton.h"
|
2008-04-19 19:14:15 +04:00
|
|
|
#include "nsScreenManagerQt.h"
|
2008-04-19 19:41:14 +04:00
|
|
|
#include "nsIdleServiceQt.h"
|
2014-02-21 06:09:02 +04:00
|
|
|
#include "nsTransferable.h"
|
2008-04-19 19:43:48 +04:00
|
|
|
#include "nsBidiKeyboard.h"
|
2014-02-21 06:09:02 +04:00
|
|
|
|
|
|
|
#include "nsHTMLFormatConverter.h"
|
|
|
|
#include "nsXULAppAPI.h"
|
|
|
|
|
2010-10-07 23:19:33 +04:00
|
|
|
#ifdef NS_PRINTING
|
|
|
|
#include "nsDeviceContextSpecQt.h"
|
|
|
|
#include "nsPrintSession.h"
|
|
|
|
#include "nsPrintOptionsQt.h"
|
|
|
|
#include "nsPrintDialogQt.h"
|
|
|
|
#endif
|
2014-02-21 06:09:02 +04:00
|
|
|
|
|
|
|
#include "nsClipboard.h"
|
|
|
|
#include "nsClipboardHelper.h"
|
2010-10-20 19:19:24 +04:00
|
|
|
|
2011-05-04 00:07:17 +04:00
|
|
|
#if defined(MOZ_X11)
|
|
|
|
#include "GfxInfoX11.h"
|
2015-05-19 04:13:59 +03:00
|
|
|
#else
|
|
|
|
#include "GfxInfo.h"
|
2011-05-04 00:07:17 +04:00
|
|
|
#endif
|
|
|
|
|
2014-02-21 06:09:02 +04:00
|
|
|
using namespace mozilla::widget;
|
2008-04-19 19:05:49 +04:00
|
|
|
|
2008-04-19 19:11:13 +04:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
|
2014-02-21 06:09:02 +04:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerQt)
|
2008-04-19 19:11:21 +04:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
|
2014-02-21 06:09:02 +04:00
|
|
|
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceQt, nsIdleServiceQt::GetInstance)
|
2008-04-19 19:11:21 +04:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
|
2008-04-19 19:02:52 +04:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
|
2010-10-07 23:19:33 +04: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-04 00:07:17 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
// This constructor should really be shared with all platforms.
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-21 06:09:02 +04:00
|
|
|
NS_DEFINE_NAMED_CID(NS_APPSHELL_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID);
|
2010-07-02 17:51:58 +04:00
|
|
|
NS_DEFINE_NAMED_CID(NS_WINDOW_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_CHILD_CID);
|
2014-02-21 06:09:02 +04: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 17:51:58 +04: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 06:09:02 +04:00
|
|
|
NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);
|
2010-10-07 23:19:33 +04: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-04 00:07:17 +04:00
|
|
|
#endif
|
|
|
|
|
2010-07-02 17:51:58 +04:00
|
|
|
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
|
2013-10-08 22:47:49 +04:00
|
|
|
{ &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor },
|
2014-02-21 06:09:02 +04:00
|
|
|
{ &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor },
|
|
|
|
{ &kNS_CHILD_CID, false, nullptr, nsWindowConstructor },
|
2013-10-08 22:47:49 +04: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 06:09:02 +04: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 23:19:33 +04:00
|
|
|
#ifdef NS_PRINTING
|
2013-10-08 22:47:49 +04:00
|
|
|
{ &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecQtConstructor },
|
|
|
|
{ &kNS_PRINTDIALOGSERVICE_CID, false, nullptr, nsPrintDialogServiceQtConstructor },
|
2014-02-21 06:09:02 +04:00
|
|
|
{ &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorQtConstructor },
|
|
|
|
{ &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor },
|
|
|
|
{ &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintOptionsQtConstructor },
|
2011-05-04 00:07:17 +04:00
|
|
|
#endif
|
2013-10-08 22:47:49 +04:00
|
|
|
{ nullptr }
|
2010-07-02 17:51:58 +04:00
|
|
|
};
|
2008-04-19 19:44:21 +04:00
|
|
|
|
2010-07-02 17:51:58 +04:00
|
|
|
static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
|
2014-02-21 06:09:02 +04:00
|
|
|
{ "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID },
|
2010-07-02 17:51:58 +04:00
|
|
|
{ "@mozilla.org/widget/appshell/qt;1", &kNS_APPSHELL_CID },
|
2014-02-21 06:09:02 +04:00
|
|
|
{ "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID },
|
2010-07-02 17:51:58 +04: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 06:09:02 +04: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 23:19:33 +04:00
|
|
|
#ifdef NS_PRINTING
|
2014-02-21 06:09:02 +04:00
|
|
|
{ "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID },
|
2010-10-07 23:19:33 +04:00
|
|
|
{ "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID },
|
|
|
|
{ "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID },
|
2014-02-21 06:09:02 +04:00
|
|
|
{ "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID },
|
2010-10-07 23:19:33 +04:00
|
|
|
{ NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID },
|
2011-05-04 00:07:17 +04:00
|
|
|
#endif
|
2013-10-08 22:47:49 +04:00
|
|
|
{ nullptr }
|
2008-04-19 19:02:52 +04:00
|
|
|
};
|
|
|
|
|
2008-10-10 19:04:34 +04:00
|
|
|
static void
|
2010-07-02 17:51:58 +04:00
|
|
|
nsWidgetQtModuleDtor()
|
2008-04-19 19:13:59 +04:00
|
|
|
{
|
2015-02-19 09:50:19 +03:00
|
|
|
// Shutdown all XP level widget classes.
|
|
|
|
WidgetUtils::Shutdown();
|
|
|
|
|
2011-09-09 06:27:11 +04:00
|
|
|
nsLookAndFeel::Shutdown();
|
2010-07-02 17:51:58 +04:00
|
|
|
nsAppShellShutdown();
|
2008-04-19 19:13:59 +04:00
|
|
|
}
|
|
|
|
|
2010-07-02 17:51:58 +04:00
|
|
|
static const mozilla::Module kWidgetModule = {
|
|
|
|
mozilla::Module::kVersion,
|
|
|
|
kWidgetCIDs,
|
|
|
|
kWidgetContracts,
|
2013-10-08 22:47:49 +04:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2010-07-02 17:51:58 +04:00
|
|
|
nsAppShellInit,
|
|
|
|
nsWidgetQtModuleDtor
|
|
|
|
};
|
2008-04-19 19:13:59 +04:00
|
|
|
|
2010-07-02 17:51:58 +04:00
|
|
|
NSMODULE_DEFN(nsWidgetQtModule) = &kWidgetModule;
|