Added minimal file dialog for SmartPhone
Use wxSYSTEM_MENU to get X symbol on PocketPC git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22114 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -46,5 +46,17 @@
|
|||||||
#undef wxHAS_CRASH_REPORT
|
#undef wxHAS_CRASH_REPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Hopefully we can emulate these dialogs in due
|
||||||
|
// course
|
||||||
|
#if wxUSE_SMARTPHONE
|
||||||
|
|
||||||
|
# ifdef wxUSE_COLOURDLG
|
||||||
|
# undef wxUSE_COLOURDLG
|
||||||
|
# define wxUSE_COLOURDLG 0
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif // _WX_FEATURES_H_
|
#endif // _WX_FEATURES_H_
|
||||||
|
|
||||||
|
@@ -1043,6 +1043,9 @@
|
|||||||
// (notably, wxNotebook pages)
|
// (notably, wxNotebook pages)
|
||||||
#define wxUSE_UXTHEME_AUTO 1
|
#define wxUSE_UXTHEME_AUTO 1
|
||||||
|
|
||||||
|
// Set to 1 to if you're developing for MS SmartPhone
|
||||||
|
#define wxUSE_SMARTPHONE 0
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// obsolete settings
|
// obsolete settings
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -1047,6 +1047,9 @@
|
|||||||
// (notably, wxNotebook pages)
|
// (notably, wxNotebook pages)
|
||||||
#define wxUSE_UXTHEME_AUTO 0
|
#define wxUSE_UXTHEME_AUTO 0
|
||||||
|
|
||||||
|
// Set to 1 to if you're developing for MS SmartPhone
|
||||||
|
#define wxUSE_SMARTPHONE 0
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// obsolete settings
|
// obsolete settings
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -122,7 +122,7 @@ bool MyApp::OnInit()
|
|||||||
// create the main application window
|
// create the main application window
|
||||||
MyFrame *frame = new MyFrame(_T("Minimal wxWindows App"),
|
MyFrame *frame = new MyFrame(_T("Minimal wxWindows App"),
|
||||||
#ifdef __WXWINCE__
|
#ifdef __WXWINCE__
|
||||||
wxPoint(0, 0), wxDefaultSize, wxNO_BORDER);
|
wxPoint(0, 0), wxDefaultSize, wxNO_BORDER|wxSYSTEM_MENU);
|
||||||
#else
|
#else
|
||||||
wxPoint(50, 50), wxSize(450, 340));
|
wxPoint(50, 50), wxSize(450, 340));
|
||||||
#endif
|
#endif
|
||||||
|
@@ -51,7 +51,7 @@
|
|||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
|
|
||||||
#ifdef __WXWINCE__
|
#if defined(__WXWINCE__) && !wxUSE_SMARTPHONE
|
||||||
#include <commdlg.h>
|
#include <commdlg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@
|
|||||||
#include "wx/msgdlg.h"
|
#include "wx/msgdlg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_COLOURDLG
|
#if wxUSE_COLOURDLG && !wxUSE_SMARTPHONE
|
||||||
|
|
||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
#include "wx/colordlg.h"
|
#include "wx/colordlg.h"
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_FILEDLG
|
#if wxUSE_FILEDLG && !wxUSE_SMARTPHONE
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
|
134
src/msw/wince/filedlgwce.cpp
Normal file
134
src/msw/wince/filedlgwce.cpp
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: src/msw/wince/filedlgwce.cpp
|
||||||
|
// Purpose: wxFileDialog for WinCE (SmartPhone)
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 01/02/97
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "filedlg.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Only use this for MS SmartPhone. Use standard file dialog
|
||||||
|
// for Pocket PC.
|
||||||
|
|
||||||
|
#if wxUSE_FILEDLG && wxUSE_SMARTPHONE
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/utils.h"
|
||||||
|
#include "wx/msgdlg.h"
|
||||||
|
#include "wx/dialog.h"
|
||||||
|
#include "wx/filedlg.h"
|
||||||
|
#include "wx/filefn.h"
|
||||||
|
#include "wx/intl.h"
|
||||||
|
#include "wx/log.h"
|
||||||
|
#include "wx/app.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/msw/private.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "wx/filename.h"
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxWin macros
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxFileDialog
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxFileDialog::wxFileDialog(wxWindow *parent,
|
||||||
|
const wxString& message,
|
||||||
|
const wxString& defaultDir,
|
||||||
|
const wxString& defaultFileName,
|
||||||
|
const wxString& wildCard,
|
||||||
|
long style,
|
||||||
|
const wxPoint& WXUNUSED(pos))
|
||||||
|
{
|
||||||
|
m_message = message;
|
||||||
|
m_dialogStyle = style;
|
||||||
|
if ( ( m_dialogStyle & wxMULTIPLE ) && ( m_dialogStyle & wxSAVE ) )
|
||||||
|
m_dialogStyle &= ~wxMULTIPLE;
|
||||||
|
m_parent = parent;
|
||||||
|
m_path = wxEmptyString;
|
||||||
|
m_fileName = defaultFileName;
|
||||||
|
m_dir = defaultDir;
|
||||||
|
m_wildCard = wildCard;
|
||||||
|
m_filterIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFileDialog::GetPaths(wxArrayString& paths) const
|
||||||
|
{
|
||||||
|
paths.Empty();
|
||||||
|
|
||||||
|
wxString dir(m_dir);
|
||||||
|
if ( m_dir.Last() != _T('\\') )
|
||||||
|
dir += _T('\\');
|
||||||
|
|
||||||
|
size_t count = m_fileNames.GetCount();
|
||||||
|
for ( size_t n = 0; n < count; n++ )
|
||||||
|
{
|
||||||
|
if (wxFileName(m_fileNames[n]).IsAbsolute())
|
||||||
|
paths.Add(m_fileNames[n]);
|
||||||
|
else
|
||||||
|
paths.Add(dir + m_fileNames[n]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFileDialog::SetPath(const wxString& path)
|
||||||
|
{
|
||||||
|
wxString ext;
|
||||||
|
wxSplitPath(path, &m_dir, &m_fileName, &ext);
|
||||||
|
if ( !ext.empty() )
|
||||||
|
m_fileName << _T('.') << ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxFileDialog::ShowModal()
|
||||||
|
{
|
||||||
|
wxWindow* parentWindow = GetParent();
|
||||||
|
if (!parentWindow)
|
||||||
|
parentWindow = wxTheApp->GetTopWindow();
|
||||||
|
|
||||||
|
wxString str = wxGetTextFromUser(m_message, _("File"), m_fileName, parentWindow);
|
||||||
|
if (str)
|
||||||
|
{
|
||||||
|
m_fileName = str;
|
||||||
|
m_fileNames.Add(str);
|
||||||
|
return wxID_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return wxID_CANCEL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
|
|
Reference in New Issue
Block a user