Add API for determining the first day of the week and use it in
wxCalendarCtrl.

Closes https://github.com/wxWidgets/wxWidgets/pull/522
This commit is contained in:
Vadim Zeitlin
2017-09-10 21:37:36 +02:00
16 changed files with 248 additions and 31 deletions

View File

@@ -8,7 +8,7 @@
enum
{
// show Sunday as the first day of the week (default)
wxCAL_SUNDAY_FIRST = 0x0000,
wxCAL_SUNDAY_FIRST = 0x0080,
// show Monday as the first day of the week
wxCAL_MONDAY_FIRST = 0x0001,
@@ -254,6 +254,11 @@ enum wxCalendarHitTestResult
month is changed, so you will often want to update them in
@c EVT_CALENDAR_PAGE_CHANGED event handler.
If neither the @c wxCAL_SUNDAY_FIRST or @c wxCAL_MONDAY_FIRST style is given,
the first day of the week is determined from operating system's settings,
if possible. The native wxGTK calendar chooses the first weekday based on
locale, and these styles have no effect on it.
@beginStyleTable
@style{wxCAL_SUNDAY_FIRST}
Show Sunday as the first day in the week (not in wxGTK)

View File

@@ -1483,6 +1483,18 @@ public:
static bool IsDSTApplicable(int year = Inv_Year,
Country country = Country_Default);
/**
Acquires the first weekday of a week based on locale and/or OS settings.
If the information was not available, returns @c Sun.
@param firstDay
The address of a WeekDay variable to which the first weekday will be
assigned to.
@return If the first day could not be determined, returns false,
and @a firstDay is set to a fallback value.
@since 3.1.1
*/
static bool GetFirstWeekDay(WeekDay *firstDay);
/**
Returns @true if the @a year is a leap one in the specified calendar.
This functions supports Gregorian and Julian calendars.