1 /*****************************************************************************
5 ** Purpose: Dialog routines for CTSim program
6 ** Programmer: Kevin Rosenberg
7 ** Date Started: July 2000
9 ** This is part of the CTSim program
10 ** Copyright (C) 1983-2000 Kevin Rosenberg
12 ** $Id: dialogs.cpp,v 1.1 2000/07/18 03:14:35 kevin Exp $
14 ** This program is free software; you can redistribute it and/or modify
15 ** it under the terms of the GNU General Public License (version 2) as
16 ** published by the Free Software Foundation.
18 ** This program is distributed in the hope that it will be useful,
19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ** GNU General Public License for more details.
23 ** You should have received a copy of the GNU General Public License
24 ** along with this program; if not, write to the Free Software
25 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 ******************************************************************************/
29 // #pragma implementation
32 // For compilers that support precompilation, includes "wx/wx.h".
33 #include "wx/wxprec.h"
43 #if !wxUSE_DOC_VIEW_ARCHITECTURE
44 #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
47 #include "wx/statline.h"
52 DialogGetImageMinMax::DialogGetImageMinMax (wxFrame* pParent, const ImageFile& rImagefile, double dDefaultMin = 0., double dDefaultMax = 0.)
53 : wxDialog (pParent, -1, "Set Image Display Minimum & Maximum", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxCAPTION), m_pTopSizer(NULL), m_pTextCtrlMin(NULL), m_pTextCtrlMax(NULL), m_pButtonSizer(NULL), m_pButtonOk(NULL), m_pButtonCancel(NULL), m_dDefaultMin(dDefaultMin), m_dDefaultMax(dDefaultMax)
55 wxBoxSizer* m_pTopSizer = new wxBoxSizer (wxVERTICAL);
57 m_pTopSizer->Add (new wxStaticText (this, -1, "Set Image Display Minimum and Maximum"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
61 m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
64 m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
66 wxGridSizer *pGridSizer = new wxGridSizer (2, 2, 5);
67 pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
68 pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
69 pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
70 pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
71 m_pTopSizer->Add (pGridSizer, 1, wxALL, 10);
73 m_pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
75 m_pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
76 m_pButtonOk = new wxButton (this, wxID_OK, "Okay");
77 m_pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
78 m_pButtonSizer->Add (m_pButtonOk, 0, wxEXPAND | wxALL, 10);
79 m_pButtonSizer->Add (m_pButtonCancel, 0, wxEXPAND | wxALL, 10);
81 m_pTopSizer->Add (m_pButtonSizer, 0, wxALIGN_CENTER);
84 SetSizer (m_pTopSizer);
85 m_pTopSizer->Fit (this);
86 m_pTopSizer->SetSizeHints (this);
89 DialogGetImageMinMax::~DialogGetImageMinMax (void)
93 delete m_pTextCtrlMin;
94 delete m_pTextCtrlMax;
95 delete m_pButtonSizer;
97 delete m_pButtonCancel;
102 DialogGetImageMinMax::getMinimum (void)
104 wxString strCtrl = m_pTextCtrlMin->GetValue();
106 if (strCtrl.ToDouble (&dValue))
109 return (m_dDefaultMin);
113 DialogGetImageMinMax::getMaximum (void)
115 wxString strCtrl = m_pTextCtrlMax->GetValue();
117 if (strCtrl.ToDouble (&dValue))
120 return (m_dDefaultMax);