00001
00031 #ifndef INC_MGUI_FORMPASSWORD_H
00032 #define INC_MGUI_FORMPASSWORD_H
00033
00034 #ifndef INC_MGUI_EDIT_H
00035 #include <mgui/edit.h>
00036 #endif
00037
00038 #ifndef INC_MGUI_DLGSHELL_H
00039 #include <mgui/dlgshell.h>
00040 #endif
00041
00042 namespace MGUI {
00043
00044
00046 class FORM_PASSWORD : public MGUI::FORM_COMPOSITE {
00047 public:
00048 enum FLAGS {
00049 FLAG_Default = 0x0000,
00050 FLAG_ValidatePassword = 0x0001,
00051 FLAG_RememberPassword = 0x0002,
00052 FLAG_NoUserName = 0x0004,
00053 };
00054
00056 FORM_PASSWORD (
00057 );
00058
00060 virtual ~FORM_PASSWORD (
00061 );
00062
00064 void Create (
00065 MGUI::LAYOUT_PANE_BASE& ParentPane,
00066 const MISTRING& Description,
00067 FLAGS flags = FLAG_Default,
00068 MGUI::LAYOUT_SIZEALIGN sizealign = MGUI::LAYOUT_SIZEALIGN_FixedHeight
00069 );
00070
00075 bool DoRememberPassword (
00076 ) const;
00077
00080 void GetBasicAuthString (
00081 MISTRING& AuthString
00082 );
00083
00086 const MISTRING& GetPassword (
00087 );
00088
00090 const MISTRING& GetUserName (
00091 );
00092
00094 void SetDelegateOnComplete (
00095 FastDelegate<void(bool)> delegate
00096 ) { m_DelegateOnComplete = delegate; }
00097
00101 void SetDelegateOnValidateUserName (
00102 FastDelegate<bool(const MISTRING&)> delegate
00103 ) { m_DelegateOnValidateUserName = delegate; }
00104
00108 void SetFocusToName (
00109 );
00110
00112 void SetUserName (
00113 const MISTRING& UserName
00114 );
00115
00116 private:
00117 #ifndef GENERATING_DOXYGEN_OUTPUT
00118 LAYOUT_PANE m_VertPane;
00119 CTRL_LABEL m_Description;
00120 FORM_EDIT_STRING m_NameForm;
00121 FORM_EDIT_STRING m_PasswordForm;
00122 CTRL_LABEL m_ValidateLabel;
00123 FORM_EDIT_STRING m_ValidateForm;
00124 CTRL_TOGGLEBUTTON m_RememberPassword;
00125
00126 MISTRING m_UserName;
00127 FastDelegate<void(bool)> m_DelegateOnComplete;
00128 FastDelegate<bool(const MISTRING&)> m_DelegateOnValidateUserName;
00129
00130 void OnUserEditChange ();
00131 void OnUserValidate ();
00132 void OnValidateChangeValue ();
00133 #endif // GENERATING_DOXYGEN_OUTPUT
00134 };
00135
00136 #ifndef GENERATING_DOXYGEN_OUTPUT
00137 DEFINE_ENUM_OP_BITWISE(FORM_PASSWORD::FLAGS)
00138 #endif
00139
00140
00141 class DLG_PASSWORD : public DLGSHELL {
00142 public:
00144 DLG_PASSWORD (
00145 const MISTRING& title,
00146 const MISTRING& Description,
00147 HELPID HelpID = HELPID__None,
00148 FORM_PASSWORD::FLAGS flags = FORM_PASSWORD::FLAG_Default
00149 );
00150
00152 virtual ~DLG_PASSWORD (
00153 );
00154
00159 bool DoRememberPassword (
00160 ) const { return (m_FormPassword.DoRememberPassword()); }
00161
00164 void GetBasicAuthString (
00165 MISTRING& AuthString
00166 ) { m_FormPassword.GetBasicAuthString(AuthString); }
00167
00169 const MISTRING& GetUserName (
00170 ) { return (m_FormPassword.GetUserName()); }
00171
00174 const MISTRING& GetPassword (
00175 ) { return (m_FormPassword.GetPassword()); }
00176
00180 void SetDelegateOnValidateUserName (
00181 FastDelegate<bool(const MISTRING&)> delegate
00182 ) { m_FormPassword.SetDelegateOnValidateUserName(delegate); }
00183
00184 void SetUserName (
00185 const MISTRING& UserName
00186 ) { m_FormPassword.SetUserName(UserName); }
00187
00188 private:
00189 #ifndef GENERATING_DOXYGEN_OUTPUT
00190 FORM_PASSWORD m_FormPassword;
00191 FORM_PASSWORD::FLAGS m_flags;
00192 MISTRING m_Description;
00193
00194 virtual ERRVALUE v_CreateContent ();
00195 virtual void v_OnOpen ();
00196
00197 void OnComplete (bool);
00198 #endif // GENERATING_DOXYGEN_OUTPUT
00199 };
00200
00201
00202 }
00203
00204 #endif // INC_MGUI_FORMPASSWORD_H