/////////////////////////////////////////////////////////////////////////////
-// Name: dialogs.cpp
+// Name: life/dialogs.cpp
// Purpose: Life! dialogs
// Author: Guillermo Rodriguez Garcia, <guille@iies.es>
// Modified by:
if (isPDA &&
wxSystemSettings::GetMetric(wxSYS_SCREEN_X) < wxSystemSettings::GetMetric(wxSYS_SCREEN_Y))
{
- listSize = wxSize(-1, 50);
+ listSize = wxSize(wxDefaultCoord, 50);
screenIsHorizontal = false;
}
sizer3->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 10 );
#endif // wxUSE_STATLINE
sizer3->Add( sizer2, 1, wxGROW | wxALL, 5 );
-#if wxUSE_STATLINE
- if (!isPDA)
- sizer3->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 10 );
-#endif // wxUSE_STATLINE
-#if defined(__SMARTPHONE__)
- SetLeftMenu(wxID_CANCEL);
- SetRightMenu(wxID_OK);
-#endif
+ wxSizer *buttonSizer = CreateButtonSizer( wxOK|wxCANCEL , true, 10 );
+ if(buttonSizer->GetChildren().GetCount() > 0 )
+ {
+ sizer3->Add( buttonSizer, 0, wxEXPAND | wxALL, 10 );
+ }
+ else
+ {
+ sizer3->AddSpacer( 10 );
+ delete buttonSizer;
+ }
// activate
SetSizer(sizer3);
-
-#if !defined(__POCKETPC__) && !defined(__SMARTPHONE__)
- sizer3->Add( CreateButtonSizer(wxOK | wxCANCEL), 0, wxCENTRE | wxALL, isPDA ? 2 : 10 );
+#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
sizer3->SetSizeHints(this);
sizer3->Fit(this);
Centre(wxBOTH | wxCENTRE_ON_SCREEN);
<guille@iies.es>\n\n\
Portions of the code are based in XLife;\n\
XLife is (c) 1989 by Jon Bennett et al.")),
- 0, wxCENTRE | wxALL, 20 );
-#if wxUSE_STATLINE
- sizer->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 5 );
-#endif // wxUSE_STATLINE
+ 0, wxCENTRE | wxRIGHT|wxLEFT|wxTOP, 20 );
-#if ! (defined(__SMARTPHONE__) || defined(__POCKETPC__))
- sizer->Add( CreateButtonSizer(wxOK), 0, wxCENTRE | wxALL, 10 );
-#endif
+ // buttons if any
+ wxSizer *buttonSizer = CreateButtonSizer( wxOK , true, 10 );
+ if(buttonSizer->GetChildren().GetCount() > 0 )
+ {
+ sizer->Add( buttonSizer, 0, wxEXPAND | wxALL, 10 );
+ }
+ else
+ {
+ sizer->AddSpacer( 20 );
+ delete buttonSizer;
+ }
// activate
SetSizer(sizer);
-
-#if ! (defined(__SMARTPHONE__) || defined(__POCKETPC__))
+#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
sizer->SetSizeHints(this);
sizer->Fit(this);
Centre(wxBOTH | wxCENTRE_ON_SCREEN);
#endif
}
-
-
-
- ::wxGetUserName() implemented.
- wxDisplay enumeration support.
- Fixed wxFileDialog breakage on WinCE due to incorrect structure size.
+- new wxSystemOption "wince.dialog.real-ok-cancel" to switch between WinCE
+ guidelines with Ok-only dialogs and dialogs using wxButtons.
Unix:
class WXDLLEXPORT wxDialogBase : public wxTopLevelWindow
{
public:
+
+ enum
+ {
+ // all flags allowed in wxDialogBase::CreateButtonSizer()
+ ButtonSizerFlags = wxOK|wxCANCEL|wxYES|wxNO|wxHELP|wxNO_DEFAULT
+ };
+
wxDialogBase() { Init(); }
virtual ~wxDialogBase() { }
wxSizer *CreateTextSizer( const wxString &message );
#endif // wxUSE_STATTEXT // && wxUSE_TEXTCTRL
-#if wxUSE_BUTTON
// places buttons into a horizontal wxBoxSizer
- wxSizer *CreateButtonSizer( long flags );
+ wxSizer *CreateButtonSizer( long flags,
+ bool separated = false,
+ wxCoord distance = 0 );
+#if wxUSE_BUTTON
wxStdDialogButtonSizer *CreateStdDialogButtonSizer( long flags );
#endif // wxUSE_BUTTON
|wxRESIZE_BORDER
#endif
);
- CreateButtons(wxOK|wxCANCEL|wxHELP);
+ CreateButtons(wxOK|wxCANCEL
+#ifndef __POCKETPC__
+ |wxHELP
+#endif
+ );
wxBookCtrlBase* notebook = GetBookCtrl();
#include "wx/containr.h"
#endif
+#include "wx/statline.h"
+#include "wx/sysopt.h"
+
#if wxUSE_STATTEXT
// ----------------------------------------------------------------------------
#endif // wxUSE_STATTEXT
-#if wxUSE_BUTTON
-
-wxSizer *wxDialogBase::CreateButtonSizer( long flags )
+wxSizer *wxDialogBase::CreateButtonSizer( long flags, bool separated, wxCoord distance )
{
#ifdef __SMARTPHONE__
+ wxUnusedVar(separated);
+ wxUnusedVar(distance);
+
wxDialog* dialog = (wxDialog*) this;
if (flags & wxOK){
dialog->SetLeftMenu(wxID_OK);
}
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
return sizer;
-#else
- return CreateStdDialogButtonSizer( flags );
-#endif
+
+#else // !__SMARTPHONE__
+
+#ifdef __POCKETPC__
+ // PocketPC guidelines recommend for Ok/Cancel dialogs to use
+ // OK button located inside caption bar and implement Cancel functionality
+ // through Undo outside dialog. As native behaviour this will be default
+ // here but can be easily replaced with real wxButtons
+ // with "wince.dialog.real-ok-cancel" option set to 1
+ if ( ((flags & ~(wxCANCEL|wxNO_DEFAULT))== wxOK) &&
+ (wxSystemOptions::GetOptionInt(wxT("wince.dialog.real-ok-cancel"))==0)
+ )
+ {
+ wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
+ return sizer;
+ }
+#endif // __POCKETPC__
+
+#if wxUSE_BUTTON
+
+ wxSizer* buttonSizer = CreateStdDialogButtonSizer( flags );
+
+ // Mac Human Interface Guidelines recommend not to use static lines as grouping elements
+#if wxUSE_STATLINE && !defined(__WXMAC__)
+ if(!separated)
+ return buttonSizer;
+
+ wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
+ topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxBOTTOM, distance );
+ topsizer->Add( buttonSizer, 0, wxEXPAND );
+ return topsizer;
+
+#else // !wxUSE_STATLINE
+
+ wxUnusedVar(separated);
+ wxUnusedVar(distance);
+ return buttonSizer;
+
+#endif // wxUSE_STATLINE/!wxUSE_STATLINE
+
+#else // !wxUSE_BUTTON
+
+ wxUnusedVar(separated);
+ wxUnusedVar(distance);
+ wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
+ return sizer;
+
+#endif // wxUSE_BUTTON/!wxUSE_BUTTON
+
+#endif // __SMARTPHONE__/!__SMARTPHONE__
}
+#if wxUSE_BUTTON
+
wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags )
{
wxStdDialogButtonSizer *sizer = new wxStdDialogButtonSizer();
+
wxButton *ok = NULL;
wxButton *yes = NULL;
wxButton *no = NULL;
return sizer;
}
-
#endif // wxUSE_BUTTON
#include "wx/arrstr.h"
#endif
-#if wxUSE_STATLINE
- #include "wx/statline.h"
-#endif
-
+#include "wx/statline.h"
#include "wx/generic/choicdgg.h"
// ----------------------------------------------------------------------------
topsizer->Add( m_listbox, 1, wxEXPAND|wxLEFT|wxRIGHT, wxLARGESMALL(15,0) );
- // smart phones does not support or do not waste space for wxButtons
-#ifdef __SMARTPHONE__
-
- SetRightMenu(wxID_CANCEL, _("Cancel"));
-
-#else // __SMARTPHONE__/!__SMARTPHONE__
-
- // Mac Human Interface Guidelines recommend not to use static lines as grouping elements
-#ifndef __WXMAC__
-#if wxUSE_STATLINE
- // 3) static line
- topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
-#endif
-#endif
-
- // 4) buttons
- topsizer->Add( CreateButtonSizer( styleDlg & (wxOK|wxCANCEL) ), 0, wxEXPAND | wxALL, 10 );
-
-#endif // !__SMARTPHONE__
+ // 3) buttons if any
+ wxSizer *buttonSizer = CreateButtonSizer( styleDlg & ButtonSizerFlags , true, wxLARGESMALL(10,0) );
+ if(buttonSizer->GetChildren().GetCount() > 0 )
+ {
+ topsizer->Add( buttonSizer, 0, wxEXPAND | wxALL, wxLARGESMALL(10,0) );
+ }
+ else
+ {
+ topsizer->AddSpacer( wxLARGESMALL(15,0) );
+ delete buttonSizer;
+ }
SetSizer( topsizer );
/////////////////////////////////////////////////////////////////////////////
-// Name: dirdlg.cpp
+// Name: src/generic/dirdlg.cpp
// Purpose: wxDirDialog
// Author: Harm van der Heijden, Robert Roebling & Julian Smart
// Modified by:
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
- // smart phones does not support or do not waste space for wxButtons
+ // smartphones does not support or do not waste space for wxButtons
#if defined(__SMARTPHONE__)
wxMenu *dirMenu = new wxMenu;
dirMenu->AppendSeparator();
dirMenu->Append(wxID_CANCEL, _("Cancel"));
- SetRightMenu(wxID_ANY, _("Options"), dirMenu);
-
#else
// 0) 'New' and 'Home' Buttons
m_input = new wxTextCtrl( this, ID_TEXTCTRL, m_path, wxDefaultPosition );
topsizer->Add( m_input, 0, wxTOP|wxLEFT|wxRIGHT | wxEXPAND, wxLARGESMALL(10,0) );
-#ifndef __SMARTPHONE__
+ // 3) buttons if any
+ wxSizer *buttonSizer = CreateButtonSizer( wxOK|wxCANCEL , true, wxLARGESMALL(10,0) );
+ if(buttonSizer->GetChildren().GetCount() > 0 )
+ {
+ topsizer->Add( buttonSizer, 0, wxEXPAND | wxALL, wxLARGESMALL(10,0) );
+ }
+ else
+ {
+ topsizer->AddSpacer( wxLARGESMALL(10,0) );
+ delete buttonSizer;
+ }
-#if wxUSE_STATLINE
- // 3) Static line
- topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
+#ifdef __SMARTPHONE__
+ // overwrite menu achieved with earlier CreateButtonSizer() call
+ SetRightMenu(wxID_ANY, _("Options"), dirMenu);
#endif
- // 4) Buttons
- topsizer->Add( CreateButtonSizer( wxOK|wxCANCEL ), 0, wxEXPAND | wxALL, 10 );
-
-#endif // !__SMARTPHONE__
-
m_input->SetFocus();
SetAutoLayout( true );
/////////////////////////////////////////////////////////////////////////////
-// Name: numdlgg.cpp
+// Name: src/generic/numdlgg.cpp
// Purpose: wxGetNumberFromUser implementation
// Author: Vadim Zeitlin
// Modified by:
#if wxUSE_STATTEXT
// 1) text message
topsizer->Add( CreateTextSizer( message ), 0, wxALL, 10 );
-#endif
+#endif
// 2) prompt and text ctrl
wxBoxSizer *inputsizer = new wxBoxSizer( wxHORIZONTAL );
#if wxUSE_STATTEXT
// prompt if any
- if (!prompt.IsEmpty())
+ if (!prompt.empty())
inputsizer->Add( new wxStaticText( this, wxID_ANY, prompt ), 0, wxCENTER | wxLEFT, 10 );
#endif
-
+
// spin ctrl
wxString valStr;
valStr.Printf(wxT("%ld"), m_value);
#endif
inputsizer->Add( m_spinctrl, 1, wxCENTER | wxLEFT | wxRIGHT, 10 );
// add both
- topsizer->Add( inputsizer, 1, wxEXPAND | wxLEFT|wxRIGHT, 5 );
-
- // smart phones does not support or do not waste space for wxButtons
-#ifdef __SMARTPHONE__
-
- SetRightMenu(wxID_CANCEL, _("Cancel"));
+ topsizer->Add( inputsizer, 0, wxEXPAND | wxLEFT|wxRIGHT, 5 );
-#else // __SMARTPHONE__/!__SMARTPHONE__
-
-#if wxUSE_STATLINE
- // 3) static line
- topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
-#endif
-
- // 4) buttons
- topsizer->Add( CreateButtonSizer( wxOK|wxCANCEL ), 0, wxEXPAND | wxALL, 10 );
-
-#endif // !__SMARTPHONE__
+ // 3) buttons if any
+ wxSizer *buttonSizer = CreateButtonSizer( wxOK|wxCANCEL , true, wxLARGESMALL(10,0) );
+ if(buttonSizer->GetChildren().GetCount() > 0 )
+ {
+ topsizer->Add( buttonSizer, 0, wxEXPAND | wxALL, wxLARGESMALL(10,0) );
+ }
+ else
+ {
+ topsizer->AddSpacer( wxLARGESMALL(15,0) );
+ delete buttonSizer;
+ }
SetSizer( topsizer );
SetAutoLayout( true );
#include "wx/bookctrl.h"
#include "wx/generic/propdlg.h"
+#include "wx/sysopt.h"
//-----------------------------------------------------------------------------
// wxPropertySheetDialog
// Creates the buttons, if any
void wxPropertySheetDialog::CreateButtons(int flags)
{
-#if defined(__SMARTPHONE__)
- // TODO: create a right-click menu with all the other IDs available.
- // Perhaps that could be embedded in CreateButtonSizer() directly.
- SetRightMenu(wxID_CANCEL);
- SetLeftMenu(wxID_OK);
- wxUnusedVar(flags);
-#elif defined(__POCKETPC__)
- // Do nothing
- wxUnusedVar(flags);
-#else
- wxSizer* sizer = CreateButtonSizer(flags);
- m_innerSizer->Add( sizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxRIGHT, 2);
- m_innerSizer->AddSpacer(2);
+#ifdef __POCKETPC__
+ // keep system option status
+ const wxChar *optionName = wxT("wince.dialog.real-ok-cancel");
+ const int status = wxSystemOptions::GetOptionInt(optionName);
+ wxSystemOptions::SetOption(optionName,0);
+#endif
+
+ wxSizer *buttonSizer = CreateButtonSizer( flags & ButtonSizerFlags );
+ if(buttonSizer->GetChildren().GetCount() > 0 )
+ {
+ m_innerSizer->Add( buttonSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxRIGHT, 2);
+ m_innerSizer->AddSpacer(2);
+ }
+ else
+ {
+ delete buttonSizer;
+ }
+
+#ifdef __POCKETPC__
+ // restore system option
+ wxSystemOptions::SetOption(optionName,status);
#endif
}
/////////////////////////////////////////////////////////////////////////////
-// Name: textdlgg.cpp
+// Name: src/generic/textdlgg.cpp
// Purpose: wxTextEntryDialog
// Author: Julian Smart
// Modified by:
#if wxUSE_STATTEXT
// 1) text message
topsizer->Add( CreateTextSizer( message ), 0, wxALL, wxLARGESMALL(10,0) );
-#endif
+#endif
// 2) text ctrl
m_textctrl = new wxTextCtrl(this, wxID_TEXT, value,
#if wxUSE_VALIDATORS
wxTextValidator validator( wxFILTER_NONE, &m_value );
m_textctrl->SetValidator( validator );
-#endif
- // wxUSE_VALIDATORS
-
- // smart phones does not support or do not waste space for wxButtons
-#ifdef __SMARTPHONE__
-
- SetRightMenu(wxID_CANCEL, _("Cancel"));
-
-#else // __SMARTPHONE__/!__SMARTPHONE__
-
-#if wxUSE_STATLINE
- // 3) static line
- topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
-#endif
+#endif // wxUSE_VALIDATORS
- // 4) buttons
- topsizer->Add( CreateButtonSizer( style ), 0, wxEXPAND | wxALL, 10 );
-
-#endif // !__SMARTPHONE__
+ // 3) buttons if any
+ wxSizer *buttonSizer = CreateButtonSizer( style & ButtonSizerFlags , true, wxLARGESMALL(10,0) );
+ if(buttonSizer->GetChildren().GetCount() > 0 )
+ {
+ topsizer->Add( buttonSizer, 0, wxEXPAND | wxALL, wxLARGESMALL(10,0) );
+ }
+ else
+ {
+ topsizer->AddSpacer( wxLARGESMALL(15,0) );
+ delete buttonSizer;
+ }
SetAutoLayout( true );
SetSizer( topsizer );