bool FortyAboutDialog::AddControls(wxWindow* parent) { #if wxUSE_HTML wxString htmlText; wxString htmlFile = wxGetApp().GetHelpFile(); { wxTextFile file(htmlFile); if (file.Exists()) { file.Open(); for ( htmlText = file.GetFirstLine(); !file.Eof(); htmlText << file.GetNextLine() << wxT("\n") ) ; } } if (htmlText.empty()) { 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 htmlText.Replace(wxT("$DATE$"), wxT(__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_CLOSE ); item2->SetDefault(); item2->SetFocus(); SetAffirmativeId(wxID_CLOSE); item0->Add( item2, 0, wxALIGN_RIGHT|wxALL, 5 ); parent->SetSizer( item0 ); parent->Layout(); item0->Fit( parent ); item0->SetSizeHints( parent ); #endif return true; }
bool ecRepositoryInfoDialog::AddControls(wxWindow* parent) { #if 0 wxColour backgroundColour = * wxBLACK; // wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); wxColour buttonBackgroundColour = * wxWHITE; // backgroundColour; wxColour buttonForegroundColour = * wxBLACK; // wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT); if (!wxGetApp().GetHiColour()) { backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); buttonBackgroundColour = backgroundColour; buttonForegroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT); } this->SetBackgroundColour(backgroundColour); #endif wxSize htmlSize(440, 380); // 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, ecID_REPOS_DIALOG_HTML_WINDOW, wxDefaultPosition, htmlSize, borderStyle); html -> SetBorders(5); wxString info; if (CreateHtmlInfo(info)) html -> SetPage(info); else { wxString msg; msg.Printf(wxT("<html><head><title>Warning</title></head><body><P>Sorry, could not obtain repository information.<P></body></html>")); html->SetPage(msg); } //// Start of sizer-based control creation wxSizer *item0 = new wxBoxSizer( wxVERTICAL ); wxWindow *item1 = parent->FindWindow( ecID_REPOS_DIALOG_HTML_WINDOW ); wxASSERT( item1 ); item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 ); wxButton *item2 = new wxButton( parent, wxID_CANCEL, "&OK", wxDefaultPosition, wxDefaultSize, 0 ); #if 0 item2->SetBackgroundColour(buttonBackgroundColour); item2->SetForegroundColour(buttonForegroundColour); #endif item2->SetDefault(); //item0->Add( item2, 0, wxALIGN_CENTER|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); //item0->Add( item2, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item0->Add( item2, 0, wxALIGN_RIGHT|wxALL, 10 ); parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); parent->Layout(); item0->Fit( parent ); item0->SetSizeHints( parent ); return TRUE; }