added API, docs and Win32 implementation of wxDatePickerCtrl
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31366 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2256,6 +2256,8 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
|
|
||||||
<set var="ADVANCED_CMN_HDR" hints="files">
|
<set var="ADVANCED_CMN_HDR" hints="files">
|
||||||
wx/calctrl.h
|
wx/calctrl.h
|
||||||
|
wx/dateevt.h
|
||||||
|
wx/datectrl.h
|
||||||
wx/dcbuffer.h
|
wx/dcbuffer.h
|
||||||
wx/generic/calctrl.h
|
wx/generic/calctrl.h
|
||||||
wx/generic/grid.h
|
wx/generic/grid.h
|
||||||
@@ -2280,10 +2282,12 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
|
|
||||||
<set var="ADVANCED_MSW_SRC" hints="files">
|
<set var="ADVANCED_MSW_SRC" hints="files">
|
||||||
src/common/taskbarcmn.cpp
|
src/common/taskbarcmn.cpp
|
||||||
|
src/msw/datectrl.cpp
|
||||||
src/msw/sound.cpp
|
src/msw/sound.cpp
|
||||||
src/msw/taskbar.cpp
|
src/msw/taskbar.cpp
|
||||||
</set>
|
</set>
|
||||||
<set var="ADVANCED_MSW_HDR" hints="files">
|
<set var="ADVANCED_MSW_HDR" hints="files">
|
||||||
|
wx/msw/datectrl.h
|
||||||
wx/msw/sound.h
|
wx/msw/sound.h
|
||||||
wx/msw/taskbar.h
|
wx/msw/taskbar.h
|
||||||
</set>
|
</set>
|
||||||
|
@@ -36,6 +36,7 @@ All:
|
|||||||
|
|
||||||
All (GUI):
|
All (GUI):
|
||||||
|
|
||||||
|
- added wxDatePickerCtrl
|
||||||
- wxSplitterWindow now supports gravity parameter (Zbigniew Zag<61>rski)
|
- wxSplitterWindow now supports gravity parameter (Zbigniew Zag<61>rski)
|
||||||
- recursive wxSizer::GetItem returns item of given window, sizer or nth index
|
- recursive wxSizer::GetItem returns item of given window, sizer or nth index
|
||||||
- wxLayoutConstraints now use best size, not current size, for AsIs() condition
|
- wxLayoutConstraints now use best size, not current size, for AsIs() condition
|
||||||
|
@@ -106,18 +106,21 @@ enum wxCalendarHitTestResult
|
|||||||
|
|
||||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::wxCalendarCtrl}\label{wxcalendarctrlwxcalendarctrldef}
|
\membersection{wxCalendarCtrl::wxCalendarCtrl}\label{wxcalendarctrlwxcalendarctrldef}
|
||||||
|
|
||||||
\func{}{wxCalendarCtrl}{\void}
|
\func{}{wxCalendarCtrl}{\void}
|
||||||
|
|
||||||
Default constructor, use \helpref{Create}{wxcalendarctrlcreate} after it.
|
Default constructor, use \helpref{Create}{wxcalendarctrlcreate} after it.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::wxCalendarCtrl}\label{wxcalendarctrlwxcalendarctrl}
|
\membersection{wxCalendarCtrl::wxCalendarCtrl}\label{wxcalendarctrlwxcalendarctrl}
|
||||||
|
|
||||||
\func{}{wxCalendarCtrl}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxDateTime\& }{date = wxDefaultDateTime}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxCAL\_SHOW\_HOLIDAYS}, \param{const wxString\& }{name = wxCalendarNameStr}}
|
\func{}{wxCalendarCtrl}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxDateTime\& }{date = wxDefaultDateTime}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxCAL\_SHOW\_HOLIDAYS}, \param{const wxString\& }{name = wxCalendarNameStr}}
|
||||||
|
|
||||||
Does the same as \helpref{Create}{wxcalendarctrlcreate} method.
|
Does the same as \helpref{Create}{wxcalendarctrlcreate} method.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::Create}\label{wxcalendarctrlcreate}
|
\membersection{wxCalendarCtrl::Create}\label{wxcalendarctrlcreate}
|
||||||
|
|
||||||
\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxDateTime\& }{date = wxDefaultDateTime}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxCAL\_SHOW\_HOLIDAYS}, \param{const wxString\& }{name = wxCalendarNameStr}}
|
\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxDateTime\& }{date = wxDefaultDateTime}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxCAL\_SHOW\_HOLIDAYS}, \param{const wxString\& }{name = wxCalendarNameStr}}
|
||||||
@@ -125,24 +128,28 @@ Does the same as \helpref{Create}{wxcalendarctrlcreate} method.
|
|||||||
Creates the control. See \helpref{wxWindow}{wxwindowctor} for the meaning of
|
Creates the control. See \helpref{wxWindow}{wxwindowctor} for the meaning of
|
||||||
the parameters and the control overview for the possible styles.
|
the parameters and the control overview for the possible styles.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::\destruct{wxCalendarCtrl}}\label{wxcalendarctrldtor}
|
\membersection{wxCalendarCtrl::\destruct{wxCalendarCtrl}}\label{wxcalendarctrldtor}
|
||||||
|
|
||||||
\func{}{\destruct{wxCalendarCtrl}}{\void}
|
\func{}{\destruct{wxCalendarCtrl}}{\void}
|
||||||
|
|
||||||
Destroys the control.
|
Destroys the control.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::SetDate}\label{wxcalendarctrlsetdate}
|
\membersection{wxCalendarCtrl::SetDate}\label{wxcalendarctrlsetdate}
|
||||||
|
|
||||||
\func{void}{SetDate}{\param{const wxDateTime\& }{date}}
|
\func{void}{SetDate}{\param{const wxDateTime\& }{date}}
|
||||||
|
|
||||||
Sets the current date.
|
Sets the current date.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::GetDate}\label{wxcalendarctrlgetdate}
|
\membersection{wxCalendarCtrl::GetDate}\label{wxcalendarctrlgetdate}
|
||||||
|
|
||||||
\constfunc{const wxDateTime\&}{GetDate}{\void}
|
\constfunc{const wxDateTime\&}{GetDate}{\void}
|
||||||
|
|
||||||
Gets the currently selected date.
|
Gets the currently selected date.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::EnableYearChange}\label{wxcalendarctrlenableyearchange}
|
\membersection{wxCalendarCtrl::EnableYearChange}\label{wxcalendarctrlenableyearchange}
|
||||||
|
|
||||||
\func{void}{EnableYearChange}{\param{bool }{enable = true}}
|
\func{void}{EnableYearChange}{\param{bool }{enable = true}}
|
||||||
@@ -151,6 +158,7 @@ This function should be used instead of changing {\tt wxCAL\_NO\_YEAR\_CHANGE}
|
|||||||
style bit directly. It allows or disallows the user to change the year
|
style bit directly. It allows or disallows the user to change the year
|
||||||
interactively.
|
interactively.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::EnableMonthChange}\label{wxcalendarctrlenablemonthchange}
|
\membersection{wxCalendarCtrl::EnableMonthChange}\label{wxcalendarctrlenablemonthchange}
|
||||||
|
|
||||||
\func{void}{EnableMonthChange}{\param{bool }{enable = true}}
|
\func{void}{EnableMonthChange}{\param{bool }{enable = true}}
|
||||||
@@ -160,6 +168,7 @@ This function should be used instead of changing
|
|||||||
change the month interactively. Note that if the month can not be changed, the
|
change the month interactively. Note that if the month can not be changed, the
|
||||||
year can not be changed neither.
|
year can not be changed neither.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::EnableHolidayDisplay}\label{wxcalendarctrlenableholidaydisplay}
|
\membersection{wxCalendarCtrl::EnableHolidayDisplay}\label{wxcalendarctrlenableholidaydisplay}
|
||||||
|
|
||||||
\func{void}{EnableHolidayDisplay}{\param{bool }{display = true}}
|
\func{void}{EnableHolidayDisplay}{\param{bool }{display = true}}
|
||||||
@@ -168,12 +177,14 @@ This function should be used instead of changing {\tt wxCAL\_SHOW\_HOLIDAYS}
|
|||||||
style bit directly. It enables or disables the special highlighting of the
|
style bit directly. It enables or disables the special highlighting of the
|
||||||
holidays.
|
holidays.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::SetHeaderColours}\label{wxcalendarctrlsetheadercolours}
|
\membersection{wxCalendarCtrl::SetHeaderColours}\label{wxcalendarctrlsetheadercolours}
|
||||||
|
|
||||||
\func{void}{SetHeaderColours}{\param{const wxColour\& }{colFg}, \param{const wxColour\& }{colBg}}
|
\func{void}{SetHeaderColours}{\param{const wxColour\& }{colFg}, \param{const wxColour\& }{colBg}}
|
||||||
|
|
||||||
Set the colours used for painting the weekdays at the top of the control.
|
Set the colours used for painting the weekdays at the top of the control.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::GetHeaderColourFg}\label{wxcalendarctrlgetheadercolourfg}
|
\membersection{wxCalendarCtrl::GetHeaderColourFg}\label{wxcalendarctrlgetheadercolourfg}
|
||||||
|
|
||||||
\constfunc{const wxColour\&}{GetHeaderColourFg}{\void}
|
\constfunc{const wxColour\&}{GetHeaderColourFg}{\void}
|
||||||
@@ -184,6 +195,7 @@ Gets the foreground colour of the header part of the calendar window.
|
|||||||
|
|
||||||
\helpref{SetHeaderColours}{wxcalendarctrlsetheadercolours}
|
\helpref{SetHeaderColours}{wxcalendarctrlsetheadercolours}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::GetHeaderColourBg}\label{wxcalendarctrlgetheadercolourbg}
|
\membersection{wxCalendarCtrl::GetHeaderColourBg}\label{wxcalendarctrlgetheadercolourbg}
|
||||||
|
|
||||||
\constfunc{const wxColour\&}{GetHeaderColourBg}{\void}
|
\constfunc{const wxColour\&}{GetHeaderColourBg}{\void}
|
||||||
@@ -194,12 +206,14 @@ Gets the background colour of the header part of the calendar window.
|
|||||||
|
|
||||||
\helpref{SetHeaderColours}{wxcalendarctrlsetheadercolours}
|
\helpref{SetHeaderColours}{wxcalendarctrlsetheadercolours}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::SetHighlightColours}\label{wxcalendarctrlsethighlightcolours}
|
\membersection{wxCalendarCtrl::SetHighlightColours}\label{wxcalendarctrlsethighlightcolours}
|
||||||
|
|
||||||
\func{void}{SetHighlightColours}{\param{const wxColour\& }{colFg}, \param{const wxColour\& }{colBg}}
|
\func{void}{SetHighlightColours}{\param{const wxColour\& }{colFg}, \param{const wxColour\& }{colBg}}
|
||||||
|
|
||||||
Set the colours to be used for highlighting the currently selected date.
|
Set the colours to be used for highlighting the currently selected date.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::GetHighlightColourFg}\label{wxcalendarctrlgethighlightcolourfg}
|
\membersection{wxCalendarCtrl::GetHighlightColourFg}\label{wxcalendarctrlgethighlightcolourfg}
|
||||||
|
|
||||||
\constfunc{const wxColour\&}{GetHighlightColourFg}{\void}
|
\constfunc{const wxColour\&}{GetHighlightColourFg}{\void}
|
||||||
@@ -210,6 +224,7 @@ Gets the foreground highlight colour.
|
|||||||
|
|
||||||
\helpref{SetHighlightColours}{wxcalendarctrlsethighlightcolours}
|
\helpref{SetHighlightColours}{wxcalendarctrlsethighlightcolours}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::GetHighlightColourBg}\label{wxcalendarctrlgethighlightcolourbg}
|
\membersection{wxCalendarCtrl::GetHighlightColourBg}\label{wxcalendarctrlgethighlightcolourbg}
|
||||||
|
|
||||||
\constfunc{const wxColour\&}{GetHighlightColourBg}{\void}
|
\constfunc{const wxColour\&}{GetHighlightColourBg}{\void}
|
||||||
@@ -220,6 +235,7 @@ Gets the background highlight colour.
|
|||||||
|
|
||||||
\helpref{SetHighlightColours}{wxcalendarctrlsethighlightcolours}
|
\helpref{SetHighlightColours}{wxcalendarctrlsethighlightcolours}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::SetHolidayColours}\label{wxcalendarctrlsetholidaycolours}
|
\membersection{wxCalendarCtrl::SetHolidayColours}\label{wxcalendarctrlsetholidaycolours}
|
||||||
|
|
||||||
\func{void}{SetHolidayColours}{\param{const wxColour\& }{colFg}, \param{const wxColour\& }{colBg}}
|
\func{void}{SetHolidayColours}{\param{const wxColour\& }{colFg}, \param{const wxColour\& }{colBg}}
|
||||||
@@ -227,6 +243,7 @@ Gets the background highlight colour.
|
|||||||
Sets the colours to be used for the holidays highlighting (only used if the
|
Sets the colours to be used for the holidays highlighting (only used if the
|
||||||
window style includes {\tt wxCAL\_SHOW\_HOLIDAYS} flag).
|
window style includes {\tt wxCAL\_SHOW\_HOLIDAYS} flag).
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::GetHolidayColourFg}\label{wxcalendarctrlgetholidaycolourfg}
|
\membersection{wxCalendarCtrl::GetHolidayColourFg}\label{wxcalendarctrlgetholidaycolourfg}
|
||||||
|
|
||||||
\constfunc{const wxColour\&}{GetHolidayColourFg}{\void}
|
\constfunc{const wxColour\&}{GetHolidayColourFg}{\void}
|
||||||
@@ -237,6 +254,7 @@ Return the foreground colour currently used for holiday highlighting.
|
|||||||
|
|
||||||
\helpref{SetHolidayColours}{wxcalendarctrlsetholidaycolours}
|
\helpref{SetHolidayColours}{wxcalendarctrlsetholidaycolours}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::GetHolidayColourBg}\label{wxcalendarctrlgetholidaycolourbg}
|
\membersection{wxCalendarCtrl::GetHolidayColourBg}\label{wxcalendarctrlgetholidaycolourbg}
|
||||||
|
|
||||||
\constfunc{const wxColour\&}{GetHolidayColourBg}{\void}
|
\constfunc{const wxColour\&}{GetHolidayColourBg}{\void}
|
||||||
@@ -247,6 +265,7 @@ Return the background colour currently used for holiday highlighting.
|
|||||||
|
|
||||||
\helpref{SetHolidayColours}{wxcalendarctrlsetholidaycolours}
|
\helpref{SetHolidayColours}{wxcalendarctrlsetholidaycolours}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::GetAttr}\label{wxcalendarctrlgetattr}
|
\membersection{wxCalendarCtrl::GetAttr}\label{wxcalendarctrlgetattr}
|
||||||
|
|
||||||
\constfunc{wxCalendarDateAttr *}{GetAttr}{\param{size\_t }{day}}
|
\constfunc{wxCalendarDateAttr *}{GetAttr}{\param{size\_t }{day}}
|
||||||
@@ -255,6 +274,7 @@ Returns the attribute for the given date (should be in the range $1\ldots31$).
|
|||||||
|
|
||||||
The returned pointer may be {\tt NULL}.
|
The returned pointer may be {\tt NULL}.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::SetAttr}\label{wxcalendarctrlsetattr}
|
\membersection{wxCalendarCtrl::SetAttr}\label{wxcalendarctrlsetattr}
|
||||||
|
|
||||||
\func{void}{SetAttr}{\param{size\_t }{day}, \param{wxCalendarDateAttr* }{attr}}
|
\func{void}{SetAttr}{\param{size\_t }{day}, \param{wxCalendarDateAttr* }{attr}}
|
||||||
@@ -263,12 +283,14 @@ Associates the attribute with the specified date (in the range $1\ldots31$).
|
|||||||
|
|
||||||
If the pointer is {\tt NULL}, the items attribute is cleared.
|
If the pointer is {\tt NULL}, the items attribute is cleared.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::SetHoliday}\label{wxcalendarctrlsetholiday}
|
\membersection{wxCalendarCtrl::SetHoliday}\label{wxcalendarctrlsetholiday}
|
||||||
|
|
||||||
\func{void}{SetHoliday}{\param{size\_t }{day}}
|
\func{void}{SetHoliday}{\param{size\_t }{day}}
|
||||||
|
|
||||||
Marks the specified day as being a holiday in the current month.
|
Marks the specified day as being a holiday in the current month.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::ResetAttr}\label{wxcalendarctrlresetattr}
|
\membersection{wxCalendarCtrl::ResetAttr}\label{wxcalendarctrlresetattr}
|
||||||
|
|
||||||
\func{void}{ResetAttr}{\param{size\_t }{day}}
|
\func{void}{ResetAttr}{\param{size\_t }{day}}
|
||||||
@@ -276,6 +298,7 @@ Marks the specified day as being a holiday in the current month.
|
|||||||
Clears any attributes associated with the given day (in the range
|
Clears any attributes associated with the given day (in the range
|
||||||
$1\ldots31$).
|
$1\ldots31$).
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarCtrl::HitTest}\label{wxcalendarctrlhittest}
|
\membersection{wxCalendarCtrl::HitTest}\label{wxcalendarctrlhittest}
|
||||||
|
|
||||||
\func{wxCalendarHitTestResult}{HitTest}{\param{const wxPoint\& }{pos}, \param{wxDateTime* }{date = NULL}, \param{wxDateTime::WeekDay* }{wd = NULL}}
|
\func{wxCalendarHitTestResult}{HitTest}{\param{const wxPoint\& }{pos}, \param{wxDateTime* }{date = NULL}, \param{wxDateTime::WeekDay* }{wd = NULL}}
|
||||||
@@ -312,6 +335,7 @@ enum wxCalendarDateBorder
|
|||||||
|
|
||||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::wxCalendarDateAttr}\label{wxcalendardateattrwxcalendardateattr}
|
\membersection{wxCalendarDateAttr::wxCalendarDateAttr}\label{wxcalendardateattrwxcalendardateattr}
|
||||||
|
|
||||||
\func{}{wxCalendarDateAttr}{\void}
|
\func{}{wxCalendarDateAttr}{\void}
|
||||||
@@ -322,72 +346,84 @@ enum wxCalendarDateBorder
|
|||||||
|
|
||||||
The constructors.
|
The constructors.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::SetTextColour}\label{wxcalendardateattrsettextcolour}
|
\membersection{wxCalendarDateAttr::SetTextColour}\label{wxcalendardateattrsettextcolour}
|
||||||
|
|
||||||
\func{void}{SetTextColour}{\param{const wxColour\& }{colText}}
|
\func{void}{SetTextColour}{\param{const wxColour\& }{colText}}
|
||||||
|
|
||||||
Sets the text (foreground) colour to use.
|
Sets the text (foreground) colour to use.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::SetBackgroundColour}\label{wxcalendardateattrsetbackgroundcolour}
|
\membersection{wxCalendarDateAttr::SetBackgroundColour}\label{wxcalendardateattrsetbackgroundcolour}
|
||||||
|
|
||||||
\func{void}{SetBackgroundColour}{\param{const wxColour\& }{colBack}}
|
\func{void}{SetBackgroundColour}{\param{const wxColour\& }{colBack}}
|
||||||
|
|
||||||
Sets the text background colour to use.
|
Sets the text background colour to use.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::SetBorderColour}\label{wxcalendardateattrsetbordercolour}
|
\membersection{wxCalendarDateAttr::SetBorderColour}\label{wxcalendardateattrsetbordercolour}
|
||||||
|
|
||||||
\func{void}{SetBorderColour}{\param{const wxColour\& }{col}}
|
\func{void}{SetBorderColour}{\param{const wxColour\& }{col}}
|
||||||
|
|
||||||
Sets the border colour to use.
|
Sets the border colour to use.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::SetFont}\label{wxcalendardateattrsetfont}
|
\membersection{wxCalendarDateAttr::SetFont}\label{wxcalendardateattrsetfont}
|
||||||
|
|
||||||
\func{void}{SetFont}{\param{const wxFont\& }{font}}
|
\func{void}{SetFont}{\param{const wxFont\& }{font}}
|
||||||
|
|
||||||
Sets the font to use.
|
Sets the font to use.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::SetBorder}\label{wxcalendardateattrsetborder}
|
\membersection{wxCalendarDateAttr::SetBorder}\label{wxcalendardateattrsetborder}
|
||||||
|
|
||||||
\func{void}{SetBorder}{\param{wxCalendarDateBorder }{border}}
|
\func{void}{SetBorder}{\param{wxCalendarDateBorder }{border}}
|
||||||
|
|
||||||
Sets the \helpref{border kind}{wxcalendardateattr}
|
Sets the \helpref{border kind}{wxcalendardateattr}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::SetHoliday}\label{wxcalendardateattrsetholiday}
|
\membersection{wxCalendarDateAttr::SetHoliday}\label{wxcalendardateattrsetholiday}
|
||||||
|
|
||||||
\func{void}{SetHoliday}{\param{bool }{holiday}}
|
\func{void}{SetHoliday}{\param{bool }{holiday}}
|
||||||
|
|
||||||
Display the date with this attribute as a holiday.
|
Display the date with this attribute as a holiday.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::HasTextColour}\label{wxcalendardateattrhastextcolour}
|
\membersection{wxCalendarDateAttr::HasTextColour}\label{wxcalendardateattrhastextcolour}
|
||||||
|
|
||||||
\constfunc{bool}{HasTextColour}{\void}
|
\constfunc{bool}{HasTextColour}{\void}
|
||||||
|
|
||||||
Returns {\tt true} if this item has a non default text foreground colour.
|
Returns {\tt true} if this item has a non default text foreground colour.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::HasBackgroundColour}\label{wxcalendardateattrhasbackgroundcolour}
|
\membersection{wxCalendarDateAttr::HasBackgroundColour}\label{wxcalendardateattrhasbackgroundcolour}
|
||||||
|
|
||||||
\constfunc{bool}{HasBackgroundColour}{\void}
|
\constfunc{bool}{HasBackgroundColour}{\void}
|
||||||
|
|
||||||
Returns {\tt true} if this attribute specifies a non default text background colour.
|
Returns {\tt true} if this attribute specifies a non default text background colour.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::HasBorderColour}\label{wxcalendardateattrhasbordercolour}
|
\membersection{wxCalendarDateAttr::HasBorderColour}\label{wxcalendardateattrhasbordercolour}
|
||||||
|
|
||||||
\constfunc{bool}{HasBorderColour}{\void}
|
\constfunc{bool}{HasBorderColour}{\void}
|
||||||
|
|
||||||
Returns {\tt true} if this attribute specifies a non default border colour.
|
Returns {\tt true} if this attribute specifies a non default border colour.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::HasFont}\label{wxcalendardateattrhasfont}
|
\membersection{wxCalendarDateAttr::HasFont}\label{wxcalendardateattrhasfont}
|
||||||
|
|
||||||
\constfunc{bool}{HasFont}{\void}
|
\constfunc{bool}{HasFont}{\void}
|
||||||
|
|
||||||
Returns {\tt true} if this attribute specifies a non default font.
|
Returns {\tt true} if this attribute specifies a non default font.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::HasBorder}\label{wxcalendardateattrhasborder}
|
\membersection{wxCalendarDateAttr::HasBorder}\label{wxcalendardateattrhasborder}
|
||||||
|
|
||||||
\constfunc{bool}{HasBorder}{\void}
|
\constfunc{bool}{HasBorder}{\void}
|
||||||
|
|
||||||
Returns {\tt true} if this attribute specifies a non default (i.e. any) border.
|
Returns {\tt true} if this attribute specifies a non default (i.e. any) border.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::IsHoliday}\label{wxcalendardateattrisholiday}
|
\membersection{wxCalendarDateAttr::IsHoliday}\label{wxcalendardateattrisholiday}
|
||||||
|
|
||||||
\constfunc{bool}{IsHoliday}{\void}
|
\constfunc{bool}{IsHoliday}{\void}
|
||||||
@@ -395,53 +431,66 @@ Returns {\tt true} if this attribute specifies a non default (i.e. any) border.
|
|||||||
Returns {\tt true} if this attribute specifies that this item should be
|
Returns {\tt true} if this attribute specifies that this item should be
|
||||||
displayed as a holiday.
|
displayed as a holiday.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::GetTextColour}\label{wxcalendardateattrgettextcolour}
|
\membersection{wxCalendarDateAttr::GetTextColour}\label{wxcalendardateattrgettextcolour}
|
||||||
|
|
||||||
\constfunc{const wxColour\&}{GetTextColour}{\void}
|
\constfunc{const wxColour\&}{GetTextColour}{\void}
|
||||||
|
|
||||||
Returns the text colour to use for the item with this attribute.
|
Returns the text colour to use for the item with this attribute.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::GetBackgroundColour}\label{wxcalendardateattrgetbackgroundcolour}
|
\membersection{wxCalendarDateAttr::GetBackgroundColour}\label{wxcalendardateattrgetbackgroundcolour}
|
||||||
|
|
||||||
\constfunc{const wxColour\&}{GetBackgroundColour}{\void}
|
\constfunc{const wxColour\&}{GetBackgroundColour}{\void}
|
||||||
|
|
||||||
Returns the background colour to use for the item with this attribute.
|
Returns the background colour to use for the item with this attribute.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::GetBorderColour}\label{wxcalendardateattrgetbordercolour}
|
\membersection{wxCalendarDateAttr::GetBorderColour}\label{wxcalendardateattrgetbordercolour}
|
||||||
|
|
||||||
\constfunc{const wxColour\&}{GetBorderColour}{\void}
|
\constfunc{const wxColour\&}{GetBorderColour}{\void}
|
||||||
|
|
||||||
Returns the border colour to use for the item with this attribute.
|
Returns the border colour to use for the item with this attribute.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::GetFont}\label{wxcalendardateattrgetfont}
|
\membersection{wxCalendarDateAttr::GetFont}\label{wxcalendardateattrgetfont}
|
||||||
|
|
||||||
\constfunc{const wxFont\&}{GetFont}{\void}
|
\constfunc{const wxFont\&}{GetFont}{\void}
|
||||||
|
|
||||||
Returns the font to use for the item with this attribute.
|
Returns the font to use for the item with this attribute.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxCalendarDateAttr::GetBorder}\label{wxcalendardateattrgetborder}
|
\membersection{wxCalendarDateAttr::GetBorder}\label{wxcalendardateattrgetborder}
|
||||||
|
|
||||||
\constfunc{wxCalendarDateBorder}{GetBorder}{\void}
|
\constfunc{wxCalendarDateBorder}{GetBorder}{\void}
|
||||||
|
|
||||||
Returns the \helpref{border}{wxcalendardateattr} to use for the item with this attribute.
|
Returns the \helpref{border}{wxcalendardateattr} to use for the item with this attribute.
|
||||||
|
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
\section{\class{wxCalendarEvent}}\label{wxcalendarevent}
|
\section{\class{wxCalendarEvent}}\label{wxcalendarevent}
|
||||||
|
|
||||||
The wxCalendarEvent class is used together with
|
The wxCalendarEvent class is used together with
|
||||||
\helpref{wxCalendarCtrl}{wxcalendarctrl}.
|
\helpref{wxCalendarCtrl}{wxcalendarctrl}.
|
||||||
|
|
||||||
|
\wxheading{Derived from}
|
||||||
|
|
||||||
|
\helpref{wxDateEvent}{wxdateevent}\\
|
||||||
|
\helpref{wxCommandEvent}{wxcommandevent}\\
|
||||||
|
\helpref{wxEvent}{wxevent}\\
|
||||||
|
\helpref{wxObject}{wxobject}
|
||||||
|
|
||||||
|
\wxheading{Include files}
|
||||||
|
|
||||||
|
<wx/calctrl.h>
|
||||||
|
|
||||||
\wxheading{See also}
|
\wxheading{See also}
|
||||||
|
|
||||||
\helpref{wxCalendarCtrl}{wxcalendarctrl}
|
\helpref{wxCalendarCtrl}{wxcalendarctrl}
|
||||||
|
|
||||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||||
|
|
||||||
\membersection{wxCalendarEvent::GetDate}\label{wxcalendareventgetdate}
|
|
||||||
|
|
||||||
\constfunc{const wxDateTime\&}{GetDate}{\void}
|
|
||||||
|
|
||||||
Returns the date. This function may be called for all event types except
|
|
||||||
{\tt EVT\_CALENDAR\_WEEKDAY\_CLICKED} one for which it doesn't make sense.
|
|
||||||
|
|
||||||
\membersection{wxCalendarEvent::GetWeekDay}\label{wxcalendareventgetweekday}
|
\membersection{wxCalendarEvent::GetWeekDay}\label{wxcalendareventgetweekday}
|
||||||
|
|
||||||
@@ -451,15 +500,11 @@ Returns the week day on which the user clicked in
|
|||||||
{\tt EVT\_CALENDAR\_WEEKDAY\_CLICKED} handler. It doesn't make sense to call
|
{\tt EVT\_CALENDAR\_WEEKDAY\_CLICKED} handler. It doesn't make sense to call
|
||||||
this function in other handlers.
|
this function in other handlers.
|
||||||
|
|
||||||
\membersection{wxCalendarEvent::SetDate}\label{wxcalendareventsetdate}
|
|
||||||
|
|
||||||
\func{void}{SetDate}{\param{const wxDateTime\&}{ date}}
|
|
||||||
|
|
||||||
Sets the date.
|
|
||||||
|
|
||||||
\membersection{wxCalendarEvent::SetWeekDay}\label{wxcalendareventsetweekday}
|
\membersection{wxCalendarEvent::SetWeekDay}\label{wxcalendareventsetweekday}
|
||||||
|
|
||||||
\func{void}{SetWeekDay}{\param{wxDateTime::WeekDay}{ day}}
|
\func{void}{SetWeekDay}{\param{wxDateTime::WeekDay}{ day}}
|
||||||
|
|
||||||
Sets the week day.
|
Sets the week day carried by the event, normally only used by the library
|
||||||
|
internally.
|
||||||
|
|
||||||
|
@@ -87,11 +87,12 @@ that are not static can have \helpref{validators}{wxvalidator} associated with t
|
|||||||
\twocolitem{\helpref{wxButton}{wxbutton}}{Push button control, displaying text}
|
\twocolitem{\helpref{wxButton}{wxbutton}}{Push button control, displaying text}
|
||||||
\twocolitem{\helpref{wxBitmapButton}{wxbitmapbutton}}{Push button control, displaying a bitmap}
|
\twocolitem{\helpref{wxBitmapButton}{wxbitmapbutton}}{Push button control, displaying a bitmap}
|
||||||
\twocolitem{\helpref{wxToggleButton}{wxtogglebutton}}{A button which stays pressed when clicked by user.}
|
\twocolitem{\helpref{wxToggleButton}{wxtogglebutton}}{A button which stays pressed when clicked by user.}
|
||||||
\twocolitem{\helpref{wxCalendarCtrl}{wxcalendarctrl}}{Date picker control}
|
\twocolitem{\helpref{wxCalendarCtrl}{wxcalendarctrl}}{Control showing an entire calendar month}
|
||||||
\twocolitem{\helpref{wxCheckBox}{wxcheckbox}}{Checkbox control}
|
\twocolitem{\helpref{wxCheckBox}{wxcheckbox}}{Checkbox control}
|
||||||
\twocolitem{\helpref{wxCheckListBox}{wxchecklistbox}}{A listbox with a checkbox to the left of each item}
|
\twocolitem{\helpref{wxCheckListBox}{wxchecklistbox}}{A listbox with a checkbox to the left of each item}
|
||||||
\twocolitem{\helpref{wxChoice}{wxchoice}}{Choice control (a combobox without the editable area)}
|
\twocolitem{\helpref{wxChoice}{wxchoice}}{Choice control (a combobox without the editable area)}
|
||||||
\twocolitem{\helpref{wxComboBox}{wxcombobox}}{A choice with an editable area}
|
\twocolitem{\helpref{wxComboBox}{wxcombobox}}{A choice with an editable area}
|
||||||
|
\twocolitem{\helpref{wxDatePickerCtrl}{wxdatepickerctrl}}{Small date picker control}
|
||||||
\twocolitem{\helpref{wxGauge}{wxgauge}}{A control to represent a varying quantity, such as time remaining}
|
\twocolitem{\helpref{wxGauge}{wxgauge}}{A control to represent a varying quantity, such as time remaining}
|
||||||
\twocolitem{\helpref{wxGenericDirCtrl}{wxgenericdirctrl}}{A control for displaying a directory tree}
|
\twocolitem{\helpref{wxGenericDirCtrl}{wxgenericdirctrl}}{A control for displaying a directory tree}
|
||||||
\twocolitem{\helpref{wxHtmlListBox}{wxhtmllistbox}}{A listbox showing HTML content}
|
\twocolitem{\helpref{wxHtmlListBox}{wxhtmllistbox}}{A listbox showing HTML content}
|
||||||
|
@@ -63,6 +63,8 @@
|
|||||||
\input dobjcomp.tex
|
\input dobjcomp.tex
|
||||||
\input dobjsmpl.tex
|
\input dobjsmpl.tex
|
||||||
\input datostrm.tex
|
\input datostrm.tex
|
||||||
|
\input dateevt.tex
|
||||||
|
\input datectrl.tex
|
||||||
\input datespan.tex
|
\input datespan.tex
|
||||||
\input datetime.tex
|
\input datetime.tex
|
||||||
\input db.tex
|
\input db.tex
|
||||||
|
154
docs/latex/wx/datectrl.tex
Normal file
154
docs/latex/wx/datectrl.tex
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
%% Name: datectrl.tex
|
||||||
|
%% Purpose: wxDatePickerCtrl documentation
|
||||||
|
%% Author: Vadim Zeitlin
|
||||||
|
%% Created: 2005-01-15
|
||||||
|
%% RCS-ID: $Id$
|
||||||
|
%% Copyright: (c) 2005 Vadim Zeitlin
|
||||||
|
%% License: wxWidgets license
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
\section{\class{wxDatePickerCtrl}}\label{wxdatepickerctrl}
|
||||||
|
|
||||||
|
This control allows the user to select a date. Unlike
|
||||||
|
\helpref{wxCalendarCtrl}{wxcalendarctrl}, which is a relatively big control,
|
||||||
|
it is implemented as a small window showing the currently selected date and
|
||||||
|
allowing to edit it directly using the keyboard and may also display a popup
|
||||||
|
window for more user-friendly date selection, depending on the styles used and
|
||||||
|
the platform.
|
||||||
|
|
||||||
|
\wxheading{Derived from}
|
||||||
|
|
||||||
|
\helpref{wxControl}{wxcontrol}\\
|
||||||
|
\helpref{wxWindow}{wxwindow}\\
|
||||||
|
\helpref{wxEvtHandler}{wxevthandler}\\
|
||||||
|
\helpref{wxObject}{wxobject}
|
||||||
|
|
||||||
|
\wxheading{Include files}
|
||||||
|
|
||||||
|
<wx/dateevt.h>
|
||||||
|
|
||||||
|
\wxheading{Event handling}
|
||||||
|
|
||||||
|
\twocolwidtha{7cm}%
|
||||||
|
\begin{twocollist}\itemsep=0pt
|
||||||
|
\twocolitem{{\bf EVT\_DATE\_CHANGED(id, func)}}{This event fires when the user
|
||||||
|
changes the current selection in the control.}
|
||||||
|
\end{twocollist}
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{wxCalendarCtrl}{wxcalendarctrl},\\
|
||||||
|
\helpref{wxDateEvent}{wxdateevent}
|
||||||
|
|
||||||
|
|
||||||
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||||
|
|
||||||
|
\membersection{wxDatePickerCtrl::wxDatePickerCtrl}\label{wxdatepickerctrlctor}
|
||||||
|
|
||||||
|
\func{}{wxDatePickerCtrl}{\param{wxWindow *}{parent},\rtfsp
|
||||||
|
\param{wxWindowID}{ id},\rtfsp
|
||||||
|
\param{const wxDateTime\& }{dt = wxDefaultDateTime},\rtfsp
|
||||||
|
\param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
|
||||||
|
\param{const wxSize\& }{size = wxDefaultSize},\rtfsp
|
||||||
|
\param{long}{ style = 0},\rtfsp
|
||||||
|
\param{const wxValidator\& }{validator = wxDefaultValidator},
|
||||||
|
\param{const wxString\& }{name = ``datectrl"}}
|
||||||
|
|
||||||
|
Initializes the object and calls \helpref{Create}{wxdatepickerctrcreate} with
|
||||||
|
all the parameters.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxDatePickerCtrl::Create}\label{wxdatepickerctrlcreate}
|
||||||
|
|
||||||
|
\func{bool}{Create}{\param{wxWindow *}{parent},\rtfsp
|
||||||
|
\param{wxWindowID}{ id},\rtfsp
|
||||||
|
\param{const wxDateTime\& }{dt = wxDefaultDateTime},\rtfsp
|
||||||
|
\param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
|
||||||
|
\param{const wxSize\& }{size = wxDefaultSize},\rtfsp
|
||||||
|
\param{long}{ style = 0},\rtfsp
|
||||||
|
\param{const wxValidator\& }{validator = wxDefaultValidator},
|
||||||
|
\param{const wxString\& }{name = ``datectrl"}}
|
||||||
|
|
||||||
|
\wxheading{Parameters}
|
||||||
|
|
||||||
|
\docparam{parent}{Parent window, must not be non-\texttt{NULL}.}
|
||||||
|
|
||||||
|
\docparam{id}{The identifier for the control.}
|
||||||
|
|
||||||
|
\docparam{dt}{The initial value of the control, if an invalid date (such as the
|
||||||
|
default value) is used, the control is set to today.}
|
||||||
|
|
||||||
|
\docparam{pos}{Initial position.}
|
||||||
|
|
||||||
|
\docparam{size}{Initial size. If left at default value, the control chooses its
|
||||||
|
own best size by using the height approximately equal to a text control and
|
||||||
|
width large enough to show the date string fully.}
|
||||||
|
|
||||||
|
\docparam{style}{The window style, should be left at $0$ as there are no
|
||||||
|
special styles for this control in this version.}
|
||||||
|
|
||||||
|
\docparam{validator}{Validator which can be used for additional date checks.}
|
||||||
|
|
||||||
|
\docparam{name}{Control name.}
|
||||||
|
|
||||||
|
\wxheading{Return value}
|
||||||
|
|
||||||
|
\true if the control was successfully created or \false if creation failed.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxDatePickerCtrl::GetRange}\label{wxdatepickerctrlgetrange}
|
||||||
|
|
||||||
|
\constfunc{bool}{GetRange}{\param{wxDateTime *}{dt1}, \param{wxDateTime }{*dt2}}
|
||||||
|
|
||||||
|
If the control had been previously limited to a range of dates using
|
||||||
|
\helpref{SetRange()}{wxdatepickerctrlsetrange}, returns the lower and upper
|
||||||
|
bounds of this range. If no range is set (or only one of the bounds is set),
|
||||||
|
the \arg{dt1} and/or \arg{dt2} are set to be invalid.
|
||||||
|
|
||||||
|
\wxheading{Parameters}
|
||||||
|
|
||||||
|
\docparam{dt1}{Pointer to the object which receives the lower range limit or
|
||||||
|
becomes invalid if it is not set. May be \texttt{NULLL} if the caller is not
|
||||||
|
interested in lower limit}
|
||||||
|
|
||||||
|
\docparam{dt2}{Same as above but for the upper limit}
|
||||||
|
|
||||||
|
\wxheading{Return value}
|
||||||
|
|
||||||
|
\false if no range limits are currently set, \true if at least one bound is
|
||||||
|
set.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxDatePickerCtrl::GetValue}\label{wxdatepickerctrlgetvalue}
|
||||||
|
|
||||||
|
\constfunc{wxDateTime}{GetValue}{\void}
|
||||||
|
|
||||||
|
Returns the currently selected. If there is no selection or the selection is
|
||||||
|
outside of the current range, an invalid object is returned.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxDatePickerCtrl::SetRange}\label{wxdatepickerctrlsetrange}
|
||||||
|
|
||||||
|
\func{void}{SetRange}{\param{const wxDateTime\&}{ dt1}, \param{const wxDateTime\&}{ dt2}}
|
||||||
|
|
||||||
|
Sets the valid range for the date selection. If \arg{dt1} is valid, it becomes
|
||||||
|
the earliest date (inclusive) accepted by the control. If \arg{dt2} is valid,
|
||||||
|
it becomes the latest possible date.
|
||||||
|
|
||||||
|
\wxheading{Remarks}
|
||||||
|
|
||||||
|
If the current value of the control is outside of the newly set range bounds,
|
||||||
|
the behaviour is undefined.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxDatePickerCtrl::SetValue}\label{wxdatepickerctrlsetvalue}
|
||||||
|
|
||||||
|
\func{void}{SetValue}{\param{const wxDateTime\&}{ dt}}
|
||||||
|
|
||||||
|
Changes the current value of the control. The date should be valid and included
|
||||||
|
in the currently selected range, if any.
|
||||||
|
|
||||||
|
Calling this method does not result in a date change event.
|
||||||
|
|
||||||
|
|
44
docs/latex/wx/dateevt.tex
Normal file
44
docs/latex/wx/dateevt.tex
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
%% Name: dateevt.tex
|
||||||
|
%% Purpose: wxDateEvent documentation
|
||||||
|
%% Author: Vadim Zeitlin
|
||||||
|
%% Created: 2005-01-15
|
||||||
|
%% RCS-ID: $Id$
|
||||||
|
%% Copyright: (c) 2005 Vadim Zeitlin
|
||||||
|
%% License: wxWidgets license
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
\section{\class{wxDateEvent}}\label{wxdateevent}
|
||||||
|
|
||||||
|
This event class carries information about a date change and is used together
|
||||||
|
with \helpref{wxDatePickerCtrl}{wxdatepickerctrl} and serves as a base class
|
||||||
|
for \helpref{wxCalendarEvent}{wxCalendarEvent}.
|
||||||
|
|
||||||
|
\wxheading{Derived from}
|
||||||
|
|
||||||
|
\helpref{wxCommandEvent}{wxcommandevent}\\
|
||||||
|
\helpref{wxEvent}{wxevent}\\
|
||||||
|
\helpref{wxObject}{wxobject}
|
||||||
|
|
||||||
|
\wxheading{Include files}
|
||||||
|
|
||||||
|
<wx/dateevt.h>
|
||||||
|
|
||||||
|
|
||||||
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||||
|
|
||||||
|
\membersection{wxDateEvent::GetDate}\label{wxdateeventgetdate}
|
||||||
|
|
||||||
|
\constfunc{const wxDateTime\&}{GetDate}{\void}
|
||||||
|
|
||||||
|
Returns the date.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxDateEvent::SetDate}\label{wxdateeventsetdate}
|
||||||
|
|
||||||
|
\func{void}{SetDate}{\param{const wxDateTime\&}{ date}}
|
||||||
|
|
||||||
|
Sets the date carried by the event, normally only used by the library
|
||||||
|
internally.
|
||||||
|
|
||||||
|
|
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#if wxUSE_CALENDARCTRL
|
#if wxUSE_CALENDARCTRL
|
||||||
|
|
||||||
#include "wx/datetime.h"
|
#include "wx/dateevt.h"
|
||||||
#include "wx/colour.h"
|
#include "wx/colour.h"
|
||||||
#include "wx/font.h"
|
#include "wx/font.h"
|
||||||
|
|
||||||
@@ -161,23 +161,23 @@ private:
|
|||||||
|
|
||||||
class WXDLLIMPEXP_ADV wxCalendarCtrl;
|
class WXDLLIMPEXP_ADV wxCalendarCtrl;
|
||||||
|
|
||||||
class WXDLLIMPEXP_ADV wxCalendarEvent : public wxCommandEvent
|
class WXDLLIMPEXP_ADV wxCalendarEvent : public wxDateEvent
|
||||||
{
|
{
|
||||||
friend class wxCalendarCtrl;
|
friend class wxCalendarCtrl;
|
||||||
public:
|
public:
|
||||||
wxCalendarEvent() { Init(); }
|
wxCalendarEvent() { Init(); }
|
||||||
wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type);
|
wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type);
|
||||||
|
|
||||||
const wxDateTime& GetDate() const { return m_date; }
|
|
||||||
void SetDate(const wxDateTime &date) { m_date = date; }
|
|
||||||
void SetWeekDay(const wxDateTime::WeekDay wd) { m_wday = wd; }
|
void SetWeekDay(const wxDateTime::WeekDay wd) { m_wday = wd; }
|
||||||
wxDateTime::WeekDay GetWeekDay() const { return m_wday; }
|
wxDateTime::WeekDay GetWeekDay() const { return m_wday; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Init();
|
void Init()
|
||||||
|
{
|
||||||
|
m_wday = wxDateTime::Inv_WeekDay;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxDateTime m_date;
|
|
||||||
wxDateTime::WeekDay m_wday;
|
wxDateTime::WeekDay m_wday;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxCalendarEvent)
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxCalendarEvent)
|
||||||
@@ -190,6 +190,14 @@ private:
|
|||||||
// so far we only have a generic version, so keep it simple
|
// so far we only have a generic version, so keep it simple
|
||||||
#include "wx/generic/calctrl.h"
|
#include "wx/generic/calctrl.h"
|
||||||
|
|
||||||
|
|
||||||
|
// now we can define the inline ctor using wxCalendarCtrl
|
||||||
|
inline
|
||||||
|
wxCalendarEvent::wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type)
|
||||||
|
: wxDateEvent(cal, cal->GetDate(), type)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// calendar event types and macros for handling them
|
// calendar event types and macros for handling them
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
59
include/wx/datectrl.h
Normal file
59
include/wx/datectrl.h
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/datectrl.h
|
||||||
|
// Purpose: implements wxDatePickerCtrl
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Modified by:
|
||||||
|
// Created: 2005-01-09
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _WX_DATECTRL_H_
|
||||||
|
#define _WX_DATECTRL_H_
|
||||||
|
|
||||||
|
#include "wx/control.h" // the base class
|
||||||
|
#include "wx/datetime.h"
|
||||||
|
|
||||||
|
#define wxDatePickerCtrlNameStr _T("datectrl")
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxDatePickerCtrl: allow the user to enter the date
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_ADV wxDatePickerCtrlBase : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/*
|
||||||
|
The derived classes should implement ctor and Create() method with the
|
||||||
|
following signature:
|
||||||
|
|
||||||
|
bool Create(wxWindow *parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxDateTime& dt = wxDefaultDateTime,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = wxDatePickerCtrlNameStr);
|
||||||
|
*/
|
||||||
|
|
||||||
|
// set/get the date
|
||||||
|
virtual void SetValue(const wxDateTime& dt) = 0;
|
||||||
|
virtual wxDateTime GetValue() const = 0;
|
||||||
|
|
||||||
|
// set/get the allowed valid range for the dates, if either/both of them
|
||||||
|
// are invalid, there is no corresponding limit and if neither is set
|
||||||
|
// GetRange() returns false
|
||||||
|
virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0;
|
||||||
|
virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
|
||||||
|
#include "wx/msw/datectrl.h"
|
||||||
|
#else
|
||||||
|
// TODO: #include "wx/generic/datectrl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _WX_DATECTRL_H_
|
||||||
|
|
61
include/wx/dateevt.h
Normal file
61
include/wx/dateevt.h
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/dateevt.h
|
||||||
|
// Purpose: declares wxDateEvent class
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Modified by:
|
||||||
|
// Created: 2005-01-10
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _WX_DATEEVT_H_
|
||||||
|
#define _WX_DATEEVT_H_
|
||||||
|
|
||||||
|
#include "wx/event.h"
|
||||||
|
#include "wx/datetime.h"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxDateEvent: used by wxCalendarCtrl and wxDatePickerCtrl
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_ADV wxDateEvent : public wxCommandEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxDateEvent() { }
|
||||||
|
wxDateEvent(wxWindow *win, const wxDateTime& dt, wxEventType type)
|
||||||
|
: wxCommandEvent(type, win->GetId()),
|
||||||
|
m_date(dt)
|
||||||
|
{
|
||||||
|
SetEventObject(win);
|
||||||
|
}
|
||||||
|
|
||||||
|
const wxDateTime& GetDate() const { return m_date; }
|
||||||
|
void SetDate(const wxDateTime &date) { m_date = date; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxDateTime m_date;
|
||||||
|
|
||||||
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDateEvent)
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// event types and macros for handling them
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
BEGIN_DECLARE_EVENT_TYPES()
|
||||||
|
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_DATE_CHANGED, 1101)
|
||||||
|
END_DECLARE_EVENT_TYPES()
|
||||||
|
|
||||||
|
typedef void (wxEvtHandler::*wxDateEventFunction)(wxDateEvent&);
|
||||||
|
|
||||||
|
#define EVT_DATE_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_DATE_CHANGED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) wxStaticCastEvent( wxDateEventFunction, & fn ), (wxObject *) NULL),
|
||||||
|
|
||||||
|
#ifdef _WX_DEFINE_DATE_EVENTS_
|
||||||
|
DEFINE_EVENT_TYPE(wxEVT_DATE_CHANGED)
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxDateEvent, wxCommandEvent)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _WX_DATEEVT_H_
|
||||||
|
|
@@ -42,7 +42,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/sizer.h"
|
#include "wx/sizer.h"
|
||||||
|
#include "wx/textctrl.h"
|
||||||
|
|
||||||
#include "wx/calctrl.h"
|
#include "wx/calctrl.h"
|
||||||
|
#include "wx/datectrl.h"
|
||||||
|
|
||||||
|
#define wxUSE_DATEPICKERCTRL 1
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// private classes
|
// private classes
|
||||||
@@ -100,6 +105,10 @@ public:
|
|||||||
void OnQuit(wxCommandEvent& event);
|
void OnQuit(wxCommandEvent& event);
|
||||||
void OnAbout(wxCommandEvent& event);
|
void OnAbout(wxCommandEvent& event);
|
||||||
|
|
||||||
|
#if wxUSE_DATEPICKERCTRL
|
||||||
|
void OnAskDate(wxCommandEvent& event);
|
||||||
|
#endif // wxUSE_DATEPICKERCTRL
|
||||||
|
|
||||||
void OnCalMonday(wxCommandEvent& event);
|
void OnCalMonday(wxCommandEvent& event);
|
||||||
void OnCalHolidays(wxCommandEvent& event);
|
void OnCalHolidays(wxCommandEvent& event);
|
||||||
void OnCalSpecial(wxCommandEvent& event);
|
void OnCalSpecial(wxCommandEvent& event);
|
||||||
@@ -122,6 +131,29 @@ private:
|
|||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if wxUSE_DATEPICKERCTRL
|
||||||
|
|
||||||
|
// Define a simple modal dialog which asks the user for a date
|
||||||
|
class MyDialog : public wxDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyDialog(wxWindow *parent, const wxDateTime& dt);
|
||||||
|
|
||||||
|
wxDateTime GetDate() const { return m_datePicker->GetValue(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
void OnDateChange(wxDateEvent& event);
|
||||||
|
|
||||||
|
|
||||||
|
wxDatePickerCtrl *m_datePicker;
|
||||||
|
wxTextCtrl *m_text;
|
||||||
|
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // wxUSE_DATEPICKERCTRL
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -130,8 +162,11 @@ private:
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
// menu items
|
// menu items
|
||||||
Calendar_File_About = 100,
|
Calendar_File_About = wxID_ABOUT,
|
||||||
Calendar_File_Quit,
|
Calendar_File_Quit = wxID_EXIT,
|
||||||
|
#if wxUSE_DATEPICKERCTRL
|
||||||
|
Calendar_File_AskDate = 100,
|
||||||
|
#endif // wxUSE_DATEPICKERCTRL
|
||||||
Calendar_Cal_Monday = 200,
|
Calendar_Cal_Monday = 200,
|
||||||
Calendar_Cal_Holidays,
|
Calendar_Cal_Holidays,
|
||||||
Calendar_Cal_Special,
|
Calendar_Cal_Special,
|
||||||
@@ -155,6 +190,10 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(Calendar_File_Quit, MyFrame::OnQuit)
|
EVT_MENU(Calendar_File_Quit, MyFrame::OnQuit)
|
||||||
EVT_MENU(Calendar_File_About, MyFrame::OnAbout)
|
EVT_MENU(Calendar_File_About, MyFrame::OnAbout)
|
||||||
|
|
||||||
|
#if wxUSE_DATEPICKERCTRL
|
||||||
|
EVT_MENU(Calendar_File_AskDate, MyFrame::OnAskDate)
|
||||||
|
#endif // wxUSE_DATEPICKERCTRL
|
||||||
|
|
||||||
EVT_MENU(Calendar_Cal_Monday, MyFrame::OnCalMonday)
|
EVT_MENU(Calendar_Cal_Monday, MyFrame::OnCalMonday)
|
||||||
EVT_MENU(Calendar_Cal_Holidays, MyFrame::OnCalHolidays)
|
EVT_MENU(Calendar_Cal_Holidays, MyFrame::OnCalHolidays)
|
||||||
EVT_MENU(Calendar_Cal_Special, MyFrame::OnCalSpecial)
|
EVT_MENU(Calendar_Cal_Special, MyFrame::OnCalSpecial)
|
||||||
@@ -180,6 +219,14 @@ BEGIN_EVENT_TABLE(MyPanel, wxPanel)
|
|||||||
EVT_CALENDAR_WEEKDAY_CLICKED(Calendar_CalCtrl, MyPanel::OnCalendarWeekDayClick)
|
EVT_CALENDAR_WEEKDAY_CLICKED(Calendar_CalCtrl, MyPanel::OnCalendarWeekDayClick)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
#if wxUSE_DATEPICKERCTRL
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
|
||||||
|
EVT_DATE_CHANGED(wxID_ANY, MyDialog::OnDateChange)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
#endif // wxUSE_DATEPICKERCTRL
|
||||||
|
|
||||||
// Create a new application object: this macro will allow wxWidgets to create
|
// Create a new application object: this macro will allow wxWidgets to create
|
||||||
// the application object during program execution (it's better than using a
|
// the application object during program execution (it's better than using a
|
||||||
// static object for many reasons) and also declares the accessor function
|
// static object for many reasons) and also declares the accessor function
|
||||||
@@ -221,6 +268,11 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
|||||||
// create a menu bar
|
// create a menu bar
|
||||||
wxMenu *menuFile = new wxMenu;
|
wxMenu *menuFile = new wxMenu;
|
||||||
|
|
||||||
|
#if wxUSE_DATEPICKERCTRL
|
||||||
|
menuFile->Append(Calendar_File_AskDate, _T("&Choose date...\tCtrl-D"), _T("Show dialog with wxDatePickerCtrl"));
|
||||||
|
menuFile->AppendSeparator();
|
||||||
|
#endif // wxUSE_DATEPICKERCTRL
|
||||||
|
|
||||||
menuFile->Append(Calendar_File_About, _T("&About...\tCtrl-A"), _T("Show about dialog"));
|
menuFile->Append(Calendar_File_About, _T("&About...\tCtrl-A"), _T("Show about dialog"));
|
||||||
menuFile->AppendSeparator();
|
menuFile->AppendSeparator();
|
||||||
menuFile->Append(Calendar_File_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));
|
menuFile->Append(Calendar_File_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));
|
||||||
@@ -351,6 +403,30 @@ void MyFrame::OnToday(wxCommandEvent &WXUNUSED(event))
|
|||||||
m_panel->Today();
|
m_panel->Today();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_DATEPICKERCTRL
|
||||||
|
|
||||||
|
void MyFrame::OnAskDate(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
MyDialog dlg(this, m_panel->GetCal()->GetDate());
|
||||||
|
if ( dlg.ShowModal() == wxID_OK )
|
||||||
|
{
|
||||||
|
const wxDateTime dt = dlg.GetDate(),
|
||||||
|
today = wxDateTime::Today();
|
||||||
|
|
||||||
|
if ( dt.GetDay() == today.GetDay() &&
|
||||||
|
dt.GetMonth() == today.GetMonth() )
|
||||||
|
{
|
||||||
|
wxMessageBox(_T("Happy birthday!"), _T("Calendar Sample"));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_panel->GetCal()->SetDate(dt);
|
||||||
|
|
||||||
|
wxLogStatus(_T("Changed the date to your birthday"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_DATEPICKERCTRL
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// MyPanel
|
// MyPanel
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -455,3 +531,53 @@ void MyPanel::Today()
|
|||||||
{
|
{
|
||||||
m_calendar->SetDate(wxDateTime::Today());
|
m_calendar->SetDate(wxDateTime::Today());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// MyDialog
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if wxUSE_DATEPICKERCTRL
|
||||||
|
|
||||||
|
MyDialog::MyDialog(wxWindow *parent, const wxDateTime& dt)
|
||||||
|
: wxDialog(parent, -1, wxString(_T("Calendar: Choose a date")))
|
||||||
|
{
|
||||||
|
wxStdDialogButtonSizer *sizerBtns = new wxStdDialogButtonSizer;
|
||||||
|
sizerBtns->AddButton(new wxButton(this, wxID_OK));
|
||||||
|
sizerBtns->AddButton(new wxButton(this, wxID_CANCEL));
|
||||||
|
sizerBtns->Finalise();
|
||||||
|
|
||||||
|
wxSizer *sizerText = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
sizerText->Add(new wxStaticText(this, -1, _T("Date in ISO format: ")),
|
||||||
|
wxSizerFlags().Border());
|
||||||
|
m_text = new wxTextCtrl(this, -1);
|
||||||
|
sizerText->Add(m_text, wxSizerFlags().Expand().Border());
|
||||||
|
|
||||||
|
wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
|
||||||
|
sizerTop->Add(new wxStaticText
|
||||||
|
(
|
||||||
|
this, -1,
|
||||||
|
_T("Enter your birthday date (not before 20th century):")
|
||||||
|
),
|
||||||
|
wxSizerFlags().Border());
|
||||||
|
|
||||||
|
m_datePicker = new wxDatePickerCtrl(this, -1, dt);
|
||||||
|
m_datePicker->SetRange(wxDateTime(1, wxDateTime::Jan, 1900),
|
||||||
|
wxDefaultDateTime);
|
||||||
|
sizerTop->Add(m_datePicker, wxSizerFlags().Expand().Border());
|
||||||
|
|
||||||
|
sizerTop->AddStretchSpacer(1);
|
||||||
|
sizerTop->Add(sizerText);
|
||||||
|
|
||||||
|
sizerTop->Add(sizerBtns, wxSizerFlags().Centre().Border());
|
||||||
|
|
||||||
|
SetSizerAndFit(sizerTop);
|
||||||
|
Layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyDialog::OnDateChange(wxDateEvent& event)
|
||||||
|
{
|
||||||
|
m_text->SetValue(event.GetDate().FormatISODate());
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_DATEPICKERCTRL
|
||||||
|
|
||||||
|
@@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#include "wx/spinctrl.h"
|
#include "wx/spinctrl.h"
|
||||||
|
|
||||||
|
#define _WX_DEFINE_DATE_EVENTS_
|
||||||
#include "wx/calctrl.h"
|
#include "wx/calctrl.h"
|
||||||
|
|
||||||
#define DEBUG_PAINT 0
|
#define DEBUG_PAINT 0
|
||||||
@@ -162,7 +163,7 @@ wxCONSTRUCTOR_6( wxCalendarCtrl , wxWindow* , Parent , wxWindowID , Id , wxDateT
|
|||||||
#else
|
#else
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxCalendarCtrl, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxCalendarCtrl, wxControl)
|
||||||
#endif
|
#endif
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxCalendarEvent, wxCommandEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxCalendarEvent, wxDateEvent)
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// events
|
// events
|
||||||
@@ -1820,22 +1821,5 @@ wxCalendarCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
|
|||||||
return wxListBox::GetClassDefaultAttributes(variant);
|
return wxListBox::GetClassDefaultAttributes(variant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxCalendarEvent
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void wxCalendarEvent::Init()
|
|
||||||
{
|
|
||||||
m_wday = wxDateTime::Inv_WeekDay;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxCalendarEvent::wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type)
|
|
||||||
: wxCommandEvent(type, cal->GetId())
|
|
||||||
{
|
|
||||||
m_date = cal->GetDate();
|
|
||||||
SetEventObject(cal);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_CALENDARCTRL
|
#endif // wxUSE_CALENDARCTRL
|
||||||
|
|
||||||
|
224
src/msw/datectrl.cpp
Normal file
224
src/msw/datectrl.cpp
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: msw/datectrl.cpp
|
||||||
|
// Purpose: wxDatePickerCtrl implementation
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Modified by:
|
||||||
|
// Created: 2005-01-09
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/datectrl.h"
|
||||||
|
|
||||||
|
#define _WX_DEFINE_DATE_EVENTS_
|
||||||
|
#include "wx/dateevt.h"
|
||||||
|
|
||||||
|
#include "wx/msw/wrapwin.h"
|
||||||
|
#include "wx/msw/wrapcctl.h"
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// helpers for wxDateTime <-> SYSTEMTIME conversion
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static inline void wxFromSystemTime(wxDateTime *dt, const SYSTEMTIME& st)
|
||||||
|
{
|
||||||
|
dt->Set(st.wDay,
|
||||||
|
wx_static_cast(wxDateTime::Month, wxDateTime::Jan + st.wMonth - 1),
|
||||||
|
st.wYear,
|
||||||
|
0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void wxToSystemTime(SYSTEMTIME *st, const wxDateTime& dt)
|
||||||
|
{
|
||||||
|
const wxDateTime::Tm tm(dt.GetTm());
|
||||||
|
|
||||||
|
st->wYear = tm.year;
|
||||||
|
st->wMonth = tm.mon - wxDateTime::Jan + 1;
|
||||||
|
st->wDay = tm.mday;
|
||||||
|
|
||||||
|
st->wDayOfWeek =
|
||||||
|
st->wHour =
|
||||||
|
st->wMinute =
|
||||||
|
st->wSecond =
|
||||||
|
st->wMilliseconds = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxDatePickerCtrl creation
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool
|
||||||
|
wxDatePickerCtrl::Create(wxWindow *parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxDateTime& dt,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
const wxValidator& validator,
|
||||||
|
const wxString& name)
|
||||||
|
{
|
||||||
|
// initialize the base class
|
||||||
|
if ( !CreateControl(parent, id, pos, size, style, validator, name) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// create the native control
|
||||||
|
if ( !MSWCreateControl(DATETIMEPICK_CLASS, _T(""), pos, size) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( dt.IsValid() )
|
||||||
|
SetValue(dt);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
WXDWORD wxDatePickerCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
|
||||||
|
{
|
||||||
|
WXDWORD styleMSW = wxDatePickerCtrlBase::MSWGetStyle(style, exstyle);
|
||||||
|
|
||||||
|
// for now this is unconditional, but we should support drop down control
|
||||||
|
// style as well later
|
||||||
|
styleMSW |= DTS_UPDOWN | DTS_SHORTDATEFORMAT;
|
||||||
|
|
||||||
|
return styleMSW;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: handle WM_WININICHANGE
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxDatePickerCtrl geometry
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxSize wxDatePickerCtrl::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
const int y = GetCharHeight();
|
||||||
|
|
||||||
|
return wxSize(DEFAULT_ITEM_WIDTH, EDIT_HEIGHT_FROM_CHAR_HEIGHT(y));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxDatePickerCtrl operations
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxDatePickerCtrl::SetValue(const wxDateTime& dt)
|
||||||
|
{
|
||||||
|
// as we don't support DTS_SHOWNONE style so far, we don't allow setting
|
||||||
|
// the control to an invalid date, but this restriction may be lifted in
|
||||||
|
// the future
|
||||||
|
wxCHECK_RET( dt.IsValid(), _T("invalid date") );
|
||||||
|
|
||||||
|
SYSTEMTIME st;
|
||||||
|
wxToSystemTime(&st, dt);
|
||||||
|
if ( !DateTime_SetSystemtime(GetHwnd(), GDT_VALID, &st) )
|
||||||
|
{
|
||||||
|
wxLogDebug(_T("DateTime_SetSystemtime() failed"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wxDateTime wxDatePickerCtrl::GetValue() const
|
||||||
|
{
|
||||||
|
wxDateTime dt;
|
||||||
|
SYSTEMTIME st;
|
||||||
|
if ( DateTime_GetSystemtime(GetHwnd(), &st) == GDT_VALID )
|
||||||
|
{
|
||||||
|
wxFromSystemTime(&dt, st);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dt;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDatePickerCtrl::SetRange(const wxDateTime& dt1, const wxDateTime& dt2)
|
||||||
|
{
|
||||||
|
SYSTEMTIME st[2];
|
||||||
|
|
||||||
|
DWORD flags = 0;
|
||||||
|
if ( dt1.IsValid() )
|
||||||
|
{
|
||||||
|
wxToSystemTime(&st[0], dt1);
|
||||||
|
flags |= GDTR_MIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( dt2.IsValid() )
|
||||||
|
{
|
||||||
|
wxToSystemTime(&st[1], dt2);
|
||||||
|
flags |= GDTR_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !DateTime_SetRange(GetHwnd(), flags, st) )
|
||||||
|
{
|
||||||
|
wxLogDebug(_T("DateTime_SetRange() failed"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) const
|
||||||
|
{
|
||||||
|
SYSTEMTIME st[2];
|
||||||
|
|
||||||
|
DWORD flags = DateTime_GetRange(GetHwnd(), st);
|
||||||
|
if ( dt1 )
|
||||||
|
{
|
||||||
|
if ( flags & GDTR_MIN )
|
||||||
|
wxFromSystemTime(dt1, st[0]);
|
||||||
|
else
|
||||||
|
*dt1 = wxDefaultDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( dt2 )
|
||||||
|
{
|
||||||
|
if ( flags & GDTR_MAX )
|
||||||
|
wxFromSystemTime(dt2, st[1]);
|
||||||
|
else
|
||||||
|
*dt2 = wxDefaultDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxDatePickerCtrl events
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool
|
||||||
|
wxDatePickerCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||||
|
{
|
||||||
|
NMHDR* hdr = (NMHDR *)lParam;
|
||||||
|
switch ( hdr->code )
|
||||||
|
{
|
||||||
|
case DTN_DATETIMECHANGE:
|
||||||
|
NMDATETIMECHANGE *dtch = (NMDATETIMECHANGE *)hdr;
|
||||||
|
wxDateTime dt;
|
||||||
|
if ( dtch->dwFlags == GDT_VALID )
|
||||||
|
wxFromSystemTime(&dt, dtch->st);
|
||||||
|
|
||||||
|
wxDateEvent event(this, dt, wxEVT_DATE_CHANGED);
|
||||||
|
if ( GetEventHandler()->ProcessEvent(event) )
|
||||||
|
{
|
||||||
|
*result = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return wxDatePickerCtrlBase::MSWOnNotify(idCtrl, lParam, result);
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user