Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

dlgAbout.cpp

Go to the documentation of this file.
00001 /* 00002 * wxChecksums 00003 * Copyright (C) 2003-2004 Julien Couot 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 00020 /** 00021 * \file dlgAbout.cpp 00022 * About dialog. 00023 */ 00024 00025 00026 //--------------------------------------------------------------------------- 00027 // For compilers that support precompilation, includes "wx.h". 00028 #include <wx/wxprec.h> 00029 00030 #ifdef __BORLANDC__ 00031 #pragma hdrstop 00032 #endif 00033 00034 #ifndef WX_PRECOMP 00035 // Include your minimal set of headers here, or wx.h 00036 #include <wx/wx.h> 00037 #endif 00038 00039 #include <wx/notebook.h> 00040 00041 #include "dlgAbout.hpp" 00042 #include "frmSums.hpp" 00043 #include "appprefs.hpp" 00044 #include "comdefs.hpp" 00045 #include "language.hpp" 00046 #include "licence.hpp" 00047 #include "utils.hpp" 00048 00049 #include "compat.hpp" 00050 //--------------------------------------------------------------------------- 00051 00052 00053 /// The C++ standard namespace. 00054 using namespace std; 00055 00056 00057 IMPLEMENT_DYNAMIC_CLASS(dlgAbout, wxDialog) 00058 00059 00060 /** 00061 * Creates a new dialog. 00062 */ 00063 dlgAbout::dlgAbout() : wxDialog() 00064 { 00065 createControls(); 00066 } 00067 //--------------------------------------------------------------------------- 00068 00069 00070 /** 00071 * Creates a new dialog. 00072 * 00073 * @param parent Parent of the dialog. 00074 */ 00075 dlgAbout::dlgAbout(wxWindow* parent) : 00076 wxDialog(parent, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 00077 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) 00078 { 00079 createControls(); 00080 00081 /* int w, h; 00082 ::wxDisplaySize(&w, &h);*/ 00083 if (parent != NULL) 00084 { 00085 wxSize s = parent->GetSize(); 00086 this->SetSize((s.GetWidth() * 9) / 10, (s.GetHeight() * 2) / 3); 00087 } 00088 Centre(); 00089 } 00090 //--------------------------------------------------------------------------- 00091 00092 00093 /** 00094 * Creates and initializes the controls of the dialog. 00095 */ 00096 void dlgAbout::createControls() 00097 { 00098 // Sets the dialog title 00099 this->SetTitle(wxString::Format(_("About %s"), wxT(APP_NAME))); 00100 00101 // The application icon and name 00102 wxStaticBitmap* imgAppIcon; 00103 frmSums* parent = wxDynamicCast(this->GetParent(), frmSums); 00104 if (parent != NULL) 00105 imgAppIcon = new wxStaticBitmap(this, -1, parent->GetIcon()); 00106 else 00107 imgAppIcon = new wxStaticBitmap(this, -1, wxNullBitmap); 00108 wxStaticText* lblAppName = new wxStaticText(this, -1, ::getAppName()); 00109 wxFont f = lblAppName->GetFont(); 00110 lblAppName->SetFont(wxFont((f.GetPointSize() * 125) / 100, f.GetFamily(), f.GetStyle(), f.GetWeight(), f.GetUnderlined(), f.GetFaceName(), f.GetDefaultEncoding())); 00111 00112 // The notebook 00113 wxNotebook* pgcAbout = new wxNotebook(this, -1); 00114 00115 // About page 00116 wxPanel* tabAbout = new wxPanel(pgcAbout); 00117 pgcAbout->AddPage(tabAbout, _("About"), true); 00118 wxStaticText* lblAppDesc = new wxStaticText(tabAbout, -1, _("Computes and verifies checksums")); 00119 wxStaticText* lblAppCopyright = new wxStaticText(tabAbout, -1, wxString::Format(_("Copyright (c) %s %s"), wxT(APP_DEV_DATES), wxT(APP_AUTHOR))); 00120 00121 // Author page 00122 wxPanel* tabAuthors = new wxPanel(pgcAbout); 00123 pgcAbout->AddPage(tabAuthors, _("Author"), false); 00124 wxTextCtrl* txtAuthors = new wxTextCtrl(tabAuthors, -1, wxString(wxT(APP_AUTHOR)) + wxString(wxT(" <jcouot@users.sourceforge.net>\n\t")) + _("Programmer & documentation"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY); 00125 00126 // Translations page 00127 wxPanel* tabTranslations = new wxPanel(pgcAbout); 00128 pgcAbout->AddPage(tabTranslations, _("Translations"), false); 00129 wxTextCtrl* txtTranslations = new wxTextCtrl(tabTranslations, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY); 00130 Languages languages; 00131 int i; 00132 for (i = 0; i < languages.getLanguagesCount(); i++) 00133 { 00134 txtTranslations->AppendText(languages.getLanguageShortName(i) + wxT('\t') + languages.getLanguageTranslatorName(i)); 00135 if (languages.getLanguageTranslatorName(i) != languages.getLanguageTranslatorNameInLocale(i)) 00136 txtTranslations->AppendText(wxT(" (") + languages.getLanguageTranslatorNameInLocale(i) + wxT(')')); 00137 txtTranslations->AppendText(wxT("\n")); 00138 } 00139 00140 // Licence agreement page 00141 wxPanel* tabLicence = new wxPanel(pgcAbout); 00142 pgcAbout->AddPage(tabLicence, _("Licence agreement")); 00143 wxTextCtrl* txtLicence = new wxTextCtrl(tabLicence, -1, wxString(_("This program is distributed under the terms of the GPL v2.")) + wxString(wxT("\n\n")) + ::getGPLLicenceText(), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY); 00144 #if defined(__WXMSW__) 00145 txtLicence->SetFont(wxSystemSettings::GetFont(wxSYS_ANSI_FIXED_FONT)); 00146 #else 00147 txtLicence->SetFont(wxFont(txtLicence->GetFont().GetPointSize(), wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); 00148 #endif // defined(__WXMSW__) 00149 00150 // Misc information page 00151 wxPanel* tabMiscInfo = new wxPanel(pgcAbout); 00152 pgcAbout->AddPage(tabMiscInfo, _("Misc information")); 00153 wxTextCtrl* txtMiscInfo = new wxTextCtrl(tabMiscInfo, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY); 00154 wxString star = wxT("* "); 00155 txtMiscInfo->AppendText(wxString::Format(star + _("Built with wxWidgets %d.%d.%d."), wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER)); 00156 #if defined(wxC_USE_LARGE_FILES) 00157 txtMiscInfo->AppendText(wxString(wxT("\n")) + star + _("Large files support enabled.")); 00158 #else 00159 txtMiscInfo->AppendText(wxString(wxT("\n")) + star + _("Large files support disabled.")); 00160 #endif // defined(wxC_USE_LARGE_FILES) 00161 00162 // The validation buttons 00163 wxButton* btnClose = new wxButton(this, wxID_CANCEL, _("&Close")); 00164 00165 00166 //------------------------------------------------------------------------- 00167 // Creates the dialog sizer 00168 00169 // The icon and the name of the application. 00170 wxBoxSizer* appIconAndNameSizer = new wxBoxSizer(wxHORIZONTAL); 00171 appIconAndNameSizer->Add(imgAppIcon, 0, wxALIGN_CENTER_VERTICAL); 00172 appIconAndNameSizer->Add(lblAppName, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00173 00174 // Notebook control sizer 00175 //wxNotebookSizer* pgcAboutSizer = new wxNotebookSizer(pgcAbout); 00176 00177 // About tab sizer 00178 // The panel sizer 00179 wxBoxSizer* tabAboutSizer2 = new wxBoxSizer(wxVERTICAL); 00180 tabAbout->SetSizer(tabAboutSizer2); 00181 wxBoxSizer* tabAboutSizer = new wxBoxSizer(wxVERTICAL); 00182 tabAboutSizer2->Add(tabAboutSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00183 00184 tabAboutSizer->Add(lblAppDesc); 00185 tabAboutSizer->Add(lblAppCopyright, 0, wxTOP, CONTROL_SPACE); 00186 00187 00188 // Translations tab sizer 00189 // The panel sizer 00190 wxBoxSizer* tabTranslationsSizer2 = new wxBoxSizer(wxVERTICAL); 00191 tabTranslations->SetSizer(tabTranslationsSizer2); 00192 wxBoxSizer* tabTranslationsSizer = new wxBoxSizer(wxVERTICAL); 00193 tabTranslationsSizer2->Add(tabTranslationsSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00194 00195 tabTranslationsSizer->Add(txtTranslations, 1, wxGROW); 00196 00197 00198 // Licence agreement tab sizer 00199 // The panel sizer 00200 wxBoxSizer* tabAuthorsSizer2 = new wxBoxSizer(wxVERTICAL); 00201 tabAuthors->SetSizer(tabAuthorsSizer2); 00202 wxBoxSizer* tabAuthorsSizer = new wxBoxSizer(wxVERTICAL); 00203 tabAuthorsSizer2->Add(tabAuthorsSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00204 00205 tabAuthorsSizer->Add(txtAuthors, 1, wxGROW); 00206 00207 00208 // Licence agreement tab sizer 00209 // The panel sizer 00210 wxBoxSizer* tabLicenceSizer2 = new wxBoxSizer(wxVERTICAL); 00211 tabLicence->SetSizer(tabLicenceSizer2); 00212 wxBoxSizer* tabLicenceSizer = new wxBoxSizer(wxVERTICAL); 00213 tabLicenceSizer2->Add(tabLicenceSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00214 00215 tabLicenceSizer->Add(txtLicence, 1, wxGROW); 00216 00217 00218 // Licence agreement tab sizer 00219 // The panel sizer 00220 wxBoxSizer* tabMiscInfoSizer2 = new wxBoxSizer(wxVERTICAL); 00221 tabMiscInfo->SetSizer(tabMiscInfoSizer2); 00222 wxBoxSizer* tabMiscInfoSizer = new wxBoxSizer(wxVERTICAL); 00223 tabMiscInfoSizer2->Add(tabMiscInfoSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00224 00225 tabMiscInfoSizer->Add(txtMiscInfo, 1, wxGROW); 00226 00227 00228 // Dialog sizer 00229 wxBoxSizer* dlgAboutSizer2 = new wxBoxSizer(wxVERTICAL); 00230 this->SetSizer(dlgAboutSizer2); 00231 wxBoxSizer* dlgAboutSizer = new wxBoxSizer(wxVERTICAL); 00232 dlgAboutSizer2->Add(dlgAboutSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00233 00234 dlgAboutSizer->Add(appIconAndNameSizer); 00235 dlgAboutSizer->Add(pgcAbout, 1, wxGROW | wxTOP, CONTROL_SPACE); 00236 dlgAboutSizer->Add(btnClose, 0, wxTOP | wxALIGN_RIGHT, CONTROL_SPACE); 00237 00238 // Set on the auto-layout feature 00239 this->SetAutoLayout(true); 00240 this->Layout(); 00241 00242 // Sets the background color 00243 //this->SetBackgroundColour(a_control->GetBackgroundColour()); 00244 } 00245 //--------------------------------------------------------------------------- 00246 00247 00248 /** 00249 * The class descructor. 00250 */ 00251 dlgAbout::~dlgAbout() 00252 { 00253 } 00254 //--------------------------------------------------------------------------- 00255 00256 00257 00258 /*BEGIN_EVENT_TABLE(dlgAbout, wxDialog) 00259 END_EVENT_TABLE()*/ 00260 //---------------------------------------------------------------------------

Generated on Sun May 30 13:37:44 2004 for wxChecksums by doxygen 1.3.7