From: Robin Dunn Date: Thu, 18 Jan 2007 19:10:43 +0000 (+0000) Subject: Add GetDateOnly X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6a6c9417a880900ac40ce031d2aa4a19658171e9 Add GetDateOnly git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44247 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/src/_datetime.i b/wxPython/src/_datetime.i index aba286b035..8216236511 100644 --- a/wxPython/src/_datetime.i +++ b/wxPython/src/_datetime.i @@ -464,6 +464,10 @@ public: // resets time to 00:00:00, doesn't change the date wxDateTime& ResetTime(); + // get the date part of this object only, i.e. the object which has the + // same date as this one but time of 00:00:00 + wxDateTime GetDateOnly() const; + // the following functions don't change the values of the other // fields, i.e. SetMinute() won't change either hour or seconds value diff --git a/wxPython/src/gtk/_misc.py b/wxPython/src/gtk/_misc.py index b723e4735d..77de443ed3 100644 --- a/wxPython/src/gtk/_misc.py +++ b/wxPython/src/gtk/_misc.py @@ -3639,6 +3639,10 @@ class DateTime(object): """ResetTime(self) -> DateTime""" return _misc_.DateTime_ResetTime(*args, **kwargs) + def GetDateOnly(*args, **kwargs): + """GetDateOnly(self) -> DateTime""" + return _misc_.DateTime_GetDateOnly(*args, **kwargs) + def SetYear(*args, **kwargs): """SetYear(self, int year) -> DateTime""" return _misc_.DateTime_SetYear(*args, **kwargs) diff --git a/wxPython/src/gtk/_misc_wrap.cpp b/wxPython/src/gtk/_misc_wrap.cpp index 8786675fb1..2f7206ba2b 100644 --- a/wxPython/src/gtk/_misc_wrap.cpp +++ b/wxPython/src/gtk/_misc_wrap.cpp @@ -24458,6 +24458,34 @@ fail: } +SWIGINTERN PyObject *_wrap_DateTime_GetDateOnly(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + wxDateTime *arg1 = (wxDateTime *) 0 ; + wxDateTime result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_wxDateTime, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DateTime_GetDateOnly" "', expected argument " "1"" of type '" "wxDateTime const *""'"); + } + arg1 = reinterpret_cast< wxDateTime * >(argp1); + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + result = ((wxDateTime const *)arg1)->GetDateOnly(); + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + resultobj = SWIG_NewPointerObj((new wxDateTime(static_cast< const wxDateTime& >(result))), SWIGTYPE_p_wxDateTime, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_DateTime_SetYear(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxDateTime *arg1 = (wxDateTime *) 0 ; @@ -39731,6 +39759,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"DateTime_SetHMS", (PyCFunction) _wrap_DateTime_SetHMS, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"DateTime_Set", (PyCFunction) _wrap_DateTime_Set, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"DateTime_ResetTime", (PyCFunction)_wrap_DateTime_ResetTime, METH_O, NULL}, + { (char *)"DateTime_GetDateOnly", (PyCFunction)_wrap_DateTime_GetDateOnly, METH_O, NULL}, { (char *)"DateTime_SetYear", (PyCFunction) _wrap_DateTime_SetYear, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"DateTime_SetMonth", (PyCFunction) _wrap_DateTime_SetMonth, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"DateTime_SetDay", (PyCFunction) _wrap_DateTime_SetDay, METH_VARARGS | METH_KEYWORDS, NULL}, diff --git a/wxPython/src/mac/_misc.py b/wxPython/src/mac/_misc.py index 580e0229ee..d457792a99 100644 --- a/wxPython/src/mac/_misc.py +++ b/wxPython/src/mac/_misc.py @@ -3639,6 +3639,10 @@ class DateTime(object): """ResetTime(self) -> DateTime""" return _misc_.DateTime_ResetTime(*args, **kwargs) + def GetDateOnly(*args, **kwargs): + """GetDateOnly(self) -> DateTime""" + return _misc_.DateTime_GetDateOnly(*args, **kwargs) + def SetYear(*args, **kwargs): """SetYear(self, int year) -> DateTime""" return _misc_.DateTime_SetYear(*args, **kwargs) diff --git a/wxPython/src/mac/_misc_wrap.cpp b/wxPython/src/mac/_misc_wrap.cpp index 4bfe656351..0d2a5693f0 100644 --- a/wxPython/src/mac/_misc_wrap.cpp +++ b/wxPython/src/mac/_misc_wrap.cpp @@ -24450,6 +24450,34 @@ fail: } +SWIGINTERN PyObject *_wrap_DateTime_GetDateOnly(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + wxDateTime *arg1 = (wxDateTime *) 0 ; + wxDateTime result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_wxDateTime, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DateTime_GetDateOnly" "', expected argument " "1"" of type '" "wxDateTime const *""'"); + } + arg1 = reinterpret_cast< wxDateTime * >(argp1); + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + result = ((wxDateTime const *)arg1)->GetDateOnly(); + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + resultobj = SWIG_NewPointerObj((new wxDateTime(static_cast< const wxDateTime& >(result))), SWIGTYPE_p_wxDateTime, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_DateTime_SetYear(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxDateTime *arg1 = (wxDateTime *) 0 ; @@ -39792,6 +39820,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"DateTime_SetHMS", (PyCFunction) _wrap_DateTime_SetHMS, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"DateTime_Set", (PyCFunction) _wrap_DateTime_Set, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"DateTime_ResetTime", (PyCFunction)_wrap_DateTime_ResetTime, METH_O, NULL}, + { (char *)"DateTime_GetDateOnly", (PyCFunction)_wrap_DateTime_GetDateOnly, METH_O, NULL}, { (char *)"DateTime_SetYear", (PyCFunction) _wrap_DateTime_SetYear, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"DateTime_SetMonth", (PyCFunction) _wrap_DateTime_SetMonth, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"DateTime_SetDay", (PyCFunction) _wrap_DateTime_SetDay, METH_VARARGS | METH_KEYWORDS, NULL}, diff --git a/wxPython/src/msw/_misc.py b/wxPython/src/msw/_misc.py index 580e0229ee..d457792a99 100644 --- a/wxPython/src/msw/_misc.py +++ b/wxPython/src/msw/_misc.py @@ -3639,6 +3639,10 @@ class DateTime(object): """ResetTime(self) -> DateTime""" return _misc_.DateTime_ResetTime(*args, **kwargs) + def GetDateOnly(*args, **kwargs): + """GetDateOnly(self) -> DateTime""" + return _misc_.DateTime_GetDateOnly(*args, **kwargs) + def SetYear(*args, **kwargs): """SetYear(self, int year) -> DateTime""" return _misc_.DateTime_SetYear(*args, **kwargs) diff --git a/wxPython/src/msw/_misc_wrap.cpp b/wxPython/src/msw/_misc_wrap.cpp index 13416c7435..e9733818ff 100644 --- a/wxPython/src/msw/_misc_wrap.cpp +++ b/wxPython/src/msw/_misc_wrap.cpp @@ -24450,6 +24450,34 @@ fail: } +SWIGINTERN PyObject *_wrap_DateTime_GetDateOnly(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + wxDateTime *arg1 = (wxDateTime *) 0 ; + wxDateTime result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_wxDateTime, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DateTime_GetDateOnly" "', expected argument " "1"" of type '" "wxDateTime const *""'"); + } + arg1 = reinterpret_cast< wxDateTime * >(argp1); + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + result = ((wxDateTime const *)arg1)->GetDateOnly(); + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + resultobj = SWIG_NewPointerObj((new wxDateTime(static_cast< const wxDateTime& >(result))), SWIGTYPE_p_wxDateTime, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_DateTime_SetYear(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxDateTime *arg1 = (wxDateTime *) 0 ; @@ -39792,6 +39820,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"DateTime_SetHMS", (PyCFunction) _wrap_DateTime_SetHMS, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"DateTime_Set", (PyCFunction) _wrap_DateTime_Set, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"DateTime_ResetTime", (PyCFunction)_wrap_DateTime_ResetTime, METH_O, NULL}, + { (char *)"DateTime_GetDateOnly", (PyCFunction)_wrap_DateTime_GetDateOnly, METH_O, NULL}, { (char *)"DateTime_SetYear", (PyCFunction) _wrap_DateTime_SetYear, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"DateTime_SetMonth", (PyCFunction) _wrap_DateTime_SetMonth, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"DateTime_SetDay", (PyCFunction) _wrap_DateTime_SetDay, METH_VARARGS | METH_KEYWORDS, NULL},