]> git.saurik.com Git - wxWidgets.git/blame - demos/dbbrowse/dlguser.cpp
icons fix for unix
[wxWidgets.git] / demos / dbbrowse / dlguser.cpp
CommitLineData
b5ffecfc
GT
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
c09d434d 9// RCS-ID: $Id$
b5ffecfc
GT
10//---------------------------------------------------------------------------
11//-- all #ifdefs that the whole Project needs. ------------------------------
12//---------------------------------------------------------------------------
13#ifdef __GNUG__
b5ce269b
BJ
14#pragma implementation
15#pragma interface
b5ffecfc
GT
16#endif
17//---------------------------------------------------------------------------
18// For compilers that support precompilation, includes "wx/wx.h".
19#include "wx/wxprec.h"
20//---------------------------------------------------------------------------
21#ifdef __BORLANDC__
b5ce269b 22#pragma hdrstop
b5ffecfc
GT
23#endif
24//---------------------------------------------------------------------------
25#ifndef WX_PRECOMP
b5ce269b 26#include "wx/wx.h"
b5ffecfc
GT
27#endif
28//---------------------------------------------------------------------------
29//-- all #includes that every .cpp needs ----19990807.mj10777 ---
30//---------------------------------------------------------------------------
31#include "dlguser.h"
32//---------------------------------------------------------------------------
c09d434d
BJ
33DlgUser::DlgUser(wxWindow *parent, const wxString& title) :
34 wxDialog(parent, ID_DIALOG_DSN, title)
b5ffecfc 35{
b5ce269b 36 SetBackgroundColour("wheat");
c09d434d
BJ
37
38 wxLayoutConstraints* layout;
39 SetAutoLayout(TRUE);
40
41// m_Dsn = new wxStaticText(this, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
42// layout = new wxLayoutConstraints;
43// layout->centreX.SameAs(this, wxCentreX);
44// layout->top.SameAs(this, wxTop,10);
45// layout->height.AsIs();
46// layout->width.AsIs();
47// m_Dsn->SetConstraints(layout);
48
49 m_Label1 = new wxStaticText(this, -1, _("User ID:"));
50 layout = new wxLayoutConstraints;
51 layout->left.SameAs(this, wxLeft, 10);
52 layout->top.SameAs(this, wxTop, 10);
53 layout->height.AsIs();
54 layout->width.Absolute(75);
55 m_Label1->SetConstraints(layout);
56
57 m_UserName = new wxTextCtrl(this, -1, "");
58 layout = new wxLayoutConstraints;
59 layout->left.SameAs(m_Label1, wxRight, 10);
60// layout->top.SameAs(m_Label1, wxTop);
61 layout->centreY.SameAs(m_Label1,wxCentreY);
62 layout->width.Absolute(200);
63 layout->height.AsIs();
64 m_UserName->SetConstraints(layout);
65
66
67 m_Label2 = new wxStaticText(this, -1, _("Password:"));
68 layout = new wxLayoutConstraints;
69 layout->left.SameAs(m_Label1, wxLeft);
70 layout->top.SameAs(m_Label1, wxBottom, 10);
71 layout->height.AsIs();
72 layout->width.SameAs(m_Label1, wxWidth);
73 m_Label2->SetConstraints(layout);
74
75 m_Password = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD);
76 layout = new wxLayoutConstraints;
77 layout->left.SameAs(m_UserName, wxLeft);
78 layout->width.SameAs(m_UserName, wxWidth);
79 // layout->top.SameAs(m_Label2, wxTop);
80 layout->centreY.SameAs(m_Label2,wxCentreY);
81 layout->height.AsIs();
82 m_Password->SetConstraints(layout);
83
84 m_OK = new wxButton(this, wxID_OK, _("Ok"));
85 layout = new wxLayoutConstraints;
86 layout->left.SameAs(this, wxLeft, 10);
87 layout->top.SameAs(m_Label2, wxBottom,10);
88 layout->height.AsIs();
89 layout->width.Absolute(75);
90 m_OK->SetConstraints(layout);
91
92 m_Cancel = new wxButton(this, wxID_CANCEL, _("Cancel"));
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
104 s_User = "";
105 s_Password = "";
106
107 Layout();
108
109
110
111
112// wxButton *but1 = new wxButton(this, wxID_OK, "OK", wxPoint(55,110), wxSize(80, 30));
113// wxButton *but2 = new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(210,110), wxSize(80, 30));
114// (void)new wxStaticText(this, -1,_("User ID"), wxPoint(20, 40), wxSize(50, 20),wxALIGN_LEFT);
115// (void)new wxStaticText(this, -1,_("Password"), wxPoint(20, 80), wxSize(50, 20),wxALIGN_LEFT);
b5ce269b 116 // but1->SetFocus();
c09d434d 117// m_OK->SetDefault();
b5ffecfc 118}
c09d434d
BJ
119
120 void DlgUser::OnInit()
121 {
122 wxString Temp; Temp.Printf(_(">>> %s <<< "),s_DSN.c_str());
123 SetTitle(Temp);
124
125 m_UserName->SetLabel(s_User);
126 m_Password->SetLabel(s_Password);
127
128 // (void)new wxStaticText(this, -1, Temp, wxPoint(10, 10), wxSize(300, 20),wxALIGN_CENTRE );
129// tc_User = new wxTextCtrl(this, ID_USER, s_User, wxPoint(75, 35), wxSize(200, 25), 0, wxDefaultValidator);
130// tc_Password = new wxTextCtrl(this, ID_PASSWORD, s_Password, wxPoint(75, 75), wxSize(200, 25),wxTE_PASSWORD, wxDefaultValidator);
131// tc_User->SetFocus();
132 }
b5ffecfc
GT
133//---------------------------------------------------------------------------
134BEGIN_EVENT_TABLE(DlgUser, wxDialog)
b5ce269b
BJ
135 EVT_BUTTON(wxID_OK, DlgUser::OnOk)
136 EVT_BUTTON(wxID_CANCEL, DlgUser::OnCancel)
c09d434d
BJ
137END_EVENT_TABLE()
138
139
b5ce269b 140 //---------------------------------------------------------------------------
c09d434d 141void DlgUser::OnOk(wxCommandEvent& WXUNUSED(event) )
b5ffecfc 142{
c09d434d
BJ
143 //canceled = FALSE;
144 s_User = m_UserName->GetValue();
145 s_Password = m_Password->GetValue();
b5ce269b 146 EndModal(wxID_OK);
b5ffecfc
GT
147}
148//---------------------------------------------------------------------------
c09d434d
BJ
149//void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) )
150// {
151// canceled = TRUE;
152// EndModal(wxID_CANCEL);
153// }
b5ffecfc 154//---------------------------------------------------------------------------
c09d434d 155