Added menu item "Show Calendar ..." to time pop up menu.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27269 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Pfeiffer
2008-09-01 17:50:06 +00:00
parent dc0cdfb2f0
commit da88cf3113
2 changed files with 60 additions and 39 deletions
+28 -8
View File
@@ -66,7 +66,8 @@ enum {
kMsgShowClock, kMsgShowClock,
kMsgChangeClock, kMsgChangeClock,
kMsgHide, kMsgHide,
kMsgLongClick kMsgLongClick,
kMsgShowCalendar
}; };
@@ -239,7 +240,28 @@ TTimeView::MessageReceived(BMessage* message)
{ {
BPoint where; BPoint where;
message->FindPoint("where", &where); message->FindPoint("where", &where);
ShowCalendar(where);
break;
}
case kMsgShowCalendar:
{
BRect bounds(Bounds());
BPoint center(bounds.LeftTop());
center += BPoint(bounds.Width() / 2, bounds.Height() / 2);
ShowCalendar(center);
break;
}
default:
BView::MessageReceived(message);
}
}
void
TTimeView::ShowCalendar(BPoint where)
{
//TODO: do nothing if the calendar is already shown //TODO: do nothing if the calendar is already shown
#ifdef _SHOW_CALENDAR_MENU_ITEM #ifdef _SHOW_CALENDAR_MENU_ITEM
@@ -274,13 +296,6 @@ TTimeView::MessageReceived(BMessage* message)
CalendarMenuWindow* window = new CalendarMenuWindow(where, fEuroDate); CalendarMenuWindow* window = new CalendarMenuWindow(where, fEuroDate);
window->Show(); window->Show();
#endif #endif
break;
}
default:
BView::MessageReceived(message);
}
} }
@@ -530,6 +545,11 @@ TTimeView::ShowClockOptions(BPoint point)
item = new BMenuItem("Hide Time", new BMessage('time')); item = new BMenuItem("Hide Time", new BMessage('time'));
menu->AddItem(item); menu->AddItem(item);
#if defined(_SHOW_CALENDAR_MENU_ITEM) || defined(_SHOW_CALENDAR_MENU_WINDOW)
item = new BMenuItem("Show Calendar" B_UTF8_ELLIPSIS, new BMessage(kMsgShowCalendar));
menu->AddItem(item);
#endif
menu->SetTargetForItems(this); menu->SetTargetForItems(this);
// Changed to accept screen coord system point; // Changed to accept screen coord system point;
// not constrained to this view now // not constrained to this view now
+1
View File
@@ -81,6 +81,7 @@ class TTimeView : public BView {
void AllowFullDate(bool); void AllowFullDate(bool);
bool ShowingEuroDate() {return fEuroDate; } bool ShowingEuroDate() {return fEuroDate; }
void ShowEuroDate(bool); void ShowEuroDate(bool);
void ShowCalendar(BPoint where);
bool Orientation() const; bool Orientation() const;
void SetOrientation(bool o); void SetOrientation(bool o);