[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [5208] Import from lmi trunk, as required for wx-2.9
From: |
Greg Chicares |
Subject: |
[lmi-commits] [5208] Import from lmi trunk, as required for wx-2.9 |
Date: |
Wed, 15 Jun 2011 20:41:24 +0000 |
Revision: 5208
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5208
Author: chicares
Date: 2011-06-15 20:41:23 +0000 (Wed, 15 Jun 2011)
Log Message:
-----------
Import from lmi trunk, as required for wx-2.9
Modified Paths:
--------------
skeleton/trunk/ChangeLog
skeleton/trunk/about_dialog.cpp
Modified: skeleton/trunk/ChangeLog
===================================================================
--- skeleton/trunk/ChangeLog 2011-06-14 16:52:09 UTC (rev 5207)
+++ skeleton/trunk/ChangeLog 2011-06-15 20:41:23 UTC (rev 5208)
@@ -5111,3 +5111,8 @@
alert_wx.cpp
Accommodate unicode for one msw system call.
+20110615T2041Z <address@hidden> [31]
+
+ about_dialog.cpp
+Import from lmi trunk, as required for wx-2.9 .
+
Modified: skeleton/trunk/about_dialog.cpp
===================================================================
--- skeleton/trunk/about_dialog.cpp 2011-06-14 16:52:09 UTC (rev 5207)
+++ skeleton/trunk/about_dialog.cpp 2011-06-15 20:41:23 UTC (rev 5208)
@@ -33,38 +33,13 @@
#include "wx_new.hpp"
#include <wx/button.h>
+#include <wx/display.h>
#include <wx/html/htmlwin.h>
#include <wx/settings.h>
#include <wx/sizer.h>
-#include <wx/string.h>
-namespace
-{
-void AddWithoutLeaking
- (wxSizer* sizer
- ,wxWindow* window
- ,int proportion = 0
- ,int flag = 0
- ,int border = 0
- ,wxObject* data = 0
- )
-{
- sizer->Add(new(wx) wxSizerItem(window, proportion, flag, border, data));
-}
+#include <string>
-void AddWithoutLeaking
- (wxSizer* sizer
- ,wxSizer* subsizer
- ,int proportion = 0
- ,int flag = 0
- ,int border = 0
- ,wxObject* data = 0
- )
-{
- sizer->Add(new(wx) wxSizerItem(subsizer, proportion, flag, border, data));
-}
-} // Unnamed namespace.
-
BEGIN_EVENT_TABLE(AboutDialog, wxDialog)
EVT_BUTTON(wxID_ABOUT, AboutDialog::UponReadLicense)
END_EVENT_TABLE()
@@ -72,11 +47,8 @@
AboutDialog::AboutDialog(wxWindow* parent)
:wxDialog
(parent
- ,-1
- ,wxString
- ( "About 'Let me illustrate...' version "
- + std::string(LMI_VERSION)
- )
+ ,wxID_ANY
+ ,"About 'Let me illustrate...' version " + std::string(LMI_VERSION)
)
{
}
@@ -85,31 +57,23 @@
{
}
-/// This virtual function calls the base-class version at the end.
+/// This virtual function calls its base-class namesake explicitly.
int AboutDialog::ShowModal()
{
-// WX !! Style wxHW_NO_SELECTION must be set at creation. Trying to
-// change it later, e.g.
-// html_window->SetWindowStyle(html_window->GetWindowStyle() |
wxHW_NO_SELECTION);
-// html_window->SetExtraStyle (html_window->GetExtraStyle() |
wxHW_NO_SELECTION);
-// doesn't work. Is that reasonable?
-
wxHtmlWindow* html_window = new(wx) wxHtmlWindow
(this
- ,-1
+ ,wxID_ANY
,wxDefaultPosition
,wxDefaultSize
- ,wxHW_SCROLLBAR_AUTO | wxHW_NO_SELECTION
+ ,wxHW_SCROLLBAR_NEVER | wxHW_NO_SELECTION
);
html_window->SetBorders(0);
html_window->SetPage(license_notices_as_html());
- int width =
- html_window->GetInternalRepresentation()->GetWidth()
- + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X)
- ;
- int height = html_window->GetInternalRepresentation()->GetHeight();
- html_window->SetSize(width, height);
+ html_window->GetInternalRepresentation()->Layout(450);
+ int const width = html_window->GetInternalRepresentation()->GetWidth ();
+ int const height = html_window->GetInternalRepresentation()->GetHeight();
+ html_window->SetMinSize(wxSize(width, height));
wxButton* license_button = new(wx) wxButton
(this
@@ -123,54 +87,53 @@
,"Let me illustrate"
);
- wxFlexGridSizer* sizer1 = new(wx) wxFlexGridSizer(0, 1);
- sizer1->AddGrowableCol(0);
- sizer1->AddGrowableCol(1);
- AddWithoutLeaking(sizer1, license_button, 1, wxALL|wxALIGN_LEFT , 5, 0);
- AddWithoutLeaking(sizer1, cancel_button , 1, wxALL|wxALIGN_RIGHT, 5, 0);
+ wxBoxSizer* sizer1 = new(wx) wxBoxSizer(wxHORIZONTAL);
+ sizer1->Add(license_button, 0, wxALL, 3);
+ sizer1->Add(cancel_button , 0, wxALL, 3);
- wxFlexGridSizer* sizer0 = new(wx) wxFlexGridSizer(1, 0);
- sizer0->AddGrowableRow(0);
- AddWithoutLeaking(sizer0, html_window , 1, wxALL , 10, 0);
- AddWithoutLeaking(sizer0, sizer1 , 1, wxALL , 10, 0);
+ wxBoxSizer* sizer0 = new(wx) wxBoxSizer(wxVERTICAL);
+ sizer0->Add(html_window, 1, wxALL , 0);
+ sizer0->Add(sizer1 , 0, wxALL | wxALIGN_RIGHT, 3);
- SetAutoLayout(true);
- SetSizer(sizer0);
- sizer0->Fit(this);
+ SetSizerAndFit(sizer0);
Center();
return wxDialog::ShowModal();
}
void AboutDialog::UponReadLicense(wxCommandEvent&)
{
- wxDialog dialog(this, -1, wxString("GNU General Public License"));
+ wxDialog dialog
+ (this
+ ,wxID_ANY
+ ,std::string("GNU General Public License")
+ ,wxDefaultPosition
+ ,wxDefaultSize
+ ,wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX
+ );
wxHtmlWindow* html_window = new(wx) wxHtmlWindow
(&dialog
- ,-1
+ ,wxID_ANY
,wxDefaultPosition
,wxDefaultSize
,wxHW_SCROLLBAR_AUTO | wxHW_NO_SELECTION
);
html_window->SetBorders(0);
html_window->SetPage(license_as_html());
- html_window->GetInternalRepresentation()->Layout(1);
- int width =
- html_window->GetInternalRepresentation()->GetWidth()
- + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X)
- ;
- int height = html_window->GetInternalRepresentation()->GetHeight();
- html_window->SetSize(width, height);
wxButton* button = new(wx) wxButton(&dialog, wxID_CANCEL, "Close");
button->SetDefault();
wxBoxSizer* sizer = new(wx) wxBoxSizer(wxVERTICAL);
- AddWithoutLeaking(sizer, html_window, 1, wxALL , 10, 0);
- AddWithoutLeaking(sizer, button , 0, wxALL|wxALIGN_RIGHT, 10, 0);
+ sizer->Add(html_window, 1, wxALL | wxEXPAND , 0);
+ sizer->Add(button , 0, wxALL | wxALIGN_RIGHT, 6);
+ dialog.SetSizerAndFit(sizer);
- dialog.SetAutoLayout(true);
- dialog.SetSizer(sizer);
- sizer->Fit(&dialog);
+ wxRect r = wxDisplay(wxDisplay::GetFromWindow(this)).GetClientArea();
+ int const minimum_width = 60 * dialog.GetCharWidth();
+ int const default_width = r.GetWidth () * 4 / 5;
+ int const default_height = r.GetHeight() * 4 / 5;
+ dialog.SetInitialSize(wxSize(minimum_width, default_height));
+ dialog.SetSize (wxSize(default_width, default_height));
dialog.Center();
dialog.ShowModal();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [5208] Import from lmi trunk, as required for wx-2.9,
Greg Chicares <=