Still use wxPreviewFrame size if it was explicitly specified
Even though it's better to not specify the preview frame size at all, the size should still be used if it was explicitly specified, but this didn't happen any more after the addition of the call to Fit(). Fix this now by only doing the equivalent of Fit() if no size was explicitly given. Also add advice about not setting the size explicitly to the documentation.
This commit is contained in:
@@ -1702,7 +1702,8 @@ void wxPreviewFrame::OnChar(wxKeyEvent &event)
|
||||
|
||||
wxPreviewFrame::wxPreviewFrame(wxPrintPreviewBase *preview, wxWindow *parent, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
|
||||
wxFrame(parent, wxID_ANY, title, pos, size, style, name)
|
||||
wxFrame(parent, wxID_ANY, title, pos, size, style, name),
|
||||
m_initialSize(size)
|
||||
{
|
||||
m_printPreview = preview;
|
||||
m_controlBar = NULL;
|
||||
@@ -1773,7 +1774,15 @@ void wxPreviewFrame::InitializeWithModality(wxPreviewFrameModalityKind kind)
|
||||
sizer->Add( m_previewCanvas, wxSizerFlags(1).Expand() );
|
||||
|
||||
SetSizer( sizer );
|
||||
sizer->Fit(this);
|
||||
|
||||
// Respect the user-specified size, if any, but use the best appropriate
|
||||
// size by default if none was explicitly given.
|
||||
if ( !m_initialSize.IsFullySpecified() )
|
||||
{
|
||||
wxSize size = m_initialSize;
|
||||
size.SetDefaults(sizer->ComputeFittingWindowSize(this));
|
||||
SetSize(size);
|
||||
}
|
||||
|
||||
// We don't want to restrict shrinking the window vertically as it might be
|
||||
// too tall (see SetInitialSize() call in wxPreviewCanvas ctor), but we do
|
||||
|
||||
Reference in New Issue
Block a user