]> git.saurik.com Git - wxWidgets.git/blame - src/msw/wince/filedlgwce.cpp
Correct making the newly inserted menu item owner drawn in some cases.
[wxWidgets.git] / src / msw / wince / filedlgwce.cpp
CommitLineData
449110cd
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/msw/wince/filedlgwce.cpp
8300f815 3// Purpose: wxFileDialog implementation for smart phones driven by WinCE
449110cd
JS
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
449110cd 7// Copyright: (c) Julian Smart
65571936 8// Licence: wxWindows licence
449110cd
JS
9/////////////////////////////////////////////////////////////////////////////
10
11// ============================================================================
12// declarations
13// ============================================================================
14
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
449110cd
JS
19// For compilers that support precompilation, includes "wx.h".
20#include "wx/wxprec.h"
21
22#ifdef __BORLANDC__
23 #pragma hdrstop
24#endif
25
26// Only use this for MS SmartPhone. Use standard file dialog
27// for Pocket PC.
28
8300f815 29#if wxUSE_FILEDLG && defined(__SMARTPHONE__) && defined(__WXWINCE__)
449110cd 30
949c9f74
WS
31#include "wx/filedlg.h"
32
449110cd
JS
33#ifndef WX_PRECOMP
34 #include "wx/utils.h"
35 #include "wx/msgdlg.h"
36 #include "wx/dialog.h"
449110cd
JS
37 #include "wx/filefn.h"
38 #include "wx/intl.h"
39 #include "wx/log.h"
40 #include "wx/app.h"
41#endif
42
43#include "wx/msw/private.h"
44
45#include <stdlib.h>
46#include <string.h>
47
48#include "wx/filename.h"
691745ab 49#include "wx/modalhook.h"
449110cd
JS
50
51// ============================================================================
52// implementation
53// ============================================================================
54
55// ----------------------------------------------------------------------------
56// wxWin macros
57// ----------------------------------------------------------------------------
58
59IMPLEMENT_CLASS(wxFileDialog, wxDialog)
60
61// ----------------------------------------------------------------------------
62// wxFileDialog
63// ----------------------------------------------------------------------------
64
65wxFileDialog::wxFileDialog(wxWindow *parent,
66 const wxString& message,
67 const wxString& defaultDir,
68 const wxString& defaultFileName,
69 const wxString& wildCard,
70 long style,
4c9a69c1
WS
71 const wxPoint& WXUNUSED(pos),
72 const wxSize& WXUNUSED(sz),
73 const wxString& WXUNUSED(name))
449110cd
JS
74{
75 m_message = message;
ff3e84ff 76 m_windowStyle = style;
e031f1df
WS
77 if ( ( m_windowStyle & wxFD_MULTIPLE ) && ( m_windowStyle & wxFD_SAVE ) )
78 m_windowStyle &= ~wxFD_MULTIPLE;
449110cd
JS
79 m_parent = parent;
80 m_path = wxEmptyString;
81 m_fileName = defaultFileName;
82 m_dir = defaultDir;
83 m_wildCard = wildCard;
84 m_filterIndex = 0;
85}
86
87void wxFileDialog::GetPaths(wxArrayString& paths) const
88{
89 paths.Empty();
90
91 wxString dir(m_dir);
9a83f860
VZ
92 if ( m_dir.Last() != wxT('\\') )
93 dir += wxT('\\');
449110cd
JS
94
95 size_t count = m_fileNames.GetCount();
96 for ( size_t n = 0; n < count; n++ )
97 {
98 if (wxFileName(m_fileNames[n]).IsAbsolute())
99 paths.Add(m_fileNames[n]);
100 else
101 paths.Add(dir + m_fileNames[n]);
102 }
103}
104
105void wxFileDialog::SetPath(const wxString& path)
106{
107 wxString ext;
bd365871 108 wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext);
449110cd 109 if ( !ext.empty() )
9a83f860 110 m_fileName << wxT('.') << ext;
449110cd
JS
111}
112
113int wxFileDialog::ShowModal()
114{
691745ab 115 WX_HOOK_MODAL_DIALOG();
643e9cf9 116
449110cd
JS
117 wxWindow* parentWindow = GetParent();
118 if (!parentWindow)
119 parentWindow = wxTheApp->GetTopWindow();
39fc096d 120
449110cd 121 wxString str = wxGetTextFromUser(m_message, _("File"), m_fileName, parentWindow);
caae22fb 122 if (str.empty())
449110cd 123 return wxID_CANCEL;
caae22fb
WS
124
125 m_fileName = str;
126 m_fileNames.Add(str);
127 return wxID_OK;
449110cd
JS
128}
129
7933c2d4
VS
130void wxFileDialog::GetFilenames(wxArrayString& files) const
131{
132 files = m_fileNames;
133}
134
8300f815 135#endif // wxUSE_FILEDLG && __SMARTPHONE__ && __WXWINCE__