Changeset 183 for trunk/src


Ignore:
Timestamp:
10/23/2008 09:56:21 AM (4 years ago)
Author:
guyru
Message:

about dialog rewrite - part 2

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/about.cpp

    r182 r183  
    2727using namespace about; 
    2828AboutDialog::AboutDialog(wxWindow* parent): 
    29     wxDialog(parent, wxID_ANY, wxT("About " PACKAGE_NAME), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE) 
     29    wxDialog(parent, wxID_ANY, wxT("About " PACKAGE_NAME), wxDefaultPosition, wxSize(-1,300), wxDEFAULT_DIALOG_STYLE) 
    3030{ 
    31         wxBitmap *logo = new wxBitmap;  
    32         *logo = wxBitmap(icon64_xpm); 
    33          
    34         notebook_main = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize, 0); 
    35          
    36         notebook_main_pane_license = new wxScrolledWindow(notebook_main, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); 
    37          
    38         notebook_main_pane_thanks = new wxScrolledWindow(notebook_main, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); 
    39          
    40         notebook_main_pane_authors = new wxScrolledWindow(notebook_main, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); 
    41          
    42         notebook_main_pane_about = new wxPanel(notebook_main, -1); 
    43          
    44         bitmap_1 = new wxDynamicBitmap((wxWindow*)this, (wxWindowID)wxID_ANY,logo); 
    45 #ifdef PORTABLE 
    46         app_label = new wxStaticText(this, -1, wxT("Open Yahtzee Portable Edition " VERSION)); 
    47 #else    
    48         app_label = new wxStaticText(this, -1, wxT("Open Yahtzee " VERSION)); 
    49 #endif 
    50         label_desc = new wxStaticText(notebook_main_pane_about, -1, wxT("A full-featured wxWidgets version of\nthe classic dice game Yahtzee.")); 
    51         label_copyright = new wxStaticText(notebook_main_pane_about, -1, wxT("(C) 2006-2008 Guy Rutenberg")); 
    52         //label_1 = new wxStaticText(notebook_main_pane_about, -1, wxT("http://openyahtzee.sourceforge.net/")); 
    53         label_7 = new wxStaticText(notebook_main_pane_authors, -1, wxT("Please report bugs to openyahtzee-users@lists.sourceforge.net.\n\nGuy Rutenberg\n\tguyrutenberg@gmail.com\n\tAuthor, maintainer")); 
    54         label_6 = new wxStaticText(notebook_main_pane_thanks, -1, wxT("Seamous McGill\n\tjohndoe@gmail.com\n\tLogo and dice design\n\nNeil Gierman\n\tngierman@roadrunn.com\n\tRPM packages")); 
    55     label_15 = new wxStaticText(notebook_main_pane_license, -1, wxT("This program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by \nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of \nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details. \n\nYou should have received a copy of the GNU General Public License \nalong with this program; if not, write to the\nFree Software Foundation, Inc.,\n59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.")); 
    56     close_button = new wxButton(this, wxID_OK, wxT("Close")); 
    57  
    58         set_properties(); 
    59         do_layout(); 
     31        addControlsAndLayout(); 
     32        SetEscapeId(wxID_CLOSE); 
    6033} 
    6134 
     35void 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); 
    6240 
    63 void AboutDialog::set_properties() 
    64 { 
    65         SetSize(wxSize(400, 300)); 
    66         app_label->SetFont(wxFont(14, wxDEFAULT, wxNORMAL, wxBOLD, 0, wxT(""))); 
    67         notebook_main_pane_authors->SetScrollRate(10, 10); 
    68         notebook_main_pane_thanks->SetScrollRate(10, 10); 
    69         notebook_main_pane_license->SetScrollRate(10, 10); 
     41        wxStaticText* app_label = new wxStaticText(this,wxID_ANY,wxT("Open Yahtzee " VERSION)); 
     42        app_label->SetFont(wxFont(14, wxDEFAULT, wxNORMAL, wxBOLD, false)); 
     43        title_sizer->Add(app_label, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 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(); 
    7058} 
    7159 
     60void AboutDialog::notebookAboutTab(wxNotebook *notebook) 
     61{ 
     62        wxPanel* panel = new wxPanel(notebook, wxID_ANY); 
     63        wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); 
    7264 
    73 void AboutDialog::do_layout() 
    74 { 
    75     // begin wxGlade: AboutDialog::do_layout 
    76     wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL); 
    77     wxBoxSizer* sizer_6 = new wxBoxSizer(wxVERTICAL); 
    78     wxBoxSizer* sizer_5 = new wxBoxSizer(wxHORIZONTAL); 
    79     wxBoxSizer* sizer_4 = new wxBoxSizer(wxVERTICAL); 
    80     wxBoxSizer* sizer_3 = new wxBoxSizer(wxVERTICAL); 
    81     wxBoxSizer* sizer_2 = new wxBoxSizer(wxHORIZONTAL); 
    82     sizer_2->Add(bitmap_1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 10); 
    83     sizer_2->Add(app_label, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 10); 
    84     sizer_1->Add(sizer_2, 0, 0, 0); 
    85     sizer_3->Add(label_desc, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 10); 
    86     sizer_3->Add(label_copyright, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 10); 
    87     //sizer_3->Add(label_1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 10); 
    88     sizer_3->Add(new wxHyperlinkCtrl(notebook_main_pane_about,wxID_ANY,OY_URL,OY_URL),0,wxALL|wxALIGN_CENTER_HORIZONTAL,10); 
    89     notebook_main_pane_about->SetSizer(sizer_3); 
    90     sizer_4->Add(label_7, 0, wxALL, 10); 
    91     notebook_main_pane_authors->SetSizer(sizer_4); 
    92     sizer_5->Add(label_6, 0, wxALL, 10); 
    93     notebook_main_pane_thanks->SetSizer(sizer_5); 
    94     sizer_6->Add(label_15, 0, wxADJUST_MINSIZE, 0); 
    95     notebook_main_pane_license->SetSizer(sizer_6); 
    96     notebook_main->AddPage(notebook_main_pane_about, wxT("About")); 
    97     notebook_main->AddPage(notebook_main_pane_authors, wxT("Authors")); 
    98     notebook_main->AddPage(notebook_main_pane_thanks, wxT("Thanks To")); 
    99     notebook_main->AddPage(notebook_main_pane_license, wxT("License Agreement")); 
    100     sizer_1->Add(notebook_main, 1, wxEXPAND, 0); 
    101     sizer_1->Add(close_button, 0, wxALL|wxALIGN_RIGHT, 10); 
    102     SetSizer(sizer_1); 
    103     Layout(); 
    104     // end wxGlade 
     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("(C) 2006-2008 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")); 
    10576} 
    10677 
     78void 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 <guyrutenberg@gmail.com>\n"); 
     82 
     83        notebook->AddPage(text, wxT("Author")); 
     84} 
     85 
     86void 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 <johndoe@ggmail.com>\n"); 
     90        *text << wxT("    Logo and dice design\n\n"); 
     91 
     92        *text << wxT("Neil Gierman <ngierman@roadrunn.com>\n"); 
     93        *text << wxT("    Help with RPM packages\n\n"); 
     94 
     95        notebook->AddPage(text, wxT("Thanks To")); 
     96} 
     97 
     98void 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                "it and/or modify it under the terms of the GNU General " 
     103                "Public License as published by the Free Software " 
     104                "Foundation; either version 2 of the License, or (at your " 
     105                "option) any later version.\n\n" 
     106 
     107                "This program is distributed in the hope that it will be " 
     108                "useful, but WITHOUT ANY WARRANTY; without even the " 
     109                "implied warranty of MERCHANTABILITY or FITNESS FOR A " 
     110                "PARTICULAR PURPOSE.  See the GNU General Public License " 
     111                "for more details. \n\n" 
     112 
     113                "You should have received a copy of the GNU General " 
     114                "Public License along with this program; if not, write to " 
     115                "the\n" 
     116                "Free Software Foundation, Inc.,\n" 
     117                "59 Temple Place - Suite 330, Boston, MA  02111-1307, USA."); 
     118 
     119        notebook->AddPage(text, wxT("License Agreement")); 
     120} 
  • trunk/src/about.h

    r182 r183  
    2424#include <wx/wx.h> 
    2525#include <wx/image.h> 
    26 #include "wxDynamicBitmap.h" 
    2726 
    2827#include <wx/notebook.h> 
     
    3231class AboutDialog: public wxDialog { 
    3332public: 
    34     AboutDialog(wxWindow* parent); 
     33        AboutDialog(wxWindow* parent); 
    3534 
    3635private: 
    37     void set_properties(); 
    38     void do_layout(); 
    39  
    40 protected: 
    41     wxDynamicBitmap* bitmap_1; 
    42     wxStaticText* app_label; 
    43     wxStaticText* label_desc; 
    44     wxStaticText* label_copyright; 
    45     wxStaticText* label_1; 
    46     wxPanel* notebook_main_pane_about; 
    47     wxStaticText* label_7; 
    48     wxScrolledWindow* notebook_main_pane_authors; 
    49     wxStaticText* label_6; 
    50     wxScrolledWindow* notebook_main_pane_thanks; 
    51     wxStaticText* label_15; 
    52     wxScrolledWindow* notebook_main_pane_license; 
    53     wxNotebook* notebook_main; 
    54     wxButton* close_button; 
     36        void addControlsAndLayout(); 
     37        void notebookAboutTab(wxNotebook *notebook); 
     38        void notebookAuthorTab(wxNotebook *notebook); 
     39        void notebookThanksTab(wxNotebook *notebook); 
     40        void notebookLicenseTab(wxNotebook *notebook); 
    5541}; 
    5642 
Note: See TracChangeset for help on using the changeset viewer.