2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
#include "nsToolkit.h"
|
2006-05-10 17:30:15 +00:00
|
|
|
#include "nsAppShell.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsWindow.h"
|
2006-05-10 17:30:15 +00:00
|
|
|
#include "nsWidgetsCID.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "prmon.h"
|
|
|
|
#include "prtime.h"
|
2002-09-28 15:04:47 +00:00
|
|
|
#include "nsIServiceManager.h"
|
2005-02-27 17:52:44 +00:00
|
|
|
#include "nsComponentManagerUtils.h"
|
2005-08-28 18:42:57 +00:00
|
|
|
#include <objbase.h>
|
2013-08-15 04:25:12 +00:00
|
|
|
#include "WinUtils.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2009-01-05 18:17:44 +00:00
|
|
|
#include "nsUXThemeData.h"
|
|
|
|
|
2002-10-17 06:47:01 +00:00
|
|
|
// unknwn.h is needed to build with WIN32_LEAN_AND_MEAN
|
|
|
|
#include <unknwn.h>
|
|
|
|
|
2013-08-15 04:25:12 +00:00
|
|
|
using namespace mozilla::widget;
|
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
nsToolkit* nsToolkit::gToolkit = nullptr;
|
1998-04-13 20:24:54 +00:00
|
|
|
HINSTANCE nsToolkit::mDllInstance = 0;
|
2014-11-17 17:51:09 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// constructor
|
|
|
|
//
|
|
|
|
//-------------------------------------------------------------------------
|
1998-09-23 19:19:23 +00:00
|
|
|
nsToolkit::nsToolkit() {
|
2011-10-05 23:54:07 +00:00
|
|
|
MOZ_COUNT_CTOR(nsToolkit);
|
2000-01-07 00:34:34 +00:00
|
|
|
|
2011-04-25 03:10:12 +00:00
|
|
|
#if defined(MOZ_STATIC_COMPONENT_LIBS)
|
2013-10-08 18:48:20 +00:00
|
|
|
nsToolkit::Startup(GetModuleHandle(nullptr));
|
2001-06-20 20:21:49 +00:00
|
|
|
#endif
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// destructor
|
|
|
|
//
|
|
|
|
//-------------------------------------------------------------------------
|
2011-10-05 23:54:07 +00:00
|
|
|
nsToolkit::~nsToolkit() { MOZ_COUNT_DTOR(nsToolkit); }
|
2001-06-20 20:21:49 +00:00
|
|
|
|
|
|
|
void nsToolkit::Startup(HMODULE hModule) {
|
2002-09-09 23:58:39 +00:00
|
|
|
nsToolkit::mDllInstance = hModule;
|
2013-08-15 04:25:12 +00:00
|
|
|
WinUtils::Initialize();
|
2013-08-16 02:02:09 +00:00
|
|
|
nsUXThemeData::Initialize();
|
2001-06-20 20:21:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void nsToolkit::Shutdown() {
|
2011-10-25 15:05:32 +00:00
|
|
|
delete gToolkit;
|
2012-07-30 14:20:58 +00:00
|
|
|
gToolkit = nullptr;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-10-15 00:49:11 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
//
|
2011-10-25 15:05:32 +00:00
|
|
|
// Return the nsToolkit for the current thread. If a toolkit does not
|
1999-10-15 00:49:11 +00:00
|
|
|
// yet exist, then one will be created...
|
|
|
|
//
|
|
|
|
//-------------------------------------------------------------------------
|
2011-10-25 15:05:32 +00:00
|
|
|
// static
|
|
|
|
nsToolkit* nsToolkit::GetToolkit() {
|
|
|
|
if (!gToolkit) {
|
|
|
|
gToolkit = new nsToolkit();
|
1999-10-15 00:49:11 +00:00
|
|
|
}
|
|
|
|
|
2011-10-25 15:05:32 +00:00
|
|
|
return gToolkit;
|
1999-10-15 00:49:11 +00:00
|
|
|
}
|