]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.cxx
#3418 creaMaracasVisu Feature New Normal - ManualPaint_model with openmp
[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 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
76 #if wxMAJOR_VERSION <= 2
77         SetBestSize(wxSize(325,100));
78 #else
79         SetSize(wxSize(325,100));
80 #endif
81 }
82 //-----------------------------------------------------------------
83 float MaximumsDialog::getXValue()
84 {
85         wxString mx=m_maxX->GetValue();
86         if(mx.IsNumber())
87         {
88                         return (float)atoi( (const char*)(mx.mb_str()) );
89         }
90         else
91                 return -1;
92 }
93 //----------------------------------------------------------------
94 float MaximumsDialog::getYValue()
95 {
96         wxString my=m_maxY->GetValue();
97         if(my.IsNumber())
98         {
99                         return atof( (const char*) (my.mb_str()) );
100         }
101         else
102                 return -1;
103 }
104 //----------------------------------------------------------------
105
106
107