]> git.saurik.com Git - wxWidgets.git/blob - demos/dbbrowse/dlguser.cpp
c5c1f41f82b150d961a4a3e8de7625c8ec196a0f
[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, 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 SetBackgroundColour("wheat");
40 pDoc = p_Doc;
41 wxLayoutConstraints* layout;
42 SetAutoLayout(TRUE);
43
44 m_Label1 = new wxStaticText(this, -1, _("User ID:"));
45 // m_Label1->SetFont(* pDoc->ft_Doc);
46 layout = new wxLayoutConstraints;
47 layout->left.SameAs(this, wxLeft, 10);
48 layout->top.SameAs(this, wxTop, 10);
49 layout->height.AsIs();
50 layout->width.Absolute(75);
51 m_Label1->SetConstraints(layout);
52
53
54 m_UserName = new wxTextCtrl(this, -1, "");
55 m_UserName->SetFont(* pDoc->ft_Doc);
56 //chSize = m_Label1->GetCharHeight()*1.4;
57
58 layout = new wxLayoutConstraints;
59 layout->left.SameAs(m_Label1, wxRight, 10);
60 layout->centreY.SameAs(m_Label1,wxCentreY);
61 layout->width.Absolute(200);
62 //layout->height.Absolute(chSize);
63 layout->height.AsIs();
64 m_UserName->SetConstraints(layout);
65
66
67 m_Label2 = new wxStaticText(this, -1, _("Password:"));
68 // m_Label2->SetFont(* pDoc->ft_Doc);
69 layout = new wxLayoutConstraints;
70 layout->left.SameAs(m_Label1, wxLeft);
71 layout->top.SameAs(m_Label1, wxBottom, 10);
72 layout->height.AsIs();
73 layout->width.SameAs(m_Label1, wxWidth);
74 m_Label2->SetConstraints(layout);
75
76 m_Password = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD);
77 // m_Password->SetFont(* pDoc->ft_Doc);
78 layout = new wxLayoutConstraints;
79 layout->left.SameAs(m_UserName, wxLeft);
80 layout->width.SameAs(m_UserName, wxWidth);
81 layout->centreY.SameAs(m_Label2,wxCentreY);
82 //layout->height.Absolute(chSize);
83 layout->height.AsIs();
84 m_Password->SetConstraints(layout);
85
86 m_OK = new wxButton(this, wxID_OK, _("OK"));
87 // m_OK->SetFont(* pDoc->ft_Doc);
88 layout = new wxLayoutConstraints;
89 layout->left.SameAs(this, wxLeft, 10);
90 layout->top.SameAs(m_Label2, wxBottom,10);
91 layout->height.AsIs();
92 layout->width.Absolute(75);
93 m_OK->SetConstraints(layout);
94
95 m_Cancel = new wxButton(this, wxID_CANCEL, _("Cancel"));
96 // m_Cancel->SetFont(* pDoc->ft_Doc);
97 layout = new wxLayoutConstraints;
98 layout->left.SameAs(m_OK, wxRight, 10);
99 layout->top.SameAs(m_OK, wxTop);
100 layout->height.AsIs();
101 layout->width.SameAs(m_OK, wxWidth);
102 m_Cancel->SetConstraints(layout);
103
104 m_OK->SetDefault();
105 m_UserName->SetFocus();
106
107 s_User = "";
108 s_Password = "";
109 Layout();
110 }
111 //----------------------------------------------------------------------------------------
112 void DlgUser::OnInit()
113 {
114 wxString Temp; Temp.Printf(">>> %s <<<",s_DSN.c_str());
115 SetTitle(Temp);
116 m_UserName->SetLabel(s_User);
117 m_Password->SetLabel(s_Password);
118 }
119 //----------------------------------------------------------------------------------------
120 BEGIN_EVENT_TABLE(DlgUser, wxDialog)
121 EVT_BUTTON(wxID_OK, DlgUser::OnOk)
122 EVT_BUTTON(wxID_CANCEL, DlgUser::OnCancel)
123 END_EVENT_TABLE()
124 //----------------------------------------------------------------------------------------
125 void DlgUser::OnOk(wxCommandEvent& WXUNUSED(event) )
126 {
127 //canceled = FALSE;
128 s_User = m_UserName->GetValue();
129 s_Password = m_Password->GetValue();
130 EndModal(wxID_OK);
131 }
132 //----------------------------------------------------------------------------------------
133 //void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) )
134 // {
135 // canceled = TRUE;
136 // EndModal(wxID_CANCEL);
137 // }
138 //----------------------------------------------------------------------------------------
139