]>
git.saurik.com Git - wxWidgets.git/blob - demos/dbbrowse/dlguser.cpp
1 //----------------------------------------------------------------------------------------
3 // Purpose: Dialog mit Variable Gestaltung durch DlgUser.wxr
4 // Author: Mark Johnson, mj10777@gmx.net
5 // Modified by: 19991105.mj10777
7 // Copyright: (c) Mark Johnson
8 // Licence: wxWindows license
10 //----------------------------------------------------------------------------------------
11 //-- all #ifdefs that the whole Project needs. -------------------------------------------
12 //----------------------------------------------------------------------------------------
14 #pragma implementation
17 //----------------------------------------------------------------------------------------
18 // For compilers that support precompilation, includes "wx/wx.h".
19 #include "wx/wxprec.h"
20 //----------------------------------------------------------------------------------------
24 //----------------------------------------------------------------------------------------
30 //----------------------------------------------------------------------------------------
31 //-- all #includes that every .cpp needs ----19990807.mj10777 ----------------
32 //----------------------------------------------------------------------------------------
34 //----------------------------------------------------------------------------------------
35 DlgUser::DlgUser(wxWindow
*parent
, MainDoc
*p_Doc
, const wxString
& title
) :
36 wxDialog(parent
, ID_DIALOG_DSN
, title
)
38 int chSize
; // Height of Font * 1.4 = Height of wxTextCtrl
39 SetBackgroundColour("wheat");
41 wxLayoutConstraints
* layout
;
44 m_Label1
= new wxStaticText(this, -1, _("User ID:"));
45 m_Label1
->SetFont(* pDoc
->ft_Doc
);
46 layout
= new wxLayoutConstraints
;
47 layout
->left
.SameAs(this, wxLeft
, 10);
48 layout
->top
.SameAs(this, wxTop
, 10);
49 layout
->height
.AsIs();
50 layout
->width
.Absolute(75);
51 m_Label1
->SetConstraints(layout
);
54 m_Label1
->GetSize(&w
, &chSize
);
56 m_UserName
= new wxTextCtrl(this, -1, "");
57 m_UserName
->SetFont(* pDoc
->ft_Doc
);
58 chSize
= m_UserName
->GetCharHeight()*1.4;
60 layout
= new wxLayoutConstraints
;
61 layout
->left
.SameAs(m_Label1
, wxRight
, 10);
62 layout
->centreY
.SameAs(m_Label1
,wxCentreY
);
63 layout
->width
.Absolute(200);
64 layout
->height
.Absolute(chSize
);
65 // layout->height.AsIs();
66 m_UserName
->SetConstraints(layout
);
69 m_Label2
= new wxStaticText(this, -1, _("Password:"));
70 m_Label2
->SetFont(* pDoc
->ft_Doc
);
71 layout
= new wxLayoutConstraints
;
72 layout
->left
.SameAs(m_Label1
, wxLeft
);
73 layout
->top
.SameAs(m_Label1
, wxBottom
, 10);
74 layout
->height
.AsIs();
75 layout
->width
.SameAs(m_Label1
, wxWidth
);
76 m_Label2
->SetConstraints(layout
);
78 m_Password
= new wxTextCtrl(this, -1, "", wxDefaultPosition
, wxDefaultSize
, wxTE_PASSWORD
);
79 m_Password
->SetFont(* pDoc
->ft_Doc
);
80 layout
= new wxLayoutConstraints
;
81 layout
->left
.SameAs(m_UserName
, wxLeft
);
82 layout
->width
.SameAs(m_UserName
, wxWidth
);
83 layout
->centreY
.SameAs(m_Label2
,wxCentreY
);
84 layout
->height
.Absolute(chSize
);
85 //layout->height.AsIs();
86 m_Password
->SetConstraints(layout
);
88 m_OK
= new wxButton(this, wxID_OK
, _("OK"));
89 m_OK
->SetFont(* pDoc
->ft_Doc
);
90 layout
= new wxLayoutConstraints
;
91 layout
->left
.SameAs(this, wxLeft
, 10);
92 layout
->top
.SameAs(m_Label2
, wxBottom
,10);
93 layout
->height
.AsIs();
94 layout
->width
.Absolute(75);
95 m_OK
->SetConstraints(layout
);
97 m_Cancel
= new wxButton(this, wxID_CANCEL
, _("Cancel"));
98 m_Cancel
->SetFont(* pDoc
->ft_Doc
);
99 layout
= new wxLayoutConstraints
;
100 layout
->left
.SameAs(m_OK
, wxRight
, 10);
101 layout
->top
.SameAs(m_OK
, wxTop
);
102 layout
->height
.AsIs();
103 layout
->width
.SameAs(m_OK
, wxWidth
);
104 m_Cancel
->SetConstraints(layout
);
107 m_UserName
->SetFocus();
113 //----------------------------------------------------------------------------------------
114 void DlgUser::OnInit()
116 wxString Temp
; Temp
.Printf(">>> %s <<<",s_DSN
.c_str());
118 m_UserName
->SetLabel(s_User
);
119 m_Password
->SetLabel(s_Password
);
121 //----------------------------------------------------------------------------------------
122 BEGIN_EVENT_TABLE(DlgUser
, wxDialog
)
123 EVT_BUTTON(wxID_OK
, DlgUser::OnOk
)
124 EVT_BUTTON(wxID_CANCEL
, DlgUser::OnCancel
)
126 //----------------------------------------------------------------------------------------
127 void DlgUser::OnOk(wxCommandEvent
& WXUNUSED(event
) )
130 s_User
= m_UserName
->GetValue();
131 s_Password
= m_Password
->GetValue();
134 //----------------------------------------------------------------------------------------
135 //void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) )
138 // EndModal(wxID_CANCEL);
140 //----------------------------------------------------------------------------------------