comparison src/about.cpp @ 0:0c0701a935f8

Start Development.
author pyon@macmini
date Sun, 21 Jul 2013 16:07:19 +0900
parents
children 7ac7d28699af
comparison
equal deleted inserted replaced
-1:000000000000 0:0c0701a935f8
1 // Filename : about.cpp
2 // Last Change: 18-Jun-2012.
3 //
4
5 #include "common.h"
6 #include "about.h"
7
8 AboutDialog::AboutDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style )
9 : wxDialog( parent, id, title, pos, size, style )
10 {
11 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
12
13 wxBoxSizer* bSizer = new wxBoxSizer( wxVERTICAL );
14
15 wxBoxSizer* bSizerOK = new wxBoxSizer( wxHORIZONTAL );
16
17 wxString iamge = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("takashi.png");
18 wxBitmap bmp = wxBitmap( iamge, wxBITMAP_TYPE_PNG );
19 m_bitmap = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxDefaultSize, 0 );
20 bSizerOK->Add( m_bitmap, 0, wxALL, 5 );
21
22 m_staticTextDesc = new wxStaticText( this, wxID_ANY, wxT("我に自由を!\rLet me free !"), wxDefaultPosition, wxSize(-1,50), 0 );
23 bSizerOK->Add( m_staticTextDesc, 0, wxALL|wxALIGN_CENTRE, 5 );
24
25 m_buttonOK = new wxButton( this, wxID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0 );
26 m_buttonOK->SetDefault();
27 bSizerOK->Add( m_buttonOK, 0, wxALL|wxALIGN_BOTTOM, 5 );
28
29 bSizer->Add( bSizerOK, 0, wxEXPAND, 5 );
30
31 m_richText = new wxRichTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxVSCROLL|wxBORDER_NONE|wxWANTS_CHARS );
32 bSizer->Add( m_richText, 1, wxEXPAND|wxALL, 5 );
33
34 this->SetSizer( bSizer );
35 this->Layout();
36
37 this->Centre( wxBOTH );
38
39 LoadChangeLog();
40 }
41
42 AboutDialog::~AboutDialog()
43 {
44 }
45
46 void AboutDialog::LoadChangeLog( void )
47 {
48 wxTextFile textfile;
49 textfile.Open( wxGetCwd() + wxFILE_SEP_PATH + wxT("Changes") );
50 for ( int i=0; i<textfile.GetLineCount(); i++ ) {
51 if ( textfile[i].StartsWith( wxT("version")) ) {
52 m_richText->BeginBold();
53 m_richText->BeginFontSize(16);
54 m_richText->BeginTextColour( wxColour( 0, 200, 0 ) );
55 m_richText->WriteText( textfile[i] );
56 m_richText->EndTextColour();
57 m_richText->EndFontSize();
58 m_richText->EndBold();
59 m_richText->Newline();
60 }
61 else if ( textfile[i].StartsWith( wxT("20")) ) {
62 m_richText->BeginAlignment( wxTEXT_ALIGNMENT_RIGHT );
63 m_richText->BeginItalic();
64 m_richText->WriteText( textfile[i] );
65 m_richText->EndItalic();
66 m_richText->EndAlignment();
67 m_richText->Newline();
68 }
69 else if ( textfile[i].StartsWith( wxT("----")) ) {
70 m_richText->WriteText( textfile[i] );
71 m_richText->Newline();
72 }
73 else {
74 m_richText->BeginSymbolBullet( wxT("* "), 60, 0, wxTEXT_ATTR_BULLET_STYLE_SYMBOL );
75 m_richText->WriteText( textfile[i] );
76 m_richText->EndSymbolBullet();
77 }
78 }
79 textfile.Close();
80 m_richText->SetEditable( false );
81 }
82