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
This commit is contained in:
Julian Smart
2005-02-16 15:37:09 +00:00
parent 26a12ab34c
commit 94f5392355
6 changed files with 99 additions and 34 deletions

View File

@@ -1666,12 +1666,18 @@ void wxStaticBoxSizer::ShowItems( bool show )
wxStdDialogButtonSizer::wxStdDialogButtonSizer() wxStdDialogButtonSizer::wxStdDialogButtonSizer()
: wxBoxSizer(wxHORIZONTAL) : 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); bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
// If we have a PDA screen, put yes/no button over // If we have a PDA screen, put yes/no button over
// all other buttons, otherwise on the left side. // all other buttons, otherwise on the left side.
if (is_pda) if (is_pda)
m_orient = wxVERTICAL; m_orient = wxVERTICAL;
#endif
m_buttonAffirmative = NULL; m_buttonAffirmative = NULL;
m_buttonApply = NULL; m_buttonApply = NULL;

View File

@@ -44,6 +44,7 @@
#endif #endif
#include "wx/fdrepdlg.h" #include "wx/fdrepdlg.h"
#include "wx/settings.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// constants // constants
@@ -102,6 +103,8 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent,
wxCHECK_MSG( m_FindReplaceData, false, wxCHECK_MSG( m_FindReplaceData, false,
_T("can't create dialog without data") ); _T("can't create dialog without data") );
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
@@ -126,7 +129,7 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent,
wxALIGN_CENTRE_VERTICAL | wxALIGN_CENTRE_VERTICAL |
wxALIGN_RIGHT | wxTOP, 5); wxALIGN_RIGHT | wxTOP, 5);
sizer2Col->Add(10, 0); sizer2Col->Add(isPda ? 2 : 10, 0);
m_textRepl = new wxTextCtrl(this, wxID_ANY, m_textRepl = new wxTextCtrl(this, wxID_ANY,
m_FindReplaceData->GetReplaceString()); m_FindReplaceData->GetReplaceString());
@@ -136,7 +139,7 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent,
leftsizer->Add(sizer2Col, 0, wxEXPAND | wxALL, 5); leftsizer->Add(sizer2Col, 0, wxEXPAND | wxALL, 5);
wxBoxSizer *optsizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *optsizer = new wxBoxSizer( isPda ? wxVERTICAL : wxHORIZONTAL );
wxBoxSizer *chksizer = new wxBoxSizer( wxVERTICAL); wxBoxSizer *chksizer = new wxBoxSizer( wxVERTICAL);
@@ -149,11 +152,19 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent,
optsizer->Add(chksizer, 0, wxALL, 10); optsizer->Add(chksizer, 0, wxALL, 10);
static const wxString searchDirections[] = {_("Up"), _("Down")}; 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"), m_radioDir = new wxRadioBox(this, wxID_ANY, _("Search direction"),
wxDefaultPosition, wxDefaultSize, 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); leftsizer->Add(optsizer);
@@ -174,8 +185,8 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent,
wxBoxSizer *topsizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *topsizer = new wxBoxSizer( wxHORIZONTAL );
topsizer->Add(leftsizer, 1, wxALL, 5); topsizer->Add(leftsizer, 1, wxALL, isPda ? 0 : 5);
topsizer->Add(bttnsizer, 0, wxALL, 5); topsizer->Add(bttnsizer, 0, wxALL, isPda ? 0 : 5);
int flags = m_FindReplaceData->GetFlags(); int flags = m_FindReplaceData->GetFlags();

View File

@@ -52,7 +52,9 @@
class WXDLLEXPORT wxFontPreviewer : public wxWindow class WXDLLEXPORT wxFontPreviewer : public wxWindow
{ {
public: public:
wxFontPreviewer(wxWindow *parent) : wxWindow(parent, wxID_ANY) {} wxFontPreviewer(wxWindow *parent, const wxSize& sz = wxDefaultSize) : wxWindow(parent, wxID_ANY, wxDefaultPosition, sz)
{
}
private: private:
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
@@ -305,6 +307,10 @@ void wxGenericFontDialog::CreateWidgets()
{ {
wxStaticText* itemStaticText15 = new wxStaticText( this, wxID_STATIC, _("C&olour:"), wxDefaultPosition, wxDefaultSize, 0 ); wxStaticText* itemStaticText15 = new wxStaticText( this, wxID_STATIC, _("C&olour:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer14->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); 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 ); wxChoice* itemChoice16 = new wxChoice( this, wxID_FONT_COLOUR, wxDefaultPosition, wxDefaultSize, NUM_COLS, wxColourDialogNames, 0 );
itemChoice16->SetHelpText(_("The font colour.")); itemChoice16->SetHelpText(_("The font colour."));
@@ -336,11 +342,12 @@ void wxGenericFontDialog::CreateWidgets()
itemBoxSizer20->Add(itemCheckBox21, 0, wxALIGN_LEFT|wxALL, 5); 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 ); wxStaticText* itemStaticText23 = new wxStaticText( this, wxID_STATIC, _("Preview:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer3->Add(itemStaticText23, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); itemBoxSizer3->Add(itemStaticText23, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxFontPreviewer* itemWindow24 = new wxFontPreviewer( this ); wxFontPreviewer* itemWindow24 = new wxFontPreviewer( this );
m_previewer = itemWindow24; m_previewer = itemWindow24;
itemWindow24->SetHelpText(_("Shows the font preview.")); itemWindow24->SetHelpText(_("Shows the font preview."));
@@ -405,7 +412,7 @@ void wxGenericFontDialog::CreateWidgets()
pointSizeChoice->SetSelection(dialogFont.GetPointSize()-1); 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()->SetSizeHints(this);
GetSizer()->Fit(this); GetSizer()->Fit(this);

View File

@@ -736,17 +736,19 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
m_btnSave = (wxButton *)NULL; m_btnSave = (wxButton *)NULL;
#endif // wxUSE_FILE #endif // wxUSE_FILE
bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
// create the controls which are always shown and layout them: we use // 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 // sizers even though our window is not resizeable to calculate the size of
// the dialog properly // the dialog properly
wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *sizerButtons = new wxBoxSizer(wxVERTICAL); wxBoxSizer *sizerButtons = new wxBoxSizer(isPda ? wxHORIZONTAL : wxVERTICAL);
wxBoxSizer *sizerAll = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *sizerAll = new wxBoxSizer(isPda ? wxVERTICAL : wxHORIZONTAL);
wxButton *btnOk = new wxButton(this, wxID_OK); 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); 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; wxBitmap bitmap;
switch ( style & wxICON_MASK ) switch ( style & wxICON_MASK )
@@ -775,13 +777,15 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
default: default:
wxFAIL_MSG(_T("incorrect log style")); 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); wxALIGN_CENTRE_VERTICAL);
const wxString& message = messages.Last(); const wxString& message = messages.Last();
sizerAll->Add(CreateTextSizer(message), 1, sizerAll->Add(CreateTextSizer(message), 1,
wxALIGN_CENTRE_VERTICAL | wxLEFT | wxRIGHT, MARGIN); 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); sizerTop->Add(sizerAll, 0, wxALL | wxEXPAND, MARGIN);
@@ -804,6 +808,13 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
btnOk->SetFocus(); btnOk->SetFocus();
Centre(); 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() void wxLogDialog::CreateDetailsControls()
@@ -824,6 +835,11 @@ void wxLogDialog::CreateDetailsControls()
wxLC_REPORT | wxLC_REPORT |
wxLC_NO_HEADER | wxLC_NO_HEADER |
wxLC_SINGLE_SEL); 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 // no need to translate these strings as they're not shown to the
// user anyhow (we use wxLC_NO_HEADER style) // user anyhow (we use wxLC_NO_HEADER style)
@@ -1007,7 +1023,9 @@ void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event))
} }
#if wxUSE_STATLINE #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 #endif // wxUSE_STATLINE
sizer->Add(m_listctrl, 1, wxEXPAND | (wxALL & ~wxTOP), MARGIN); 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); 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 // don't change the width when expanding/collapsing
SetSize(wxDefaultCoord, size.y); SetSize(wxDefaultCoord, size.y);

View File

@@ -39,12 +39,12 @@
#include "wx/event.h" #include "wx/event.h"
#include "wx/gauge.h" #include "wx/gauge.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/settings.h"
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/timer.h" #include "wx/timer.h"
#endif #endif
#include "wx/generic/progdlgg.h" #include "wx/generic/progdlgg.h"
#include "wx/settings.h"
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// macros // macros
@@ -114,6 +114,8 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
m_hasAbortButton = (style & wxPD_CAN_ABORT) != 0; m_hasAbortButton = (style & wxPD_CAN_ABORT) != 0;
m_hasSkipButton = (style & wxPD_CAN_SKIP) != 0; m_hasSkipButton = (style & wxPD_CAN_SKIP) != 0;
bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
// we have to remove the "Close" button from the title bar then as it is // we have to remove the "Close" button from the title bar then as it is
// confusing to have it - it doesn't work anyhow // confusing to have it - it doesn't work anyhow
@@ -258,13 +260,16 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
SetSizerAndFit(sizer); 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 // try to make the dialog not square but rectangular of reasonable width
sizeDlg.x = (wxCoord)wxMax(widthText, 4*sizeDlg.y/3); sizeDlg.x = (wxCoord)wxMax(widthText, 4*sizeDlg.y/3);
sizeDlg.x *= 3; sizeDlg.x *= 3;
sizeDlg.x /= 2; sizeDlg.x /= 2;
SetClientSize(sizeDlg); SetClientSize(sizeDlg);
}
Centre(wxCENTER_FRAME | wxBOTH); Centre(wxCENTER_FRAME | wxBOTH);

View File

@@ -37,7 +37,6 @@
#include "wx/dialog.h" #include "wx/dialog.h"
#include "wx/icon.h" #include "wx/icon.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/settings.h"
#include "wx/textctrl.h" #include "wx/textctrl.h"
#include "wx/statbmp.h" #include "wx/statbmp.h"
#include "wx/stattext.h" #include "wx/stattext.h"
@@ -46,6 +45,7 @@
#include "wx/statline.h" #include "wx/statline.h"
#include "wx/artprov.h" #include "wx/artprov.h"
#include "wx/settings.h"
#include "wx/tipdlg.h" #include "wx/tipdlg.h"
@@ -222,6 +222,7 @@ wxTipDialog::wxTipDialog(wxWindow *parent,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{ {
m_tipProvider = tipProvider; m_tipProvider = tipProvider;
bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
// 1) create all controls in tab order // 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...")); wxStaticText *text = new wxStaticText(this, wxID_ANY, _("Did you know..."));
#ifndef __SMARTPHONE__ // Currently this causes the bottom half to be chopped off,
wxFont font = text->GetFont(); // so disable the large font
font.SetPointSize(int(1.6 * font.GetPointSize())); #ifndef __WXMSW__
font.SetWeight(wxFONTWEIGHT_BOLD); if (!isPda)
text->SetFont(font); {
wxFont font = text->GetFont();
font.SetPointSize(int(1.6 * font.GetPointSize()));
font.SetWeight(wxFONTWEIGHT_BOLD);
text->SetFont(font);
}
#endif #endif
m_text = new wxTextCtrl(this, wxID_ANY, wxEmptyString, 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) ); topsizer->Add( m_text, 1, wxEXPAND | wxLEFT|wxRIGHT, wxLARGESMALL(10,0) );
wxBoxSizer *bottom = new wxBoxSizer( wxHORIZONTAL ); 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 // smart phones does not support or do not waste space for wxButtons
#ifdef __SMARTPHONE__ #ifdef __SMARTPHONE__
SetRightMenu(wxID_NEXT_TIP, _("Next")); SetRightMenu(wxID_NEXT_TIP, _("Next"));
SetLeftMenu(wxID_CLOSE); SetLeftMenu(wxID_CLOSE);
#else #else
bottom->Add( 10,10,1 ); if (!isPda)
bottom->Add( 10,10,1 );
bottom->Add( btnNext, 0, wxCENTER | wxLEFT, wxLARGESMALL(10,0) ); bottom->Add( btnNext, 0, wxCENTER | wxLEFT, wxLARGESMALL(10,0) );
bottom->Add( btnClose, 0, wxCENTER | wxLEFT, wxLARGESMALL(10,0) ); bottom->Add( btnClose, 0, wxCENTER | wxLEFT, wxLARGESMALL(10,0) );
#endif #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(); SetTipText();