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