diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h index cf2ed32dc3..03ab0b5092 100644 --- a/include/wx/propgrid/propgrid.h +++ b/include/wx/propgrid/propgrid.h @@ -1556,6 +1556,12 @@ public: static wxString& CreateEscapeSequences( wxString& dst_str, wxString& src_str ); + // Checks system screen design used for laying out various dialogs. + static bool IsSmallScreen() + { + return wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA; + } + /** Returns rectangle that fully contains properties between and including p1 and p2. Rectangle is in virtual scrolled window coordinates. diff --git a/include/wx/propgrid/propgriddefs.h b/include/wx/propgrid/propgriddefs.h index d00f147b67..ddc12cf131 100644 --- a/include/wx/propgrid/propgriddefs.h +++ b/include/wx/propgrid/propgriddefs.h @@ -177,14 +177,6 @@ // Use this macro to generate standard custom image height from #define wxPG_STD_CUST_IMAGE_HEIGHT(LINEHEIGHT) (LINEHEIGHT-3) - -#if defined(__WXWINCE__) - #define wxPG_SMALL_SCREEN 1 -#else - #define wxPG_SMALL_SCREEN 0 -#endif - - // Undefine wxPG_ICON_WIDTH to use supplied xpm bitmaps instead // (for tree buttons) //#undef wxPG_ICON_WIDTH diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 5dd01d5e7f..e7257f7fbb 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -1696,10 +1696,12 @@ void wxPropertyGrid::SetCurControlBoldFont() wxPoint wxPropertyGrid::GetGoodEditorDialogPosition( wxPGProperty* p, const wxSize& sz ) { -#if wxPG_SMALL_SCREEN - // On small-screen devices, always show dialogs with default position and size. - return wxDefaultPosition; -#else + if ( IsSmallScreen() ) + { + // On small-screen devices, always show dialogs with default position and size. + return wxDefaultPosition; + } + int splitterX = GetSplitterPosition(); int x = splitterX; int y = p->GetY(); @@ -1729,7 +1731,6 @@ wxPoint wxPropertyGrid::GetGoodEditorDialogPosition( wxPGProperty* p, new_y = y + m_lineHeight; return wxPoint(new_x,new_y); -#endif } // ----------------------------------------------------------------------- diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp index e9d1a189f7..68e382670a 100644 --- a/src/propgrid/props.cpp +++ b/src/propgrid/props.cpp @@ -1833,7 +1833,19 @@ wxValidator* wxDirProperty::DoGetValidator() const bool wxDirProperty::OnButtonClick( wxPropertyGrid* propGrid, wxString& value ) { // Update property value from editor, if necessary - wxSize dlg_sz(300,400); + wxSize dlg_sz; + wxPoint dlg_pos; + + if ( wxPropertyGrid::IsSmallScreen() ) + { + dlg_sz = wxDefaultSize; + dlg_pos = wxDefaultPosition; + } + else + { + dlg_sz.Set(300, 400); + dlg_pos = propGrid->GetGoodEditorDialogPosition(this, dlg_sz); + } wxString dlgMessage(m_dlgMessage); if ( dlgMessage.empty() ) @@ -1842,13 +1854,7 @@ bool wxDirProperty::OnButtonClick( wxPropertyGrid* propGrid, wxString& value ) dlgMessage, value, 0, -#if !wxPG_SMALL_SCREEN - propGrid->GetGoodEditorDialogPosition(this,dlg_sz), - dlg_sz -#else - wxDefaultPosition, - wxDefaultSize -#endif + dlg_pos, dlg_sz ); if ( dlg.ShowModal() == wxID_OK ) @@ -2225,11 +2231,7 @@ bool wxLongStringProperty::DisplayEditorDialog( wxPGProperty* prop, wxPropertyGr dlg->SetFont(propGrid->GetFont()); // To allow entering chars of the same set as the propGrid // Multi-line text editor dialog. -#if !wxPG_SMALL_SCREEN - const int spacing = 8; -#else - const int spacing = 4; -#endif + const int spacing = wxPropertyGrid::IsSmallScreen()? 4 : 8; wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* rowsizer = new wxBoxSizer( wxHORIZONTAL ); long edStyle = wxTE_MULTILINE; @@ -2251,11 +2253,12 @@ bool wxLongStringProperty::DisplayEditorDialog( wxPGProperty* prop, wxPropertyGr dlg->SetSizer( topsizer ); topsizer->SetSizeHints( dlg ); -#if !wxPG_SMALL_SCREEN - dlg->SetSize(400,300); + if ( !wxPropertyGrid::IsSmallScreen()) + { + dlg->SetSize(400,300); - dlg->Move( propGrid->GetGoodEditorDialogPosition(prop,dlg->GetSize()) ); -#endif + dlg->Move( propGrid->GetGoodEditorDialogPosition(prop,dlg->GetSize()) ); + } int res = dlg->ShowModal(); @@ -2372,11 +2375,7 @@ bool wxPGArrayEditorDialog::Create( wxWindow *parent, SetFont(parent->GetFont()); // To allow entering chars of the same set as the propGrid -#if !wxPG_SMALL_SCREEN - const int spacing = 4; -#else - const int spacing = 3; -#endif + const int spacing = wxPropertyGrid::IsSmallScreen()? 3: 4; m_modified = false; @@ -2447,13 +2446,14 @@ bool wxPGArrayEditorDialog::Create( wxWindow *parent, SetSizer( topsizer ); topsizer->SetSizeHints( this ); -#if !wxPG_SMALL_SCREEN - if ( sz.x == wxDefaultSize.x && - sz.y == wxDefaultSize.y ) - SetSize( wxSize(275,360) ); - else - SetSize(sz); -#endif + if ( !wxPropertyGrid::IsSmallScreen() ) + { + if ( sz.x == wxDefaultSize.x && + sz.y == wxDefaultSize.y ) + SetSize(275, 360); + else + SetSize(sz); + } return res; } @@ -2821,9 +2821,10 @@ bool wxArrayStringProperty::OnButtonClick( wxPropertyGrid* propGrid, dlg->SetDialogValue( useValue ); dlg->Create(propGrid, wxEmptyString, m_label); -#if !wxPG_SMALL_SCREEN - dlg->Move( propGrid->GetGoodEditorDialogPosition(this,dlg->GetSize()) ); -#endif + if ( !wxPropertyGrid::IsSmallScreen() ) + { + dlg->Move( propGrid->GetGoodEditorDialogPosition(this,dlg->GetSize()) ); + } bool retVal;