2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
// Name: DlgUser.h,cpp
|
|
|
|
// Purpose: Dialog mit Variable Gestaltung durch DlgUser.wxr
|
2001-02-12 14:23:44 -05:00
|
|
|
// Author: Mark Johnson
|
2000-01-28 10:25:32 -05:00
|
|
|
// Modified by: 19991105.mj10777
|
|
|
|
// Created: 19991105
|
|
|
|
// Copyright: (c) Mark Johnson
|
|
|
|
// Licence: wxWindows license
|
2000-01-31 08:20:36 -05:00
|
|
|
// RCS-ID: $Id$
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2005-09-23 08:56:45 -04:00
|
|
|
|
2000-01-28 10:25:32 -05:00
|
|
|
// For compilers that support precompilation, includes "wx/wx.h".
|
|
|
|
#include "wx/wxprec.h"
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
#ifdef __BORLANDC__
|
2000-01-31 05:43:24 -05:00
|
|
|
#pragma hdrstop
|
2000-01-28 10:25:32 -05:00
|
|
|
#endif
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
#ifndef WX_PRECOMP
|
2000-01-31 05:43:24 -05:00
|
|
|
#include "wx/wx.h"
|
2000-01-28 10:25:32 -05:00
|
|
|
#endif
|
2000-03-17 08:12:10 -05:00
|
|
|
|
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
//-- all #includes that every .cpp needs ----19990807.mj10777 ----------------
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
#include "std.h"
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-02-21 03:05:13 -05:00
|
|
|
DlgUser::DlgUser(wxWindow *parent, MainDoc *p_Doc, const wxString& title) :
|
2001-02-01 15:24:44 -05:00
|
|
|
wxDialog(parent, ID_DIALOG_DSN, title)
|
2000-01-28 10:25:32 -05:00
|
|
|
{
|
2001-02-01 15:24:44 -05:00
|
|
|
int chSize; // Height of Font * 1.4 = Height of wxTextCtrl
|
2004-06-12 19:44:08 -04:00
|
|
|
|
2001-02-01 15:24:44 -05:00
|
|
|
float ratio = (float)1.4;
|
2000-03-17 08:39:45 -05:00
|
|
|
#ifdef __WXMOTIF__
|
2001-02-01 15:24:44 -05:00
|
|
|
ratio = (float)2.1;
|
2000-03-17 08:39:45 -05:00
|
|
|
#endif
|
2004-06-12 19:44:08 -04:00
|
|
|
|
2004-01-11 17:08:25 -05:00
|
|
|
SetBackgroundColour(_T("wheat"));
|
2001-02-01 15:24:44 -05:00
|
|
|
pDoc = p_Doc;
|
|
|
|
wxLayoutConstraints* layout;
|
2004-06-01 14:27:09 -04:00
|
|
|
SetAutoLayout(true);
|
2004-06-12 19:44:08 -04:00
|
|
|
|
2004-06-01 14:27:09 -04:00
|
|
|
m_Label1 = new wxStaticText(this, wxID_ANY, _("User ID:"));
|
2001-02-01 15:24:44 -05:00
|
|
|
m_Label1->SetFont(* pDoc->ft_Doc);
|
|
|
|
layout = new wxLayoutConstraints;
|
|
|
|
layout->left.SameAs(this, wxLeft, 10);
|
|
|
|
layout->top.SameAs(this, wxTop, 10);
|
|
|
|
layout->height.AsIs();
|
|
|
|
layout->width.Absolute(75);
|
|
|
|
m_Label1->SetConstraints(layout);
|
2004-06-12 19:44:08 -04:00
|
|
|
|
2001-02-01 15:24:44 -05:00
|
|
|
int w;
|
2004-06-12 19:44:08 -04:00
|
|
|
m_Label1->GetSize(&w, &chSize);
|
|
|
|
|
|
|
|
m_UserName = new wxTextCtrl(this, wxID_ANY, wxEmptyString);
|
2001-02-01 15:24:44 -05:00
|
|
|
m_UserName->SetFont(* pDoc->ft_Doc);
|
|
|
|
chSize = (int) (m_UserName->GetCharHeight()*ratio);
|
2004-06-12 19:44:08 -04:00
|
|
|
|
2001-02-01 15:24:44 -05:00
|
|
|
layout = new wxLayoutConstraints;
|
|
|
|
layout->left.SameAs(m_Label1, wxRight, 10);
|
|
|
|
layout->centreY.SameAs(m_Label1,wxCentreY);
|
|
|
|
layout->width.Absolute(200);
|
|
|
|
layout->height.Absolute(chSize);
|
|
|
|
// layout->height.AsIs();
|
|
|
|
m_UserName->SetConstraints(layout);
|
2004-06-12 19:44:08 -04:00
|
|
|
|
|
|
|
|
2004-06-01 14:27:09 -04:00
|
|
|
m_Label2 = new wxStaticText(this, wxID_ANY, _("Password:"));
|
2001-02-01 15:24:44 -05:00
|
|
|
m_Label2->SetFont(* pDoc->ft_Doc);
|
|
|
|
layout = new wxLayoutConstraints;
|
|
|
|
layout->left.SameAs(m_Label1, wxLeft);
|
|
|
|
layout->top.SameAs(m_Label1, wxBottom, 10);
|
|
|
|
layout->height.AsIs();
|
|
|
|
layout->width.SameAs(m_Label1, wxWidth);
|
|
|
|
m_Label2->SetConstraints(layout);
|
2004-06-12 19:44:08 -04:00
|
|
|
|
|
|
|
m_Password = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD);
|
2001-02-01 15:24:44 -05:00
|
|
|
m_Password->SetFont(* pDoc->ft_Doc);
|
|
|
|
layout = new wxLayoutConstraints;
|
|
|
|
layout->left.SameAs(m_UserName, wxLeft);
|
|
|
|
layout->width.SameAs(m_UserName, wxWidth);
|
|
|
|
layout->centreY.SameAs(m_Label2,wxCentreY);
|
|
|
|
layout->height.Absolute(chSize);
|
|
|
|
//layout->height.AsIs();
|
|
|
|
m_Password->SetConstraints(layout);
|
2004-06-12 19:44:08 -04:00
|
|
|
|
2005-01-31 13:18:18 -05:00
|
|
|
m_OK = new wxButton(this, wxID_OK);
|
2001-02-01 15:24:44 -05:00
|
|
|
m_OK->SetFont(* pDoc->ft_Doc);
|
|
|
|
layout = new wxLayoutConstraints;
|
|
|
|
layout->left.SameAs(this, wxLeft, 10);
|
|
|
|
layout->top.SameAs(m_Label2, wxBottom,10);
|
|
|
|
layout->height.AsIs();
|
|
|
|
layout->width.Absolute(75);
|
|
|
|
m_OK->SetConstraints(layout);
|
2004-06-12 19:44:08 -04:00
|
|
|
|
2005-01-31 13:18:18 -05:00
|
|
|
m_Cancel = new wxButton(this, wxID_CANCEL);
|
2001-02-01 15:24:44 -05:00
|
|
|
m_Cancel->SetFont(* pDoc->ft_Doc);
|
|
|
|
layout = new wxLayoutConstraints;
|
|
|
|
layout->left.SameAs(m_OK, wxRight, 10);
|
|
|
|
layout->top.SameAs(m_OK, wxTop);
|
|
|
|
layout->height.AsIs();
|
|
|
|
layout->width.SameAs(m_OK, wxWidth);
|
|
|
|
m_Cancel->SetConstraints(layout);
|
2004-06-12 19:44:08 -04:00
|
|
|
|
2001-02-01 15:24:44 -05:00
|
|
|
m_OK->SetDefault();
|
|
|
|
m_UserName->SetFocus();
|
2004-06-12 19:44:08 -04:00
|
|
|
|
|
|
|
s_User = wxEmptyString;
|
|
|
|
s_Password = wxEmptyString;
|
2001-02-01 15:24:44 -05:00
|
|
|
Layout();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
void DlgUser::OnInit()
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
wxString Temp; Temp.Printf(_T(">>> %s <<<"),s_DSN.c_str());
|
2001-02-01 15:24:44 -05:00
|
|
|
SetTitle(Temp);
|
|
|
|
m_UserName->SetLabel(s_User);
|
|
|
|
m_Password->SetLabel(s_Password);
|
2000-02-12 09:11:17 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
BEGIN_EVENT_TABLE(DlgUser, wxDialog)
|
2001-02-01 15:24:44 -05:00
|
|
|
EVT_BUTTON(wxID_OK, DlgUser::OnOk)
|
|
|
|
EVT_BUTTON(wxID_CANCEL, DlgUser::OnCancel)
|
2000-01-31 08:20:36 -05:00
|
|
|
END_EVENT_TABLE()
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-31 08:20:36 -05:00
|
|
|
void DlgUser::OnOk(wxCommandEvent& WXUNUSED(event) )
|
2000-01-28 10:25:32 -05:00
|
|
|
{
|
2004-06-01 14:27:09 -04:00
|
|
|
//canceled = false;
|
2001-02-01 15:24:44 -05:00
|
|
|
s_User = m_UserName->GetValue();
|
|
|
|
s_Password = m_Password->GetValue();
|
|
|
|
EndModal(wxID_OK);
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-31 08:20:36 -05:00
|
|
|
//void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) )
|
|
|
|
// {
|
2004-06-01 14:27:09 -04:00
|
|
|
// canceled = true;
|
2000-01-31 08:20:36 -05:00
|
|
|
// EndModal(wxID_CANCEL);
|
|
|
|
// }
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-31 08:20:36 -05:00
|
|
|
|