]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/configtool/standalone/wxwin/licensedlg.cpp
Initial revision
[karo-tx-redboot.git] / tools / src / tools / configtool / standalone / wxwin / licensedlg.cpp
1 //####COPYRIGHTBEGIN####
2 //
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 //
6 // This program is part of the eCos host tools.
7 //
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free
10 // Software Foundation; either version 2 of the License, or (at your option)
11 // any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
16 // more details.
17 //
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 //
22 // ----------------------------------------------------------------------------
23 //
24 //####COPYRIGHTEND####
25 // appsettings.cpp :
26 //
27 //===========================================================================
28 //#####DESCRIPTIONBEGIN####
29 //
30 // Author(s):   julians
31 // Contact(s):  julians
32 // Date:        2000/12/18
33 // Version:     $Id$
34 // Purpose:
35 // Description: Implementation file for ecLicenseDialog
36 // Requires:
37 // Provides:
38 // See also:
39 // Known bugs:
40 // Usage:
41 //
42 //####DESCRIPTIONEND####
43 //
44 //===========================================================================
45
46 #ifdef __GNUG__
47     #pragma implementation "licensedlg.cpp"
48 #endif
49
50 #include "ecpch.h"
51
52 #ifdef __BORLANDC__
53     #pragma hdrstop
54 #endif
55
56 #include "wx/valgen.h"
57
58 #include "licensedlg.h"
59 #include "configtool.h"
60
61 //----------------------------------------------------------------------------
62 // ecLicenseDialog
63 //----------------------------------------------------------------------------
64
65 // WDR: event table for ecLicenseDialog
66
67 BEGIN_EVENT_TABLE(ecLicenseDialog, ecDialog)
68     EVT_BUTTON( wxID_OK, ecLicenseDialog::OnOK )
69     EVT_BUTTON( wxID_CANCEL, ecLicenseDialog::OnCancel )
70 END_EVENT_TABLE()
71
72 ecLicenseDialog::ecLicenseDialog( const wxString& licenseText, wxWindow *parent, wxWindowID id, const wxString &title,
73     const wxPoint &position, const wxSize& size, long style )
74 {
75     SetExtraStyle(wxDIALOG_EX_CONTEXTHELP);
76     m_licenseText = licenseText;
77
78     wxDialog::Create( parent, id, title, position, size, style );
79
80     CreateControls();
81     
82     Centre(wxBOTH);
83 }
84
85 // WDR: handler implementations for ecLicenseDialog
86
87 void ecLicenseDialog::OnOK(wxCommandEvent &event)
88 {
89     event.Skip();
90 }
91
92 void ecLicenseDialog::OnCancel(wxCommandEvent &event)
93 {
94     event.Skip();
95 }
96
97 void ecLicenseDialog::CreateControls()
98 {
99     wxWindow* parent = this;
100
101     wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
102
103     wxTextCtrl *item1 = new wxTextCtrl( parent, ecID_LICENSE_TEXT, _(""), wxDefaultPosition, wxSize(590,260), wxTE_MULTILINE|wxTE_READONLY );
104     item0->Add( item1, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
105
106     wxStaticText *item2 = new wxStaticText( parent, wxID_STATIC, 
107         _("Do you accept all the terms of the preceding license agreement?"),
108         wxDefaultPosition, wxDefaultSize, 0 );
109     item0->Add( item2, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
110
111     wxSizer *item3 = new wxBoxSizer( wxHORIZONTAL );
112
113     wxButton *item4 = new wxButton( parent, wxID_OK, _("&Yes"), wxDefaultPosition, wxDefaultSize, 0 );
114     item4->SetDefault();
115     item3->Add( item4, 0, wxALIGN_CENTRE|wxALL, 5 );
116
117     wxButton *item5 = new wxButton( parent, wxID_CANCEL, _("&No"), wxDefaultPosition, wxDefaultSize, 0 );
118     item3->Add( item5, 0, wxALIGN_CENTRE|wxALL, 5 );
119
120     item0->Add( item3, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
121
122     parent->SetAutoLayout( TRUE );
123     parent->SetSizer( item0 );
124     parent->Layout();
125     item0->Fit( parent );
126     item0->SetSizeHints( parent );
127
128     // Add validators
129     parent->FindWindow( ecID_LICENSE_TEXT )->SetValidator(wxGenericValidator(& m_licenseText));
130
131     // Add context-sensitive help text
132     parent->FindWindow( ecID_LICENSE_TEXT )->SetHelpText(_("Displays the license for this package."));
133     parent->FindWindow( wxID_OK )->SetHelpText(_("Confirms that you accept the license."));
134     parent->FindWindow( wxID_CANCEL )->SetHelpText(_("Confirms that you do NOT accept the license."));
135
136 #if __WXGTK__
137     // parent->FindWindow( wxID_CONTEXT_HELP )->SetHelpText(_("Invokes context-sensitive help for the clicked-on window."));
138 #endif
139
140 }
141
142