Credentials dialog banner title now dynamic

This commit is contained in:
Simon Rozman 2016-06-21 09:18:17 +02:00
parent 0c8492ccd1
commit b634956901
4 changed files with 36 additions and 41 deletions

View File

@ -31,7 +31,7 @@ template <class _Tmeth, class _wxT> class wxEAPConfigDialog;
/// ///
/// EAP credentials dialog /// EAP credentials dialog
/// ///
class wxEAPCredentialsDialog; template <class _Tprov> class wxEAPCredentialsDialog;
/// ///
/// EAP dialog banner /// EAP dialog banner
@ -153,22 +153,50 @@ protected:
}; };
template <class _Tprov>
class wxEAPCredentialsDialog : public wxEAPCredentialsDialogBase class wxEAPCredentialsDialog : public wxEAPCredentialsDialogBase
{ {
public: public:
/// ///
/// Constructs a credential dialog /// Constructs a credential dialog
/// ///
wxEAPCredentialsDialog(wxWindow* parent); wxEAPCredentialsDialog(_Tprov &prov, wxWindow* parent) : wxEAPCredentialsDialogBase(parent)
{
// Set extra style here, as wxFormBuilder overrides all default flags.
this->SetExtraStyle(this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY);
// Set banner title.
m_banner->m_title->SetLabel(wxString::Format(_("%s Credentials"), prov.m_id.c_str()));
m_buttonsOK->SetDefault();
}
/// ///
/// Adds panels to the dialog /// Adds panels to the dialog
/// ///
void AddContents(wxPanel **contents, size_t content_count); void AddContents(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, 5);
this->Layout();
this->GetSizer()->Fit(this);
contents[0]->SetFocusFromKbd();
}
}
protected: protected:
/// \cond internal /// \cond internal
virtual void OnInitDialog(wxInitDialogEvent& event);
virtual void OnInitDialog(wxInitDialogEvent& event)
{
for (wxSizerItemList::compatibility_iterator panel = m_panels->GetChildren().GetFirst(); panel; panel = panel->GetNext())
panel->GetData()->GetWindow()->GetEventHandler()->ProcessEvent(event);
}
/// \endcond /// \endcond
}; };
@ -341,7 +369,7 @@ protected:
{ {
UNREFERENCED_PARAMETER(event); UNREFERENCED_PARAMETER(event);
wxEAPCredentialsDialog dlg(this); wxEAPCredentialsDialog<_Tprov> dlg(m_prov, this);
_wxT *panel = new _wxT(m_prov, m_cred, m_target.c_str(), &dlg, true); _wxT *panel = new _wxT(m_prov, m_cred, m_target.c_str(), &dlg, true);
@ -363,7 +391,7 @@ protected:
{ {
UNREFERENCED_PARAMETER(event); UNREFERENCED_PARAMETER(event);
wxEAPCredentialsDialog dlg(this); wxEAPCredentialsDialog<_Tprov> dlg(m_prov, this);
_wxT *panel = new _wxT(m_prov, m_cred, _T(""), &dlg, true); _wxT *panel = new _wxT(m_prov, m_cred, _T(""), &dlg, true);

View File

@ -582,7 +582,7 @@
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
<property name="permission">protected</property> <property name="permission">public</property>
<property name="pin_button">1</property> <property name="pin_button">1</property>
<property name="pos"></property> <property name="pos"></property>
<property name="resize">Resizable</property> <property name="resize">Resizable</property>

View File

@ -92,9 +92,9 @@ class wxEAPBannerPanelBase : public wxPanel
private: private:
protected: protected:
wxStaticText* m_title;
public: public:
wxStaticText* m_title;
wxEAPBannerPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = 0 ); wxEAPBannerPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = 0 );
~wxEAPBannerPanelBase(); ~wxEAPBannerPanelBase();

View File

@ -21,39 +21,6 @@
#include "StdAfx.h" #include "StdAfx.h"
//////////////////////////////////////////////////////////////////////
// wxEAPCredentialsDialog
//////////////////////////////////////////////////////////////////////
wxEAPCredentialsDialog::wxEAPCredentialsDialog(wxWindow* parent) : wxEAPCredentialsDialogBase(parent)
{
// Set extra style here, as wxFormBuilder overrides all default flags.
this->SetExtraStyle(this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY);
m_buttonsOK->SetDefault();
}
void wxEAPCredentialsDialog::AddContents(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, 5);
this->Layout();
this->GetSizer()->Fit(this);
contents[0]->SetFocusFromKbd();
}
}
void wxEAPCredentialsDialog::OnInitDialog(wxInitDialogEvent& event)
{
for (wxSizerItemList::compatibility_iterator panel = m_panels->GetChildren().GetFirst(); panel; panel = panel->GetNext())
panel->GetData()->GetWindow()->GetEventHandler()->ProcessEvent(event);
}
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// wxEAPBannerPanel // wxEAPBannerPanel
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////