From: Julian Smart Date: Wed, 16 Feb 2005 15:37:09 +0000 (+0000) Subject: Standard dialogs becoming useable on WinCE. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/94f5392355df17ef8cd4884637a1ce71a07dd685 Standard dialogs becoming useable on WinCE. Make standard button sizer horizontal on WinCE since vertically it looks atrocious (app will need to reduce number of buttons if they don't fit) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32095 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 0ce0b9977a..63aa512c25 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -1666,12 +1666,18 @@ void wxStaticBoxSizer::ShowItems( bool show ) wxStdDialogButtonSizer::wxStdDialogButtonSizer() : wxBoxSizer(wxHORIZONTAL) { + // Vertical buttons with lots of space on either side + // looks rubbish on WinCE, so let's not do this for now. + // If we are going to use vertical buttons, we should + // put the sizer to the right of other controls in the dialog, + // and that's beyond the scope of this sizer. +#ifndef __WXWINCE__ bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); - // If we have a PDA screen, put yes/no button over // all other buttons, otherwise on the left side. if (is_pda) m_orient = wxVERTICAL; +#endif m_buttonAffirmative = NULL; m_buttonApply = NULL; diff --git a/src/generic/fdrepdlg.cpp b/src/generic/fdrepdlg.cpp index 29e31d7b60..1d14141be1 100644 --- a/src/generic/fdrepdlg.cpp +++ b/src/generic/fdrepdlg.cpp @@ -44,6 +44,7 @@ #endif #include "wx/fdrepdlg.h" +#include "wx/settings.h" // ---------------------------------------------------------------------------- // constants @@ -102,6 +103,8 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent, wxCHECK_MSG( m_FindReplaceData, false, _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 @@ -126,7 +129,7 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent, wxALIGN_CENTRE_VERTICAL | wxALIGN_RIGHT | wxTOP, 5); - sizer2Col->Add(10, 0); + sizer2Col->Add(isPda ? 2 : 10, 0); m_textRepl = new wxTextCtrl(this, wxID_ANY, m_FindReplaceData->GetReplaceString()); @@ -136,7 +139,7 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent, leftsizer->Add(sizer2Col, 0, wxEXPAND | wxALL, 5); - wxBoxSizer *optsizer = new wxBoxSizer( wxHORIZONTAL ); + wxBoxSizer *optsizer = new wxBoxSizer( isPda ? wxVERTICAL : wxHORIZONTAL ); wxBoxSizer *chksizer = new wxBoxSizer( wxVERTICAL); @@ -149,11 +152,19 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent, optsizer->Add(chksizer, 0, wxALL, 10); static const wxString searchDirections[] = {_("Up"), _("Down")}; + int majorDimension = 0; + int rbStyle ; + if (isPda) + rbStyle = wxRA_SPECIFY_ROWS; + else + rbStyle = wxRA_SPECIFY_COLS; + m_radioDir = new wxRadioBox(this, wxID_ANY, _("Search direction"), wxDefaultPosition, wxDefaultSize, - WXSIZEOF(searchDirections), searchDirections); + WXSIZEOF(searchDirections), searchDirections, + majorDimension, rbStyle); - optsizer->Add(m_radioDir, 0, wxALL, 10); + optsizer->Add(m_radioDir, 0, wxALL, isPda ? 5 : 10); leftsizer->Add(optsizer); @@ -174,8 +185,8 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent, wxBoxSizer *topsizer = new wxBoxSizer( wxHORIZONTAL ); - topsizer->Add(leftsizer, 1, wxALL, 5); - topsizer->Add(bttnsizer, 0, wxALL, 5); + topsizer->Add(leftsizer, 1, wxALL, isPda ? 0 : 5); + topsizer->Add(bttnsizer, 0, wxALL, isPda ? 0 : 5); int flags = m_FindReplaceData->GetFlags(); diff --git a/src/generic/fontdlgg.cpp b/src/generic/fontdlgg.cpp index fc558e2131..abf7bd4504 100644 --- a/src/generic/fontdlgg.cpp +++ b/src/generic/fontdlgg.cpp @@ -52,7 +52,9 @@ class WXDLLEXPORT wxFontPreviewer : public wxWindow { public: - wxFontPreviewer(wxWindow *parent) : wxWindow(parent, wxID_ANY) {} + wxFontPreviewer(wxWindow *parent, const wxSize& sz = wxDefaultSize) : wxWindow(parent, wxID_ANY, wxDefaultPosition, sz) + { + } private: void OnPaint(wxPaintEvent& event); @@ -305,6 +307,10 @@ void wxGenericFontDialog::CreateWidgets() { wxStaticText* itemStaticText15 = new wxStaticText( this, wxID_STATIC, _("C&olour:"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer14->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + + wxSize colourSize = wxDefaultSize; + if (is_pda) + colourSize.x = 100; wxChoice* itemChoice16 = new wxChoice( this, wxID_FONT_COLOUR, wxDefaultPosition, wxDefaultSize, NUM_COLS, wxColourDialogNames, 0 ); itemChoice16->SetHelpText(_("The font colour.")); @@ -336,11 +342,12 @@ void wxGenericFontDialog::CreateWidgets() itemBoxSizer20->Add(itemCheckBox21, 0, wxALIGN_LEFT|wxALL, 5); } - itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + if (!is_pda) + itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxStaticText* itemStaticText23 = new wxStaticText( this, wxID_STATIC, _("Preview:"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer3->Add(itemStaticText23, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - + wxFontPreviewer* itemWindow24 = new wxFontPreviewer( this ); m_previewer = itemWindow24; itemWindow24->SetHelpText(_("Shows the font preview.")); @@ -405,7 +412,7 @@ void wxGenericFontDialog::CreateWidgets() pointSizeChoice->SetSelection(dialogFont.GetPointSize()-1); - GetSizer()->SetItemMinSize(m_previewer, 430, 100); + GetSizer()->SetItemMinSize(m_previewer, is_pda ? 100 : 430, is_pda ? 40 : 100); GetSizer()->SetSizeHints(this); GetSizer()->Fit(this); diff --git a/src/generic/logg.cpp b/src/generic/logg.cpp index cda1784ab1..9b8d9b0599 100644 --- a/src/generic/logg.cpp +++ b/src/generic/logg.cpp @@ -736,17 +736,19 @@ wxLogDialog::wxLogDialog(wxWindow *parent, m_btnSave = (wxButton *)NULL; #endif // wxUSE_FILE + bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); + // create the controls which are always shown and layout them: we use // sizers even though our window is not resizeable to calculate the size of // the dialog properly wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); - wxBoxSizer *sizerButtons = new wxBoxSizer(wxVERTICAL); - wxBoxSizer *sizerAll = new wxBoxSizer(wxHORIZONTAL); + wxBoxSizer *sizerButtons = new wxBoxSizer(isPda ? wxHORIZONTAL : wxVERTICAL); + wxBoxSizer *sizerAll = new wxBoxSizer(isPda ? wxVERTICAL : wxHORIZONTAL); wxButton *btnOk = new wxButton(this, wxID_OK); - sizerButtons->Add(btnOk, 0, wxCENTRE | wxBOTTOM, MARGIN/2); + sizerButtons->Add(btnOk, 0, isPda ? wxCENTRE : wxCENTRE|wxBOTTOM, MARGIN/2); m_btnDetails = new wxButton(this, wxID_MORE, ms_details + EXPAND_SUFFIX); - sizerButtons->Add(m_btnDetails, 0, wxCENTRE | wxTOP, MARGIN/2 - 1); + sizerButtons->Add(m_btnDetails, 0, isPda ? wxCENTRE|wxLEFT : wxCENTRE | wxTOP, MARGIN/2 - 1); wxBitmap bitmap; switch ( style & wxICON_MASK ) @@ -775,13 +777,15 @@ wxLogDialog::wxLogDialog(wxWindow *parent, default: wxFAIL_MSG(_T("incorrect log style")); } - sizerAll->Add(new wxStaticBitmap(this, wxID_ANY, bitmap), 0, + + if (!isPda) + sizerAll->Add(new wxStaticBitmap(this, wxID_ANY, bitmap), 0, wxALIGN_CENTRE_VERTICAL); const wxString& message = messages.Last(); sizerAll->Add(CreateTextSizer(message), 1, wxALIGN_CENTRE_VERTICAL | wxLEFT | wxRIGHT, MARGIN); - sizerAll->Add(sizerButtons, 0, wxALIGN_RIGHT | wxLEFT, MARGIN); + sizerAll->Add(sizerButtons, 0, isPda ? wxCENTRE|wxTOP|wxBOTTOM : (wxALIGN_RIGHT | wxLEFT), MARGIN); sizerTop->Add(sizerAll, 0, wxALL | wxEXPAND, MARGIN); @@ -804,6 +808,13 @@ wxLogDialog::wxLogDialog(wxWindow *parent, btnOk->SetFocus(); Centre(); + + if (isPda) + { + // Move up the screen so that when we expand the dialog, + // there's enough space. + Move(wxPoint(GetPosition().x, GetPosition().y / 2)); + } } void wxLogDialog::CreateDetailsControls() @@ -824,6 +835,11 @@ void wxLogDialog::CreateDetailsControls() wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL); +#ifdef __WXWINCE__ + // This maks a big aesthetic difference on WinCE but I + // don't want to risk problems on other platforms + m_listctrl->Hide(); +#endif // no need to translate these strings as they're not shown to the // user anyhow (we use wxLC_NO_HEADER style) @@ -1007,7 +1023,9 @@ void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event)) } #if wxUSE_STATLINE - sizer->Add(m_statline, 0, wxEXPAND | (wxALL & ~wxTOP), MARGIN); + bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); + if (!isPda) + sizer->Add(m_statline, 0, wxEXPAND | (wxALL & ~wxTOP), MARGIN); #endif // wxUSE_STATLINE sizer->Add(m_listctrl, 1, wxEXPAND | (wxALL & ~wxTOP), MARGIN); @@ -1054,6 +1072,11 @@ void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event)) SetSizeHints(size.x, size.y, m_maxWidth, m_maxHeight); +#ifdef __WXWINCE__ + if (m_showingDetails) + m_listctrl->Show(); +#endif + // don't change the width when expanding/collapsing SetSize(wxDefaultCoord, size.y); diff --git a/src/generic/progdlgg.cpp b/src/generic/progdlgg.cpp index 72a85e1210..0e64813028 100644 --- a/src/generic/progdlgg.cpp +++ b/src/generic/progdlgg.cpp @@ -39,12 +39,12 @@ #include "wx/event.h" #include "wx/gauge.h" #include "wx/intl.h" - #include "wx/settings.h" #include "wx/dcclient.h" #include "wx/timer.h" #endif #include "wx/generic/progdlgg.h" +#include "wx/settings.h" // --------------------------------------------------------------------------- // macros @@ -114,6 +114,8 @@ wxProgressDialog::wxProgressDialog(wxString const &title, m_hasAbortButton = (style & wxPD_CAN_ABORT) != 0; m_hasSkipButton = (style & wxPD_CAN_SKIP) != 0; + bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); + #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) // we have to remove the "Close" button from the title bar then as it is // confusing to have it - it doesn't work anyhow @@ -258,13 +260,16 @@ wxProgressDialog::wxProgressDialog(wxString const &title, SetSizerAndFit(sizer); - sizeDlg.y += 2*LAYOUT_MARGIN; + if (!isPda) + { + sizeDlg.y += 2*LAYOUT_MARGIN; - // try to make the dialog not square but rectangular of reasonabel width - sizeDlg.x = (wxCoord)wxMax(widthText, 4*sizeDlg.y/3); - sizeDlg.x *= 3; - sizeDlg.x /= 2; - SetClientSize(sizeDlg); + // try to make the dialog not square but rectangular of reasonable width + sizeDlg.x = (wxCoord)wxMax(widthText, 4*sizeDlg.y/3); + sizeDlg.x *= 3; + sizeDlg.x /= 2; + SetClientSize(sizeDlg); + } Centre(wxCENTER_FRAME | wxBOTH); diff --git a/src/generic/tipdlg.cpp b/src/generic/tipdlg.cpp index 3c014cab9c..0bb63154a9 100644 --- a/src/generic/tipdlg.cpp +++ b/src/generic/tipdlg.cpp @@ -37,7 +37,6 @@ #include "wx/dialog.h" #include "wx/icon.h" #include "wx/intl.h" - #include "wx/settings.h" #include "wx/textctrl.h" #include "wx/statbmp.h" #include "wx/stattext.h" @@ -46,6 +45,7 @@ #include "wx/statline.h" #include "wx/artprov.h" +#include "wx/settings.h" #include "wx/tipdlg.h" @@ -222,6 +222,7 @@ wxTipDialog::wxTipDialog(wxWindow *parent, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { m_tipProvider = tipProvider; + bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); // 1) create all controls in tab order @@ -240,11 +241,16 @@ wxTipDialog::wxTipDialog(wxWindow *parent, wxStaticText *text = new wxStaticText(this, wxID_ANY, _("Did you know...")); -#ifndef __SMARTPHONE__ - wxFont font = text->GetFont(); - font.SetPointSize(int(1.6 * font.GetPointSize())); - font.SetWeight(wxFONTWEIGHT_BOLD); - text->SetFont(font); + // Currently this causes the bottom half to be chopped off, + // so disable the large font +#ifndef __WXMSW__ + if (!isPda) + { + wxFont font = text->GetFont(); + font.SetPointSize(int(1.6 * font.GetPointSize())); + font.SetWeight(wxFONTWEIGHT_BOLD); + text->SetFont(font); + } #endif m_text = new wxTextCtrl(this, wxID_ANY, wxEmptyString, @@ -288,19 +294,26 @@ wxTipDialog::wxTipDialog(wxWindow *parent, topsizer->Add( m_text, 1, wxEXPAND | wxLEFT|wxRIGHT, wxLARGESMALL(10,0) ); wxBoxSizer *bottom = new wxBoxSizer( wxHORIZONTAL ); - bottom->Add( m_checkbox, 0, wxCENTER ); + if (isPda) + topsizer->Add( m_checkbox, 0, wxCENTER|wxTOP ); + else + bottom->Add( m_checkbox, 0, wxCENTER ); // smart phones does not support or do not waste space for wxButtons #ifdef __SMARTPHONE__ SetRightMenu(wxID_NEXT_TIP, _("Next")); SetLeftMenu(wxID_CLOSE); #else - bottom->Add( 10,10,1 ); + if (!isPda) + bottom->Add( 10,10,1 ); bottom->Add( btnNext, 0, wxCENTER | wxLEFT, wxLARGESMALL(10,0) ); bottom->Add( btnClose, 0, wxCENTER | wxLEFT, wxLARGESMALL(10,0) ); #endif - topsizer->Add( bottom, 0, wxEXPAND | wxALL, wxLARGESMALL(10,0) ); + if (isPda) + topsizer->Add( bottom, 0, wxCENTER | wxALL, 5 ); + else + topsizer->Add( bottom, 0, wxEXPAND | wxALL, wxLARGESMALL(10,0) ); SetTipText();