wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
sizerTop->Add(sizerIconAndText, wxSizerFlags(1).Expand().Border());
- const int defBorder = wxSizerFlags::GetDefaultBorder();
- wxSizer *buttonSizer = CreateButtonSizer( wxOK , false, defBorder );
- if(buttonSizer->GetChildren().GetCount() > 0 )
+ wxSizer *sizerBtns = CreateButtonSizer(wxOK);
+ if ( sizerBtns )
{
- sizerTop->Add( buttonSizer, 0, wxEXPAND | wxALL, defBorder );
- }
- else
- {
- sizerTop->AddSpacer( defBorder );
- delete buttonSizer;
+ sizerTop->Add(sizerBtns, wxSizerFlags().Expand().Border());
}
SetSizerAndFit(sizerTop);
CentreOnScreen();
- wxWindow *ok = FindWindow(wxID_OK);
- if (ok) ok->SetFocus();
-
return true;
}
#define wxID_LISTBOX 3000
-// ---------------------------------------------------------------------------
-// macros
-// ---------------------------------------------------------------------------
-
-/* Macro for avoiding #ifdefs when value have to be different depending on size of
- device we display on - take it from something like wxDesktopPolicy in the future
- */
-
-#if defined(__SMARTPHONE__)
- #define wxLARGESMALL(large,small) small
-#else
- #define wxLARGESMALL(large,small) large
-#endif
-
// ----------------------------------------------------------------------------
// private functions
// ----------------------------------------------------------------------------
long styleLbox)
{
#ifdef __WXMAC__
+ // FIXME: why??
if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg & (~wxCANCEL) ) )
return false;
#else
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
// 1) text message
-#ifdef __WXMAC__
- // align text and list at least on mac
- topsizer->Add( CreateTextSizer( message ), 0, wxALL, wxLARGESMALL(15,0) );
-#else
- topsizer->Add( CreateTextSizer( message ), 0, wxALL, wxLARGESMALL(10,0) );
-#endif
+ topsizer->
+ Add(CreateTextSizer(message), wxSizerFlags().Expand().TripleBorder());
+
// 2) list box
- m_listbox = CreateList(n,choices,styleLbox);
+ m_listbox = CreateList(n, choices, styleLbox);
if ( n > 0 )
m_listbox->SetSelection(0);
- topsizer->Add( m_listbox, 1, wxEXPAND|wxLEFT|wxRIGHT, wxLARGESMALL(15,0) );
+ topsizer->
+ Add(m_listbox, wxSizerFlags().Expand().TripleBorder(wxLEFT | wxRIGHT));
// 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
+ wxSizer *
+ buttonSizer = CreateSeparatedButtonSizer(styleDlg & ButtonSizerFlags);
+ if ( buttonSizer )
{
- topsizer->AddSpacer( wxLARGESMALL(15,0) );
- delete buttonSizer;
+ topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder());
}
SetSizer( topsizer );
const int sliderHeight = 160;
+ // first sliders
#if wxUSE_SLIDER
const int sliderX = singleCustomColourRect.x + singleCustomColourRect.width + sectionSpacing;
wxBoxSizer *sliderSizer = new wxBoxSizer( wxHORIZONTAL );
- // 1) space for sliders
- sliderSizer->Add( sliderX, sliderHeight );
- sliderSizer->Add( redSlider, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 10 );
- sliderSizer->Add( greenSlider, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 10 );
- sliderSizer->Add( blueSlider, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 10 );
+ sliderSizer->Add(sliderX, sliderHeight );
- topSizer->Add( sliderSizer, 0, wxCENTRE | wxALL, 10 );
+ wxSizerFlags flagsRight;
+ flagsRight.Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL).DoubleBorder();
+
+ sliderSizer->Add(redSlider, flagsRight);
+ sliderSizer->Add(greenSlider,flagsRight);
+ sliderSizer->Add(blueSlider,flagsRight);
+
+ topSizer->Add(sliderSizer, wxSizerFlags().Centre().DoubleBorder());
#else
- topSizer->Add( 1, sliderHeight, 0, wxCENTRE | wxALL, 15 );
+ topSizer->Add(1, sliderHeight, wxSizerFlags(1).Centre().TripleBorder());
#endif // wxUSE_SLIDER
-#if wxUSE_STATLINE
- // 2) static line
- topSizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
-#endif
+ // then the custom button
+ topSizer->Add(new wxButton(this, wxID_ADD_CUSTOM,
+ _("Add to custom colours") ),
+ wxSizerFlags().DoubleHorzBorder());
- // 3) buttons
- wxSizer *buttonsizer = CreateButtonSizer( wxOK|wxCANCEL );
- buttonsizer->Add( new wxButton(this, wxID_ADD_CUSTOM, _("Add to custom colours") ), 0, wxLEFT|wxRIGHT, 10 );
- topSizer->Add( buttonsizer, 0, wxEXPAND | wxALL, 10 );
+ // then the standard buttons
+ wxSizer *buttonsizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL);
+ if ( buttonsizer )
+ {
+ topSizer->Add(buttonsizer, wxSizerFlags().Expand().DoubleBorder());
+ }
SetAutoLayout( true );
SetSizer( topSizer );
static const int ID_SHOW_HIDDEN = 1005;
static const int ID_GO_HOME = 1006;
-// ---------------------------------------------------------------------------
-// macros
-// ---------------------------------------------------------------------------
-
-/* Macro for avoiding #ifdefs when value have to be different depending on size of
- device we display on - take it from something like wxDesktopPolicy in the future
- */
-
-#if defined(__SMARTPHONE__)
- #define wxLARGESMALL(large,small) small
-#else
- #define wxLARGESMALL(large,small) large
-#endif
-
//-----------------------------------------------------------------------------
// wxGenericDirDialog
//-----------------------------------------------------------------------------
wxSize(300, 200),
dirStyle);
- topsizer->Add( m_dirCtrl, 1, wxTOP|wxLEFT|wxRIGHT | wxEXPAND, wxLARGESMALL(10,0) );
+ wxSizerFlags flagsBorder2;
+ flagsBorder2.DoubleBorder(wxTOP | wxLEFT | wxRIGHT);
+
+ topsizer->Add(m_dirCtrl, wxSizerFlags(flagsBorder2).Proportion(1).Expand());
#ifndef __SMARTPHONE__
// Make the an option depending on a flag?
- wxCheckBox* check = new wxCheckBox( this, ID_SHOW_HIDDEN, _("Show hidden directories") );
- topsizer->Add( check, 0, wxLEFT|wxRIGHT|wxTOP | wxALIGN_RIGHT, 10 );
+ wxCheckBox *
+ check = new wxCheckBox(this, ID_SHOW_HIDDEN, _("Show &hidden directories"));
+ topsizer->Add(check, wxSizerFlags(flagsBorder2).Right());
#endif // !__SMARTPHONE__
// 2) text ctrl
m_input = new wxTextCtrl( this, ID_TEXTCTRL, m_path, wxDefaultPosition );
- topsizer->Add( m_input, 0, wxTOP|wxLEFT|wxRIGHT | wxEXPAND, wxLARGESMALL(10,0) );
+ topsizer->Add(m_input, wxSizerFlags(flagsBorder2).Expand());
// 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
+ wxSizer *buttonSizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL);
+ if ( buttonSizer )
{
- topsizer->AddSpacer( wxLARGESMALL(10,0) );
- delete buttonSizer;
+ topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder());
}
#ifdef __SMARTPHONE__
- // overwrite menu achieved with earlier CreateButtonSizer() call
+ // overwrite menu set by CreateSeparatedButtonSizer() call above
SetRightMenu(wxID_ANY, _("Options"), dirMenu);
#endif
wxDefaultPosition, wxSize(540,200),
style2);
+ m_text = new wxTextCtrl(this, ID_TEXT, m_fileName,
+ wxDefaultPosition, wxDefaultSize,
+ wxTE_PROCESS_ENTER);
+ m_choice = new wxChoice(this, ID_CHOICE);
+
if (is_pda)
{
// PDAs have a different screen layout
- mainsizer->Add( m_list, 1, wxEXPAND | wxLEFT|wxRIGHT, 5 );
+ mainsizer->Add(m_list, wxSizerFlags(1).Expand().HorzBorder());
- wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
- m_text = new wxTextCtrl( this, ID_TEXT, m_fileName, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
- textsizer->Add( m_text, 1, wxCENTER | wxALL, 5 );
- mainsizer->Add( textsizer, 0, wxEXPAND );
+ wxBoxSizer *textsizer = new wxBoxSizer(wxHORIZONTAL);
+ textsizer->Add(m_text, wxSizerFlags(1).Centre().Border());
+ mainsizer->Add(textsizer, wxSizerFlags().Expand());
m_check = NULL;
- m_choice = new wxChoice( this, ID_CHOICE );
- textsizer->Add( m_choice, 1, wxCENTER|wxALL, 5 );
+ textsizer->Add(m_choice, wxSizerFlags(1).Centre().Border());
- wxSizer *bsizer = CreateButtonSizer( wxOK|wxCANCEL , false, 5 );
- if(bsizer->GetChildren().GetCount() > 0 )
- {
- mainsizer->Add( bsizer, 0, wxEXPAND | wxALL, 5 );
- }
- else
- {
- delete bsizer;
- }
+ wxSizer *bsizer = CreateButtonSizer(wxOK | wxCANCEL);
+ if ( bsizer )
+ mainsizer->Add(bsizer, wxSizerFlags().Expand().Border());
}
- else
+ else // !is_pda
{
- mainsizer->Add( m_list, 1, wxEXPAND | wxLEFT|wxRIGHT, 10 );
-
- wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
- m_text = new wxTextCtrl( this, ID_TEXT, m_fileName, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
- textsizer->Add( m_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
- textsizer->Add( new wxButton( this, wxID_OK ), 0, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
- mainsizer->Add( textsizer, 0, wxEXPAND );
-
- wxBoxSizer *choicesizer = new wxBoxSizer( wxHORIZONTAL );
- m_choice = new wxChoice( this, ID_CHOICE );
- choicesizer->Add( m_choice, 1, wxCENTER|wxALL, 10 );
- m_check = new wxCheckBox( this, ID_CHECK, _("Show hidden files") );
- m_check->SetValue( ms_lastShowHidden );
- choicesizer->Add( m_check, 0, wxCENTER|wxALL, 10 );
- choicesizer->Add( new wxButton( this, wxID_CANCEL ), 0, wxCENTER | wxALL, 10 );
- mainsizer->Add( choicesizer, 0, wxEXPAND );
+ mainsizer->Add(m_list, wxSizerFlags(1).Expand().DoubleHorzBorder());
+
+ wxBoxSizer *textsizer = new wxBoxSizer(wxHORIZONTAL);
+ textsizer->Add(m_text, wxSizerFlags(1).Centre().
+ DoubleBorder(wxLEFT | wxRIGHT | wxTOP));
+ textsizer->Add(new wxButton(this, wxID_OK), wxSizerFlags().Centre().
+ DoubleBorder(wxLEFT | wxRIGHT | wxTOP));
+ mainsizer->Add(textsizer, wxSizerFlags().Expand());
+
+ wxSizerFlags flagsCentre;
+ flagsCentre.Centre().DoubleBorder();
+
+ wxBoxSizer *choicesizer = new wxBoxSizer(wxHORIZONTAL);
+ choicesizer->Add(m_choice, wxSizerFlags(flagsCentre).Proportion(1));
+
+ m_check = new wxCheckBox(this, ID_CHECK, _("Show &hidden files"));
+ m_check->SetValue(ms_lastShowHidden);
+
+ choicesizer->Add(m_check, flagsCentre);
+ choicesizer->Add(new wxButton(this, wxID_CANCEL), flagsCentre);
+ mainsizer->Add(choicesizer, wxSizerFlags().Expand());
}
SetWildcard(wildCard);
topsizer->Add( icon_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
#endif // wxUSE_STATTEXT
-#if wxUSE_STATLINE
- // 3) static line
- topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
-#endif // wxUSE_STATLINE
-
- // 4) buttons
+ // 3) buttons
int center_flag = wxEXPAND;
- if (style & wxYES_NO) center_flag = wxALIGN_CENTRE;
- topsizer->Add( CreateButtonSizer( style & (wxOK|wxCANCEL|wxYES_NO|wxYES_DEFAULT|wxNO_DEFAULT) ),
- 0, center_flag | wxALL, 10 );
+ if (style & wxYES_NO)
+ center_flag = wxALIGN_CENTRE;
+ wxSizer *sizerBtn = CreateSeparatedButtonSizer(style & ButtonSizerFlags);
+ if ( sizerBtn )
+ topsizer->Add(sizerBtn, 0, center_flag | wxALL, 10 );
SetAutoLayout( true );
SetSizer( topsizer );
#define wxSpinCtrl wxTextCtrl
#endif
-// ---------------------------------------------------------------------------
-// macros
-// ---------------------------------------------------------------------------
-
-/* Macro for avoiding #ifdefs when value have to be different depending on size of
- device we display on - take it from something like wxDesktopPolicy in the future
- */
-
-#if defined(__SMARTPHONE__)
- #define wxLARGESMALL(large,small) small
-#else
- #define wxLARGESMALL(large,small) large
-#endif
-
// ============================================================================
// implementation
// ============================================================================
topsizer->Add( inputsizer, 0, wxEXPAND | wxLEFT|wxRIGHT, 5 );
// 3) buttons if any
- wxSizer *buttonSizer = CreateButtonSizer( wxOK|wxCANCEL , true, wxLARGESMALL(10,0) );
- if(buttonSizer->GetChildren().GetCount() > 0 )
+ wxSizer *buttonSizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL);
+ if ( buttonSizer )
{
- topsizer->Add( buttonSizer, 0, wxEXPAND | wxALL, wxLARGESMALL(10,0) );
+ topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder());
}
- else
- {
- topsizer->AddSpacer( wxLARGESMALL(15,0) );
- delete buttonSizer;
- }
SetSizer( topsizer );
SetAutoLayout( true );
mainsizer->Add( bottomsizer, 0, wxTOP|wxLEFT|wxRIGHT, 12 );
-#if wxUSE_STATLINE
- // 4) static line
- mainsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
-#endif
-
- // 5) buttons
+ // 4) buttons
- mainsizer->Add( CreateButtonSizer( wxOK|wxCANCEL), 0, wxEXPAND|wxALL, 10 );
+ wxSizer *sizerBtn = CreateSeparatedButtonSizer( wxOK|wxCANCEL);
+ if ( sizerBtn )
+ mainsizer->Add(sizerBtn, 0, wxEXPAND|wxALL, 10 );
SetAutoLayout( true );
SetSizer( mainsizer );
#endif
wxSizer *buttonSizer = CreateButtonSizer( flags & ButtonSizerFlags );
- if(buttonSizer->GetChildren().GetCount() > 0 )
+ if( buttonSizer )
{
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
static const int wxID_TEXT = 3000;
-// ---------------------------------------------------------------------------
-// macros
-// ---------------------------------------------------------------------------
-
-/* Macro for avoiding #ifdefs when value have to be different depending on size of
- device we display on - take it from something like wxDesktopPolicy in the future
- */
-
-#if defined(__SMARTPHONE__)
- #define wxLARGESMALL(large,small) small
-#else
- #define wxLARGESMALL(large,small) large
-#endif
-
// ============================================================================
// implementation
// ============================================================================
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
+ wxSizerFlags flagsBorder2;
+ flagsBorder2.DoubleBorder();
+
#if wxUSE_STATTEXT
// 1) text message
- topsizer->Add( CreateTextSizer( message ), 0, wxALL, wxLARGESMALL(10,0) );
+ topsizer->Add(CreateTextSizer(message), flagsBorder2);
#endif
// 2) text ctrl
m_textctrl = new wxTextCtrl(this, wxID_TEXT, value,
wxDefaultPosition, wxSize(300, wxDefaultCoord),
style & ~wxTextEntryDialogStyle);
- topsizer->Add( m_textctrl, style & wxTE_MULTILINE ? 1 : 0, wxEXPAND | wxLEFT|wxRIGHT, wxLARGESMALL(15,0) );
+
+ topsizer->Add(m_textctrl,
+ wxSizerFlags(style & wxTE_MULTILINE ? 1 : 0).
+ Expand().
+ TripleBorder(wxLEFT | wxRIGHT));
#if wxUSE_VALIDATORS
wxTextValidator validator( wxFILTER_NONE, &m_value );
#endif // wxUSE_VALIDATORS
// 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
+ wxSizer *buttonSizer = CreateSeparatedButtonSizer(style & ButtonSizerFlags);
+ if ( buttonSizer )
{
- topsizer->AddSpacer( wxLARGESMALL(15,0) );
- delete buttonSizer;
+ topsizer->Add(buttonSizer, wxSizerFlags(flagsBorder2).Expand());
}
SetAutoLayout( true );