Highlight current system date in BCalendarView.
* Issue: In BCalendarView presently, there is no notion of a current date and the current date is not highlighted. So in the deskbar tray calendar which uses BCalendarView, we cannot know the current date once we change the selected day. * Fix: Make BCalendarView accept pulse messages, check for system date with every pulse message and update the current date accordingly. Highlight the current date by rendering its day number text in a different color. Signed-off-by: Adrien Destugues <[email protected]> ticket : #13592
This commit is contained in:
committed by
Adrien Destugues
parent
3ceec1db72
commit
8013f2e07d
@@ -28,11 +28,11 @@ public:
|
|||||||
BCalendarView(BRect frame, const char* name,
|
BCalendarView(BRect frame, const char* name,
|
||||||
uint32 resizeMask = B_FOLLOW_LEFT_TOP,
|
uint32 resizeMask = B_FOLLOW_LEFT_TOP,
|
||||||
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS
|
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS
|
||||||
| B_NAVIGABLE);
|
| B_NAVIGABLE | B_PULSE_NEEDED);
|
||||||
|
|
||||||
BCalendarView(const char* name,
|
BCalendarView(const char* name,
|
||||||
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS
|
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS
|
||||||
| B_NAVIGABLE);
|
| B_NAVIGABLE | B_PULSE_NEEDED);
|
||||||
|
|
||||||
virtual ~BCalendarView();
|
virtual ~BCalendarView();
|
||||||
|
|
||||||
@@ -49,7 +49,8 @@ public:
|
|||||||
|
|
||||||
virtual void DrawDay(BView* owner, BRect frame,
|
virtual void DrawDay(BView* owner, BRect frame,
|
||||||
const char* text, bool isSelected = false,
|
const char* text, bool isSelected = false,
|
||||||
bool isEnabled = true, bool focus = false);
|
bool isEnabled = true, bool focus = false,
|
||||||
|
bool highlight = false);
|
||||||
virtual void DrawDayName(BView* owner, BRect frame,
|
virtual void DrawDayName(BView* owner, BRect frame,
|
||||||
const char* text);
|
const char* text);
|
||||||
virtual void DrawWeekNumber(BView* owner, BRect frame,
|
virtual void DrawWeekNumber(BView* owner, BRect frame,
|
||||||
@@ -70,6 +71,8 @@ public:
|
|||||||
|
|
||||||
virtual void KeyDown(const char* bytes, int32 numBytes);
|
virtual void KeyDown(const char* bytes, int32 numBytes);
|
||||||
|
|
||||||
|
virtual void Pulse();
|
||||||
|
|
||||||
virtual void ResizeToPreferred();
|
virtual void ResizeToPreferred();
|
||||||
virtual void GetPreferredSize(float* width, float* height);
|
virtual void GetPreferredSize(float* width, float* height);
|
||||||
|
|
||||||
@@ -138,6 +141,7 @@ private:
|
|||||||
void _InitObject();
|
void _InitObject();
|
||||||
|
|
||||||
void _SetToDay();
|
void _SetToDay();
|
||||||
|
void _SetToCurrentDay();
|
||||||
void _GetYearMonthForSelection(
|
void _GetYearMonthForSelection(
|
||||||
const Selection& selection, int32* year,
|
const Selection& selection, int32* year,
|
||||||
int32* month) const;
|
int32* month) const;
|
||||||
@@ -154,12 +158,16 @@ private:
|
|||||||
void _DrawDay(int32 curRow, int32 curColumn,
|
void _DrawDay(int32 curRow, int32 curColumn,
|
||||||
int32 row, int32 column, int32 counter,
|
int32 row, int32 column, int32 counter,
|
||||||
BRect frame, const char* text,
|
BRect frame, const char* text,
|
||||||
bool focus = false);
|
bool focus = false, bool highlight = false);
|
||||||
void _DrawItem(BView* owner, BRect frame,
|
void _DrawItem(BView* owner, BRect frame,
|
||||||
const char* text, bool isSelected = false,
|
const char* text, bool isSelected = false,
|
||||||
bool isEnabled = true, bool focus = false);
|
bool isEnabled = true, bool focus = false,
|
||||||
|
bool highlight = false);
|
||||||
|
|
||||||
void _UpdateSelection();
|
void _UpdateSelection();
|
||||||
|
void _UpdateCurrentDay();
|
||||||
|
void _UpdateCurrentDate();
|
||||||
|
|
||||||
BRect _FirstCalendarItemFrame() const;
|
BRect _FirstCalendarItemFrame() const;
|
||||||
BRect _SetNewSelectedDay(const BPoint& where);
|
BRect _SetNewSelectedDay(const BPoint& where);
|
||||||
|
|
||||||
@@ -169,6 +177,7 @@ private:
|
|||||||
BMessage* fSelectionMessage;
|
BMessage* fSelectionMessage;
|
||||||
|
|
||||||
BDate fDate;
|
BDate fDate;
|
||||||
|
BDate fCurrentDate;
|
||||||
|
|
||||||
Selection fFocusedDay;
|
Selection fFocusedDay;
|
||||||
Selection fNewFocusedDay;
|
Selection fNewFocusedDay;
|
||||||
@@ -178,6 +187,10 @@ private:
|
|||||||
Selection fNewSelectedDay;
|
Selection fNewSelectedDay;
|
||||||
bool fSelectionChanged;
|
bool fSelectionChanged;
|
||||||
|
|
||||||
|
Selection fCurrentDay;
|
||||||
|
Selection fNewCurrentDay;
|
||||||
|
bool fCurrentDayChanged;
|
||||||
|
|
||||||
int32 fStartOfWeek;
|
int32 fStartOfWeek;
|
||||||
bool fDayNameHeaderVisible;
|
bool fDayNameHeaderVisible;
|
||||||
bool fWeekNumberHeaderVisible;
|
bool fWeekNumberHeaderVisible;
|
||||||
|
|||||||
@@ -42,8 +42,10 @@ BCalendarView::BCalendarView(BRect frame, const char* name, uint32 resizeMask,
|
|||||||
BInvoker(),
|
BInvoker(),
|
||||||
fSelectionMessage(NULL),
|
fSelectionMessage(NULL),
|
||||||
fDate(),
|
fDate(),
|
||||||
|
fCurrentDate(BDate::CurrentDate(B_LOCAL_TIME)),
|
||||||
fFocusChanged(false),
|
fFocusChanged(false),
|
||||||
fSelectionChanged(false),
|
fSelectionChanged(false),
|
||||||
|
fCurrentDayChanged(false),
|
||||||
fStartOfWeek((int32)B_WEEKDAY_MONDAY),
|
fStartOfWeek((int32)B_WEEKDAY_MONDAY),
|
||||||
fDayNameHeaderVisible(true),
|
fDayNameHeaderVisible(true),
|
||||||
fWeekNumberHeaderVisible(true)
|
fWeekNumberHeaderVisible(true)
|
||||||
@@ -58,8 +60,10 @@ BCalendarView::BCalendarView(const char* name, uint32 flags)
|
|||||||
BInvoker(),
|
BInvoker(),
|
||||||
fSelectionMessage(NULL),
|
fSelectionMessage(NULL),
|
||||||
fDate(),
|
fDate(),
|
||||||
|
fCurrentDate(BDate::CurrentDate(B_LOCAL_TIME)),
|
||||||
fFocusChanged(false),
|
fFocusChanged(false),
|
||||||
fSelectionChanged(false),
|
fSelectionChanged(false),
|
||||||
|
fCurrentDayChanged(false),
|
||||||
fStartOfWeek((int32)B_WEEKDAY_MONDAY),
|
fStartOfWeek((int32)B_WEEKDAY_MONDAY),
|
||||||
fDayNameHeaderVisible(true),
|
fDayNameHeaderVisible(true),
|
||||||
fWeekNumberHeaderVisible(true)
|
fWeekNumberHeaderVisible(true)
|
||||||
@@ -80,8 +84,10 @@ BCalendarView::BCalendarView(BMessage* archive)
|
|||||||
BInvoker(),
|
BInvoker(),
|
||||||
fSelectionMessage(NULL),
|
fSelectionMessage(NULL),
|
||||||
fDate(archive),
|
fDate(archive),
|
||||||
|
fCurrentDate(BDate::CurrentDate(B_LOCAL_TIME)),
|
||||||
fFocusChanged(false),
|
fFocusChanged(false),
|
||||||
fSelectionChanged(false),
|
fSelectionChanged(false),
|
||||||
|
fCurrentDayChanged(false),
|
||||||
fStartOfWeek((int32)B_WEEKDAY_MONDAY),
|
fStartOfWeek((int32)B_WEEKDAY_MONDAY),
|
||||||
fDayNameHeaderVisible(true),
|
fDayNameHeaderVisible(true),
|
||||||
fWeekNumberHeaderVisible(true)
|
fWeekNumberHeaderVisible(true)
|
||||||
@@ -185,6 +191,12 @@ BCalendarView::Draw(BRect updateRect)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fCurrentDayChanged) {
|
||||||
|
_UpdateCurrentDay();
|
||||||
|
UnlockLooper();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_DrawDays();
|
_DrawDays();
|
||||||
_DrawDayHeader();
|
_DrawDayHeader();
|
||||||
_DrawWeekHeader();
|
_DrawWeekHeader();
|
||||||
@@ -200,9 +212,9 @@ BCalendarView::Draw(BRect updateRect)
|
|||||||
|
|
||||||
void
|
void
|
||||||
BCalendarView::DrawDay(BView* owner, BRect frame, const char* text,
|
BCalendarView::DrawDay(BView* owner, BRect frame, const char* text,
|
||||||
bool isSelected, bool isEnabled, bool focus)
|
bool isSelected, bool isEnabled, bool focus, bool highlight)
|
||||||
{
|
{
|
||||||
_DrawItem(owner, frame, text, isSelected, isEnabled, focus);
|
_DrawItem(owner, frame, text, isSelected, isEnabled, focus, highlight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -463,6 +475,13 @@ BCalendarView::KeyDown(const char* bytes, int32 numBytes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BCalendarView::Pulse()
|
||||||
|
{
|
||||||
|
_UpdateCurrentDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BCalendarView::ResizeToPreferred()
|
BCalendarView::ResizeToPreferred()
|
||||||
{
|
{
|
||||||
@@ -741,6 +760,30 @@ BCalendarView::_SetToDay()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BCalendarView::_SetToCurrentDay()
|
||||||
|
{
|
||||||
|
BDate date(fDate.Year(), fDate.Month(), 1);
|
||||||
|
if (!date.IsValid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const int32 firstDayOffset = (7 + date.DayOfWeek() - fStartOfWeek) % 7;
|
||||||
|
|
||||||
|
int32 day = 1 - firstDayOffset;
|
||||||
|
for (int32 row = 0; row < 6; ++row) {
|
||||||
|
for (int32 column = 0; column < 7; ++column) {
|
||||||
|
if (day == fCurrentDate.Day()) {
|
||||||
|
fNewCurrentDay.SetTo(row, column);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
day++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fNewCurrentDay.SetTo(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BCalendarView::_GetYearMonthForSelection(const Selection& selection,
|
BCalendarView::_GetYearMonthForSelection(const Selection& selection,
|
||||||
int32* year, int32* month) const
|
int32* year, int32* month) const
|
||||||
@@ -813,6 +856,7 @@ BCalendarView::_SetupDayNumbers()
|
|||||||
fFocusedDay.SetTo(0, 0);
|
fFocusedDay.SetTo(0, 0);
|
||||||
fSelectedDay.SetTo(0, 0);
|
fSelectedDay.SetTo(0, 0);
|
||||||
fNewFocusedDay.SetTo(0, 0);
|
fNewFocusedDay.SetTo(0, 0);
|
||||||
|
fCurrentDay.SetTo(-1, -1);
|
||||||
|
|
||||||
const int32 daysInMonth = startOfMonth.DaysInMonth();
|
const int32 daysInMonth = startOfMonth.DaysInMonth();
|
||||||
const int32 firstDayOffset
|
const int32 firstDayOffset
|
||||||
@@ -837,6 +881,9 @@ BCalendarView::_SetupDayNumbers()
|
|||||||
fSelectedDay.SetTo(row, column);
|
fSelectedDay.SetTo(row, column);
|
||||||
fNewFocusedDay.SetTo(row, column);
|
fNewFocusedDay.SetTo(row, column);
|
||||||
}
|
}
|
||||||
|
if (day == fCurrentDate.Day()
|
||||||
|
&& fDate.Month() == fCurrentDate.Month())
|
||||||
|
fCurrentDay.SetTo(row, column);
|
||||||
counter++;
|
counter++;
|
||||||
fDayNumbers[row][column].Truncate(0);
|
fDayNumbers[row][column].Truncate(0);
|
||||||
fDayNumbers[row][column] << day;
|
fDayNumbers[row][column] << day;
|
||||||
@@ -862,7 +909,8 @@ BCalendarView::_SetupWeekNumbers()
|
|||||||
|
|
||||||
void
|
void
|
||||||
BCalendarView::_DrawDay(int32 currRow, int32 currColumn, int32 row,
|
BCalendarView::_DrawDay(int32 currRow, int32 currColumn, int32 row,
|
||||||
int32 column, int32 counter, BRect frame, const char* text, bool focus)
|
int32 column, int32 counter, BRect frame, const char* text,
|
||||||
|
bool focus, bool highlight)
|
||||||
{
|
{
|
||||||
BDate startOfMonth(fDate.Year(), fDate.Month(), 1);
|
BDate startOfMonth(fDate.Year(), fDate.Month(), 1);
|
||||||
const int32 firstDayOffset
|
const int32 firstDayOffset
|
||||||
@@ -883,7 +931,7 @@ BCalendarView::_DrawDay(int32 currRow, int32 currColumn, int32 row,
|
|||||||
enabled = false; // days of month before or after
|
enabled = false; // days of month before or after
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawDay(this, frame, text, selected, enabled, focus);
|
DrawDay(this, frame, text, selected, enabled, focus, highlight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -899,6 +947,9 @@ BCalendarView::_DrawDays()
|
|||||||
const int32 focusRow = fFocusedDay.row;
|
const int32 focusRow = fFocusedDay.row;
|
||||||
const int32 focusColumn = fFocusedDay.column;
|
const int32 focusColumn = fFocusedDay.column;
|
||||||
|
|
||||||
|
const int32 highlightRow = fCurrentDay.row;
|
||||||
|
const int32 highlightColumn = fCurrentDay.column;
|
||||||
|
|
||||||
int32 counter = 0;
|
int32 counter = 0;
|
||||||
for (int32 row = 0; row < 6; ++row) {
|
for (int32 row = 0; row < 6; ++row) {
|
||||||
BRect tmp = frame;
|
BRect tmp = frame;
|
||||||
@@ -906,8 +957,9 @@ BCalendarView::_DrawDays()
|
|||||||
counter++;
|
counter++;
|
||||||
const char* day = fDayNumbers[row][column].String();
|
const char* day = fDayNumbers[row][column].String();
|
||||||
bool focus = isFocus && focusRow == row && focusColumn == column;
|
bool focus = isFocus && focusRow == row && focusColumn == column;
|
||||||
|
bool highlight = highlightRow == row && highlightColumn == column;
|
||||||
_DrawDay(currRow, currColumn, row, column, counter, tmp, day,
|
_DrawDay(currRow, currColumn, row, column, counter, tmp, day,
|
||||||
focus);
|
focus, highlight);
|
||||||
|
|
||||||
tmp.OffsetBy(tmp.Width(), 0.0);
|
tmp.OffsetBy(tmp.Width(), 0.0);
|
||||||
}
|
}
|
||||||
@@ -927,6 +979,9 @@ BCalendarView::_DrawFocusRect()
|
|||||||
const int32 focusRow = fFocusedDay.row;
|
const int32 focusRow = fFocusedDay.row;
|
||||||
const int32 focusColumn = fFocusedDay.column;
|
const int32 focusColumn = fFocusedDay.column;
|
||||||
|
|
||||||
|
const int32 highlightRow = fCurrentDay.row;
|
||||||
|
const int32 highlightColumn = fCurrentDay.column;
|
||||||
|
|
||||||
int32 counter = 0;
|
int32 counter = 0;
|
||||||
for (int32 row = 0; row < 6; ++row) {
|
for (int32 row = 0; row < 6; ++row) {
|
||||||
BRect tmp = frame;
|
BRect tmp = frame;
|
||||||
@@ -936,13 +991,15 @@ BCalendarView::_DrawFocusRect()
|
|||||||
fFocusedDay.SetTo(row, column);
|
fFocusedDay.SetTo(row, column);
|
||||||
|
|
||||||
bool focus = IsFocus() && true;
|
bool focus = IsFocus() && true;
|
||||||
|
bool highlight = highlightRow == row && highlightColumn == column;
|
||||||
const char* day = fDayNumbers[row][column].String();
|
const char* day = fDayNumbers[row][column].String();
|
||||||
_DrawDay(currRow, currColumn, row, column, counter, tmp, day,
|
_DrawDay(currRow, currColumn, row, column, counter, tmp, day,
|
||||||
focus);
|
focus, highlight);
|
||||||
} else if (focusRow == row && focusColumn == column) {
|
} else if (focusRow == row && focusColumn == column) {
|
||||||
const char* day = fDayNumbers[row][column].String();
|
const char* day = fDayNumbers[row][column].String();
|
||||||
|
bool highlight = highlightRow == row && highlightColumn == column;
|
||||||
_DrawDay(currRow, currColumn, row, column, counter, tmp, day,
|
_DrawDay(currRow, currColumn, row, column, counter, tmp, day,
|
||||||
false);
|
false, highlight);
|
||||||
}
|
}
|
||||||
tmp.OffsetBy(tmp.Width(), 0.0);
|
tmp.OffsetBy(tmp.Width(), 0.0);
|
||||||
}
|
}
|
||||||
@@ -1010,7 +1067,7 @@ BCalendarView::_DrawWeekHeader()
|
|||||||
|
|
||||||
void
|
void
|
||||||
BCalendarView::_DrawItem(BView* owner, BRect frame, const char* text,
|
BCalendarView::_DrawItem(BView* owner, BRect frame, const char* text,
|
||||||
bool isSelected, bool isEnabled, bool focus)
|
bool isSelected, bool isEnabled, bool focus, bool isHighlight)
|
||||||
{
|
{
|
||||||
rgb_color lColor = LowColor();
|
rgb_color lColor = LowColor();
|
||||||
rgb_color highColor = HighColor();
|
rgb_color highColor = HighColor();
|
||||||
@@ -1027,6 +1084,10 @@ BCalendarView::_DrawItem(BView* owner, BRect frame, const char* text,
|
|||||||
} else
|
} else
|
||||||
SetHighColor(ui_color(B_LIST_BACKGROUND_COLOR));
|
SetHighColor(ui_color(B_LIST_BACKGROUND_COLOR));
|
||||||
|
|
||||||
|
if (isHighlight) {
|
||||||
|
textColor = keyboard_navigation_color();
|
||||||
|
}
|
||||||
|
|
||||||
SetLowColor(HighColor());
|
SetLowColor(HighColor());
|
||||||
|
|
||||||
FillRect(frame.InsetByCopy(1.0, 1.0));
|
FillRect(frame.InsetByCopy(1.0, 1.0));
|
||||||
@@ -1062,6 +1123,9 @@ BCalendarView::_UpdateSelection()
|
|||||||
const int32 focusRow = fFocusedDay.row;
|
const int32 focusRow = fFocusedDay.row;
|
||||||
const int32 focusColumn = fFocusedDay.column;
|
const int32 focusColumn = fFocusedDay.column;
|
||||||
|
|
||||||
|
const int32 highlightRow = fCurrentDay.row;
|
||||||
|
const int32 highlightColumn = fCurrentDay.column;
|
||||||
|
|
||||||
int32 counter = 0;
|
int32 counter = 0;
|
||||||
for (int32 row = 0; row < 6; ++row) {
|
for (int32 row = 0; row < 6; ++row) {
|
||||||
BRect tmp = frame;
|
BRect tmp = frame;
|
||||||
@@ -1074,12 +1138,14 @@ BCalendarView::_UpdateSelection()
|
|||||||
const char* day = fDayNumbers[row][column].String();
|
const char* day = fDayNumbers[row][column].String();
|
||||||
bool focus = IsFocus() && focusRow == row
|
bool focus = IsFocus() && focusRow == row
|
||||||
&& focusColumn == column;
|
&& focusColumn == column;
|
||||||
_DrawDay(row, column, row, column, counter, tmp, day, focus);
|
bool highlight = highlightRow == row && highlightColumn == column;
|
||||||
|
_DrawDay(row, column, row, column, counter, tmp, day, focus, highlight);
|
||||||
} else if (currRow == row && currColumn == column) {
|
} else if (currRow == row && currColumn == column) {
|
||||||
const char* day = fDayNumbers[row][column].String();
|
const char* day = fDayNumbers[row][column].String();
|
||||||
bool focus = IsFocus() && focusRow == row
|
bool focus = IsFocus() && focusRow == row
|
||||||
&& focusColumn == column;
|
&& focusColumn == column;
|
||||||
_DrawDay(currRow, currColumn, -1, -1, counter, tmp, day, focus);
|
bool highlight = highlightRow == row && highlightColumn == column;
|
||||||
|
_DrawDay(currRow, currColumn, -1, -1, counter, tmp, day, focus, highlight);
|
||||||
}
|
}
|
||||||
tmp.OffsetBy(tmp.Width(), 0.0);
|
tmp.OffsetBy(tmp.Width(), 0.0);
|
||||||
}
|
}
|
||||||
@@ -1088,6 +1154,79 @@ BCalendarView::_UpdateSelection()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BCalendarView::_UpdateCurrentDay()
|
||||||
|
{
|
||||||
|
BRect frame = _FirstCalendarItemFrame();
|
||||||
|
|
||||||
|
const int32 selectRow = fSelectedDay.row;
|
||||||
|
const int32 selectColumn = fSelectedDay.column;
|
||||||
|
|
||||||
|
const int32 focusRow = fFocusedDay.row;
|
||||||
|
const int32 focusColumn = fFocusedDay.column;
|
||||||
|
|
||||||
|
const int32 currRow = fCurrentDay.row;
|
||||||
|
const int32 currColumn = fCurrentDay.column;
|
||||||
|
|
||||||
|
int32 counter = 0;
|
||||||
|
for (int32 row = 0; row < 6; ++row) {
|
||||||
|
BRect tmp = frame;
|
||||||
|
for (int32 column = 0; column < 7; ++column) {
|
||||||
|
counter++;
|
||||||
|
if (fNewCurrentDay.row == row
|
||||||
|
&& fNewCurrentDay.column == column) {
|
||||||
|
fCurrentDay.SetTo(row, column);
|
||||||
|
|
||||||
|
const char* day = fDayNumbers[row][column].String();
|
||||||
|
bool focus = IsFocus() && focusRow == row
|
||||||
|
&& focusColumn == column;
|
||||||
|
bool isSelected = selectRow == row && selectColumn == column;
|
||||||
|
if (isSelected)
|
||||||
|
_DrawDay(row, column, row, column, counter, tmp, day, focus, true);
|
||||||
|
else
|
||||||
|
_DrawDay(row, column, -1, -1, counter, tmp, day, focus, true);
|
||||||
|
|
||||||
|
} else if (currRow == row && currColumn == column) {
|
||||||
|
const char* day = fDayNumbers[row][column].String();
|
||||||
|
bool focus = IsFocus() && focusRow == row
|
||||||
|
&& focusColumn == column;
|
||||||
|
bool isSelected = selectRow == row && selectColumn == column;
|
||||||
|
if(isSelected)
|
||||||
|
_DrawDay(currRow, currColumn, row, column, counter, tmp, day, focus, false);
|
||||||
|
else
|
||||||
|
_DrawDay(currRow, currColumn, -1, -1, counter, tmp, day, focus, false);
|
||||||
|
}
|
||||||
|
tmp.OffsetBy(tmp.Width(), 0.0);
|
||||||
|
}
|
||||||
|
frame.OffsetBy(0.0, frame.Height());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BCalendarView::_UpdateCurrentDate()
|
||||||
|
{
|
||||||
|
BDate date = BDate::CurrentDate(B_LOCAL_TIME);
|
||||||
|
|
||||||
|
if (!date.IsValid())
|
||||||
|
return;
|
||||||
|
if (date == fCurrentDate)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fCurrentDate = date;
|
||||||
|
|
||||||
|
if (fDate.Year() == date.Year() && fDate.Month() == date.Month()) {
|
||||||
|
_SetToCurrentDay();
|
||||||
|
fCurrentDayChanged = true;
|
||||||
|
Draw(_RectOfDay(fCurrentDay));
|
||||||
|
Draw(_RectOfDay(fNewCurrentDay));
|
||||||
|
fCurrentDayChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BRect
|
BRect
|
||||||
BCalendarView::_FirstCalendarItemFrame() const
|
BCalendarView::_FirstCalendarItemFrame() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user