]>
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 |
c92b0f9a MJ |
28 | //---------------------------------------------------------------------------------------- |
29 | //-- all #includes that every .cpp needs ----19990807.mj10777 ---------------- | |
30 | //---------------------------------------------------------------------------------------- | |
31 | #include "std.h" | |
32 | //---------------------------------------------------------------------------------------- | |
3fa0976a | 33 | DlgUser::DlgUser(wxWindow *parent, MainDoc *p_Doc, const wxString& title) : |
c09d434d | 34 | wxDialog(parent, ID_DIALOG_DSN, title) |
b5ffecfc | 35 | { |
b54f1155 | 36 | int chSize; // Height of Font * 1.4 = Height of wxTextCtrl |
c92b0f9a | 37 | SetBackgroundColour("wheat"); |
b54f1155 | 38 | pDoc = p_Doc; |
c92b0f9a MJ |
39 | wxLayoutConstraints* layout; |
40 | SetAutoLayout(TRUE); | |
c09d434d | 41 | |
b54f1155 MJ |
42 | m_Label1 = new wxStaticText(this, -1, _("User ID:")); |
43 | m_Label1->SetFont(* pDoc->ft_Doc); | |
44 | layout = new wxLayoutConstraints; | |
45 | layout->left.SameAs(this, wxLeft, 10); | |
46 | layout->top.SameAs(this, wxTop, 10); | |
47 | layout->height.AsIs(); | |
48 | layout->width.Absolute(75); | |
49 | m_Label1->SetConstraints(layout); | |
c09d434d | 50 | |
b54f1155 MJ |
51 | m_UserName = new wxTextCtrl(this, -1, ""); |
52 | m_UserName->SetFont(* pDoc->ft_Doc); | |
53 | chSize = m_UserName->GetCharHeight()*1.4; | |
54 | layout = new wxLayoutConstraints; | |
55 | layout->left.SameAs(m_Label1, wxRight, 10); | |
56 | layout->centreY.SameAs(m_Label1,wxCentreY); | |
57 | layout->width.Absolute(200); | |
58 | layout->height.Absolute(chSize); | |
59 | m_UserName->SetConstraints(layout); | |
c92b0f9a MJ |
60 | |
61 | ||
b54f1155 MJ |
62 | m_Label2 = new wxStaticText(this, -1, _("Password:")); |
63 | m_Label2->SetFont(* pDoc->ft_Doc); | |
64 | layout = new wxLayoutConstraints; | |
65 | layout->left.SameAs(m_Label1, wxLeft); | |
66 | layout->top.SameAs(m_Label1, wxBottom, 10); | |
67 | layout->height.AsIs(); | |
68 | layout->width.SameAs(m_Label1, wxWidth); | |
69 | m_Label2->SetConstraints(layout); | |
c92b0f9a | 70 | |
b54f1155 MJ |
71 | m_Password = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD); |
72 | m_Password->SetFont(* pDoc->ft_Doc); | |
73 | layout = new wxLayoutConstraints; | |
74 | layout->left.SameAs(m_UserName, wxLeft); | |
75 | layout->width.SameAs(m_UserName, wxWidth); | |
76 | layout->centreY.SameAs(m_Label2,wxCentreY); | |
77 | layout->height.Absolute(chSize); | |
78 | m_Password->SetConstraints(layout); | |
c92b0f9a | 79 | |
b54f1155 MJ |
80 | m_OK = new wxButton(this, wxID_OK, _("OK")); |
81 | m_OK->SetFont(* pDoc->ft_Doc); | |
82 | layout = new wxLayoutConstraints; | |
83 | layout->left.SameAs(this, wxLeft, 10); | |
84 | layout->top.SameAs(m_Label2, wxBottom,10); | |
85 | layout->height.AsIs(); | |
86 | layout->width.Absolute(75); | |
87 | m_OK->SetConstraints(layout); | |
c09d434d | 88 | |
b54f1155 MJ |
89 | m_Cancel = new wxButton(this, wxID_CANCEL, _("Cancel")); |
90 | m_Cancel->SetFont(* pDoc->ft_Doc); | |
91 | layout = new wxLayoutConstraints; | |
92 | layout->left.SameAs(m_OK, wxRight, 10); | |
93 | layout->top.SameAs(m_OK, wxTop); | |
94 | layout->height.AsIs(); | |
95 | layout->width.SameAs(m_OK, wxWidth); | |
96 | m_Cancel->SetConstraints(layout); | |
c09d434d | 97 | |
b54f1155 MJ |
98 | m_OK->SetDefault(); |
99 | m_UserName->SetFocus(); | |
c92b0f9a | 100 | |
b54f1155 MJ |
101 | s_User = ""; |
102 | s_Password = ""; | |
103 | Layout(); | |
b5ffecfc | 104 | } |
c92b0f9a MJ |
105 | //---------------------------------------------------------------------------------------- |
106 | void DlgUser::OnInit() | |
107 | { | |
0068587b | 108 | wxString Temp; Temp.Printf(">>> %s <<<",s_DSN.c_str()); |
c92b0f9a MJ |
109 | SetTitle(Temp); |
110 | m_UserName->SetLabel(s_User); | |
111 | m_Password->SetLabel(s_Password); | |
c92b0f9a MJ |
112 | } |
113 | //---------------------------------------------------------------------------------------- | |
b5ffecfc | 114 | BEGIN_EVENT_TABLE(DlgUser, wxDialog) |
c92b0f9a MJ |
115 | EVT_BUTTON(wxID_OK, DlgUser::OnOk) |
116 | EVT_BUTTON(wxID_CANCEL, DlgUser::OnCancel) | |
c09d434d | 117 | END_EVENT_TABLE() |
c92b0f9a | 118 | //---------------------------------------------------------------------------------------- |
c09d434d | 119 | void DlgUser::OnOk(wxCommandEvent& WXUNUSED(event) ) |
b5ffecfc | 120 | { |
c09d434d BJ |
121 | //canceled = FALSE; |
122 | s_User = m_UserName->GetValue(); | |
123 | s_Password = m_Password->GetValue(); | |
b5ce269b | 124 | EndModal(wxID_OK); |
b5ffecfc | 125 | } |
c92b0f9a | 126 | //---------------------------------------------------------------------------------------- |
c09d434d BJ |
127 | //void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) ) |
128 | // { | |
129 | // canceled = TRUE; | |
130 | // EndModal(wxID_CANCEL); | |
131 | // } | |
c92b0f9a | 132 | //---------------------------------------------------------------------------------------- |
c09d434d | 133 |