No more avoiding wxSizer::Fit in wxWinCE builds.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38954 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -108,12 +108,8 @@ wxGetOsVersion will return these values:
|
|||||||
|
|
||||||
\subsubsection{Window sizing in wxWinCE}
|
\subsubsection{Window sizing in wxWinCE}
|
||||||
|
|
||||||
When creating frames and dialogs, create them with wxDefaultPosition and
|
Top level windows (dialogs, frames) are created always full-screen. Fit() of sizers will not rescale top
|
||||||
wxDefaultSize, which will tell WinCE to create them full-screen.
|
level windows but instead will scale window content.
|
||||||
|
|
||||||
Don't call Fit() and Centre(), so the content sizes to
|
|
||||||
the window rather than fitting the window to the content. (We really need a single API call
|
|
||||||
that will do the right thing on each platform.)
|
|
||||||
|
|
||||||
If the screen orientation changes, the windows will automatically be resized
|
If the screen orientation changes, the windows will automatically be resized
|
||||||
so no further action needs to be taken (unless you want to change the layout
|
so no further action needs to be taken (unless you want to change the layout
|
||||||
|
@@ -732,6 +732,15 @@ wxSize wxSizer::GetMinWindowSize( wxWindow *window )
|
|||||||
// Return a window size that will fit within the screens dimensions
|
// Return a window size that will fit within the screens dimensions
|
||||||
wxSize wxSizer::FitSize( wxWindow *window )
|
wxSize wxSizer::FitSize( wxWindow *window )
|
||||||
{
|
{
|
||||||
|
if ( window->IsTopLevel() )
|
||||||
|
{
|
||||||
|
wxTopLevelWindow *tlw = wxDynamicCast(window, wxTopLevelWindow);
|
||||||
|
if ( tlw && tlw->IsAlwaysMaximized() )
|
||||||
|
{
|
||||||
|
return tlw->GetClientSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxSize size = GetMinWindowSize( window );
|
wxSize size = GetMinWindowSize( window );
|
||||||
wxSize sizeMax = GetMaxWindowSize( window );
|
wxSize sizeMax = GetMaxWindowSize( window );
|
||||||
|
|
||||||
|
@@ -255,11 +255,6 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent,
|
|||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
long styleLbox)
|
long styleLbox)
|
||||||
{
|
{
|
||||||
#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
|
|
||||||
styleDlg &= ~wxBORDER_MASK;
|
|
||||||
styleDlg &= ~wxRESIZE_BORDER;
|
|
||||||
styleDlg &= ~wxCAPTION;
|
|
||||||
#endif
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg & (~wxCANCEL) ) )
|
if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg & (~wxCANCEL) ) )
|
||||||
return false;
|
return false;
|
||||||
@@ -299,13 +294,11 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent,
|
|||||||
|
|
||||||
SetSizer( topsizer );
|
SetSizer( topsizer );
|
||||||
|
|
||||||
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
|
|
||||||
topsizer->SetSizeHints( this );
|
topsizer->SetSizeHints( this );
|
||||||
topsizer->Fit( this );
|
topsizer->Fit( this );
|
||||||
|
|
||||||
if ( styleDlg & wxCENTRE )
|
if ( styleDlg & wxCENTRE )
|
||||||
Centre(wxBOTH);
|
Centre(wxBOTH);
|
||||||
#endif
|
|
||||||
|
|
||||||
m_listbox->SetFocus();
|
m_listbox->SetFocus();
|
||||||
|
|
||||||
|
@@ -193,12 +193,10 @@ wxGenericDirDialog::wxGenericDirDialog(wxWindow* parent, const wxString& title,
|
|||||||
SetAutoLayout( true );
|
SetAutoLayout( true );
|
||||||
SetSizer( topsizer );
|
SetSizer( topsizer );
|
||||||
|
|
||||||
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
|
|
||||||
topsizer->SetSizeHints( this );
|
topsizer->SetSizeHints( this );
|
||||||
topsizer->Fit( this );
|
topsizer->Fit( this );
|
||||||
|
|
||||||
Centre( wxBOTH );
|
Centre( wxBOTH );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGenericDirDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
|
void wxGenericDirDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
|
||||||
|
@@ -89,10 +89,7 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent,
|
|||||||
{
|
{
|
||||||
if ( !wxDialog::Create(parent, wxID_ANY, title,
|
if ( !wxDialog::Create(parent, wxID_ANY, title,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxDEFAULT_DIALOG_STYLE
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
|
||||||
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
|
|
||||||
| wxRESIZE_BORDER
|
|
||||||
#endif
|
|
||||||
| style) )
|
| style) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -104,7 +101,7 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent,
|
|||||||
_T("can't create dialog without data") );
|
_T("can't create dialog without data") );
|
||||||
|
|
||||||
bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
|
bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
|
||||||
|
|
||||||
wxBoxSizer *leftsizer = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer *leftsizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
// 3 columns because there is a spacer in the middle
|
// 3 columns because there is a spacer in the middle
|
||||||
@@ -158,7 +155,7 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent,
|
|||||||
rbStyle = wxRA_SPECIFY_ROWS;
|
rbStyle = wxRA_SPECIFY_ROWS;
|
||||||
else
|
else
|
||||||
rbStyle = wxRA_SPECIFY_COLS;
|
rbStyle = wxRA_SPECIFY_COLS;
|
||||||
|
|
||||||
m_radioDir = new wxRadioBox(this, wxID_ANY, _("Search direction"),
|
m_radioDir = new wxRadioBox(this, wxID_ANY, _("Search direction"),
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
WXSIZEOF(searchDirections), searchDirections,
|
WXSIZEOF(searchDirections), searchDirections,
|
||||||
@@ -212,12 +209,10 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent,
|
|||||||
SetAutoLayout( true );
|
SetAutoLayout( true );
|
||||||
SetSizer( topsizer );
|
SetSizer( topsizer );
|
||||||
|
|
||||||
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
|
|
||||||
topsizer->SetSizeHints( this );
|
topsizer->SetSizeHints( this );
|
||||||
topsizer->Fit( this );
|
topsizer->Fit( this );
|
||||||
|
|
||||||
Centre( wxBOTH );
|
Centre( wxBOTH );
|
||||||
#endif
|
|
||||||
|
|
||||||
m_textFind->SetFocus();
|
m_textFind->SetFocus();
|
||||||
|
|
||||||
@@ -294,4 +289,3 @@ void wxGenericFindReplaceDialog::OnCloseWindow(wxCloseEvent &)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_FINDREPLDLG
|
#endif // wxUSE_FINDREPLDLG
|
||||||
|
|
||||||
|
@@ -1002,10 +1002,7 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!wxDialog::Create( parent, wxID_ANY, message, pos, wxDefaultSize,
|
if (!wxDialog::Create( parent, wxID_ANY, message, pos, wxDefaultSize,
|
||||||
wxDEFAULT_DIALOG_STYLE
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
|
||||||
#if !(defined(__PDA__) || defined(__SMARTPHONE__))
|
|
||||||
| wxRESIZE_BORDER
|
|
||||||
#endif
|
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@@ -430,13 +430,11 @@ void wxGenericFontDialog::CreateWidgets()
|
|||||||
m_pointSizeChoice->SetSelection(m_dialogFont.GetPointSize()-1);
|
m_pointSizeChoice->SetSelection(m_dialogFont.GetPointSize()-1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
|
|
||||||
GetSizer()->SetItemMinSize(m_previewer, is_pda ? 100 : 430, is_pda ? 40 : 100);
|
GetSizer()->SetItemMinSize(m_previewer, is_pda ? 100 : 430, is_pda ? 40 : 100);
|
||||||
GetSizer()->SetSizeHints(this);
|
GetSizer()->SetSizeHints(this);
|
||||||
GetSizer()->Fit(this);
|
GetSizer()->Fit(this);
|
||||||
|
|
||||||
Centre(wxBOTH);
|
Centre(wxBOTH);
|
||||||
#endif
|
|
||||||
|
|
||||||
delete[] families;
|
delete[] families;
|
||||||
delete[] styles;
|
delete[] styles;
|
||||||
|
@@ -141,12 +141,10 @@ wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent,
|
|||||||
SetSizer( topsizer );
|
SetSizer( topsizer );
|
||||||
SetAutoLayout( true );
|
SetAutoLayout( true );
|
||||||
|
|
||||||
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
|
|
||||||
topsizer->SetSizeHints( this );
|
topsizer->SetSizeHints( this );
|
||||||
topsizer->Fit( this );
|
topsizer->Fit( this );
|
||||||
|
|
||||||
Centre( wxBOTH );
|
Centre( wxBOTH );
|
||||||
#endif
|
|
||||||
|
|
||||||
m_spinctrl->SetSelection(-1, -1);
|
m_spinctrl->SetSelection(-1, -1);
|
||||||
m_spinctrl->SetFocus();
|
m_spinctrl->SetFocus();
|
||||||
|
@@ -124,13 +124,11 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
|
|||||||
SetAutoLayout( true );
|
SetAutoLayout( true );
|
||||||
SetSizer( topsizer );
|
SetSizer( topsizer );
|
||||||
|
|
||||||
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
|
|
||||||
topsizer->SetSizeHints( this );
|
topsizer->SetSizeHints( this );
|
||||||
topsizer->Fit( this );
|
topsizer->Fit( this );
|
||||||
|
|
||||||
if ( style & wxCENTRE )
|
if ( style & wxCENTRE )
|
||||||
Centre( wxBOTH );
|
Centre( wxBOTH );
|
||||||
#endif
|
|
||||||
|
|
||||||
m_textctrl->SetSelection(-1, -1);
|
m_textctrl->SetSelection(-1, -1);
|
||||||
m_textctrl->SetFocus();
|
m_textctrl->SetFocus();
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: tipdlg.cpp
|
// Name: src/generic/tipdlg.cpp
|
||||||
// Purpose: implementation of wxTipDialog
|
// Purpose: implementation of wxTipDialog
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -218,10 +218,7 @@ wxTipDialog::wxTipDialog(wxWindow *parent,
|
|||||||
bool showAtStartup)
|
bool showAtStartup)
|
||||||
: wxDialog(parent, wxID_ANY, _("Tip of the Day"),
|
: wxDialog(parent, wxID_ANY, _("Tip of the Day"),
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxDEFAULT_DIALOG_STYLE
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
|
||||||
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
|
|
||||||
| wxRESIZE_BORDER
|
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
m_tipProvider = tipProvider;
|
m_tipProvider = tipProvider;
|
||||||
@@ -319,12 +316,10 @@ wxTipDialog::wxTipDialog(wxWindow *parent,
|
|||||||
|
|
||||||
SetSizer( topsizer );
|
SetSizer( topsizer );
|
||||||
|
|
||||||
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
|
|
||||||
topsizer->SetSizeHints( this );
|
topsizer->SetSizeHints( this );
|
||||||
topsizer->Fit( this );
|
topsizer->Fit( this );
|
||||||
|
|
||||||
Centre(wxBOTH | wxCENTER_FRAME);
|
Centre(wxBOTH | wxCENTER_FRAME);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -348,4 +343,3 @@ bool wxShowTip(wxWindow *parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_STARTUP_TIPS
|
#endif // wxUSE_STARTUP_TIPS
|
||||||
|
|
||||||
|
@@ -593,10 +593,14 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent,
|
|||||||
MSWUpdateUIState(UIS_INITIALIZE);
|
MSWUpdateUIState(UIS_INITIALIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: if we include PocketPC in this test, dialogs can fail to show up,
|
||||||
|
// for example the text entry dialog in the dialogs sample. Problem with Maximise()?
|
||||||
|
#if defined(__WXWINCE__) && (defined(__SMARTPHONE__) || defined(__WINCE_STANDARDSDK__))
|
||||||
if ( ( style & wxMAXIMIZE ) || IsAlwaysMaximized() )
|
if ( ( style & wxMAXIMIZE ) || IsAlwaysMaximized() )
|
||||||
{
|
{
|
||||||
this->Maximize();
|
this->Maximize();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__SMARTPHONE__) && defined(__WXWINCE__)
|
#if defined(__SMARTPHONE__) && defined(__WXWINCE__)
|
||||||
SetRightMenu(); // to nothing for initialization
|
SetRightMenu(); // to nothing for initialization
|
||||||
|
Reference in New Issue
Block a user