svn-gvsig-desktop / trunk / build / distribution / launcher / izpack-launcher-1.3_linux / src / selectiondialog.cpp @ 21757
History | View | Annotate | Download (4.13 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 |
int optionIndex = 0; |
58 |
wxString rlabels[] = { |
59 |
_("use JRE used by a previous gvSIG version"),
|
60 |
_("install a JRE version ready to run in the user home directory"),
|
61 |
_("select a JRE manualy"),
|
62 |
_("use the JRE defined in JAVA_HOME environment variable or finded in the shell execution path")
|
63 |
}; |
64 |
if( canUsePreviousgvSIG )
|
65 |
{ |
66 |
//rlabels[0] = _("use JRE used by a previous gvSIG version (Recommended) .");
|
67 |
rlabels[0] = rlabels[0] + _(" (Recommended)."); |
68 |
rlabels[1] = rlabels[1] + "."; |
69 |
} |
70 |
else
|
71 |
{ |
72 |
rlabels[0] = rlabels[0] + "."; |
73 |
rlabels[1] = rlabels[1] +_(" (Recommended)."); |
74 |
optionIndex = 1;
|
75 |
} |
76 |
optionsBox = new wxRadioBox(this, -1, |
77 |
_("Select one of these options:"),
|
78 |
wxDefaultPosition, wxDefaultSize, 4, rlabels, 1, |
79 |
wxRA_SPECIFY_COLS); |
80 |
/*
|
81 |
if( canUsePreviousgvSIG )
|
82 |
{
|
83 |
optionsBox->SetSelection( 0 );
|
84 |
}
|
85 |
else
|
86 |
{
|
87 |
optionsBox->SetSelection( 1 );
|
88 |
}
|
89 |
*/
|
90 |
optionsBox->SetSelection(optionIndex); |
91 |
//optionsBox->SetLabel(
|
92 |
//optionsBox->GetSelection(),
|
93 |
//optionsBox->GetLabel(optionsBox->GetSelection()) + _(" (Recommended) ") );
|
94 |
|
95 |
sizer->Add(optionsBox, 1, wxGROW | wxALL, 10); |
96 |
|
97 |
okButton = new wxButton(this, wxID_OK, _("Continue")); |
98 |
//cancelButton = new wxButton(this, wxID_CANCEL, _("Cancel"));
|
99 |
okButton->SetFocus(); |
100 |
sizer->Add(okButton, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT //| wxALL |
101 |
, 10);
|
102 |
|
103 |
//sizer->Add(cancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL , 10);
|
104 |
|
105 |
|
106 |
optionsBox->Enable(0, canUsePreviousgvSIG);
|
107 |
optionsBox->Enable(3, canUseEnviron);
|
108 |
|
109 |
// Sizer
|
110 |
SetSizer(sizer); |
111 |
sizer->SetSizeHints(this);
|
112 |
} |
113 |
|
114 |
bool SelectionDialog::Validate()
|
115 |
{ |
116 |
switch (optionsBox->GetSelection())
|
117 |
{ |
118 |
case 0: userAction = PREVIOUS_GVSIG; break; |
119 |
case 1: userAction = PROVIDED; break; |
120 |
case 2: userAction = SELECT_MANUALY; break; |
121 |
case 3: userAction = ENVIRON; break; |
122 |
default: break; |
123 |
} |
124 |
return true; |
125 |
} |