| 1 |
// $Header: $ |
| 2 |
/*************************************************************************** |
| 3 |
* Copyright (C) 2006-2012 by Guy Rutenberg * |
| 4 |
* [email protected] * |
| 5 |
* * |
| 6 |
* This program is free software; you can redistribute it and/or modify * |
| 7 |
* it under the terms of the GNU General Public License as published by * |
| 8 |
* the Free Software Foundation; either version 2 of the License, or * |
| 9 |
* (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This program is distributed in the hope that it will be useful, * |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 |
* GNU General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU General Public License * |
| 17 |
* along with this program; if not, write to the * |
| 18 |
* Free Software Foundation, Inc., * |
| 19 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 20 |
***************************************************************************/ |
| 21 |
|
| 22 |
#include "about.h" |
| 23 |
#include <wx/hyperlink.h> |
| 24 |
#include "icon64.xpm" |
| 25 |
#include "../config.h" |
| 26 |
|
| 27 |
using namespace about; |
| 28 |
AboutDialog::AboutDialog(wxWindow* parent): |
| 29 |
wxDialog(parent, wxID_ANY, wxT("About ") wxT(PACKAGE_NAME), wxDefaultPosition, wxSize(-1,300), wxDEFAULT_DIALOG_STYLE & (~wxCLOSE_BOX)) |
| 30 |
{ |
| 31 |
addControlsAndLayout(); |
| 32 |
SetEscapeId(wxID_CLOSE); |
| 33 |
} |
| 34 |
|
| 35 |
void AboutDialog::addControlsAndLayout() |
| 36 |
{ |
| 37 |
wxBoxSizer* title_sizer = new wxBoxSizer(wxHORIZONTAL); |
| 38 |
wxStaticBitmap* logo = new wxStaticBitmap(this, wxID_ANY,wxBitmap(icon64_xpm)); |
| 39 |
title_sizer->Add(logo, 0, wxALL|wxALIGN_CENTER_VERTICAL, 10); |
| 40 |
|
| 41 |
wxStaticText* app_label = new wxStaticText(this,wxID_ANY,wxT("Open Yahtzee ") wxT(VERSION)); |
| 42 |
app_label->SetFont(wxFont(14, wxDEFAULT, wxNORMAL, wxBOLD, false)); |
| •43 |
title_sizer->Add(app_label, 0, wxALL|wxALIGN_CENTER_VERTICAL, 10); |
| 44 |
|
| 45 |
wxNotebook* notebook_main = new wxNotebook(this, wxID_ANY); |
| 46 |
notebookAboutTab(notebook_main); |
| 47 |
notebookAuthorTab(notebook_main); |
| 48 |
notebookThanksTab(notebook_main); |
| 49 |
notebookLicenseTab(notebook_main); |
| 50 |
|
| 51 |
wxBoxSizer* top_sizer = new wxBoxSizer(wxVERTICAL); |
| 52 |
top_sizer->Add(title_sizer); |
| 53 |
top_sizer->Add(notebook_main, 1, wxEXPAND, 0); |
| 54 |
top_sizer->Add(new wxButton(this,wxID_CLOSE), 0, wxALL|wxALIGN_RIGHT, 10); |
| 55 |
|
| 56 |
SetSizer(top_sizer); |
| 57 |
Layout(); |
| 58 |
} |
| 59 |
|
| 60 |
void AboutDialog::notebookAboutTab(wxNotebook *notebook) |
| 61 |
{ |
| 62 |
wxPanel* panel = new wxPanel(notebook, wxID_ANY); |
| 63 |
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); |
| 64 |
|
| 65 |
wxStaticText* label_desc = new wxStaticText(panel, wxID_ANY, wxT("A full-featured wxWidgets version of\nthe classic dice game Yahtzee.")); |
| 66 |
sizer->Add(label_desc, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 10); |
| 67 |
|
| 68 |
wxStaticText* label_copyright = new wxStaticText(panel, wxID_ANY, wxT("\xA9 2006-2012 Guy Rutenberg")); |
| 69 |
sizer->Add(label_copyright, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 10); |
| 70 |
|
| 71 |
sizer->Add(new wxHyperlinkCtrl(panel,wxID_ANY,OY_URL,OY_URL),0,wxALL|wxALIGN_CENTER_HORIZONTAL,10); |
| 72 |
|
| 73 |
panel->SetSizer(sizer); |
| 74 |
|
| 75 |
notebook->AddPage(panel, wxT("About")); |
| 76 |
} |
| 77 |
|
| 78 |
void AboutDialog::notebookAuthorTab(wxNotebook *notebook) |
| 79 |
{ |
| 80 |
wxTextCtrl* text = new wxTextCtrl(notebook, wxID_ANY,wxT(""),wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE|wxTE_READONLY); |
| 81 |
*text << wxT("Guy Rutenberg <[email protected]>\n"); |
| 82 |
|
| 83 |
notebook->AddPage(text, wxT("Author")); |
| 84 |
} |
| 85 |
|
| 86 |
void AboutDialog::notebookThanksTab(wxNotebook *notebook) |
| 87 |
{ |
| 88 |
wxTextCtrl* text = new wxTextCtrl(notebook, wxID_ANY,wxT(""),wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE|wxTE_READONLY); |
| 89 |
*text << wxT("Seamous McGill <[email protected]>\n"); |
| 90 |
*text << wxT(" Logo and dice design\n\n"); |
| 91 |
|
| 92 |
*text << wxT("Neil Gierman <[email protected]>\n"); |
| 93 |
*text << wxT(" Help with RPM packages\n\n"); |
| 94 |
|
| 95 |
notebook->AddPage(text, wxT("Thanks To")); |
| 96 |
} |
| 97 |
|
| 98 |
void AboutDialog::notebookLicenseTab(wxNotebook *notebook) |
| 99 |
{ |
| 100 |
wxTextCtrl* text = new wxTextCtrl(notebook, wxID_ANY,wxT(""),wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE|wxTE_READONLY); |
| 101 |
*text << wxT("This program is free software; you can redistribute ") |
| 102 |
wxT("it and/or modify it under the terms of the GNU General ") |
| 103 |
wxT("Public License as published by the Free Software ") |
| 104 |
wxT("Foundation; either version 2 of the License, or (at your ") |
| 105 |
wxT("option) any later version.\n\n") |
| 106 |
|
| 107 |
wxT("This program is distributed in the hope that it will be ") |
| 108 |
wxT("useful, but WITHOUT ANY WARRANTY; without even the ") |
| 109 |
wxT("implied warranty of MERCHANTABILITY or FITNESS FOR A ") |
| 110 |
wxT("PARTICULAR PURPOSE. See the GNU General Public License ") |
| 111 |
wxT("for more details. \n\n") |
| 112 |
|
| 113 |
wxT("You should have received a copy of the GNU General ") |
| 114 |
wxT("Public License along with this program; if not, write to ") |
| 115 |
wxT("the\n") |
| 116 |
wxT("Free Software Foundation, Inc.,\n") |
| 117 |
wxT("59 Temple Place - Suite 330, Boston, MA 02111-1307, USA."); |
| 118 |
|
| 119 |
notebook->AddPage(text, wxT("License Agreement")); |
| 120 |
} |