]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.cxx
e1cec14686f246586a662bc50cf92bfc24b0dea7
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / MaximumsDialog.cxx
1 #include "MaximumsDialog.h"
2
3 IMPLEMENT_CLASS(MaximumsDialog, wxDialog)
4
5 MaximumsDialog::MaximumsDialog(wxWindow *parent,wxString title)
6 :wxDialog(parent,-1,title,wxDefaultPosition,wxDefaultSize, wxDEFAULT_DIALOG_STYLE,_T("dialogBox"))
7 {
8         /*
9          where the user can put the values of the maxX and maxY of the axes of the plotter
10         */
11         m_maxX = new wxTextCtrl( this, -1, wxT(""));
12     m_maxY = new wxTextCtrl( this, -1, wxT(""));
13
14         /*
15         * just labels
16         */
17         maxX=new wxStaticText(this,-1,_T("Max X:"));
18         maxY=new wxStaticText(this,-1,_T("Max Y:"));
19         
20         /*
21         Buttons
22         */
23         okBtn = new wxButton(this,wxID_OK ,_T("OK"));
24         cancelBtn = new wxButton(this,wxID_CANCEL,_T("Cancel"));
25
26         //BOXES
27         //Upper Box
28         wxBoxSizer * upper_box = new wxBoxSizer( wxHORIZONTAL );
29         //Including components for plotter control
30         upper_box->Add( maxX, wxSizerFlags().Border(wxALL,6));
31         upper_box->Add( m_maxX, wxSizerFlags().Border(wxALL,6));
32         upper_box->Add( maxY, wxSizerFlags().Border(wxALL,6));
33         upper_box->Add( m_maxY, wxSizerFlags().Border(wxALL,6));
34         
35
36         //bottom Sizer
37         wxBoxSizer *bottomBox = new wxBoxSizer( wxHORIZONTAL );
38         bottomBox->Add( okBtn, wxSizerFlags().Center());
39         bottomBox->AddSpacer(40);
40         bottomBox->Add( cancelBtn,wxSizerFlags().Center() );
41
42         // Adding the components to the sizer
43         wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
44         sizer->Add( upper_box,0,wxALIGN_BOTTOM);
45         //sizer->AddGrowableRow (1,1);
46         sizer->Add( bottomBox,0,wxALIGN_CENTER);
47     
48         SetAutoLayout( TRUE );
49     SetSizer( sizer );
50         SetBestSize(wxSize(325,100));
51 }
52 //-----------------------------------------------------------------
53 float MaximumsDialog::getXValue()
54 {
55         wxString mx=m_maxX->GetValue();
56         if(mx.IsNumber())
57         {
58                         return (float)atoi( (const char*)(mx.mb_str()) );
59         }
60         else
61                 return -1;
62 }
63 //----------------------------------------------------------------
64 float MaximumsDialog::getYValue()
65 {
66         wxString my=m_maxY->GetValue();
67         if(my.IsNumber())
68         {
69                         return atof( (const char*) (my.mb_str()) );
70         }
71         else
72                 return -1;
73 }
74 //----------------------------------------------------------------
75
76
77