529 lines
19 KiB
C++
529 lines
19 KiB
C++
/*
|
|
Copyright 2015-2020 Amebis
|
|
Copyright 2016 GÉANT
|
|
|
|
This file is part of GÉANTLink.
|
|
|
|
GÉANTLink is free software: you can redistribute it and/or modify it
|
|
under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
GÉANTLink is distributed in the hope that it will be useful, but
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// wxEAPBannerPanel
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
wxEAPBannerPanel::wxEAPBannerPanel(wxWindow* parent) : wxEAPBannerPanelBase(parent)
|
|
{
|
|
}
|
|
|
|
|
|
/// \cond internal
|
|
bool wxEAPBannerPanel::AcceptsFocusFromKeyboard() const
|
|
{
|
|
return false;
|
|
}
|
|
/// \endcond
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// wxEAPGeneralDialog
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
wxEAPGeneralDialog::wxEAPGeneralDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style) :
|
|
wxEAPGeneralDialogBase(parent, id, title, pos, size, style)
|
|
{
|
|
// Set extra style here, as wxFormBuilder overrides all default flags.
|
|
this->SetExtraStyle(this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY);
|
|
|
|
// Load window icons.
|
|
#ifdef __WINDOWS__
|
|
wxIconBundle icons;
|
|
icons.AddIcon(wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)));
|
|
icons.AddIcon(wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXICON ), ::GetSystemMetrics(SM_CYICON )));
|
|
this->SetIcons(icons);
|
|
#else
|
|
this->SetIcon(wxIcon(wxICON(product.ico)));
|
|
#endif
|
|
|
|
m_buttonsOK->SetDefault();
|
|
}
|
|
|
|
|
|
void wxEAPGeneralDialog::AddContent(wxPanel **contents, size_t content_count)
|
|
{
|
|
if (content_count) {
|
|
for (size_t i = 0; i < content_count; i++)
|
|
m_panels->Add(contents[i], 0, wxALL|wxEXPAND, FromDIP(5));
|
|
|
|
this->Layout();
|
|
this->GetSizer()->Fit(this);
|
|
contents[0]->SetFocusFromKbd();
|
|
}
|
|
}
|
|
|
|
|
|
void wxEAPGeneralDialog::AddContent(wxPanel *content)
|
|
{
|
|
AddContent(&content, 1);
|
|
}
|
|
|
|
|
|
/// \cond internal
|
|
void wxEAPGeneralDialog::OnInitDialog(wxInitDialogEvent& event)
|
|
{
|
|
wxEAPGeneralDialogBase::OnInitDialog(event);
|
|
|
|
for (wxSizerItemList::compatibility_iterator panel = m_panels->GetChildren().GetFirst(); panel; panel = panel->GetNext())
|
|
panel->GetData()->GetWindow()->GetEventHandler()->ProcessEvent(event);
|
|
}
|
|
/// \endcond
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// wxEAPCredentialsDialog
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
wxEAPCredentialsDialog::wxEAPCredentialsDialog(const eap::config_provider &prov, wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style) :
|
|
wxEAPGeneralDialog(parent, id, title, pos, size, style)
|
|
{
|
|
// Set banner title.
|
|
m_banner->m_title->SetLabel(wxString::Format(_("%s Credentials"), wxEAPGetProviderName(prov.m_name)));
|
|
|
|
#if __DANGEROUS__LOG_CONFIDENTIAL_DATA
|
|
AddContent(new wxEAPCredentialLogWarningPanel(this));
|
|
#endif
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// wxEAPNotePanel
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
wxEAPNotePanel::wxEAPNotePanel(wxWindow* parent) :
|
|
m_provider_notice(NULL),
|
|
m_help_web_label(NULL),
|
|
m_help_web_value(NULL),
|
|
m_help_email_label(NULL),
|
|
m_help_email_value(NULL),
|
|
m_help_phone_label(NULL),
|
|
m_help_phone_value(NULL),
|
|
wxEAPNotePanelBase(parent)
|
|
{
|
|
}
|
|
|
|
|
|
/// \cond internal
|
|
|
|
bool wxEAPNotePanel::AcceptsFocusFromKeyboard() const
|
|
{
|
|
return m_help_web_value || m_help_email_value || m_help_phone_label;
|
|
}
|
|
|
|
|
|
void wxEAPNotePanel::CreateContactFields(const eap::config_provider &prov)
|
|
{
|
|
if (!prov.m_help_email.empty() || !prov.m_help_web.empty() || !prov.m_help_phone.empty()) {
|
|
m_provider_notice = new wxStaticText(this, wxID_ANY, wxString::Format(_("For additional help and instructions, please contact %s at:"),
|
|
!prov.m_name.empty() ? prov.m_name.c_str() : _("your provider")), wxDefaultPosition, wxDefaultSize, 0);
|
|
m_provider_notice->Wrap(FromDIP(449));
|
|
m_note_vert->Add(m_provider_notice, 0, wxUP|wxLEFT|wxRIGHT|wxEXPAND, FromDIP(5));
|
|
|
|
wxFlexGridSizer* sb_contact_tbl;
|
|
sb_contact_tbl = new wxFlexGridSizer(0, 2, FromDIP(5), FromDIP(5));
|
|
sb_contact_tbl->AddGrowableCol(1);
|
|
sb_contact_tbl->SetFlexibleDirection(wxBOTH);
|
|
sb_contact_tbl->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
|
|
|
wxFont font_wingdings(-1, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Wingdings"));
|
|
|
|
if (!prov.m_help_web.empty()) {
|
|
m_help_web_label = new wxStaticText(this, wxID_ANY, wxT("\xb6"), wxDefaultPosition, wxDefaultSize, 0);
|
|
m_help_web_label->Wrap(-1);
|
|
m_help_web_label->SetFont(font_wingdings);
|
|
sb_contact_tbl->Add(m_help_web_label, 0, wxEXPAND|wxALIGN_TOP, FromDIP(5));
|
|
|
|
m_help_web_value = new wxHyperlinkCtrl(this, wxID_ANY, prov.m_help_web, prov.m_help_web, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
|
|
m_help_web_value->SetToolTip(_("Open the default web browser"));
|
|
sb_contact_tbl->Add(m_help_web_value, 0, wxEXPAND|wxALIGN_TOP, FromDIP(5));
|
|
}
|
|
|
|
if (!prov.m_help_email.empty()) {
|
|
m_help_email_label = new wxStaticText(this, wxID_ANY, wxT("\x2a"), wxDefaultPosition, wxDefaultSize, 0);
|
|
m_help_email_label->Wrap(-1);
|
|
m_help_email_label->SetFont(font_wingdings);
|
|
sb_contact_tbl->Add(m_help_email_label, 0, wxEXPAND|wxALIGN_TOP, FromDIP(5));
|
|
|
|
m_help_email_value = new wxHyperlinkCtrl(this, wxID_ANY, prov.m_help_email, wxString(wxT("mailto:")) + prov.m_help_email, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
|
|
m_help_email_value->SetToolTip(_("Open your e-mail program"));
|
|
sb_contact_tbl->Add(m_help_email_value, 0, wxEXPAND|wxALIGN_TOP, FromDIP(5));
|
|
}
|
|
|
|
if (!prov.m_help_phone.empty()) {
|
|
m_help_phone_label = new wxStaticText(this, wxID_ANY, wxT("\x29"), wxDefaultPosition, wxDefaultSize, 0);
|
|
m_help_phone_label->Wrap(-1);
|
|
m_help_phone_label->SetFont(font_wingdings);
|
|
sb_contact_tbl->Add(m_help_phone_label, 0, wxEXPAND|wxALIGN_TOP, FromDIP(5));
|
|
|
|
m_help_phone_value = new wxHyperlinkCtrl(this, wxID_ANY, prov.m_help_phone, wxString(wxT("tel:")) + GetPhoneNumber(prov.m_help_phone.c_str()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
|
|
m_help_phone_value->SetToolTip(_("Dial the phone number"));
|
|
sb_contact_tbl->Add(m_help_phone_value, 0, wxEXPAND|wxALIGN_TOP, FromDIP(5));
|
|
}
|
|
|
|
m_note_vert->Add(sb_contact_tbl, 0, wxLEFT|wxRIGHT|wxDOWN|wxEXPAND, FromDIP(5));
|
|
}
|
|
}
|
|
|
|
/// \endcond
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// wxEAPProviderLockedPanel
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
wxEAPProviderLockedPanel::wxEAPProviderLockedPanel(const eap::config_provider &prov, wxWindow* parent) : wxEAPNotePanel(parent)
|
|
{
|
|
// Load and set icon.
|
|
winstd::library lib_shell32;
|
|
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
|
m_note_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(48)));
|
|
|
|
m_note_label->SetLabel(wxString::Format(_("%s has pre-set parts of this configuration. Those parts are locked to prevent accidental modification."),
|
|
!prov.m_name.empty() ? prov.m_name.c_str() : _("Your provider")));
|
|
m_note_label->Wrap(FromDIP(449));
|
|
|
|
CreateContactFields(prov);
|
|
|
|
this->Layout();
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// wxEAPCredentialWarningPanel
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
wxEAPCredentialWarningPanel::wxEAPCredentialWarningPanel(const eap::config_provider &prov, eap::config_method::status_t status, wxWindow* parent) : wxEAPNotePanel(parent)
|
|
{
|
|
// Load and set icon.
|
|
winstd::library lib_shell32;
|
|
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
|
m_note_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(161)));
|
|
|
|
m_note_label->SetLabel((
|
|
status == eap::config_method::status_t::cred_invalid ? _("Previous attempt to connect reported invalid credentials.") :
|
|
status == eap::config_method::status_t::cred_expired ? _("Previous attempt to connect reported your credentials expired.") :
|
|
status == eap::config_method::status_t::cred_changing ? _("Previous attempt to connect reported your credentials are being changed.") :
|
|
_("Previous attempt to connect failed.")) + " " +
|
|
_("Please, make sure your credentials are correct, or try again later."));
|
|
m_note_label->Wrap(FromDIP(449));
|
|
|
|
CreateContactFields(prov);
|
|
|
|
this->Layout();
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// wxEAPCredentialWarningPanel
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#if __DANGEROUS__LOG_CONFIDENTIAL_DATA
|
|
wxEAPCredentialLogWarningPanel::wxEAPCredentialLogWarningPanel(wxWindow* parent) : wxEAPNotePanel(parent)
|
|
{
|
|
// Load and set icon.
|
|
winstd::library lib_shell32;
|
|
if (lib_shell32.load(_T("imageres.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
|
m_note_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(105)));
|
|
|
|
m_note_label->SetLabel(wxString::Format(_("The %s version installed on this computer logs credentials in visible and easy to read way."), wxT(PRODUCT_NAME_STR)) + " " +
|
|
_("Please, reconsider necessity to enter your credentials."));
|
|
m_note_label->Wrap(FromDIP(449));
|
|
|
|
this->Layout();
|
|
}
|
|
#endif
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// wxEAPConfigWindow
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
wxEAPConfigWindow::wxEAPConfigWindow(eap::config_provider &prov, eap::config_method &cfg, wxWindow* parent) :
|
|
m_prov(prov),
|
|
m_cfg(cfg),
|
|
wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL)
|
|
{
|
|
this->SetScrollRate(FromDIP(5), FromDIP(5));
|
|
|
|
// Connect Events
|
|
this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxEAPConfigWindow::OnInitDialog));
|
|
}
|
|
|
|
|
|
wxEAPConfigWindow::~wxEAPConfigWindow()
|
|
{
|
|
// Disconnect Events
|
|
this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxEAPConfigWindow::OnInitDialog));
|
|
}
|
|
|
|
|
|
/// \cond internal
|
|
void wxEAPConfigWindow::OnInitDialog(wxInitDialogEvent& event)
|
|
{
|
|
// Call TransferDataToWindow() manually, as wxScrolledWindow somehow skips that.
|
|
TransferDataToWindow();
|
|
|
|
event.Skip();
|
|
}
|
|
/// \endcond
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// wxEAPProviderContactInfoPanel
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
wxEAPProviderContactInfoPanel::wxEAPProviderContactInfoPanel(eap::config_provider &prov, wxWindow* parent) :
|
|
m_prov(prov),
|
|
wxEAPProviderContactInfoPanelBase(parent)
|
|
{
|
|
// Load and set icon.
|
|
winstd::library lib_shell32;
|
|
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
|
m_provider_contact_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(259)));
|
|
}
|
|
|
|
|
|
/// \cond internal
|
|
|
|
bool wxEAPProviderContactInfoPanel::TransferDataToWindow()
|
|
{
|
|
m_provider_name ->SetValue(m_prov.m_name );
|
|
m_provider_web ->SetValue(m_prov.m_help_web );
|
|
m_provider_email->SetValue(m_prov.m_help_email);
|
|
m_provider_phone->SetValue(m_prov.m_help_phone);
|
|
|
|
return wxEAPProviderContactInfoPanelBase::TransferDataToWindow();
|
|
}
|
|
|
|
|
|
bool wxEAPProviderContactInfoPanel::TransferDataFromWindow()
|
|
{
|
|
wxCHECK(wxEAPProviderContactInfoPanelBase::TransferDataFromWindow(), false);
|
|
|
|
m_prov.m_name = m_provider_name ->GetValue();
|
|
m_prov.m_help_web = m_provider_web ->GetValue();
|
|
m_prov.m_help_email = m_provider_email->GetValue();
|
|
m_prov.m_help_phone = m_provider_phone->GetValue();
|
|
|
|
return true;
|
|
}
|
|
|
|
/// \endcond
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// wxEAPProviderIDPanel
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
wxEAPProviderIDPanel::wxEAPProviderIDPanel(eap::config_provider &prov, wxWindow* parent) :
|
|
m_prov(prov),
|
|
wxEAPProviderIDPanelBase(parent)
|
|
{
|
|
// Load and set icon.
|
|
winstd::library lib_shell32;
|
|
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
|
m_provider_id_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(29)));
|
|
}
|
|
|
|
|
|
/// \cond internal
|
|
|
|
bool wxEAPProviderIDPanel::TransferDataToWindow()
|
|
{
|
|
m_provider_namespace->SetStringSelection(m_prov.m_namespace);
|
|
m_provider_id ->SetValue(m_prov.m_id);
|
|
|
|
return wxEAPProviderIDPanelBase::TransferDataToWindow();
|
|
}
|
|
|
|
|
|
bool wxEAPProviderIDPanel::TransferDataFromWindow()
|
|
{
|
|
wxCHECK(wxEAPProviderIDPanelBase::TransferDataFromWindow(), false);
|
|
|
|
m_prov.m_namespace = m_provider_namespace->GetStringSelection();
|
|
m_prov.m_id = m_provider_id ->GetValue();
|
|
|
|
return true;
|
|
}
|
|
|
|
/// \endcond
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// wxEAPProviderLockPanel
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
wxEAPProviderLockPanel::wxEAPProviderLockPanel(eap::config_provider &prov, wxWindow* parent) :
|
|
m_prov(prov),
|
|
wxEAPProviderLockPanelBase(parent)
|
|
{
|
|
// Load and set icon.
|
|
winstd::library lib_shell32;
|
|
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
|
m_provider_lock_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(1003)));
|
|
}
|
|
|
|
|
|
/// \cond internal
|
|
|
|
bool wxEAPProviderLockPanel::TransferDataToWindow()
|
|
{
|
|
m_provider_lock->SetValue(m_prov.m_read_only);
|
|
|
|
return wxEAPProviderLockPanelBase::TransferDataToWindow();
|
|
}
|
|
|
|
|
|
bool wxEAPProviderLockPanel::TransferDataFromWindow()
|
|
{
|
|
wxCHECK(wxEAPProviderLockPanelBase::TransferDataFromWindow(), false);
|
|
|
|
m_prov.m_read_only = m_provider_lock->GetValue();
|
|
|
|
return true;
|
|
}
|
|
|
|
/// \endcond
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// wxEAPConfigProvider
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
wxEAPConfigProvider::wxEAPConfigProvider(eap::config_provider &prov, wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style) :
|
|
m_prov(prov),
|
|
wxEAPGeneralDialog(parent, id, title, pos, size, style)
|
|
{
|
|
// Set banner title.
|
|
m_banner->m_title->SetLabel(title);
|
|
|
|
m_contact = new wxEAPProviderContactInfoPanel(prov, this);
|
|
AddContent(m_contact);
|
|
|
|
m_identity = new wxEAPProviderIDPanel(prov, this);
|
|
AddContent(m_identity);
|
|
|
|
m_lock = new wxEAPProviderLockPanel(prov, this);
|
|
AddContent(m_lock);
|
|
|
|
m_contact->m_provider_name->SetFocusFromKbd();
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// wxEAPProviderSelectDialog
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
wxEAPProviderSelectDialog::wxEAPProviderSelectDialog(eap::config_connection &cfg, wxWindow *parent) :
|
|
m_selected(NULL),
|
|
wxEAPProviderSelectDialogBase(parent)
|
|
{
|
|
// Set banner title.
|
|
std::unique_ptr<eap::config_method> cfg_dummy(cfg.m_module.make_config_method());
|
|
m_banner->m_title->SetLabel(wxString::Format("%s %s", wxT(PRODUCT_NAME_STR), cfg_dummy->get_method_str()));
|
|
|
|
// Iterate over providers.
|
|
for (auto cfg_prov = cfg.m_providers.cbegin(), cfg_prov_end = cfg.m_providers.cend(); cfg_prov != cfg_prov_end; ++cfg_prov) {
|
|
wxCommandLinkButton *btn = new wxCommandLinkButton(this, wxID_ANY, wxEAPGetProviderName(cfg_prov->m_name));
|
|
m_providers->Add(btn, 0, wxALL|wxEXPAND, FromDIP(5));
|
|
|
|
btn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxEAPProviderSelectDialog::OnProvSelect), new wxVariant((void*)&*cfg_prov), this);
|
|
}
|
|
|
|
this->Layout();
|
|
this->GetSizer()->Fit(this);
|
|
}
|
|
|
|
|
|
/// \cond internal
|
|
void wxEAPProviderSelectDialog::OnProvSelect(wxCommandEvent& event)
|
|
{
|
|
// Set selected provider and dismiss dialog.
|
|
m_selected = static_cast<eap::config_provider*>(dynamic_cast<const wxVariant*>(event.GetEventUserData())->GetVoidPtr());
|
|
this->EndModal(wxID_OK);
|
|
event.Skip();
|
|
}
|
|
/// \endcond
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// wxInitializerPeer
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
wxInitializerPeer::wxInitializerPeer(_In_ HINSTANCE instance, _In_ const wxString &domain, _In_opt_ HWND hwndParent)
|
|
{
|
|
wxCriticalSectionLocker locker(s_lock);
|
|
|
|
if (s_init_ref_count++ == 0) {
|
|
// Initialize application.
|
|
new wxApp();
|
|
wxEntryStart(instance);
|
|
|
|
// Do our wxWidgets configuration and localization initialization.
|
|
wxInitializeConfig();
|
|
s_locale = new wxLocale;
|
|
if (wxInitializeLocale(*s_locale)) {
|
|
s_locale->AddCatalog(wxT("wxExtend") wxT(wxExtendVersion));
|
|
if (!domain.IsEmpty())
|
|
s_locale->AddCatalog(domain);
|
|
}
|
|
}
|
|
|
|
if (hwndParent) {
|
|
// Create wxWidget-approved parent window.
|
|
m_parent = new wxWindow;
|
|
m_parent->SetHWND((WXHWND)hwndParent);
|
|
m_parent->AdoptAttributesFromHWND();
|
|
wxTopLevelWindows.Append(m_parent);
|
|
} else
|
|
m_parent = NULL;
|
|
}
|
|
|
|
|
|
wxInitializerPeer::~wxInitializerPeer()
|
|
{
|
|
wxCriticalSectionLocker locker(s_lock);
|
|
|
|
if (m_parent) {
|
|
wxTopLevelWindows.DeleteObject(m_parent);
|
|
m_parent->SetHWND((WXHWND)NULL);
|
|
}
|
|
|
|
if (--s_init_ref_count == 0) {
|
|
wxEntryCleanup();
|
|
|
|
if (s_locale) {
|
|
delete s_locale;
|
|
s_locale = NULL;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
wxCriticalSection wxInitializerPeer::s_lock;
|
|
unsigned long wxInitializerPeer::s_init_ref_count = 0;
|
|
wxLocale *wxInitializerPeer::s_locale = NULL;
|