Statistics
| Revision:

root / trunk / install / launcher / izpack-launcher-1.3_windows / src / selectiondialog.cpp @ 11445

History | View | Annotate | Download (3.43 KB)

1
/* Copyright (c) 2004 Julien Ponge - All rights reserved.
2
 *
3
 * Permission is hereby granted, free of charge, to any person obtaining a copy
4
 * of this software and associated documentation files (the "Software"), to
5
 * deal in the Software without restriction, including without limitation the
6
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
 * sell copies of the Software, and to permit persons to whom the Software is
8
 * furnished to do so, subject to the following conditions:
9
 *
10
 * The above copyright notice and this permission notice shall be included in
11
 * all copies or substantial portions of the Software.
12
 *
13
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
 * IN THE SOFTWARE.
20
 */
21

    
22
#include "selectiondialog.h"
23

    
24
SelectionDialog::SelectionDialog(const bool &enablePreviousgvSIG,
25
                             const bool &enableEnviron, const wxString &wxStringHeadline )
26
  : wxDialog(0, -1, _(wxStringHeadline), wxDefaultPosition, wxDefaultSize,
27
             wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
28
{
29
  userAction     = PROVIDED;
30
  canUsePreviousgvSIG  = enablePreviousgvSIG;
31
  canUseEnviron = enableEnviron;
32

    
33
  buildUI();
34
  //SetIcon(wxICON(package));  ???
35
}
36

    
37
SelectionDialog::~SelectionDialog()
38
{
39

    
40
}
41

    
42
void SelectionDialog::buildUI()
43
{
44
  // Inits
45

    
46
  wxString explanationMsg = _("The application requires a Java Runtime Environment");
47
  sizer = new wxBoxSizer(wxVERTICAL);
48

    
49
  // Widgets
50

    
51
  explanationText = new wxStaticText(this, -1, explanationMsg, wxDefaultPosition);
52
  sizer->Add(explanationText, 0, wxALIGN_LEFT | wxALL, 10);
53

    
54
  wxString rlabels[] = {
55
    _("use JRE used by a previous application version."),
56
    _("install a JRE version ready to run in the user home directory."),
57
    _("install requisites in the system."),
58
    _("select a JRE manualy."),
59
    _("use the default JRE defined in the system.")
60
  };
61
  optionsBox = new wxRadioBox(this, -1,
62
                              _("Select one of these options:"),
63
                              wxDefaultPosition, wxDefaultSize, 5, rlabels, 1,
64
                              wxRA_SPECIFY_COLS);
65
  if( canUsePreviousgvSIG ) 
66
  {
67
     optionsBox->SetSelection( 0 );
68
  } 
69
  else 
70
  {
71
     optionsBox->SetSelection( 1 );
72
  }
73
  sizer->Add(optionsBox, 1, wxGROW | wxALL, 10);
74

    
75
  okButton = new wxButton(this, wxID_OK, _("Continue"));
76
  //cancelButton = new wxButton(this, wxID_CANCEL, _("Cancel"));
77
  okButton->SetFocus();
78
  sizer->Add(okButton, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT  //| wxALL
79
                          , 10);
80
  
81
  //sizer->Add(cancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL , 10);
82

    
83

    
84
  optionsBox->Enable(0, canUsePreviousgvSIG);
85
  optionsBox->Enable(4, canUseEnviron);
86

    
87
  // Sizer
88
  SetSizer(sizer);
89
  sizer->SetSizeHints(this);
90
}
91

    
92
bool SelectionDialog::Validate()
93
{
94
  switch (optionsBox->GetSelection())
95
  {
96
  case 0: userAction = PREVIOUS_GVSIG;   break;
97
  case 1: userAction = PROVIDED; break;
98
  case 2: userAction = INSTALL; break;
99
  case 3: userAction = SELECT_MANUALY; break;
100
  case 4: userAction = ENVIRON; break;
101
  default: break;
102
  }
103
  return true;
104
}