]> git.saurik.com Git - wxWidgets.git/commitdiff
Provide native implementation of wx{Date,Time}PickerCtrl for wxOSX/Cocoa.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 20 Dec 2011 21:27:14 +0000 (21:27 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 20 Dec 2011 21:27:14 +0000 (21:27 +0000)
Use NSDatePicker to implement both of these controls. Almost all of
wxDatePickerCtrl styles are not supported in the native version but the basic
functionality does work and looks much better than the generic version (which
is still available as wxDatePickerCtrlGeneric if needed) under Mac.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70071 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

17 files changed:
Makefile.in
build/bakefiles/files.bkl
docs/changes.txt
docs/doxygen/images/wxmac/datepickerctrl.png
docs/doxygen/images/wxmac/timepickerctrl.png [new file with mode: 0644]
include/wx/datectrl.h
include/wx/datetimectrl.h
include/wx/osx/core/private/datetimectrl.h [new file with mode: 0644]
include/wx/osx/datectrl.h [new file with mode: 0644]
include/wx/osx/datetimectrl.h [new file with mode: 0644]
include/wx/osx/timectrl.h [new file with mode: 0644]
include/wx/timectrl.h
interface/wx/datectrl.h
src/osx/cocoa/datetimectrl.mm [new file with mode: 0644]
src/osx/datectrl_osx.cpp [new file with mode: 0644]
src/osx/datetimectrl_osx.cpp [new file with mode: 0644]
src/osx/timectrl_osx.cpp [new file with mode: 0644]

index e26323cdec473aca99836f7d11fd65e8719577ca..cfc19f622efb239a37eb98053961b3bce4f43ab5 100644 (file)
@@ -3691,11 +3691,14 @@ COND_TOOLKIT_OSX_CARBON_ADVANCED_PLATFORM_HDR =  \
 COND_TOOLKIT_OSX_COCOA_ADVANCED_PLATFORM_HDR =  \
        wx/generic/animate.h \
        wx/osx/dataview.h \
+       wx/osx/datectrl.h \
+       wx/osx/datetimectrl.h \
        wx/osx/dvrenderer.h \
        wx/osx/dvrenderers.h \
        wx/osx/joystick.h \
        wx/osx/sound.h \
        wx/osx/taskbarosx.h \
+       wx/osx/timectrl.h \
        wx/osx/core/joystick.h \
        wx/osx/cocoa/dataview.h
 @COND_TOOLKIT_OSX_COCOA@ADVANCED_PLATFORM_HDR = $(COND_TOOLKIT_OSX_COCOA_ADVANCED_PLATFORM_HDR)
@@ -6247,7 +6250,7 @@ COND_TOOLKIT_MSW___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS =  \
        monodll_commandlinkbutton.o \
        monodll_datecontrols.o \
        monodll_datectrl.o \
-       monodll_datetimectrl.o \
+       monodll_msw_datetimectrl.o \
        monodll_msw_hyperlink.o \
        monodll_timectrl.o
 @COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS = $(COND_TOOLKIT_MSW___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS)
@@ -6258,7 +6261,7 @@ COND_TOOLKIT_WINCE___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS =  \
        monodll_commandlinkbutton.o \
        monodll_datecontrols.o \
        monodll_datectrl.o \
-       monodll_datetimectrl.o \
+       monodll_msw_datetimectrl.o \
        monodll_msw_hyperlink.o \
        monodll_timectrl.o
 @COND_TOOLKIT_WINCE@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS = $(COND_TOOLKIT_WINCE___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS)
@@ -8205,7 +8208,7 @@ COND_TOOLKIT_MSW___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_1 =  \
        monolib_commandlinkbutton.o \
        monolib_datecontrols.o \
        monolib_datectrl.o \
-       monolib_datetimectrl.o \
+       monolib_msw_datetimectrl.o \
        monolib_msw_hyperlink.o \
        monolib_timectrl.o
 @COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_1 = $(COND_TOOLKIT_MSW___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_1)
@@ -8216,7 +8219,7 @@ COND_TOOLKIT_WINCE___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_1 =  \
        monolib_commandlinkbutton.o \
        monolib_datecontrols.o \
        monolib_datectrl.o \
-       monolib_datetimectrl.o \
+       monolib_msw_datetimectrl.o \
        monolib_msw_hyperlink.o \
        monolib_timectrl.o
 @COND_TOOLKIT_WINCE@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_1 = $(COND_TOOLKIT_WINCE___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_1)
@@ -12005,7 +12008,7 @@ COND_TOOLKIT_MSW___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_2 =  \
        advdll_commandlinkbutton.o \
        advdll_datecontrols.o \
        advdll_datectrl.o \
-       advdll_datetimectrl.o \
+       advdll_msw_datetimectrl.o \
        advdll_msw_hyperlink.o \
        advdll_timectrl.o
 @COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_2 = $(COND_TOOLKIT_MSW___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_2)
@@ -12016,7 +12019,7 @@ COND_TOOLKIT_WINCE___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_2 =  \
        advdll_commandlinkbutton.o \
        advdll_datecontrols.o \
        advdll_datectrl.o \
-       advdll_datetimectrl.o \
+       advdll_msw_datetimectrl.o \
        advdll_msw_hyperlink.o \
        advdll_timectrl.o
 @COND_TOOLKIT_WINCE@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_2 = $(COND_TOOLKIT_WINCE___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_2)
@@ -12123,7 +12126,7 @@ COND_TOOLKIT_MSW___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_3 =  \
        advlib_commandlinkbutton.o \
        advlib_datecontrols.o \
        advlib_datectrl.o \
-       advlib_datetimectrl.o \
+       advlib_msw_datetimectrl.o \
        advlib_msw_hyperlink.o \
        advlib_timectrl.o
 @COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_3 = $(COND_TOOLKIT_MSW___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_3)
@@ -12134,7 +12137,7 @@ COND_TOOLKIT_WINCE___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_3 =  \
        advlib_commandlinkbutton.o \
        advlib_datecontrols.o \
        advlib_datectrl.o \
-       advlib_datetimectrl.o \
+       advlib_msw_datetimectrl.o \
        advlib_msw_hyperlink.o \
        advlib_timectrl.o
 @COND_TOOLKIT_WINCE@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_3 = $(COND_TOOLKIT_WINCE___ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_3)
@@ -13407,12 +13410,16 @@ COND_TOOLKIT_OSX_CARBON___ADVANCED_PLATFORM_SRC_OBJECTS =  \
 COND_TOOLKIT_OSX_COCOA___ADVANCED_PLATFORM_SRC_OBJECTS =  \
        monodll_taskbarcmn.o \
        monodll_animateg.o \
+       monodll_datetimectrl_osx.o \
+       monodll_datectrl_osx.o \
        monodll_sound_osx.o \
+       monodll_timectrl_osx.o \
        monodll_carbon_sound.o \
        monodll_core_sound.o \
        monodll_cocoa_aboutdlg.o \
        monodll_dataview_osx.o \
        monodll_cocoa_dataview.o \
+       monodll_cocoa_datetimectrl.o \
        monodll_osx_cocoa_taskbar.o \
        monodll_hidjoystick.o
 @COND_TOOLKIT_OSX_COCOA@__ADVANCED_PLATFORM_SRC_OBJECTS = $(COND_TOOLKIT_OSX_COCOA___ADVANCED_PLATFORM_SRC_OBJECTS)
@@ -13595,12 +13602,16 @@ COND_TOOLKIT_OSX_CARBON___ADVANCED_PLATFORM_SRC_OBJECTS_0 =  \
 COND_TOOLKIT_OSX_COCOA___ADVANCED_PLATFORM_SRC_OBJECTS_0 =  \
        monolib_taskbarcmn.o \
        monolib_animateg.o \
+       monolib_datetimectrl_osx.o \
+       monolib_datectrl_osx.o \
        monolib_sound_osx.o \
+       monolib_timectrl_osx.o \
        monolib_carbon_sound.o \
        monolib_core_sound.o \
        monolib_cocoa_aboutdlg.o \
        monolib_dataview_osx.o \
        monolib_cocoa_dataview.o \
+       monolib_cocoa_datetimectrl.o \
        monolib_osx_cocoa_taskbar.o \
        monolib_hidjoystick.o
 @COND_TOOLKIT_OSX_COCOA@__ADVANCED_PLATFORM_SRC_OBJECTS_0 = $(COND_TOOLKIT_OSX_COCOA___ADVANCED_PLATFORM_SRC_OBJECTS_0)
@@ -13881,12 +13892,16 @@ COND_TOOLKIT_OSX_CARBON___ADVANCED_PLATFORM_SRC_OBJECTS_8 =  \
 COND_TOOLKIT_OSX_COCOA___ADVANCED_PLATFORM_SRC_OBJECTS_8 =  \
        advdll_taskbarcmn.o \
        advdll_animateg.o \
+       advdll_datetimectrl_osx.o \
+       advdll_datectrl_osx.o \
        advdll_sound_osx.o \
+       advdll_timectrl_osx.o \
        advdll_carbon_sound.o \
        advdll_core_sound.o \
        advdll_cocoa_aboutdlg.o \
        advdll_dataview_osx.o \
        advdll_cocoa_dataview.o \
+       advdll_cocoa_datetimectrl.o \
        advdll_osx_cocoa_taskbar.o \
        advdll_hidjoystick.o
 @COND_TOOLKIT_OSX_COCOA@__ADVANCED_PLATFORM_SRC_OBJECTS_8 = $(COND_TOOLKIT_OSX_COCOA___ADVANCED_PLATFORM_SRC_OBJECTS_8)
@@ -13971,12 +13986,16 @@ COND_TOOLKIT_OSX_CARBON___ADVANCED_PLATFORM_SRC_OBJECTS_9 =  \
 COND_TOOLKIT_OSX_COCOA___ADVANCED_PLATFORM_SRC_OBJECTS_9 =  \
        advlib_taskbarcmn.o \
        advlib_animateg.o \
+       advlib_datetimectrl_osx.o \
+       advlib_datectrl_osx.o \
        advlib_sound_osx.o \
+       advlib_timectrl_osx.o \
        advlib_carbon_sound.o \
        advlib_core_sound.o \
        advlib_cocoa_aboutdlg.o \
        advlib_dataview_osx.o \
        advlib_cocoa_dataview.o \
+       advlib_cocoa_datetimectrl.o \
        advlib_osx_cocoa_taskbar.o \
        advlib_hidjoystick.o
 @COND_TOOLKIT_OSX_COCOA@__ADVANCED_PLATFORM_SRC_OBJECTS_9 = $(COND_TOOLKIT_OSX_COCOA___ADVANCED_PLATFORM_SRC_OBJECTS_9)
@@ -20906,6 +20925,15 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
 @COND_TOOLKIT_COCOA_USE_GUI_1@monodll_hidjoystick.o: $(srcdir)/src/osx/core/hidjoystick.cpp $(MONODLL_ODEP)
 @COND_TOOLKIT_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/hidjoystick.cpp
 
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_datetimectrl_osx.o: $(srcdir)/src/osx/datetimectrl_osx.cpp $(MONODLL_ODEP)
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@     $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/datetimectrl_osx.cpp
+
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_datectrl_osx.o: $(srcdir)/src/osx/datectrl_osx.cpp $(MONODLL_ODEP)
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@     $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/datectrl_osx.cpp
+
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_timectrl_osx.o: $(srcdir)/src/osx/timectrl_osx.cpp $(MONODLL_ODEP)
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@     $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/timectrl_osx.cpp
+
 @COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_core_sound.o: $(srcdir)/src/osx/core/sound.cpp $(MONODLL_ODEP)
 @COND_TOOLKIT_OSX_COCOA_USE_GUI_1@     $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/sound.cpp
 
@@ -20918,6 +20946,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
 @COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_cocoa_dataview.o: $(srcdir)/src/osx/cocoa/dataview.mm $(MONODLL_ODEP)
 @COND_TOOLKIT_OSX_COCOA_USE_GUI_1@     $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/dataview.mm
 
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_cocoa_datetimectrl.o: $(srcdir)/src/osx/cocoa/datetimectrl.mm $(MONODLL_ODEP)
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@     $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/datetimectrl.mm
+
 @COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_osx_cocoa_taskbar.o: $(srcdir)/src/osx/cocoa/taskbar.mm $(MONODLL_ODEP)
 @COND_TOOLKIT_OSX_COCOA_USE_GUI_1@     $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/taskbar.mm
 
@@ -21020,10 +21051,10 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
 @COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monodll_datectrl.o: $(srcdir)/src/msw/datectrl.cpp $(MONODLL_ODEP)
 @COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@        $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/datectrl.cpp
 
-@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monodll_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(MONODLL_ODEP)
+@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monodll_msw_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(MONODLL_ODEP)
 @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@  $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/datetimectrl.cpp
 
-@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monodll_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(MONODLL_ODEP)
+@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monodll_msw_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(MONODLL_ODEP)
 @COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@        $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/datetimectrl.cpp
 
 @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monodll_msw_hyperlink.o: $(srcdir)/src/msw/hyperlink.cpp $(MONODLL_ODEP)
@@ -26294,6 +26325,15 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
 @COND_TOOLKIT_COCOA_USE_GUI_1@monolib_hidjoystick.o: $(srcdir)/src/osx/core/hidjoystick.cpp $(MONOLIB_ODEP)
 @COND_TOOLKIT_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/hidjoystick.cpp
 
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_datetimectrl_osx.o: $(srcdir)/src/osx/datetimectrl_osx.cpp $(MONOLIB_ODEP)
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@     $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/datetimectrl_osx.cpp
+
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_datectrl_osx.o: $(srcdir)/src/osx/datectrl_osx.cpp $(MONOLIB_ODEP)
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@     $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/datectrl_osx.cpp
+
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_timectrl_osx.o: $(srcdir)/src/osx/timectrl_osx.cpp $(MONOLIB_ODEP)
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@     $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/timectrl_osx.cpp
+
 @COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_core_sound.o: $(srcdir)/src/osx/core/sound.cpp $(MONOLIB_ODEP)
 @COND_TOOLKIT_OSX_COCOA_USE_GUI_1@     $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/sound.cpp
 
@@ -26306,6 +26346,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
 @COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_cocoa_dataview.o: $(srcdir)/src/osx/cocoa/dataview.mm $(MONOLIB_ODEP)
 @COND_TOOLKIT_OSX_COCOA_USE_GUI_1@     $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/dataview.mm
 
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_cocoa_datetimectrl.o: $(srcdir)/src/osx/cocoa/datetimectrl.mm $(MONOLIB_ODEP)
+@COND_TOOLKIT_OSX_COCOA_USE_GUI_1@     $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/datetimectrl.mm
+
 @COND_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_osx_cocoa_taskbar.o: $(srcdir)/src/osx/cocoa/taskbar.mm $(MONOLIB_ODEP)
 @COND_TOOLKIT_OSX_COCOA_USE_GUI_1@     $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/taskbar.mm
 
@@ -26408,10 +26451,10 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
 @COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monolib_datectrl.o: $(srcdir)/src/msw/datectrl.cpp $(MONOLIB_ODEP)
 @COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@        $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/datectrl.cpp
 
-@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monolib_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(MONOLIB_ODEP)
+@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monolib_msw_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(MONOLIB_ODEP)
 @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@  $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/datetimectrl.cpp
 
-@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monolib_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(MONOLIB_ODEP)
+@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monolib_msw_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(MONOLIB_ODEP)
 @COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@        $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/datetimectrl.cpp
 
 @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monolib_msw_hyperlink.o: $(srcdir)/src/msw/hyperlink.cpp $(MONOLIB_ODEP)
@@ -35882,6 +35925,15 @@ advdll_wizard.o: $(srcdir)/src/generic/wizard.cpp $(ADVDLL_ODEP)
 @COND_TOOLKIT_COCOA@advdll_hidjoystick.o: $(srcdir)/src/osx/core/hidjoystick.cpp $(ADVDLL_ODEP)
 @COND_TOOLKIT_COCOA@   $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/osx/core/hidjoystick.cpp
 
+@COND_TOOLKIT_OSX_COCOA@advdll_datetimectrl_osx.o: $(srcdir)/src/osx/datetimectrl_osx.cpp $(ADVDLL_ODEP)
+@COND_TOOLKIT_OSX_COCOA@       $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/osx/datetimectrl_osx.cpp
+
+@COND_TOOLKIT_OSX_COCOA@advdll_datectrl_osx.o: $(srcdir)/src/osx/datectrl_osx.cpp $(ADVDLL_ODEP)
+@COND_TOOLKIT_OSX_COCOA@       $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/osx/datectrl_osx.cpp
+
+@COND_TOOLKIT_OSX_COCOA@advdll_timectrl_osx.o: $(srcdir)/src/osx/timectrl_osx.cpp $(ADVDLL_ODEP)
+@COND_TOOLKIT_OSX_COCOA@       $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/osx/timectrl_osx.cpp
+
 @COND_TOOLKIT_OSX_COCOA@advdll_core_sound.o: $(srcdir)/src/osx/core/sound.cpp $(ADVDLL_ODEP)
 @COND_TOOLKIT_OSX_COCOA@       $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/osx/core/sound.cpp
 
@@ -35894,6 +35946,9 @@ advdll_wizard.o: $(srcdir)/src/generic/wizard.cpp $(ADVDLL_ODEP)
 @COND_TOOLKIT_OSX_COCOA@advdll_cocoa_dataview.o: $(srcdir)/src/osx/cocoa/dataview.mm $(ADVDLL_ODEP)
 @COND_TOOLKIT_OSX_COCOA@       $(CXXC) -c -o $@ $(ADVDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/dataview.mm
 
+@COND_TOOLKIT_OSX_COCOA@advdll_cocoa_datetimectrl.o: $(srcdir)/src/osx/cocoa/datetimectrl.mm $(ADVDLL_ODEP)
+@COND_TOOLKIT_OSX_COCOA@       $(CXXC) -c -o $@ $(ADVDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/datetimectrl.mm
+
 @COND_TOOLKIT_OSX_COCOA@advdll_osx_cocoa_taskbar.o: $(srcdir)/src/osx/cocoa/taskbar.mm $(ADVDLL_ODEP)
 @COND_TOOLKIT_OSX_COCOA@       $(CXXC) -c -o $@ $(ADVDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/taskbar.mm
 
@@ -35996,10 +36051,10 @@ advdll_wizard.o: $(srcdir)/src/generic/wizard.cpp $(ADVDLL_ODEP)
 @COND_TOOLKIT_WINCE_WXUNIV_0@advdll_datectrl.o: $(srcdir)/src/msw/datectrl.cpp $(ADVDLL_ODEP)
 @COND_TOOLKIT_WINCE_WXUNIV_0@  $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/msw/datectrl.cpp
 
-@COND_TOOLKIT_MSW_WXUNIV_0@advdll_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(ADVDLL_ODEP)
+@COND_TOOLKIT_MSW_WXUNIV_0@advdll_msw_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(ADVDLL_ODEP)
 @COND_TOOLKIT_MSW_WXUNIV_0@    $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/msw/datetimectrl.cpp
 
-@COND_TOOLKIT_WINCE_WXUNIV_0@advdll_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(ADVDLL_ODEP)
+@COND_TOOLKIT_WINCE_WXUNIV_0@advdll_msw_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(ADVDLL_ODEP)
 @COND_TOOLKIT_WINCE_WXUNIV_0@  $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/msw/datetimectrl.cpp
 
 @COND_TOOLKIT_MSW_WXUNIV_0@advdll_msw_hyperlink.o: $(srcdir)/src/msw/hyperlink.cpp $(ADVDLL_ODEP)
@@ -36269,6 +36324,15 @@ advlib_wizard.o: $(srcdir)/src/generic/wizard.cpp $(ADVLIB_ODEP)
 @COND_TOOLKIT_COCOA@advlib_hidjoystick.o: $(srcdir)/src/osx/core/hidjoystick.cpp $(ADVLIB_ODEP)
 @COND_TOOLKIT_COCOA@   $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/osx/core/hidjoystick.cpp
 
+@COND_TOOLKIT_OSX_COCOA@advlib_datetimectrl_osx.o: $(srcdir)/src/osx/datetimectrl_osx.cpp $(ADVLIB_ODEP)
+@COND_TOOLKIT_OSX_COCOA@       $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/osx/datetimectrl_osx.cpp
+
+@COND_TOOLKIT_OSX_COCOA@advlib_datectrl_osx.o: $(srcdir)/src/osx/datectrl_osx.cpp $(ADVLIB_ODEP)
+@COND_TOOLKIT_OSX_COCOA@       $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/osx/datectrl_osx.cpp
+
+@COND_TOOLKIT_OSX_COCOA@advlib_timectrl_osx.o: $(srcdir)/src/osx/timectrl_osx.cpp $(ADVLIB_ODEP)
+@COND_TOOLKIT_OSX_COCOA@       $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/osx/timectrl_osx.cpp
+
 @COND_TOOLKIT_OSX_COCOA@advlib_core_sound.o: $(srcdir)/src/osx/core/sound.cpp $(ADVLIB_ODEP)
 @COND_TOOLKIT_OSX_COCOA@       $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/osx/core/sound.cpp
 
@@ -36281,6 +36345,9 @@ advlib_wizard.o: $(srcdir)/src/generic/wizard.cpp $(ADVLIB_ODEP)
 @COND_TOOLKIT_OSX_COCOA@advlib_cocoa_dataview.o: $(srcdir)/src/osx/cocoa/dataview.mm $(ADVLIB_ODEP)
 @COND_TOOLKIT_OSX_COCOA@       $(CXXC) -c -o $@ $(ADVLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/dataview.mm
 
+@COND_TOOLKIT_OSX_COCOA@advlib_cocoa_datetimectrl.o: $(srcdir)/src/osx/cocoa/datetimectrl.mm $(ADVLIB_ODEP)
+@COND_TOOLKIT_OSX_COCOA@       $(CXXC) -c -o $@ $(ADVLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/datetimectrl.mm
+
 @COND_TOOLKIT_OSX_COCOA@advlib_osx_cocoa_taskbar.o: $(srcdir)/src/osx/cocoa/taskbar.mm $(ADVLIB_ODEP)
 @COND_TOOLKIT_OSX_COCOA@       $(CXXC) -c -o $@ $(ADVLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/taskbar.mm
 
@@ -36383,10 +36450,10 @@ advlib_wizard.o: $(srcdir)/src/generic/wizard.cpp $(ADVLIB_ODEP)
 @COND_TOOLKIT_WINCE_WXUNIV_0@advlib_datectrl.o: $(srcdir)/src/msw/datectrl.cpp $(ADVLIB_ODEP)
 @COND_TOOLKIT_WINCE_WXUNIV_0@  $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/msw/datectrl.cpp
 
-@COND_TOOLKIT_MSW_WXUNIV_0@advlib_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(ADVLIB_ODEP)
+@COND_TOOLKIT_MSW_WXUNIV_0@advlib_msw_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(ADVLIB_ODEP)
 @COND_TOOLKIT_MSW_WXUNIV_0@    $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/msw/datetimectrl.cpp
 
-@COND_TOOLKIT_WINCE_WXUNIV_0@advlib_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(ADVLIB_ODEP)
+@COND_TOOLKIT_WINCE_WXUNIV_0@advlib_msw_datetimectrl.o: $(srcdir)/src/msw/datetimectrl.cpp $(ADVLIB_ODEP)
 @COND_TOOLKIT_WINCE_WXUNIV_0@  $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/msw/datetimectrl.cpp
 
 @COND_TOOLKIT_MSW_WXUNIV_0@advlib_msw_hyperlink.o: $(srcdir)/src/msw/hyperlink.cpp $(ADVLIB_ODEP)
index 327fa2e606166417dd45cb5cd324cec7f1861c36..f27574f37e202358b71e985136508306c2b3acfa 100644 (file)
@@ -3118,12 +3118,16 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
 <set var="ADVANCED_OSX_COCOA_SRC" hints="files">
     src/common/taskbarcmn.cpp
     src/generic/animateg.cpp
+    src/osx/datetimectrl_osx.cpp
+    src/osx/datectrl_osx.cpp
     src/osx/sound_osx.cpp
+    src/osx/timectrl_osx.cpp
     src/osx/carbon/sound.cpp
     src/osx/core/sound.cpp
     src/osx/cocoa/aboutdlg.mm
     src/osx/dataview_osx.cpp
     src/osx/cocoa/dataview.mm
+    src/osx/cocoa/datetimectrl.mm
     src/osx/cocoa/taskbar.mm
     src/osx/core/hidjoystick.cpp
 </set>
@@ -3131,11 +3135,14 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
 <set var="ADVANCED_OSX_COCOA_HDR" hints="files">
     wx/generic/animate.h
     wx/osx/dataview.h
+    wx/osx/datectrl.h
+    wx/osx/datetimectrl.h
     wx/osx/dvrenderer.h
     wx/osx/dvrenderers.h
     wx/osx/joystick.h
     wx/osx/sound.h
     wx/osx/taskbarosx.h
+    wx/osx/timectrl.h
     wx/osx/core/joystick.h
     wx/osx/cocoa/dataview.h
 </set>
index 36f74dd1f604e1cdce6c74a98e547cf1ef5746e3..4dfbd21c213cf8cf82d8e880f23a482ce0125ffd 100644 (file)
@@ -460,6 +460,10 @@ MSW:
 - Fixed regression with initial focus in the dialogs in 2.9.3.
 - Added support for wxEXEC_MAKE_GROUP_LEADER to wxExecute (tteras).
 
+OSX:
+
+- Provide native implementations of wxDatePickerCtrl and wxTimePickerCtrl.
+
 
 2.9.3: (released 2011-12-14)
 ------
index 51c989c78ca5f29ac4a601c439e75bd310671dfc..41b1e4aacde5e3f783aa0f477258f702d8306ec4 100644 (file)
Binary files a/docs/doxygen/images/wxmac/datepickerctrl.png and b/docs/doxygen/images/wxmac/datepickerctrl.png differ
diff --git a/docs/doxygen/images/wxmac/timepickerctrl.png b/docs/doxygen/images/wxmac/timepickerctrl.png
new file mode 100644 (file)
index 0000000..674cb46
Binary files /dev/null and b/docs/doxygen/images/wxmac/timepickerctrl.png differ
index d666a59a10ccc90151a77830c85c237774652113..c579b81d980d4fcf734371a562d85b56cca6671f 100644 (file)
@@ -83,6 +83,10 @@ public:
 #elif defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
     #include "wx/msw/datectrl.h"
 
+    #define wxHAS_NATIVE_DATEPICKCTRL
+#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__)
+    #include "wx/osx/datectrl.h"
+
     #define wxHAS_NATIVE_DATEPICKCTRL
 #else
     #include "wx/generic/datectrl.h"
index 453c9174b53bd68575164eb864d3bedac1eb3942..a3bdac2d47964a820ffed77a189d584b2f50fc58 100644 (file)
@@ -35,10 +35,10 @@ public:
     virtual wxDateTime GetValue() const = 0;
 };
 
-// Only MSW currently has any code to share between wxDatePickerCtrl and
-// wxTimePickerCtrl, under the other platforms this class is trivial.
 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
     #include "wx/msw/datetimectrl.h"
+#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__)
+    #include "wx/osx/datetimectrl.h"
 #else
     typedef wxDateTimePickerCtrlBase wxDateTimePickerCtrl;
 #endif
diff --git a/include/wx/osx/core/private/datetimectrl.h b/include/wx/osx/core/private/datetimectrl.h
new file mode 100644 (file)
index 0000000..ecb7b65
--- /dev/null
@@ -0,0 +1,71 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        wx/osx/core/private/datetime.h
+// Purpose:
+// Author:      Vadim Zeitlin
+// Created:     2011-12-19
+// RCS-ID:      $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $
+// Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_OSX_CORE_PRIVATE_DATETIMECTRL_H_
+#define _WX_OSX_CORE_PRIVATE_DATETIMECTRL_H_
+
+#if wxUSE_DATEPICKCTRL
+
+#include "wx/osx/private.h"
+
+#include "wx/datetime.h"
+
+enum wxDateTimeWidgetKind
+{
+    wxDateTimeWidget_YearMonthDay,
+    wxDateTimeWidget_HourMinuteSecond
+};
+
+// ----------------------------------------------------------------------------
+// wxDateTimeWidgetImpl: peer class for wxDateTimePickerCtrl.
+// ----------------------------------------------------------------------------
+
+class wxDateTimeWidgetImpl
+#if wxOSX_USE_COCOA
+    : public wxWidgetCocoaImpl
+#elif wxOSX_USE_CARBON
+    : public wxMacControl
+#else
+    #error "Unsupported platform"
+#endif
+{
+public:
+    static wxDateTimeWidgetImpl*
+    CreateDateTimePicker(wxDateTimePickerCtrl* wxpeer,
+                         const wxDateTime& dt,
+                         const wxPoint& pos,
+                         const wxSize& size,
+                         long style,
+                         wxDateTimeWidgetKind kind);
+
+    virtual void SetDateTime(const wxDateTime& dt) = 0;
+    virtual wxDateTime GetDateTime() const = 0;
+
+    virtual void SetDateRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0;
+    virtual bool GetDateRange(wxDateTime* dt1, wxDateTime* dt2) = 0;
+
+    virtual ~wxDateTimeWidgetImpl() { }
+
+protected:
+#if wxOSX_USE_COCOA
+    wxDateTimeWidgetImpl(wxDateTimePickerCtrl* wxpeer, WXWidget view)
+        : wxWidgetCocoaImpl(wxpeer, view)
+    {
+    }
+#elif wxOSX_USE_CARBON
+    // There is no Carbon implementation of this control yet so we don't need
+    // any ctor for it yet but it should be added here if Carbon version is
+    // written later.
+#endif
+};
+
+#endif // wxUSE_DATEPICKCTRL
+
+#endif // _WX_OSX_CORE_PRIVATE_DATETIMECTRL_H_
diff --git a/include/wx/osx/datectrl.h b/include/wx/osx/datectrl.h
new file mode 100644 (file)
index 0000000..e31ebc5
--- /dev/null
@@ -0,0 +1,55 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        wx/osx/datectrl.h
+// Purpose:     Declaration of wxOSX-specific wxDatePickerCtrl class.
+// Author:      Vadim Zeitlin
+// Created:     2011-12-18
+// RCS-ID:      $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $
+// Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_OSX_DATECTRL_H_
+#define _WX_OSX_DATECTRL_H_
+
+// ----------------------------------------------------------------------------
+// wxDatePickerCtrl
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlBase
+{
+public:
+    // Constructors.
+    wxDatePickerCtrl() { }
+
+    wxDatePickerCtrl(wxWindow *parent,
+                     wxWindowID id,
+                     const wxDateTime& dt = wxDefaultDateTime,
+                     const wxPoint& pos = wxDefaultPosition,
+                     const wxSize& size = wxDefaultSize,
+                     long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
+                     const wxValidator& validator = wxDefaultValidator,
+                     const wxString& name = wxDatePickerCtrlNameStr)
+    {
+        Create(parent, id, dt, pos, size, style, validator, name);
+    }
+
+    bool Create(wxWindow *parent,
+                wxWindowID id,
+                const wxDateTime& dt = wxDefaultDateTime,
+                const wxPoint& pos = wxDefaultPosition,
+                const wxSize& size = wxDefaultSize,
+                long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
+                const wxValidator& validator = wxDefaultValidator,
+                const wxString& name = wxDatePickerCtrlNameStr);
+
+    // Implement the base class pure virtuals.
+    virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2);
+    virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const;
+
+    virtual void OSXGenerateEvent(const wxDateTime& dt);
+
+private:
+    wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl);
+};
+
+#endif // _WX_OSX_DATECTRL_H_
diff --git a/include/wx/osx/datetimectrl.h b/include/wx/osx/datetimectrl.h
new file mode 100644 (file)
index 0000000..d69e53d
--- /dev/null
@@ -0,0 +1,34 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        wx/osx/datetimectrl.h
+// Purpose:     Declaration of wxOSX-specific wxDateTimePickerCtrl class.
+// Author:      Vadim Zeitlin
+// Created:     2011-12-18
+// RCS-ID:      $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $
+// Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_OSX_DATETIMECTRL_H_
+#define _WX_OSX_DATETIMECTRL_H_
+
+class wxDateTimeWidgetImpl;
+
+// ----------------------------------------------------------------------------
+// wxDateTimePickerCtrl
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDateTimePickerCtrl : public wxDateTimePickerCtrlBase
+{
+public:
+    // Implement the base class pure virtuals.
+    virtual void SetValue(const wxDateTime& dt);
+    virtual wxDateTime GetValue() const;
+
+    // Implementation only.
+    virtual void OSXGenerateEvent(const wxDateTime& dt) = 0;
+
+protected:
+    wxDateTimeWidgetImpl* GetDateTimePeer() const;
+};
+
+#endif // _WX_OSX_DATETIMECTRL_H_
diff --git a/include/wx/osx/timectrl.h b/include/wx/osx/timectrl.h
new file mode 100644 (file)
index 0000000..58d053c
--- /dev/null
@@ -0,0 +1,51 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        wx/osx/timectrl.h
+// Purpose:     Declaration of wxOSX-specific wxTimePickerCtrl class.
+// Author:      Vadim Zeitlin
+// Created:     2011-12-18
+// RCS-ID:      $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $
+// Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_OSX_TIMECTRL_H_
+#define _WX_OSX_TIMECTRL_H_
+
+// ----------------------------------------------------------------------------
+// wxTimePickerCtrl
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxTimePickerCtrl : public wxTimePickerCtrlBase
+{
+public:
+    // Constructors.
+    wxTimePickerCtrl() { }
+
+    wxTimePickerCtrl(wxWindow *parent,
+                     wxWindowID id,
+                     const wxDateTime& dt = wxDefaultDateTime,
+                     const wxPoint& pos = wxDefaultPosition,
+                     const wxSize& size = wxDefaultSize,
+                     long style = wxTP_DEFAULT,
+                     const wxValidator& validator = wxDefaultValidator,
+                     const wxString& name = wxTimePickerCtrlNameStr)
+    {
+        Create(parent, id, dt, pos, size, style, validator, name);
+    }
+
+    bool Create(wxWindow *parent,
+                wxWindowID id,
+                const wxDateTime& dt = wxDefaultDateTime,
+                const wxPoint& pos = wxDefaultPosition,
+                const wxSize& size = wxDefaultSize,
+                long style = wxTP_DEFAULT,
+                const wxValidator& validator = wxDefaultValidator,
+                const wxString& name = wxTimePickerCtrlNameStr);
+
+    virtual void OSXGenerateEvent(const wxDateTime& dt);
+
+private:
+    wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTimePickerCtrl);
+};
+
+#endif // _WX_OSX_TIMECTRL_H_
index 0bc9db79ca089570fb7da177c466fac0872be3eb..4672675cee01fca721c1cda2426c283c42d7643a 100644 (file)
@@ -58,6 +58,10 @@ public:
 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
     #include "wx/msw/timectrl.h"
 
+    #define wxHAS_NATIVE_TIMEPICKERCTRL
+#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__)
+    #include "wx/osx/timectrl.h"
+
     #define wxHAS_NATIVE_TIMEPICKERCTRL
 #else
     #include "wx/generic/timectrl.h"
index 32829e081a842cfb43ee2277fddcd195dc3a903b..feb241cd4e627a3c4b59e8dfaf8a4839ab2ec981 100644 (file)
            style is not supported by the generic version.
     @style{wxDP_DROPDOWN}
            Creates a control with a month calendar drop-down part from which
-           the user can select a date.
+           the user can select a date. This style is not supported in OSX/Cocoa
+           native version.
     @style{wxDP_DEFAULT}
            Creates a control with the style that is best supported for the
-           current platform (currently wxDP_SPIN under Windows and
-           wxDP_DROPDOWN elsewhere).
+           current platform (currently wxDP_SPIN under Windows and OSX/Cocoa
+           and wxDP_DROPDOWN elsewhere).
     @style{wxDP_ALLOWNONE}
            With this style, the control allows the user to not enter any valid
            date at all. Without it - the default - the control always has some
-           valid date.
+           valid date. This style is not supported in OSX/Cocoa native version.
     @style{wxDP_SHOWCENTURY}
            Forces display of the century in the default date format. Without
            this style the century could be displayed, or not, depending on the
-           default date representation in the system.
+           default date representation in the system. This style is not
+           supported in OSX/Cocoa native version currently.
     @endStyleTable
 
+    As can be seen from the remarks above, most of the control style are only
+    supported in the native MSW implementation. In portable code it's
+    recommended to use @c wxDP_DEFAULT style only, possibly combined with @c
+    wxDP_SHOWCENTURY (this is also the style used by default if none is
+    specified).
+
     @beginEventEmissionTable{wxDateEvent}
     @event{EVT_DATE_CHANGED(id, func)}
            This event fires when the user changes the current selection in the
diff --git a/src/osx/cocoa/datetimectrl.mm b/src/osx/cocoa/datetimectrl.mm
new file mode 100644 (file)
index 0000000..4e8a44e
--- /dev/null
@@ -0,0 +1,179 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        src/osx/cocoa/datetimectrl.mm
+// Purpose:     Implementation of wxDateTimePickerCtrl for Cocoa.
+// Author:      Vadim Zeitlin
+// Created:     2011-12-18
+// Version:     $Id$
+// Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#if wxUSE_DATEPICKCTRL
+
+#include "wx/datetimectrl.h"
+#include "wx/datectrl.h"
+
+#include "wx/osx/core/private/datetimectrl.h"
+#include "wx/osx/cocoa/private/date.h"
+
+using namespace wxOSXImpl;
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// Cocoa wrappers
+// ----------------------------------------------------------------------------
+
+@interface wxNSDatePicker : NSDatePicker
+{
+}
+
+@end
+
+@implementation wxNSDatePicker
+
++ (void)initialize
+{
+    static BOOL initialized = NO;
+    if (!initialized)
+    {
+        initialized = YES;
+        wxOSXCocoaClassAddWXMethods( self );
+    }
+}
+
+@end
+
+// ----------------------------------------------------------------------------
+// Peer-specific subclass
+// ----------------------------------------------------------------------------
+
+namespace
+{
+
+class wxDateTimeWidgetCocoaImpl : public wxDateTimeWidgetImpl
+{
+public:
+    wxDateTimeWidgetCocoaImpl(wxDateTimePickerCtrl* peer, wxNSDatePicker* w)
+        : wxDateTimeWidgetImpl(peer, w)
+    {
+    }
+
+    virtual void SetDateTime(const wxDateTime& dt)
+    {
+        [View() setDateValue: NSDateFromWX(dt)];
+    }
+
+    virtual wxDateTime GetDateTime() const
+    {
+        return NSDateToWX([View() dateValue]);
+    }
+
+    virtual void SetDateRange(const wxDateTime& dt1, const wxDateTime& dt2)
+    {
+        // Note that passing nil is ok here so we don't need to test for the
+        // dates validity.
+        [View() setMinDate: NSDateFromWX(dt1)];
+        [View() setMaxDate: NSDateFromWX(dt2)];
+    }
+
+    virtual bool GetDateRange(wxDateTime* dt1, wxDateTime* dt2)
+    {
+        bool hasLimits = false;
+        if ( dt1 )
+        {
+            *dt1 = NSDateToWX([View() minDate]);
+            hasLimits = true;
+        }
+
+        if ( dt2 )
+        {
+            *dt2 = NSDateToWX([View() maxDate]);
+            hasLimits = true;
+        }
+
+        return hasLimits;
+    }
+
+    virtual void controlAction(WXWidget WXUNUSED(slf),
+                               void* WXUNUSED(cmd),
+                               void* WXUNUSED(sender))
+    {
+        wxWindow* const wxpeer = GetWXPeer();
+        if ( wxpeer )
+        {
+            static_cast<wxDateTimePickerCtrl*>(wxpeer)->
+                OSXGenerateEvent(GetDateTime());
+        }
+    }
+
+private:
+    wxNSDatePicker* View() const
+    {
+        return static_cast<wxNSDatePicker *>(m_osxView);
+    }
+};
+
+} // anonymous namespace
+
+// ----------------------------------------------------------------------------
+// CreateDateTimePicker() implementation
+// ----------------------------------------------------------------------------
+
+/* static */
+wxDateTimeWidgetImpl*
+wxDateTimeWidgetImpl::CreateDateTimePicker(wxDateTimePickerCtrl* wxpeer,
+                                           const wxDateTime& dt,
+                                           const wxPoint& pos,
+                                           const wxSize& size,
+                                           long style,
+                                           wxDateTimeWidgetKind kind)
+{
+    NSRect r = wxOSXGetFrameForControl(wxpeer, pos, size);
+    wxNSDatePicker* v = [[wxNSDatePicker alloc] initWithFrame:r];
+
+    NSDatePickerElementFlags elements = 0;
+    switch ( kind )
+    {
+        case wxDateTimeWidget_YearMonthDay:
+            elements = NSYearMonthDayDatePickerElementFlag;
+            break;
+
+        case wxDateTimeWidget_HourMinuteSecond:
+            elements = NSHourMinuteSecondDatePickerElementFlag;
+            break;
+    }
+
+    wxASSERT_MSG( elements, "Unknown date time widget kind" );
+    [v setDatePickerElements: elements];
+
+    [v setDatePickerStyle: NSTextFieldAndStepperDatePickerStyle];
+
+    if ( dt.IsValid() )
+    {
+        [v setDateValue: NSDateFromWX(dt)];
+    }
+
+    wxDateTimeWidgetImpl* c = new wxDateTimeWidgetCocoaImpl(wxpeer, v);
+    c->SetFlipped(false);
+    return c;
+}
+
+#endif // wxUSE_DATEPICKCTRL
diff --git a/src/osx/datectrl_osx.cpp b/src/osx/datectrl_osx.cpp
new file mode 100644 (file)
index 0000000..c353c0a
--- /dev/null
@@ -0,0 +1,90 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        src/osx/datectrl_osx.cpp
+// Purpose:     Implementation of wxDatePickerCtrl for OS X.
+// Author:      Vadim Zeitlin
+// Created:     2011-12-18
+// RCS-ID:      $Id: wxhead.cpp,v 1.11 2010-04-22 12:44:51 zeitlin Exp $
+// Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#if wxUSE_DATEPICKCTRL && wxOSX_USE_COCOA
+
+#include "wx/datectrl.h"
+#include "wx/dateevt.h"
+
+#include "wx/osx/core/private/datetimectrl.h"
+
+// ============================================================================
+// wxDatePickerCtrl implementation
+// ============================================================================
+
+wxIMPLEMENT_DYNAMIC_CLASS(wxDatePickerCtrl, wxControl);
+
+bool
+wxDatePickerCtrl::Create(wxWindow *parent,
+                         wxWindowID id,
+                         const wxDateTime& dt,
+                         const wxPoint& pos,
+                         const wxSize& size,
+                         long style,
+                         const wxValidator& validator,
+                         const wxString& name)
+{
+    DontCreatePeer();
+
+    if ( !wxDatePickerCtrlBase::Create(parent, id, pos, size,
+                                       style, validator, name) )
+        return false;
+
+    wxOSXWidgetImpl* const peer = wxDateTimeWidgetImpl::CreateDateTimePicker
+                                  (
+                                    this,
+                                    dt,
+                                    pos,
+                                    size,
+                                    style,
+                                    wxDateTimeWidget_YearMonthDay
+                                  );
+    if ( !peer )
+        return false;
+
+    SetPeer(peer);
+
+    MacPostControlCreate(pos, size);
+
+    return true;
+}
+
+void wxDatePickerCtrl::SetRange(const wxDateTime& dt1, const wxDateTime& dt2)
+{
+    GetDateTimePeer()->SetDateRange(dt1, dt2);
+}
+
+bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) const
+{
+    return GetDateTimePeer()->GetDateRange(dt1, dt2);
+}
+
+void wxDatePickerCtrl::OSXGenerateEvent(const wxDateTime& dt)
+{
+    wxDateEvent event(this, dt, wxEVT_DATE_CHANGED);
+    HandleWindowEvent(event);
+}
+
+#endif // wxUSE_DATEPICKCTRL && wxOSX_USE_COCOA
diff --git a/src/osx/datetimectrl_osx.cpp b/src/osx/datetimectrl_osx.cpp
new file mode 100644 (file)
index 0000000..45a4965
--- /dev/null
@@ -0,0 +1,55 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        src/osx/datetimectrl_osx.cpp
+// Purpose:     Implementation of wxDateTimePickerCtrl for OS X.
+// Author:      Vadim Zeitlin
+// Created:     2011-12-18
+// RCS-ID:      $Id: wxhead.cpp,v 1.11 2010-04-22 12:44:51 zeitlin Exp $
+// Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#if wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL
+
+#ifndef WX_PRECOMP
+#endif // WX_PRECOMP
+
+#include "wx/datetimectrl.h"
+
+#include "wx/osx/core/private/datetimectrl.h"
+
+// ============================================================================
+// wxDateTimePickerCtrl implementation
+// ============================================================================
+
+wxDateTimeWidgetImpl* wxDateTimePickerCtrl::GetDateTimePeer() const
+{
+    return static_cast<wxDateTimeWidgetImpl*>(GetPeer());
+}
+
+void wxDateTimePickerCtrl::SetValue(const wxDateTime& dt)
+{
+    GetDateTimePeer()->SetDateTime(dt);
+}
+
+wxDateTime wxDateTimePickerCtrl::GetValue() const
+{
+    return GetDateTimePeer()->GetDateTime();
+}
+
+
+#endif // wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL
diff --git a/src/osx/timectrl_osx.cpp b/src/osx/timectrl_osx.cpp
new file mode 100644 (file)
index 0000000..ca60080
--- /dev/null
@@ -0,0 +1,80 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        src/osx/timectrl_osx.cpp
+// Purpose:     Implementation of wxTimePickerCtrl for OS X.
+// Author:      Vadim Zeitlin
+// Created:     2011-12-18
+// RCS-ID:      $Id: wxhead.cpp,v 1.11 2010-04-22 12:44:51 zeitlin Exp $
+// Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#if wxUSE_TIMEPICKCTRL && wxOSX_USE_COCOA
+
+#include "wx/timectrl.h"
+#include "wx/dateevt.h"
+
+#include "wx/osx/core/private/datetimectrl.h"
+
+// ============================================================================
+// wxTimePickerCtrl implementation
+// ============================================================================
+
+wxIMPLEMENT_DYNAMIC_CLASS(wxTimePickerCtrl, wxControl);
+
+bool
+wxTimePickerCtrl::Create(wxWindow *parent,
+                         wxWindowID id,
+                         const wxDateTime& dt,
+                         const wxPoint& pos,
+                         const wxSize& size,
+                         long style,
+                         const wxValidator& validator,
+                         const wxString& name)
+{
+    DontCreatePeer();
+
+    if ( !wxTimePickerCtrlBase::Create(parent, id, pos, size,
+                                       style, validator, name) )
+        return false;
+
+    wxOSXWidgetImpl* const peer = wxDateTimeWidgetImpl::CreateDateTimePicker
+                                  (
+                                    this,
+                                    dt,
+                                    pos,
+                                    size,
+                                    style,
+                                    wxDateTimeWidget_HourMinuteSecond
+                                  );
+    if ( !peer )
+        return false;
+
+    SetPeer(peer);
+
+    MacPostControlCreate(pos, size);
+
+    return true;
+}
+
+void wxTimePickerCtrl::OSXGenerateEvent(const wxDateTime& dt)
+{
+    wxDateEvent event(this, dt, wxEVT_TIME_CHANGED);
+    HandleWindowEvent(event);
+}
+
+#endif // wxUSE_TIMEPICKCTRL && wxOSX_USE_COCOA