* Got rid of the _SHOW_CALENDAR_MENU_ITEM, and _SHOW_CALENDAR_MENU_WINDOW

defines - it's always in, and I don't think it makes any sense to make this
  an option (since it just uses a system widget).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33699 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-10-21 12:00:56 +00:00
parent 733ca9bd93
commit c5c6248e3d
2 changed files with 30 additions and 48 deletions
+13 -35
View File
@@ -35,23 +35,17 @@ All rights reserved.
#include "TimeView.h"
#ifdef _SHOW_CALENDAR_MENU_ITEM
# include "CalendarMenuItem.h"
#endif
#ifdef _SHOW_CALENDAR_MENU_WINDOW
# include "CalendarMenuWindow.h"
#endif
#include <string.h>
#include <Debug.h>
#include <MenuItem.h>
#include <MessageRunner.h>
#include <PopUpMenu.h>
#include <Roster.h>
#include <Window.h>
#include <Screen.h>
#include <Window.h>
#include <string.h>
#include "CalendarMenuWindow.h"
const char* kShortDateFormat = "%m/%d/%y";
@@ -265,30 +259,15 @@ TTimeView::MessageReceived(BMessage* message)
void
TTimeView::ShowCalendar(BPoint where)
{
//TODO: do nothing if the calendar is already shown
if (fCalendarWindow.IsValid()) {
// If the calendar is already shown, just activate it
BMessage activate(B_SET_PROPERTY);
activate.AddSpecifier("Active");
activate.AddBool("data", true);
#ifdef _SHOW_CALENDAR_MENU_ITEM
BPopUpMenu* menu = new BPopUpMenu("", false, false);
menu->SetFont(be_plain_font);
menu->AddItem(new CalendarMenuItem());
menu->ResizeToPreferred();
BPoint point = where;
BScreen screen;
where.y = Bounds().bottom + 4;
// make sure the menu is visible and doesn't hide the date
ConvertToScreen(&where);
if (where.y + menu->Bounds().Height() > screen.Frame().bottom)
where.y -= menu->Bounds().Height() + 2 * Bounds().Height();
ConvertToScreen(&point);
menu->Go(where, true, true, BRect(point.x - 4, point.y - 4,
point.x + 4, point.y + 4), true);
#elif _SHOW_CALENDAR_MENU_WINDOW
if (fCalendarWindow.SendMessage(&activate) == B_OK)
return;
}
where.y = Bounds().bottom + 4.0;
ConvertToScreen(&where);
@@ -297,8 +276,9 @@ TTimeView::ShowCalendar(BPoint where)
where.y -= (Bounds().Height() + 4.0);
CalendarMenuWindow* window = new CalendarMenuWindow(where, fEuroDate);
fCalendarWindow = BMessenger(window);
window->Show();
#endif
}
@@ -585,11 +565,9 @@ TTimeView::ShowClockOptions(BPoint point)
item = new BMenuItem("Hide Time", new BMessage('time'));
menu->AddItem(item);
#if defined(_SHOW_CALENDAR_MENU_ITEM) || defined(_SHOW_CALENDAR_MENU_WINDOW)
item = new BMenuItem("Show Calendar" B_UTF8_ELLIPSIS,
new BMessage(kShowCalendar));
menu->AddItem(item);
#endif
menu->SetTargetForItems(this);
// Changed to accept screen coord system point;
+4
View File
@@ -34,9 +34,12 @@ All rights reserved.
#ifndef TIME_VIEW_H
#define TIME_VIEW_H
#include <OS.h>
#include <Messenger.h>
#include <View.h>
const uint32 kShowSeconds = 'ShSc';
const uint32 kMilTime = 'MilT';
const uint32 kFullDate = 'FDat';
@@ -129,6 +132,7 @@ class TTimeView : public BView {
BPoint fTimeLocation;
BPoint fDateLocation;
BMessenger fCalendarWindow;
BMessageRunner* fLongClickMessageRunner;
};