]> git.saurik.com Git - wxWidgets.git/blob - demos/dbbrowse/dlguser.cpp
Removed WXWIN_COMPATIBILITY_2_2 together with code guarded by it.
[wxWidgets.git] / demos / dbbrowse / dlguser.cpp
1 //----------------------------------------------------------------------------------------
2 // Name: DlgUser.h,cpp
3 // Purpose: Dialog mit Variable Gestaltung durch DlgUser.wxr
4 // Author: Mark Johnson
5 // Modified by: 19991105.mj10777
6 // Created: 19991105
7 // Copyright: (c) Mark Johnson
8 // Licence: wxWindows license
9 // RCS-ID: $Id$
10 //----------------------------------------------------------------------------------------
11
12 // For compilers that support precompilation, includes "wx/wx.h".
13 #include "wx/wxprec.h"
14 //----------------------------------------------------------------------------------------
15 #ifdef __BORLANDC__
16 #pragma hdrstop
17 #endif
18 //----------------------------------------------------------------------------------------
19 #ifndef WX_PRECOMP
20 #include "wx/wx.h"
21 #endif
22
23
24 //----------------------------------------------------------------------------------------
25 //-- all #includes that every .cpp needs ----19990807.mj10777 ----------------
26 //----------------------------------------------------------------------------------------
27 #include "std.h"
28
29 //----------------------------------------------------------------------------------------
30 DlgUser::DlgUser(wxWindow *parent, MainDoc *p_Doc, const wxString& title) :
31 wxDialog(parent, ID_DIALOG_DSN, title)
32 {
33 int chSize; // Height of Font * 1.4 = Height of wxTextCtrl
34
35 float ratio = (float)1.4;
36 #ifdef __WXMOTIF__
37 ratio = (float)2.1;
38 #endif
39
40 SetBackgroundColour(_T("wheat"));
41 pDoc = p_Doc;
42 wxLayoutConstraints* layout;
43 SetAutoLayout(true);
44
45 m_Label1 = new wxStaticText(this, wxID_ANY, _("User ID:"));
46 m_Label1->SetFont(* pDoc->ft_Doc);
47 layout = new wxLayoutConstraints;
48 layout->left.SameAs(this, wxLeft, 10);
49 layout->top.SameAs(this, wxTop, 10);
50 layout->height.AsIs();
51 layout->width.Absolute(75);
52 m_Label1->SetConstraints(layout);
53
54 int w;
55 m_Label1->GetSize(&w, &chSize);
56
57 m_UserName = new wxTextCtrl(this, wxID_ANY, wxEmptyString);
58 m_UserName->SetFont(* pDoc->ft_Doc);
59 chSize = (int) (m_UserName->GetCharHeight()*ratio);
60
61 layout = new wxLayoutConstraints;
62 layout->left.SameAs(m_Label1, wxRight, 10);
63 layout->centreY.SameAs(m_Label1,wxCentreY);
64 layout->width.Absolute(200);
65 layout->height.Absolute(chSize);
66 // layout->height.AsIs();
67 m_UserName->SetConstraints(layout);
68
69
70 m_Label2 = new wxStaticText(this, wxID_ANY, _("Password:"));
71 m_Label2->SetFont(* pDoc->ft_Doc);
72 layout = new wxLayoutConstraints;
73 layout->left.SameAs(m_Label1, wxLeft);
74 layout->top.SameAs(m_Label1, wxBottom, 10);
75 layout->height.AsIs();
76 layout->width.SameAs(m_Label1, wxWidth);
77 m_Label2->SetConstraints(layout);
78
79 m_Password = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD);
80 m_Password->SetFont(* pDoc->ft_Doc);
81 layout = new wxLayoutConstraints;
82 layout->left.SameAs(m_UserName, wxLeft);
83 layout->width.SameAs(m_UserName, wxWidth);
84 layout->centreY.SameAs(m_Label2,wxCentreY);
85 layout->height.Absolute(chSize);
86 //layout->height.AsIs();
87 m_Password->SetConstraints(layout);
88
89 m_OK = new wxButton(this, wxID_OK);
90 m_OK->SetFont(* pDoc->ft_Doc);
91 layout = new wxLayoutConstraints;
92 layout->left.SameAs(this, wxLeft, 10);
93 layout->top.SameAs(m_Label2, wxBottom,10);
94 layout->height.AsIs();
95 layout->width.Absolute(75);
96 m_OK->SetConstraints(layout);
97
98 m_Cancel = new wxButton(this, wxID_CANCEL);
99 m_Cancel->SetFont(* pDoc->ft_Doc);
100 layout = new wxLayoutConstraints;
101 layout->left.SameAs(m_OK, wxRight, 10);
102 layout->top.SameAs(m_OK, wxTop);
103 layout->height.AsIs();
104 layout->width.SameAs(m_OK, wxWidth);
105 m_Cancel->SetConstraints(layout);
106
107 m_OK->SetDefault();
108 m_UserName->SetFocus();
109
110 s_User = wxEmptyString;
111 s_Password = wxEmptyString;
112 Layout();
113 }
114
115 //----------------------------------------------------------------------------------------
116 void DlgUser::OnInit()
117 {
118 wxString Temp; Temp.Printf(_T(">>> %s <<<"),s_DSN.c_str());
119 SetTitle(Temp);
120 m_UserName->SetLabel(s_User);
121 m_Password->SetLabel(s_Password);
122 }
123
124 //----------------------------------------------------------------------------------------
125 BEGIN_EVENT_TABLE(DlgUser, wxDialog)
126 EVT_BUTTON(wxID_OK, DlgUser::OnOk)
127 EVT_BUTTON(wxID_CANCEL, DlgUser::OnCancel)
128 END_EVENT_TABLE()
129
130 //----------------------------------------------------------------------------------------
131 void DlgUser::OnOk(wxCommandEvent& WXUNUSED(event) )
132 {
133 //canceled = false;
134 s_User = m_UserName->GetValue();
135 s_Password = m_Password->GetValue();
136 EndModal(wxID_OK);
137 }
138
139 //----------------------------------------------------------------------------------------
140 //void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) )
141 // {
142 // canceled = true;
143 // EndModal(wxID_CANCEL);
144 // }
145 //----------------------------------------------------------------------------------------
146