]>
Commit | Line | Data |
---|---|---|
c92b0f9a | 1 | //---------------------------------------------------------------------------------------- |
b5ffecfc GT |
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 | |
c09d434d | 9 | // RCS-ID: $Id$ |
c92b0f9a MJ |
10 | //---------------------------------------------------------------------------------------- |
11 | //-- all #ifdefs that the whole Project needs. ------------------------------------------- | |
12 | //---------------------------------------------------------------------------------------- | |
b5ffecfc | 13 | #ifdef __GNUG__ |
b5ce269b BJ |
14 | #pragma implementation |
15 | #pragma interface | |
b5ffecfc | 16 | #endif |
c92b0f9a | 17 | //---------------------------------------------------------------------------------------- |
b5ffecfc GT |
18 | // For compilers that support precompilation, includes "wx/wx.h". |
19 | #include "wx/wxprec.h" | |
c92b0f9a | 20 | //---------------------------------------------------------------------------------------- |
b5ffecfc | 21 | #ifdef __BORLANDC__ |
b5ce269b | 22 | #pragma hdrstop |
b5ffecfc | 23 | #endif |
c92b0f9a | 24 | //---------------------------------------------------------------------------------------- |
b5ffecfc | 25 | #ifndef WX_PRECOMP |
b5ce269b | 26 | #include "wx/wx.h" |
b5ffecfc | 27 | #endif |
780ee02d BJ |
28 | |
29 | ||
c92b0f9a MJ |
30 | //---------------------------------------------------------------------------------------- |
31 | //-- all #includes that every .cpp needs ----19990807.mj10777 ---------------- | |
32 | //---------------------------------------------------------------------------------------- | |
33 | #include "std.h" | |
34 | //---------------------------------------------------------------------------------------- | |
3fa0976a | 35 | DlgUser::DlgUser(wxWindow *parent, MainDoc *p_Doc, const wxString& title) : |
c09d434d | 36 | wxDialog(parent, ID_DIALOG_DSN, title) |
b5ffecfc | 37 | { |
5a074a3c | 38 | int chSize; // Height of Font * 1.4 = Height of wxTextCtrl |
7ef53f2d BJ |
39 | |
40 | float ratio = 1.4; | |
41 | #ifdef __WXMOTIF__ | |
42 | ratio = 2.1; | |
43 | #endif | |
44 | ||
c92b0f9a | 45 | SetBackgroundColour("wheat"); |
b54f1155 | 46 | pDoc = p_Doc; |
c92b0f9a MJ |
47 | wxLayoutConstraints* layout; |
48 | SetAutoLayout(TRUE); | |
c09d434d | 49 | |
b54f1155 | 50 | m_Label1 = new wxStaticText(this, -1, _("User ID:")); |
5a074a3c | 51 | m_Label1->SetFont(* pDoc->ft_Doc); |
b54f1155 MJ |
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); | |
5a074a3c BJ |
58 | |
59 | int w; | |
60 | m_Label1->GetSize(&w, &chSize); | |
780ee02d | 61 | |
b54f1155 MJ |
62 | m_UserName = new wxTextCtrl(this, -1, ""); |
63 | m_UserName->SetFont(* pDoc->ft_Doc); | |
7ef53f2d | 64 | chSize = (int) (m_UserName->GetCharHeight()*ratio); |
780ee02d | 65 | |
b54f1155 MJ |
66 | layout = new wxLayoutConstraints; |
67 | layout->left.SameAs(m_Label1, wxRight, 10); | |
68 | layout->centreY.SameAs(m_Label1,wxCentreY); | |
69 | layout->width.Absolute(200); | |
5a074a3c BJ |
70 | layout->height.Absolute(chSize); |
71 | // layout->height.AsIs(); | |
b54f1155 | 72 | m_UserName->SetConstraints(layout); |
c92b0f9a MJ |
73 | |
74 | ||
b54f1155 | 75 | m_Label2 = new wxStaticText(this, -1, _("Password:")); |
5a074a3c | 76 | m_Label2->SetFont(* pDoc->ft_Doc); |
b54f1155 MJ |
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); | |
c92b0f9a | 83 | |
b54f1155 | 84 | m_Password = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD); |
5a074a3c | 85 | m_Password->SetFont(* pDoc->ft_Doc); |
b54f1155 MJ |
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); | |
5a074a3c BJ |
90 | layout->height.Absolute(chSize); |
91 | //layout->height.AsIs(); | |
b54f1155 | 92 | m_Password->SetConstraints(layout); |
c92b0f9a | 93 | |
b54f1155 | 94 | m_OK = new wxButton(this, wxID_OK, _("OK")); |
5a074a3c | 95 | m_OK->SetFont(* pDoc->ft_Doc); |
b54f1155 MJ |
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); | |
c09d434d | 102 | |
b54f1155 | 103 | m_Cancel = new wxButton(this, wxID_CANCEL, _("Cancel")); |
5a074a3c | 104 | m_Cancel->SetFont(* pDoc->ft_Doc); |
b54f1155 MJ |
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); | |
c09d434d | 111 | |
b54f1155 MJ |
112 | m_OK->SetDefault(); |
113 | m_UserName->SetFocus(); | |
c92b0f9a | 114 | |
b54f1155 MJ |
115 | s_User = ""; |
116 | s_Password = ""; | |
117 | Layout(); | |
b5ffecfc | 118 | } |
c92b0f9a MJ |
119 | //---------------------------------------------------------------------------------------- |
120 | void DlgUser::OnInit() | |
121 | { | |
0068587b | 122 | wxString Temp; Temp.Printf(">>> %s <<<",s_DSN.c_str()); |
c92b0f9a MJ |
123 | SetTitle(Temp); |
124 | m_UserName->SetLabel(s_User); | |
125 | m_Password->SetLabel(s_Password); | |
c92b0f9a MJ |
126 | } |
127 | //---------------------------------------------------------------------------------------- | |
b5ffecfc | 128 | BEGIN_EVENT_TABLE(DlgUser, wxDialog) |
c92b0f9a MJ |
129 | EVT_BUTTON(wxID_OK, DlgUser::OnOk) |
130 | EVT_BUTTON(wxID_CANCEL, DlgUser::OnCancel) | |
c09d434d | 131 | END_EVENT_TABLE() |
c92b0f9a | 132 | //---------------------------------------------------------------------------------------- |
c09d434d | 133 | void DlgUser::OnOk(wxCommandEvent& WXUNUSED(event) ) |
b5ffecfc | 134 | { |
c09d434d BJ |
135 | //canceled = FALSE; |
136 | s_User = m_UserName->GetValue(); | |
137 | s_Password = m_Password->GetValue(); | |
b5ce269b | 138 | EndModal(wxID_OK); |
b5ffecfc | 139 | } |
c92b0f9a | 140 | //---------------------------------------------------------------------------------------- |
c09d434d BJ |
141 | //void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) ) |
142 | // { | |
143 | // canceled = TRUE; | |
144 | // EndModal(wxID_CANCEL); | |
145 | // } | |
c92b0f9a | 146 | //---------------------------------------------------------------------------------------- |
c09d434d | 147 |