]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.cxx
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / MaximumsDialog.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 #include "MaximumsDialog.h"
27
28 IMPLEMENT_CLASS(MaximumsDialog, wxDialog)
29
30 MaximumsDialog::MaximumsDialog(wxWindow *parent,wxString title)
31 :wxDialog(parent,-1,title,wxDefaultPosition,wxDefaultSize, wxDEFAULT_DIALOG_STYLE,_T("dialogBox"))
32 {
33         /*
34          where the user can put the values of the maxX and maxY of the axes of the plotter
35         */
36         m_maxX = new wxTextCtrl( this, -1, wxT(""));
37     m_maxY = new wxTextCtrl( this, -1, wxT(""));
38
39         /*
40         * just labels
41         */
42         maxX=new wxStaticText(this,-1,_T("Max X:"));
43         maxY=new wxStaticText(this,-1,_T("Max Y:"));
44         
45         /*
46         Buttons
47         */
48         okBtn = new wxButton(this,wxID_OK ,_T("OK"));
49         cancelBtn = new wxButton(this,wxID_CANCEL,_T("Cancel"));
50
51         //BOXES
52         //Upper Box
53         wxBoxSizer * upper_box = new wxBoxSizer( wxHORIZONTAL );
54         //Including components for plotter control
55         upper_box->Add( maxX, wxSizerFlags().Border(wxALL,6));
56         upper_box->Add( m_maxX, wxSizerFlags().Border(wxALL,6));
57         upper_box->Add( maxY, wxSizerFlags().Border(wxALL,6));
58         upper_box->Add( m_maxY, wxSizerFlags().Border(wxALL,6));
59         
60
61         //bottom Sizer
62         wxBoxSizer *bottomBox = new wxBoxSizer( wxHORIZONTAL );
63         bottomBox->Add( okBtn, wxSizerFlags().Center());
64         bottomBox->AddSpacer(40);
65         bottomBox->Add( cancelBtn,wxSizerFlags().Center() );
66
67         // Adding the components to the sizer
68         wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
69         sizer->Add( upper_box,0,wxALIGN_BOTTOM);
70         //sizer->AddGrowableRow (1,1);
71         sizer->Add( bottomBox,0,wxALIGN_CENTER);
72     
73         SetAutoLayout( TRUE );
74     SetSizer( sizer );
75         SetBestSize(wxSize(325,100));
76 }
77 //-----------------------------------------------------------------
78 float MaximumsDialog::getXValue()
79 {
80         wxString mx=m_maxX->GetValue();
81         if(mx.IsNumber())
82         {
83                         return (float)atoi( (const char*)(mx.mb_str()) );
84         }
85         else
86                 return -1;
87 }
88 //----------------------------------------------------------------
89 float MaximumsDialog::getYValue()
90 {
91         wxString my=m_maxY->GetValue();
92         if(my.IsNumber())
93         {
94                         return atof( (const char*) (my.mb_str()) );
95         }
96         else
97                 return -1;
98 }
99 //----------------------------------------------------------------
100
101
102