]>
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
45 SetBackgroundColour("wheat");
47 wxLayoutConstraints
* layout
;
50 m_Label1
= new wxStaticText(this, -1, _("User ID:"));
51 m_Label1
->SetFont(* pDoc
->ft_Doc
);
52 layout
= new wxLayoutConstraints
;
53 layout
->left
.SameAs(this, wxLeft
, 10);
54 layout
->top
.SameAs(this, wxTop
, 10);
55 layout
->height
.AsIs();
56 layout
->width
.Absolute(75);
57 m_Label1
->SetConstraints(layout
);
60 m_Label1
->GetSize(&w
, &chSize
);
62 m_UserName
= new wxTextCtrl(this, -1, "");
63 m_UserName
->SetFont(* pDoc
->ft_Doc
);
64 chSize
= (int) (m_UserName
->GetCharHeight()*ratio
);
66 layout
= new wxLayoutConstraints
;
67 layout
->left
.SameAs(m_Label1
, wxRight
, 10);
68 layout
->centreY
.SameAs(m_Label1
,wxCentreY
);
69 layout
->width
.Absolute(200);
70 layout
->height
.Absolute(chSize
);
71 // layout->height.AsIs();
72 m_UserName
->SetConstraints(layout
);
75 m_Label2
= new wxStaticText(this, -1, _("Password:"));
76 m_Label2
->SetFont(* pDoc
->ft_Doc
);
77 layout
= new wxLayoutConstraints
;
78 layout
->left
.SameAs(m_Label1
, wxLeft
);
79 layout
->top
.SameAs(m_Label1
, wxBottom
, 10);
80 layout
->height
.AsIs();
81 layout
->width
.SameAs(m_Label1
, wxWidth
);
82 m_Label2
->SetConstraints(layout
);
84 m_Password
= new wxTextCtrl(this, -1, "", wxDefaultPosition
, wxDefaultSize
, wxTE_PASSWORD
);
85 m_Password
->SetFont(* pDoc
->ft_Doc
);
86 layout
= new wxLayoutConstraints
;
87 layout
->left
.SameAs(m_UserName
, wxLeft
);
88 layout
->width
.SameAs(m_UserName
, wxWidth
);
89 layout
->centreY
.SameAs(m_Label2
,wxCentreY
);
90 layout
->height
.Absolute(chSize
);
91 //layout->height.AsIs();
92 m_Password
->SetConstraints(layout
);
94 m_OK
= new wxButton(this, wxID_OK
, _("OK"));
95 m_OK
->SetFont(* pDoc
->ft_Doc
);
96 layout
= new wxLayoutConstraints
;
97 layout
->left
.SameAs(this, wxLeft
, 10);
98 layout
->top
.SameAs(m_Label2
, wxBottom
,10);
99 layout
->height
.AsIs();
100 layout
->width
.Absolute(75);
101 m_OK
->SetConstraints(layout
);
103 m_Cancel
= new wxButton(this, wxID_CANCEL
, _("Cancel"));
104 m_Cancel
->SetFont(* pDoc
->ft_Doc
);
105 layout
= new wxLayoutConstraints
;
106 layout
->left
.SameAs(m_OK
, wxRight
, 10);
107 layout
->top
.SameAs(m_OK
, wxTop
);
108 layout
->height
.AsIs();
109 layout
->width
.SameAs(m_OK
, wxWidth
);
110 m_Cancel
->SetConstraints(layout
);
113 m_UserName
->SetFocus();
119 //----------------------------------------------------------------------------------------
120 void DlgUser::OnInit()
122 wxString Temp
; Temp
.Printf(">>> %s <<<",s_DSN
.c_str());
124 m_UserName
->SetLabel(s_User
);
125 m_Password
->SetLabel(s_Password
);
127 //----------------------------------------------------------------------------------------
128 BEGIN_EVENT_TABLE(DlgUser
, wxDialog
)
129 EVT_BUTTON(wxID_OK
, DlgUser::OnOk
)
130 EVT_BUTTON(wxID_CANCEL
, DlgUser::OnCancel
)
132 //----------------------------------------------------------------------------------------
133 void DlgUser::OnOk(wxCommandEvent
& WXUNUSED(event
) )
136 s_User
= m_UserName
->GetValue();
137 s_Password
= m_Password
->GetValue();
140 //----------------------------------------------------------------------------------------
141 //void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) )
144 // EndModal(wxID_CANCEL);
146 //----------------------------------------------------------------------------------------