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