Make GUI DPI-aware

This commit is contained in:
2018-09-17 11:43:19 +02:00
parent c7f1a66a4a
commit 10297c7ab3
24 changed files with 236 additions and 228 deletions

View File

@@ -11,7 +11,7 @@
///////////////////////////////////////////////////////////////////////////
wxTTLSConfigPanelBase::wxTTLSConfigPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
wxTTLSConfigPanelBase::wxTTLSConfigPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, long style ) : wxPanel( parent, id, pos, parent->FromDIP(wxSize( 500,-1 )), style )
{
wxStaticBoxSizer* sb_outer_identity;
sb_outer_identity = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Outer Identity") ), wxVERTICAL );
@@ -20,14 +20,14 @@ wxTTLSConfigPanelBase::wxTTLSConfigPanelBase( wxWindow* parent, wxWindowID id, c
sb_outer_identity_horiz = new wxBoxSizer( wxHORIZONTAL );
m_outer_identity_icon = new wxStaticBitmap( sb_outer_identity->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
sb_outer_identity_horiz->Add( m_outer_identity_icon, 0, wxALL, 5 );
sb_outer_identity_horiz->Add( m_outer_identity_icon, 0, wxALL, FromDIP(5) );
wxBoxSizer* sb_outer_identity_vert;
sb_outer_identity_vert = new wxBoxSizer( wxVERTICAL );
m_outer_identity_label = new wxStaticText( sb_outer_identity->GetStaticBox(), wxID_ANY, _("Select the user ID supplicant introduces itself as to authenticator:"), wxDefaultPosition, wxDefaultSize, 0 );
m_outer_identity_label->Wrap( 440 );
sb_outer_identity_vert->Add( m_outer_identity_label, 0, wxALL|wxEXPAND, 5 );
m_outer_identity_label->Wrap( FromDIP(440) );
sb_outer_identity_vert->Add( m_outer_identity_label, 0, wxALL|wxEXPAND, FromDIP(5) );
wxBoxSizer* sb_outer_identity_radio;
sb_outer_identity_radio = new wxBoxSizer( wxVERTICAL );
@@ -35,12 +35,12 @@ wxTTLSConfigPanelBase::wxTTLSConfigPanelBase( wxWindow* parent, wxWindowID id, c
m_outer_identity_same = new wxRadioButton( sb_outer_identity->GetStaticBox(), wxID_ANY, _("&True identity"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_outer_identity_same->SetToolTip( _("Use my true user name") );
sb_outer_identity_radio->Add( m_outer_identity_same, 1, wxEXPAND, 5 );
sb_outer_identity_radio->Add( m_outer_identity_same, 1, wxEXPAND, FromDIP(5) );
m_outer_identity_empty = new wxRadioButton( sb_outer_identity->GetStaticBox(), wxID_ANY, _("Use &empty outer identity"), wxDefaultPosition, wxDefaultSize, 0 );
m_outer_identity_empty->SetToolTip( _("Ommit my user name and use @mydomain.org only") );
sb_outer_identity_radio->Add( m_outer_identity_empty, 1, wxEXPAND, 5 );
sb_outer_identity_radio->Add( m_outer_identity_empty, 1, wxEXPAND, FromDIP(5) );
wxBoxSizer* sb_outer_identity_custom;
sb_outer_identity_custom = new wxBoxSizer( wxHORIZONTAL );
@@ -48,24 +48,24 @@ wxTTLSConfigPanelBase::wxTTLSConfigPanelBase( wxWindow* parent, wxWindowID id, c
m_outer_identity_custom = new wxRadioButton( sb_outer_identity->GetStaticBox(), wxID_ANY, _("&Custom outer identity:"), wxDefaultPosition, wxDefaultSize, 0 );
m_outer_identity_custom->SetToolTip( _("Specify custom outer identity") );
sb_outer_identity_custom->Add( m_outer_identity_custom, 0, wxEXPAND, 5 );
sb_outer_identity_custom->Add( m_outer_identity_custom, 0, wxEXPAND, FromDIP(5) );
m_outer_identity_custom_val = new wxTextCtrl( sb_outer_identity->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_outer_identity_custom_val->SetToolTip( _("Custom outer identity to use") );
sb_outer_identity_custom->Add( m_outer_identity_custom_val, 1, wxEXPAND, 5 );
sb_outer_identity_custom->Add( m_outer_identity_custom_val, 1, wxEXPAND, FromDIP(5) );
sb_outer_identity_radio->Add( sb_outer_identity_custom, 1, wxEXPAND, 5 );
sb_outer_identity_radio->Add( sb_outer_identity_custom, 1, wxEXPAND, FromDIP(5) );
sb_outer_identity_vert->Add( sb_outer_identity_radio, 0, wxEXPAND|wxALL, 5 );
sb_outer_identity_vert->Add( sb_outer_identity_radio, 0, wxEXPAND|wxALL, FromDIP(5) );
sb_outer_identity_horiz->Add( sb_outer_identity_vert, 1, wxEXPAND, 5 );
sb_outer_identity_horiz->Add( sb_outer_identity_vert, 1, wxEXPAND, FromDIP(5) );
sb_outer_identity->Add( sb_outer_identity_horiz, 0, wxEXPAND, 5 );
sb_outer_identity->Add( sb_outer_identity_horiz, 0, wxEXPAND, FromDIP(5) );
this->SetSizer( sb_outer_identity );

View File

@@ -50,7 +50,7 @@ class wxTTLSConfigPanelBase : public wxPanel
public:
wxTTLSConfigPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
wxTTLSConfigPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, long style = wxTAB_TRAVERSAL );
~wxTTLSConfigPanelBase();
};

View File

@@ -113,12 +113,12 @@ wxTTLSConfigWindow::wxTTLSConfigWindow(eap::config_provider &prov, eap::config_m
sb_content = new wxBoxSizer( wxVERTICAL );
if (m_prov.m_read_only)
sb_content->Add(new wxEAPProviderLockedPanel(m_prov, this), 0, wxALL|wxEXPAND, 5);
sb_content->Add(new wxEAPProviderLockedPanel(m_prov, this), 0, wxALL|wxEXPAND, FromDIP(5));
m_inner_title = new wxStaticText(this, wxID_ANY, _("Inner Authentication"), wxDefaultPosition, wxDefaultSize, 0);
m_inner_title->SetFont(wxFont(18, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString));
m_inner_title->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVECAPTION ) );
sb_content->Add(m_inner_title, 0, wxALL|wxALIGN_RIGHT, 5);
sb_content->Add(m_inner_title, 0, wxALL|wxALIGN_RIGHT, FromDIP(5));
m_inner_type = new wxChoicebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCHB_DEFAULT);
m_inner_type->SetToolTip( _("Select inner authentication method from the list") );
@@ -134,26 +134,26 @@ wxTTLSConfigWindow::wxTTLSConfigWindow(eap::config_provider &prov, eap::config_m
wxEapHostConfigPanel *panel_eaphost = new wxEapHostConfigPanel(m_prov, m_cfg_eaphost, m_inner_type);
m_inner_type->AddPage(panel_eaphost, _("Other EAP methods..."));
#endif
sb_content->Add(m_inner_type, 0, wxALL|wxEXPAND, 5);
sb_content->Add(m_inner_type, 0, wxALL|wxEXPAND, FromDIP(5));
sb_content->Add(20, 20, 1, wxALL|wxEXPAND, 5);
sb_content->Add(FromDIP(20), FromDIP(20), 1, wxALL|wxEXPAND, FromDIP(5));
m_outer_title = new wxStaticText(this, wxID_ANY, _("Outer Authentication"), wxDefaultPosition, wxDefaultSize, 0);
m_outer_title->SetFont(wxFont(18, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString));
m_outer_title->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVECAPTION ) );
sb_content->Add(m_outer_title, 0, wxALL|wxALIGN_RIGHT, 5);
sb_content->Add(m_outer_title, 0, wxALL|wxALIGN_RIGHT, FromDIP(5));
m_outer_identity = new wxTTLSConfigPanel(m_prov, dynamic_cast<eap::config_method_ttls&>(m_cfg), this);
sb_content->Add(m_outer_identity, 0, wxALL|wxEXPAND, 5);
sb_content->Add(m_outer_identity, 0, wxALL|wxEXPAND, FromDIP(5));
m_tls = new wxTLSConfigPanel(m_prov, dynamic_cast<eap::config_method_tls&>(m_cfg), this);
sb_content->Add(m_tls, 0, wxALL|wxEXPAND, 5);
sb_content->Add(m_tls, 0, wxALL|wxEXPAND, FromDIP(5));
wxSize size = sb_content->CalcMin();
if (size.y > 500) {
if (size.y > FromDIP(500)) {
// Increase the width to allow space for vertical scroll bar (to prevent horizontal one) and truncate the height.
size.x += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X, this);
size.y = 500;
size.y = FromDIP(500);
}
this->SetMinSize(size);