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