native implementation of wxDirDialog for wxCocoa (patch 1403780)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38035 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2006-03-12 15:30:52 +00:00
parent 71ac8ec3c8
commit 937f314d3f
6 changed files with 247 additions and 19 deletions

View File

@ -1757,6 +1757,7 @@ COND_TOOLKIT_COCOA_GUI_HDR = \
wx/cocoa/dcmemory.h \
wx/cocoa/dcscreen.h \
wx/cocoa/dialog.h \
wx/cocoa/dirdlg.h \
wx/cocoa/display.h \
wx/cocoa/drawer.h \
wx/cocoa/filedlg.h \
@ -1792,7 +1793,6 @@ COND_TOOLKIT_COCOA_GUI_HDR = \
wx/cocoa/toplevel.h \
wx/cocoa/window.h \
wx/generic/caret.h \
wx/generic/dirdlgg.h \
wx/generic/fdrepdlg.h \
wx/generic/fontdlgg.h \
wx/generic/imaglist.h \
@ -2436,6 +2436,7 @@ COND_TOOLKIT_WINCE_GUI_HDR = \
wx/msw/removble.ico \
wx/msw/std.ico \
wx/generic/fdrepdlg.h \
wx/generic/filedlgg.h \
wx/generic/fontdlgg.h \
wx/msw/wince/checklst.h \
wx/msw/wince/choicece.h \
@ -3669,6 +3670,7 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS = \
monodll_dcmemory.o \
monodll_dcscreen.o \
monodll_dialog.o \
monodll_dirdlg.o \
monodll_display.o \
monodll_drawer.o \
monodll_evtloop.o \
@ -3713,7 +3715,6 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS = \
monodll_accel.o \
monodll_caret.o \
monodll_colrdlgg.o \
monodll_dirdlgg.o \
monodll_fdrepdlg.o \
monodll_fontdlgg.o \
monodll_imaglist.o \
@ -4152,6 +4153,7 @@ COND_TOOLKIT_WINCE___GUI_SRC_OBJECTS = \
monodll_treectrl.o \
monodll_dirdlgg.o \
monodll_fdrepdlg.o \
monodll_filedlgg.o \
monodll_fontdlgg.o \
monodll_checklst.o \
monodll_choicece.o \
@ -5291,6 +5293,7 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_1 = \
monolib_dcmemory.o \
monolib_dcscreen.o \
monolib_dialog.o \
monolib_dirdlg.o \
monolib_display.o \
monolib_drawer.o \
monolib_evtloop.o \
@ -5335,7 +5338,6 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_1 = \
monolib_accel.o \
monolib_caret.o \
monolib_colrdlgg.o \
monolib_dirdlgg.o \
monolib_fdrepdlg.o \
monolib_fontdlgg.o \
monolib_imaglist.o \
@ -5774,6 +5776,7 @@ COND_TOOLKIT_WINCE___GUI_SRC_OBJECTS_1 = \
monolib_treectrl.o \
monolib_dirdlgg.o \
monolib_fdrepdlg.o \
monolib_filedlgg.o \
monolib_fontdlgg.o \
monolib_checklst.o \
monolib_choicece.o \
@ -7146,6 +7149,7 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_2 = \
coredll_dcmemory.o \
coredll_dcscreen.o \
coredll_dialog.o \
coredll_dirdlg.o \
coredll_display.o \
coredll_drawer.o \
coredll_evtloop.o \
@ -7190,7 +7194,6 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_2 = \
coredll_accel.o \
coredll_caret.o \
coredll_colrdlgg.o \
coredll_dirdlgg.o \
coredll_fdrepdlg.o \
coredll_fontdlgg.o \
coredll_imaglist.o \
@ -7629,6 +7632,7 @@ COND_TOOLKIT_WINCE___GUI_SRC_OBJECTS_2 = \
coredll_treectrl.o \
coredll_dirdlgg.o \
coredll_fdrepdlg.o \
coredll_filedlgg.o \
coredll_fontdlgg.o \
coredll_checklst.o \
coredll_choicece.o \
@ -8477,6 +8481,7 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_3 = \
corelib_dcmemory.o \
corelib_dcscreen.o \
corelib_dialog.o \
corelib_dirdlg.o \
corelib_display.o \
corelib_drawer.o \
corelib_evtloop.o \
@ -8521,7 +8526,6 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_3 = \
corelib_accel.o \
corelib_caret.o \
corelib_colrdlgg.o \
corelib_dirdlgg.o \
corelib_fdrepdlg.o \
corelib_fontdlgg.o \
corelib_imaglist.o \
@ -8960,6 +8964,7 @@ COND_TOOLKIT_WINCE___GUI_SRC_OBJECTS_3 = \
corelib_treectrl.o \
corelib_dirdlgg.o \
corelib_fdrepdlg.o \
corelib_filedlgg.o \
corelib_fontdlgg.o \
corelib_checklst.o \
corelib_choicece.o \
@ -13295,9 +13300,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monodll_dirdlgg.o: $(srcdir)/src/generic/dirdlgg.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/dirdlgg.cpp
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@monodll_dirdlgg.o: $(srcdir)/src/generic/dirdlgg.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/dirdlgg.cpp
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monodll_dirdlgg.o: $(srcdir)/src/generic/dirdlgg.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/dirdlgg.cpp
@ -13337,6 +13339,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1_WXUNIV_0@monodll_filedlgg.o: $(srcdir)/src/generic/filedlgg.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/filedlgg.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monodll_filedlgg.o: $(srcdir)/src/generic/filedlgg.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/filedlgg.cpp
@COND_USE_GUI_1_WXUNIV_1@monodll_filedlgg.o: $(srcdir)/src/generic/filedlgg.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/filedlgg.cpp
@ -14291,6 +14296,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@monodll_dirdlg.o: $(srcdir)/src/mac/carbon/dirdlg.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/carbon/dirdlg.cpp
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@monodll_dirdlg.o: $(srcdir)/src/cocoa/dirdlg.mm $(MONODLL_ODEP)
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/cocoa/dirdlg.mm
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monodll_dragimag.o: $(srcdir)/src/msw/dragimag.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/dragimag.cpp
@ -17075,9 +17083,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monolib_dirdlgg.o: $(srcdir)/src/generic/dirdlgg.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/dirdlgg.cpp
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@monolib_dirdlgg.o: $(srcdir)/src/generic/dirdlgg.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/dirdlgg.cpp
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monolib_dirdlgg.o: $(srcdir)/src/generic/dirdlgg.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/dirdlgg.cpp
@ -17117,6 +17122,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1_WXUNIV_0@monolib_filedlgg.o: $(srcdir)/src/generic/filedlgg.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/filedlgg.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monolib_filedlgg.o: $(srcdir)/src/generic/filedlgg.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/filedlgg.cpp
@COND_USE_GUI_1_WXUNIV_1@monolib_filedlgg.o: $(srcdir)/src/generic/filedlgg.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/filedlgg.cpp
@ -18071,6 +18079,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@monolib_dirdlg.o: $(srcdir)/src/mac/carbon/dirdlg.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/carbon/dirdlg.cpp
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@monolib_dirdlg.o: $(srcdir)/src/cocoa/dirdlg.mm $(MONOLIB_ODEP)
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/cocoa/dirdlg.mm
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monolib_dragimag.o: $(srcdir)/src/msw/dragimag.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/dragimag.cpp
@ -21272,9 +21283,6 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@coredll_dirdlgg.o: $(srcdir)/src/generic/dirdlgg.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/dirdlgg.cpp
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@coredll_dirdlgg.o: $(srcdir)/src/generic/dirdlgg.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/dirdlgg.cpp
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@coredll_dirdlgg.o: $(srcdir)/src/generic/dirdlgg.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/dirdlgg.cpp
@ -21314,6 +21322,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1_WXUNIV_0@coredll_filedlgg.o: $(srcdir)/src/generic/filedlgg.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/filedlgg.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@coredll_filedlgg.o: $(srcdir)/src/generic/filedlgg.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/filedlgg.cpp
@COND_USE_GUI_1_WXUNIV_1@coredll_filedlgg.o: $(srcdir)/src/generic/filedlgg.cpp $(COREDLL_ODEP)
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/filedlgg.cpp
@ -22268,6 +22279,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@coredll_dirdlg.o: $(srcdir)/src/mac/carbon/dirdlg.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/mac/carbon/dirdlg.cpp
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@coredll_dirdlg.o: $(srcdir)/src/cocoa/dirdlg.mm $(COREDLL_ODEP)
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/cocoa/dirdlg.mm
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@coredll_dragimag.o: $(srcdir)/src/msw/dragimag.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/dragimag.cpp
@ -24041,9 +24055,6 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@corelib_dirdlgg.o: $(srcdir)/src/generic/dirdlgg.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/dirdlgg.cpp
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@corelib_dirdlgg.o: $(srcdir)/src/generic/dirdlgg.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/dirdlgg.cpp
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@corelib_dirdlgg.o: $(srcdir)/src/generic/dirdlgg.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/dirdlgg.cpp
@ -24083,6 +24094,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1_WXUNIV_0@corelib_filedlgg.o: $(srcdir)/src/generic/filedlgg.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/filedlgg.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@corelib_filedlgg.o: $(srcdir)/src/generic/filedlgg.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/filedlgg.cpp
@COND_USE_GUI_1_WXUNIV_1@corelib_filedlgg.o: $(srcdir)/src/generic/filedlgg.cpp $(CORELIB_ODEP)
@COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/filedlgg.cpp
@ -25037,6 +25051,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@corelib_dirdlg.o: $(srcdir)/src/mac/carbon/dirdlg.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/mac/carbon/dirdlg.cpp
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@corelib_dirdlg.o: $(srcdir)/src/cocoa/dirdlg.mm $(CORELIB_ODEP)
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/cocoa/dirdlg.mm
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@corelib_dragimag.o: $(srcdir)/src/msw/dragimag.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/dragimag.cpp

View File

@ -2260,6 +2260,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/cocoa/dcmemory.mm
src/cocoa/dcscreen.cpp
src/cocoa/dialog.mm
src/cocoa/dirdlg.mm
src/cocoa/display.mm
src/cocoa/drawer.mm
src/cocoa/evtloop.mm
@ -2305,7 +2306,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/generic/accel.cpp
src/generic/caret.cpp
src/generic/colrdlgg.cpp
src/generic/dirdlgg.cpp
src/generic/fdrepdlg.cpp
src/generic/fontdlgg.cpp
src/generic/imaglist.cpp
@ -2354,6 +2354,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/cocoa/dcmemory.h
wx/cocoa/dcscreen.h
wx/cocoa/dialog.h
wx/cocoa/dirdlg.h
wx/cocoa/display.h
wx/cocoa/drawer.h
wx/cocoa/filedlg.h
@ -2390,7 +2391,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/cocoa/window.h
<!-- Generic implementations used by wxCocoa: -->
wx/generic/caret.h
wx/generic/dirdlgg.h
wx/generic/fdrepdlg.h
wx/generic/fontdlgg.h
wx/generic/imaglist.h

View File

@ -201,6 +201,10 @@ wxMac:
- Fixed joystick GetXMin/Max bug.
- Fixed Unix domain socket problem in wxIPC.
wxCocoa:
- wxDirDialog is now native (Hiroyuki Nakamura)
wxWinCE:
- Pressing build-in joystick on WinCE phones fires wxEVT_JOY_BUTTON_DOWN event.

58
include/wx/cocoa/dirdlg.h Normal file
View File

@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/cocoa/dirdlg.h
// Purpose: wxDirDialog class
// Author: Ryan Norton
// Modified by: Hiroyuki Nakamura(maloninc)
// Created: 2006-01-10
// RCS-ID: $Id$
// Copyright: (c) Ryan Norton
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COCOA_DIRDLG_H_
#define _WX_COCOA_DIRDLG_H_
DECLARE_WXCOCOA_OBJC_CLASS(NSSavePanel);
#define wxDirDialog wxCocoaDirDialog
//-------------------------------------------------------------------------
// wxDirDialog
//-------------------------------------------------------------------------
class WXDLLEXPORT wxDirDialog: public wxDialog
{
DECLARE_DYNAMIC_CLASS(wxDirDialog)
DECLARE_NO_COPY_CLASS(wxDirDialog)
public:
wxDirDialog(wxWindow *parent,
const wxString& message = wxDirSelectorPromptStr,
const wxString& defaultPath = _T(""),
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& name = wxDirDialogNameStr);
~wxDirDialog();
wxString GetMessage() const { return m_message; }
wxString GetPath() const { return m_path; }
long GetStyle() const { return m_dialogStyle; }
virtual int ShowModal();
inline WX_NSSavePanel GetNSSavePanel()
{ return (WX_NSSavePanel)m_cocoaNSWindow; }
protected:
wxString m_message;
long m_dialogStyle;
wxString m_dir;
wxWindow * m_parent;
wxString m_path;
wxString m_fileName;
private:
wxArrayString m_fileNames;
};
#endif // _WX_DIRDLG_H_

View File

@ -84,6 +84,11 @@ public:
#include "wx/mac/dirdlg.h"
// Native Cocoa
#elif defined(__WXCOCOA__)
#include "wx/cocoa/dirdlg.h"
// Other ports use generic implementation
#elif defined(__WXMOTIF__) || \
defined(__WXGTK__) || \

144
src/cocoa/dirdlg.mm Normal file
View File

@ -0,0 +1,144 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/cocoa/dirdlg.mm
// Purpose: wxDirDialog for wxCocoa
// Author: Ryan Norton
// Modified by: Hiroyuki Nakamura(maloninc)
// Created: 2006-01-10
// RCS-ID: $Id$
// Copyright: (c) Ryan Norton
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if wxUSE_DIRDLG
#ifndef WX_PRECOMP
#include "wx/msgdlg.h"
#include "wx/filedlg.h"
#include "wx/dirdlg.h"
#include "wx/app.h"
#endif
#include "wx/filename.h"
#include "wx/cocoa/autorelease.h"
#include "wx/cocoa/string.h"
#import <AppKit/NSOpenPanel.h>
#import <AppKit/NSSavePanel.h>
#import <Foundation/NSArray.h>
// ============================================================================
// implementation
// ============================================================================
IMPLEMENT_CLASS(wxCocoaDirDialog, wxDialog)
// ----------------------------------------------------------------------------
// wxDirDialog
// ----------------------------------------------------------------------------
wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
const wxString& defaultPath, long style, const wxPoint& pos,
const wxSize& size, const wxString& name)
{
wxTopLevelWindows.Append(this);
m_message = message;
m_dialogStyle = style;
m_parent = parent;
m_path = defaultPath;
wxASSERT(CreateBase(parent,wxID_ANY,pos,wxDefaultSize,style,wxDefaultValidator,wxDialogNameStr));
if ( parent )
parent->AddChild(this);
m_cocoaNSWindow = nil;
m_cocoaNSView = nil;
//If the user requests to save - use a NSSavePanel
//else use a NSOpenPanel
if (m_dialogStyle & wxSAVE)
{
SetNSPanel([NSSavePanel savePanel]);
[GetNSSavePanel() setTitle:wxNSStringWithWxString(message)];
[GetNSSavePanel() setPrompt:@"Save"];
[GetNSSavePanel() setTreatsFilePackagesAsDirectories:YES];
[GetNSSavePanel() setCanSelectHiddenExtension:YES];
}
else //m_dialogStyle & wxOPEN
{
SetNSPanel([NSOpenPanel openPanel]);
[m_cocoaNSWindow setTitle:wxNSStringWithWxString(message)];
[(NSOpenPanel*)m_cocoaNSWindow setResolvesAliases:YES];
[(NSOpenPanel*)m_cocoaNSWindow setCanChooseFiles:NO];
[(NSOpenPanel*)m_cocoaNSWindow setCanChooseDirectories:YES];
[GetNSSavePanel() setPrompt:@"Open"];
}
if (m_dialogStyle & wxDD_NEW_DIR_BUTTON) //m_dialogStyle & wxDD_NEW_DIR_BUTTON
{
[(NSOpenPanel*)m_cocoaNSWindow setCanCreateDirectories:YES];
}
}
wxDirDialog::~wxDirDialog()
{
}
int wxDirDialog::ShowModal()
{
wxAutoNSAutoreleasePool thePool;
m_fileNames.Empty();
int nResult;
if (m_dialogStyle & wxSAVE)
{
nResult = [GetNSSavePanel()
runModalForDirectory:wxNSStringWithWxString(m_dir)
file:wxNSStringWithWxString(m_fileName)];
if (nResult == NSOKButton)
{
m_fileNames.Add(wxStringWithNSString([GetNSSavePanel() filename]));
m_path = m_fileNames[0];
}
}
else //m_dialogStyle & wxOPEN
{
nResult = [(NSOpenPanel*)m_cocoaNSWindow
runModalForDirectory:wxNSStringWithWxString(m_dir)
file:wxNSStringWithWxString(m_fileName)
types:NULL];
if (nResult == NSOKButton)
{
for(unsigned i = 0; i < [[(NSOpenPanel*)m_cocoaNSWindow filenames] count]; ++i)
{
m_fileNames.Add(wxStringWithNSString([[(NSOpenPanel*)m_cocoaNSWindow filenames] objectAtIndex:(i)]));
}
m_path = m_fileNames[0];
}
}
return nResult == NSOKButton ? wxID_OK : wxID_CANCEL;
}
#endif // wxUSE_DIRDLG