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()
: 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;

View File

@@ -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();

View File

@@ -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);
@@ -306,6 +308,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."));
if (ShowToolTips())
@@ -336,6 +342,7 @@ void wxGenericFontDialog::CreateWidgets()
itemBoxSizer20->Add(itemCheckBox21, 0, wxALIGN_LEFT|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 );
@@ -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);

View File

@@ -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"));
}
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,6 +1023,8 @@ void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event))
}
#if wxUSE_STATLINE
bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
if (!isPda)
sizer->Add(m_statline, 0, wxEXPAND | (wxALL & ~wxTOP), MARGIN);
#endif // wxUSE_STATLINE
@@ -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);

View File

@@ -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);
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 *= 3;
sizeDlg.x /= 2;
SetClientSize(sizeDlg);
}
Centre(wxCENTER_FRAME | wxBOTH);

View File

@@ -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__
// 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,6 +294,9 @@ wxTipDialog::wxTipDialog(wxWindow *parent,
topsizer->Add( m_text, 1, wxEXPAND | wxLEFT|wxRIGHT, wxLARGESMALL(10,0) );
wxBoxSizer *bottom = new wxBoxSizer( wxHORIZONTAL );
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
@@ -295,11 +304,15 @@ wxTipDialog::wxTipDialog(wxWindow *parent,
SetRightMenu(wxID_NEXT_TIP, _("Next"));
SetLeftMenu(wxID_CLOSE);
#else
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
if (isPda)
topsizer->Add( bottom, 0, wxCENTER | wxALL, 5 );
else
topsizer->Add( bottom, 0, wxEXPAND | wxALL, wxLARGESMALL(10,0) );
SetTipText();