Hi,
the current WCalendar implementation lets you select dates which are
earlier then the bottom or later than the top date. The attached patches
fixes this problem.
Regards,
Stefan
*** wt-3.2.1-orig/src/Wt/WCalendar.C 2012-09-21 16:07:39.000000000 +0200
--- wt-3.2.1/src/Wt/WCalendar.C 2012-09-21 16:27:38.000000000 +0200
***************
*** 293,300 ****
std::string styleClass;
! if ((!bottom_.isNull() && date < bottom_) ||
! (!top_.isNull() && date > top_))
styleClass += " Wt-cal-oor";
else if (date.month() != currentMonth())
styleClass += " Wt-cal-oom";
--- 293,299 ----
std::string styleClass;
! if (isInvalid(date))
styleClass += " Wt-cal-oor";
else if (date.month() != currentMonth())
styleClass += " Wt-cal-oom";
***************
*** 389,407 ****
}
}
void WCalendar::cellClicked(Coordinate weekday)
{
date dt = dateForCell(weekday.i, weekday.j);
! clicked().emit(WDate(dt.year(), dt.month(), dt.day()));
if (selectionMode_ != ExtendedSelection && singleClickSelect_)
! activated().emit(WDate(dt.year(), dt.month(), dt.day()));
}
void WCalendar::cellDblClicked(Coordinate weekday)
{
date dt = dateForCell(weekday.i, weekday.j);
! activated().emit(WDate(dt.year(), dt.month(), dt.day()));
}
date WCalendar::dateForCell(int week, int dayOfWeek)
--- 388,420 ----
}
}
+ bool WCalendar::isInvalid(const WDate& dt)
+ {
+ return ((!bottom_.isNull() && dt < bottom_) ||
+ (!top_.isNull() && dt > top_));
+ }
+
void WCalendar::cellClicked(Coordinate weekday)
{
date dt = dateForCell(weekday.i, weekday.j);
! WDate d(dt.year(), dt.month(), dt.day());
! if (isInvalid(d))
! return;
!
! clicked().emit(d);
if (selectionMode_ != ExtendedSelection && singleClickSelect_)
! activated().emit(d);
}
void WCalendar::cellDblClicked(Coordinate weekday)
{
date dt = dateForCell(weekday.i, weekday.j);
! WDate d(dt.year(), dt.month(), dt.day());
! if (isInvalid(d))
! return;
!
! activated().emit(d);
}
date WCalendar::dateForCell(int week, int dayOfWeek)
*** wt-3.2.1-orig/src/Wt/WCalendar 2012-09-21 16:07:39.000000000 +0200
--- wt-3.2.1/src/Wt/WCalendar 2012-09-21 16:23:44.000000000 +0200
***************
*** 387,392 ****
--- 387,393 ----
void selectInCurrentMonth(const WDate& d);
+ bool isInvalid(const WDate& d);
void cellClicked(Coordinate c);
void cellDblClicked(Coordinate c);
};
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest