Statistics
| Revision:

root / trunk / install / launcher / izpack-launcher-1.3_linux / src / selectiondialog.cpp @ 6834

History | View | Annotate | Download (3.47 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
  //wxFont font;
46
  //font.SetFamily(wxDECORATIVE);
47
  //font.SetPointSize(12);
48
  //this->SetFont(font);
49

    
50
  wxString explanationMsg = _("gvSIG requires a Java Runtime Environment");
51
  sizer = new wxBoxSizer(wxVERTICAL);
52

    
53
  // Widgets
54

    
55
  explanationText = new wxStaticText(this, -1, explanationMsg, wxDefaultPosition);
56
  sizer->Add(explanationText, 0, wxALIGN_LEFT | wxALL, 10);
57

    
58
  wxString rlabels[] = {
59
    _("use JRE used by a previous gvSIG version."),
60
    _("install JRE version ready to run in the user home directory."),
61
    _("selecte a JRE manualy"),
62
    _("use JRE defined in JAVA_HOME environ variable or finded in the shell execution path")
63
  };
64
  optionsBox = new wxRadioBox(this, -1,
65
                              _("Select one of these options:"),
66
                              wxDefaultPosition, wxDefaultSize, 4, rlabels, 1,
67
                              wxRA_SPECIFY_COLS);
68
  if( canUsePreviousgvSIG ) 
69
  {
70
     optionsBox->SetSelection( 0 );
71
  } 
72
  else 
73
  {
74
     optionsBox->SetSelection( 1 );
75
  }
76
  sizer->Add(optionsBox, 1, wxGROW | wxALL, 10);
77

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

    
86

    
87
  optionsBox->Enable(0, canUsePreviousgvSIG);
88
  optionsBox->Enable(3, canUseEnviron);
89

    
90
  // Sizer
91
  SetSizer(sizer);
92
  sizer->SetSizeHints(this);
93
}
94

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