Adjustement to the small display of Smartphones.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29249 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -41,11 +41,9 @@
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/bmpbuttn.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxGenericDirDialog
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxGenericDirDialog, wxDialog)
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static const int ID_DIRCTRL = 1000;
|
||||
static const int ID_TEXTCTRL = 1001;
|
||||
@@ -55,6 +53,26 @@ static const int ID_NEW = 1004;
|
||||
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
|
||||
*/
|
||||
|
||||
#if defined(__SMARTPHONE__)
|
||||
#define wxLARGESMALL(large,small) small
|
||||
#else
|
||||
#define wxLARGESMALL(large,small) large
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxGenericDirDialog
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxGenericDirDialog, wxDialog)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxGenericDirDialog, wxDialog)
|
||||
EVT_CLOSE (wxGenericDirDialog::OnCloseWindow)
|
||||
EVT_BUTTON (wxID_OK, wxGenericDirDialog::OnOK)
|
||||
@@ -82,11 +100,18 @@ wxGenericDirDialog::wxGenericDirDialog(wxWindow* parent, const wxString& title,
|
||||
|
||||
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
// Smartphone does not have buttons
|
||||
#if defined(__SMARTPHONE__)
|
||||
|
||||
// FIXME: make 'new dir' and 'home' in local dialog menu
|
||||
|
||||
#else
|
||||
|
||||
// 0) 'New' and 'Home' Buttons
|
||||
wxSizer* buttonsizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
// VS: 'Home directory' concept is unknown to MS-DOS
|
||||
#ifndef __DOS__
|
||||
#if !defined(__DOS__)
|
||||
wxBitmapButton* homeButton =
|
||||
new wxBitmapButton(this, ID_GO_HOME,
|
||||
wxArtProvider::GetBitmap(wxART_GO_HOME, wxART_BUTTON));
|
||||
@@ -112,6 +137,8 @@ wxGenericDirDialog::wxGenericDirDialog(wxWindow* parent, const wxString& title,
|
||||
|
||||
topsizer->Add( buttonsizer, 0, wxTOP | wxALIGN_RIGHT, 10 );
|
||||
|
||||
#endif // __SMARTPHONE__/!__SMARTPHONE__
|
||||
|
||||
// 1) dir ctrl
|
||||
m_dirCtrl = NULL; // this is neccessary, event handler called from
|
||||
// wxGenericDirCtrl would crash otherwise!
|
||||
@@ -131,15 +158,23 @@ wxGenericDirDialog::wxGenericDirDialog(wxWindow* parent, const wxString& title,
|
||||
wxSize(300, 200),
|
||||
dirStyle);
|
||||
|
||||
topsizer->Add( m_dirCtrl, 1, wxTOP|wxLEFT|wxRIGHT | wxEXPAND, 10 );
|
||||
topsizer->Add( m_dirCtrl, 1, wxTOP|wxLEFT|wxRIGHT | wxEXPAND, wxLARGESMALL(10,0) );
|
||||
|
||||
#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 );
|
||||
#endif // !__SMARTPHONE__
|
||||
|
||||
// 2) text ctrl
|
||||
m_input = new wxTextCtrl( this, ID_TEXTCTRL, m_path, wxDefaultPosition );
|
||||
topsizer->Add( m_input, 0, wxTOP|wxLEFT|wxRIGHT | wxEXPAND, 10 );
|
||||
topsizer->Add( m_input, 0, wxTOP|wxLEFT|wxRIGHT | wxEXPAND, wxLARGESMALL(10,0) );
|
||||
|
||||
#ifdef __SMARTPHONE__
|
||||
|
||||
SetRightMenu(wxID_CANCEL, _("Cancel"));
|
||||
|
||||
#else // __SMARTPHONE__/!__SMARTPHONE__
|
||||
|
||||
#if wxUSE_STATLINE
|
||||
// 3) Static line
|
||||
@@ -158,6 +193,9 @@ wxGenericDirDialog::wxGenericDirDialog(wxWindow* parent, const wxString& title,
|
||||
topsizer->Add( buttonsizer, 0, wxLEFT|wxTOP|wxBOTTOM | wxALIGN_RIGHT, 10 );
|
||||
|
||||
okButton->SetDefault();
|
||||
|
||||
#endif // !__SMARTPHONE__
|
||||
|
||||
m_dirCtrl->SetFocus();
|
||||
|
||||
SetAutoLayout( true );
|
||||
|
@@ -52,6 +52,20 @@
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if defined(__SMARTPHONE__)
|
||||
#define wxLARGESMALL(large,small) small
|
||||
#else
|
||||
#define wxLARGESMALL(large,small) large
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
@@ -84,13 +98,13 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
|
||||
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
// 1) text message
|
||||
topsizer->Add( CreateTextSizer( message ), 0, wxALL, 10 );
|
||||
topsizer->Add( CreateTextSizer( message ), 0, wxALL, wxLARGESMALL(10,0) );
|
||||
|
||||
// 2) text ctrl
|
||||
m_textctrl = new wxTextCtrl(this, wxID_TEXT, value,
|
||||
wxDefaultPosition, wxSize(300, wxDefaultCoord),
|
||||
style & ~wxTextEntryDialogStyle);
|
||||
topsizer->Add( m_textctrl, 1, wxEXPAND | wxLEFT|wxRIGHT, 15 );
|
||||
topsizer->Add( m_textctrl, 1, wxEXPAND | wxLEFT|wxRIGHT, wxLARGESMALL(15,0) );
|
||||
|
||||
#if wxUSE_VALIDATORS
|
||||
wxTextValidator validator( wxFILTER_NONE, &m_value );
|
||||
@@ -98,6 +112,12 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
|
||||
#endif
|
||||
// wxUSE_VALIDATORS
|
||||
|
||||
#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 );
|
||||
@@ -106,6 +126,8 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
|
||||
// 4) buttons
|
||||
topsizer->Add( CreateButtonSizer( style ), 0, wxCENTRE | wxALL, 10 );
|
||||
|
||||
#endif // !__SMARTPHONE__
|
||||
|
||||
SetAutoLayout( true );
|
||||
SetSizer( topsizer );
|
||||
|
||||
|
Reference in New Issue
Block a user