+//----------------------------------------------------------------------------
+// stAboutDialog
+//----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(FortyAboutDialog,wxDialog)
+END_EVENT_TABLE()
+
+FortyAboutDialog::FortyAboutDialog( wxWindow *parent, wxWindowID id, const wxString &title,
+ const wxPoint &position, const wxSize& size, long style ) :
+ wxDialog( parent, id, title, position, size, style )
+{
+ AddControls(this);
+
+ Centre(wxBOTH);
+}
+
+bool FortyAboutDialog::AddControls(wxWindow* parent)
+{
+#if wxUSE_HTML
+ wxString htmlText;
+ wxString htmlFile(wxT("about.htm"));
+
+ //if (!wxGetApp().GetMemoryTextResource(wxT("about.htm"), htmlText))
+ {
+// wxSetWorkingDirectory(wxGetApp().GetAppDir());
+// wxString htmlFile(wxGetApp().GetFullAppPath(wxT("about.htm")));
+
+ wxTextFile file(htmlFile);
+ if (file.Exists())
+ {
+ file.Open();
+ for ( htmlText = file.GetFirstLine();
+ !file.Eof();
+ htmlText << file.GetNextLine() << _T("\n") ) ;
+ }
+ }
+
+ if (htmlText.IsEmpty())
+ {
+ htmlText.Printf(wxT("<html><head><title>Warning</title></head><body><P>Sorry, could not find resource for About dialog<P></body></html>"));
+ }
+
+ // Customize the HTML
+#if 0
+ wxString verString;
+ verString.Printf("%.2f", stVERSION_NUMBER);
+ htmlText.Replace(wxT("$VERSION$"), verString);
+#endif
+ htmlText.Replace(wxT("$DATE$"), _T(__DATE__));
+
+ wxSize htmlSize(400, 290);
+
+ // Note: in later versions of wxWin this will be fixed so wxRAISED_BORDER
+ // does the right thing. Meanwhile, this is a workaround.
+#ifdef __WXMSW__
+ long borderStyle = wxDOUBLE_BORDER;
+#else
+ long borderStyle = wxRAISED_BORDER;
+#endif
+
+ wxHtmlWindow* html = new wxHtmlWindow(this, ID_ABOUT_HTML_WINDOW, wxDefaultPosition, htmlSize, borderStyle);
+ html -> SetBorders(10);
+ html -> SetPage(htmlText);
+
+ //// Start of sizer-based control creation
+
+ wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
+
+ wxWindow *item1 = parent->FindWindow( ID_ABOUT_HTML_WINDOW );
+ wxASSERT( item1 );
+ item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 );
+
+ wxButton *item2 = new wxButton( parent, wxID_CANCEL, _T("&Close"), wxDefaultPosition, wxDefaultSize, 0 );
+ item2->SetDefault();
+ item2->SetFocus();
+
+ item0->Add( item2, 0, wxALIGN_RIGHT|wxALL, 5 );
+
+ parent->SetSizer( item0 );
+ parent->Layout();
+ item0->Fit( parent );
+ item0->SetSizeHints( parent );
+#endif
+
+ return true;
+}