1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free
10 // Software Foundation; either version 2 of the License, or (at your option)
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
27 //===========================================================================
28 //#####DESCRIPTIONBEGIN####
31 // Contact(s): julians
35 // Description: Implementation file for ecAboutDialog
42 //####DESCRIPTIONEND####
44 //===========================================================================
47 #pragma implementation "aboutdlg.cpp"
52 #include "wx/wxhtml.h"
53 #include "wx/datetime.h"
55 #include "wx/fs_mem.h"
62 #include "configtool.h"
65 //----------------------------------------------------------------------------
67 //----------------------------------------------------------------------------
69 // WDR: event table for ecAboutDialog
71 BEGIN_EVENT_TABLE(ecAboutDialog,wxDialog)
74 ecAboutDialog::ecAboutDialog( wxWindow *parent, wxWindowID id, const wxString &title,
75 const wxPoint &position, const wxSize& size, long style ) :
76 wxDialog( parent, id, title, position, size, style )
83 bool ecAboutDialog::AddControls(wxWindow* parent)
87 if (!wxGetApp().GetMemoryTextResource(wxT("about.htm"), htmlText))
89 wxSetWorkingDirectory(wxGetApp().GetAppDir());
90 wxString htmlFile(wxGetApp().GetFullAppPath(wxT("about.htm")));
92 if (wxFileExists(htmlFile))
95 file.Open(htmlFile, wxFile::read);
96 long len = file.Length();
97 char* buf = htmlText.GetWriteBuf(len + 1);
100 htmlText.UngetWriteBuf();
104 if (htmlText.IsEmpty())
106 htmlText.Printf(wxT("<html><head><title>Warning</title></head><body><P>Sorry, could not find resource for About dialog<P></body></html>"));
109 // Customize the HTML
110 htmlText.Replace(wxT("$VERSION$"), ecCONFIGURATION_TOOL_VERSION);
111 htmlText.Replace(wxT("$DATE$"), __DATE__);
113 wxSize htmlSize(420, 390);
115 // Note: in later versions of wxWin this will be fixed so wxRAISED_BORDER
116 // does the right thing. Meanwhile, this is a workaround.
118 long borderStyle = wxDOUBLE_BORDER;
120 long borderStyle = wxRAISED_BORDER;
123 wxHtmlWindow* html = new wxHtmlWindow(this, ecID_ABOUT_DIALOG_HTML_WINDOW, wxDefaultPosition, htmlSize, borderStyle);
124 html -> SetBorders(0);
125 html -> SetPage(htmlText);
127 //// Start of sizer-based control creation
129 wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
131 wxWindow *item1 = parent->FindWindow( ecID_ABOUT_DIALOG_HTML_WINDOW );
133 item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 );
135 wxButton *item2 = new wxButton( parent, wxID_CANCEL, "&OK", wxDefaultPosition, wxDefaultSize, 0 );
138 item0->Add( item2, 0, wxALIGN_RIGHT|wxALL, 10 );
140 parent->SetAutoLayout( TRUE );
141 parent->SetSizer( item0 );
143 item0->Fit( parent );
144 item0->SetSizeHints( parent );
153 ecSplashScreen::ecSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style):
154 wxSplashScreen(bitmap, splashStyle, milliseconds, parent, id, pos, size, style)
158 ecSplashScreen::~ecSplashScreen()
160 wxGetApp().m_splashScreen = NULL;