Listing 3: pwd_box.h — Creating a custom dialog box class

#ifndef __PWD_DLG_H__
#define __PWD_DLG_H__

#include <wx/wxprec.h>
    
#ifdef __BORLANDC__
#pragma hdrstop
#endif
    
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

enum    // alternative to a group of const definitions
{
    ID_name = 1,
    ID_pwd,
    ID_label_name,
    ID_label_pwd
};


class PasswordDlg : public wxDialog
{
public:
    PasswordDlg (wxWindow * parent,
                 const wxString & title = "Login",
                 const wxPoint & position = wxDefaultPosition);

    wxString get_name () const
    {
        return m_name->GetValue();
    }

    wxString get_password () const
    {
        return m_password->GetValue();
    }

    void OnTextChanged (wxCommandEvent &);

private:        
    wxStaticText *  m_label_name;
    wxStaticText *  m_label_password;
    wxTextCtrl *    m_name;
    wxTextCtrl *    m_password;
    wxButton *      m_ok;
    wxButton *      m_cancel;
        // Notice prefix m_ for the data members; 
        // this is the standard wxWindows naming 
        // convention

    DECLARE_EVENT_TABLE ()
};

#endif
— End of Listing —