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:
Włodzimierz Skiba
2006-04-30 00:20:54 +00:00
parent 6aa68c25a4
commit f43255e838
11 changed files with 21 additions and 42 deletions

View File

@@ -108,12 +108,8 @@ wxGetOsVersion will return these values:
\subsubsection{Window sizing in wxWinCE}
When creating frames and dialogs, create them with wxDefaultPosition and
wxDefaultSize, which will tell WinCE to create them full-screen.
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.)
Top level windows (dialogs, frames) are created always full-screen. Fit() of sizers will not rescale top
level windows but instead will scale window content.
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

View File

@@ -732,6 +732,15 @@ wxSize wxSizer::GetMinWindowSize( wxWindow *window )
// Return a window size that will fit within the screens dimensions
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 sizeMax = GetMaxWindowSize( window );

View File

@@ -255,11 +255,6 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent,
const wxPoint& pos,
long styleLbox)
{
#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
styleDlg &= ~wxBORDER_MASK;
styleDlg &= ~wxRESIZE_BORDER;
styleDlg &= ~wxCAPTION;
#endif
#ifdef __WXMAC__
if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg & (~wxCANCEL) ) )
return false;
@@ -299,13 +294,11 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent,
SetSizer( topsizer );
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
topsizer->SetSizeHints( this );
topsizer->Fit( this );
if ( styleDlg & wxCENTRE )
Centre(wxBOTH);
#endif
m_listbox->SetFocus();

View File

@@ -193,12 +193,10 @@ wxGenericDirDialog::wxGenericDirDialog(wxWindow* parent, const wxString& title,
SetAutoLayout( true );
SetSizer( topsizer );
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
topsizer->SetSizeHints( this );
topsizer->Fit( this );
Centre( wxBOTH );
#endif
}
void wxGenericDirDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))

View File

@@ -89,10 +89,7 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent,
{
if ( !wxDialog::Create(parent, wxID_ANY, title,
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
| wxRESIZE_BORDER
#endif
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
| style) )
{
return false;
@@ -104,7 +101,7 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent,
_T("can't create dialog without data") );
bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
wxBoxSizer *leftsizer = new wxBoxSizer( wxVERTICAL );
// 3 columns because there is a spacer in the middle
@@ -158,7 +155,7 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent,
rbStyle = wxRA_SPECIFY_ROWS;
else
rbStyle = wxRA_SPECIFY_COLS;
m_radioDir = new wxRadioBox(this, wxID_ANY, _("Search direction"),
wxDefaultPosition, wxDefaultSize,
WXSIZEOF(searchDirections), searchDirections,
@@ -212,12 +209,10 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent,
SetAutoLayout( true );
SetSizer( topsizer );
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
topsizer->SetSizeHints( this );
topsizer->Fit( this );
Centre( wxBOTH );
#endif
m_textFind->SetFocus();
@@ -294,4 +289,3 @@ void wxGenericFindReplaceDialog::OnCloseWindow(wxCloseEvent &)
}
#endif // wxUSE_FINDREPLDLG

View File

@@ -1002,10 +1002,7 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
return true;
if (!wxDialog::Create( parent, wxID_ANY, message, pos, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE
#if !(defined(__PDA__) || defined(__SMARTPHONE__))
| wxRESIZE_BORDER
#endif
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
))
{
return false;

View File

@@ -430,13 +430,11 @@ void wxGenericFontDialog::CreateWidgets()
m_pointSizeChoice->SetSelection(m_dialogFont.GetPointSize()-1);
#endif
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
GetSizer()->SetItemMinSize(m_previewer, is_pda ? 100 : 430, is_pda ? 40 : 100);
GetSizer()->SetSizeHints(this);
GetSizer()->Fit(this);
Centre(wxBOTH);
#endif
delete[] families;
delete[] styles;

View File

@@ -141,12 +141,10 @@ wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent,
SetSizer( topsizer );
SetAutoLayout( true );
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
topsizer->SetSizeHints( this );
topsizer->Fit( this );
Centre( wxBOTH );
#endif
m_spinctrl->SetSelection(-1, -1);
m_spinctrl->SetFocus();

View File

@@ -124,13 +124,11 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
SetAutoLayout( true );
SetSizer( topsizer );
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
topsizer->SetSizeHints( this );
topsizer->Fit( this );
if ( style & wxCENTRE )
Centre( wxBOTH );
#endif
m_textctrl->SetSelection(-1, -1);
m_textctrl->SetFocus();

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Name: tipdlg.cpp
// Name: src/generic/tipdlg.cpp
// Purpose: implementation of wxTipDialog
// Author: Vadim Zeitlin
// Modified by:
@@ -218,10 +218,7 @@ wxTipDialog::wxTipDialog(wxWindow *parent,
bool showAtStartup)
: wxDialog(parent, wxID_ANY, _("Tip of the Day"),
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
| wxRESIZE_BORDER
#endif
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
)
{
m_tipProvider = tipProvider;
@@ -319,12 +316,10 @@ wxTipDialog::wxTipDialog(wxWindow *parent,
SetSizer( topsizer );
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
topsizer->SetSizeHints( this );
topsizer->Fit( this );
Centre(wxBOTH | wxCENTER_FRAME);
#endif
}
// ----------------------------------------------------------------------------
@@ -348,4 +343,3 @@ bool wxShowTip(wxWindow *parent,
}
#endif // wxUSE_STARTUP_TIPS

View File

@@ -593,10 +593,14 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent,
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() )
{
this->Maximize();
}
#endif
#if defined(__SMARTPHONE__) && defined(__WXWINCE__)
SetRightMenu(); // to nothing for initialization