]>
Commit | Line | Data |
---|---|---|
1 | //---------------------------------------------------------------------------------------- | |
2 | // Name: DlgUser.h,cpp | |
3 | // Purpose: Dialog mit Variable Gestaltung durch DlgUser.wxr | |
4 | // Author: Mark Johnson, mj10777@gmx.net | |
5 | // Modified by: 19991105.mj10777 | |
6 | // Created: 19991105 | |
7 | // Copyright: (c) Mark Johnson | |
8 | // Licence: wxWindows license | |
9 | // RCS-ID: $Id$ | |
10 | //---------------------------------------------------------------------------------------- | |
11 | //-- all #ifdefs that the whole Project needs. ------------------------------------------- | |
12 | //---------------------------------------------------------------------------------------- | |
13 | #ifdef __GNUG__ | |
14 | #pragma implementation | |
15 | #pragma interface | |
16 | #endif | |
17 | //---------------------------------------------------------------------------------------- | |
18 | // For compilers that support precompilation, includes "wx/wx.h". | |
19 | #include "wx/wxprec.h" | |
20 | //---------------------------------------------------------------------------------------- | |
21 | #ifdef __BORLANDC__ | |
22 | #pragma hdrstop | |
23 | #endif | |
24 | //---------------------------------------------------------------------------------------- | |
25 | #ifndef WX_PRECOMP | |
26 | #include "wx/wx.h" | |
27 | #endif | |
28 | ||
29 | ||
30 | //---------------------------------------------------------------------------------------- | |
31 | //-- all #includes that every .cpp needs ----19990807.mj10777 ---------------- | |
32 | //---------------------------------------------------------------------------------------- | |
33 | #include "std.h" | |
34 | //---------------------------------------------------------------------------------------- | |
35 | DlgUser::DlgUser(wxWindow *parent, MainDoc *p_Doc, const wxString& title) : | |
36 | wxDialog(parent, ID_DIALOG_DSN, title) | |
37 | { | |
38 | int chSize; // Height of Font * 1.4 = Height of wxTextCtrl | |
39 | ||
40 | float ratio = 1.4; | |
41 | #ifdef __WXMOTIF__ | |
42 | ratio = 2.1; | |
43 | #endif | |
44 | ||
45 | SetBackgroundColour("wheat"); | |
46 | pDoc = p_Doc; | |
47 | wxLayoutConstraints* layout; | |
48 | SetAutoLayout(TRUE); | |
49 | ||
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); | |
58 | ||
59 | int w; | |
60 | m_Label1->GetSize(&w, &chSize); | |
61 | ||
62 | m_UserName = new wxTextCtrl(this, -1, ""); | |
63 | m_UserName->SetFont(* pDoc->ft_Doc); | |
64 | chSize = (int) (m_UserName->GetCharHeight()*ratio); | |
65 | ||
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); | |
73 | ||
74 | ||
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); | |
83 | ||
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); | |
93 | ||
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); | |
102 | ||
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); | |
111 | ||
112 | m_OK->SetDefault(); | |
113 | m_UserName->SetFocus(); | |
114 | ||
115 | s_User = ""; | |
116 | s_Password = ""; | |
117 | Layout(); | |
118 | } | |
119 | //---------------------------------------------------------------------------------------- | |
120 | void DlgUser::OnInit() | |
121 | { | |
122 | wxString Temp; Temp.Printf(">>> %s <<<",s_DSN.c_str()); | |
123 | SetTitle(Temp); | |
124 | m_UserName->SetLabel(s_User); | |
125 | m_Password->SetLabel(s_Password); | |
126 | } | |
127 | //---------------------------------------------------------------------------------------- | |
128 | BEGIN_EVENT_TABLE(DlgUser, wxDialog) | |
129 | EVT_BUTTON(wxID_OK, DlgUser::OnOk) | |
130 | EVT_BUTTON(wxID_CANCEL, DlgUser::OnCancel) | |
131 | END_EVENT_TABLE() | |
132 | //---------------------------------------------------------------------------------------- | |
133 | void DlgUser::OnOk(wxCommandEvent& WXUNUSED(event) ) | |
134 | { | |
135 | //canceled = FALSE; | |
136 | s_User = m_UserName->GetValue(); | |
137 | s_Password = m_Password->GetValue(); | |
138 | EndModal(wxID_OK); | |
139 | } | |
140 | //---------------------------------------------------------------------------------------- | |
141 | //void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) ) | |
142 | // { | |
143 | // canceled = TRUE; | |
144 | // EndModal(wxID_CANCEL); | |
145 | // } | |
146 | //---------------------------------------------------------------------------------------- | |
147 |