* 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:
@@ -35,23 +35,17 @@ All rights reserved.
|
|||||||
|
|
||||||
#include "TimeView.h"
|
#include "TimeView.h"
|
||||||
|
|
||||||
#ifdef _SHOW_CALENDAR_MENU_ITEM
|
#include <string.h>
|
||||||
# include "CalendarMenuItem.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _SHOW_CALENDAR_MENU_WINDOW
|
|
||||||
# include "CalendarMenuWindow.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <MessageRunner.h>
|
#include <MessageRunner.h>
|
||||||
#include <PopUpMenu.h>
|
#include <PopUpMenu.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
#include <Window.h>
|
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
|
#include <Window.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include "CalendarMenuWindow.h"
|
||||||
|
|
||||||
|
|
||||||
const char* kShortDateFormat = "%m/%d/%y";
|
const char* kShortDateFormat = "%m/%d/%y";
|
||||||
@@ -265,30 +259,15 @@ TTimeView::MessageReceived(BMessage* message)
|
|||||||
void
|
void
|
||||||
TTimeView::ShowCalendar(BPoint where)
|
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
|
if (fCalendarWindow.SendMessage(&activate) == B_OK)
|
||||||
|
return;
|
||||||
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
|
|
||||||
|
|
||||||
where.y = Bounds().bottom + 4.0;
|
where.y = Bounds().bottom + 4.0;
|
||||||
ConvertToScreen(&where);
|
ConvertToScreen(&where);
|
||||||
@@ -297,8 +276,9 @@ TTimeView::ShowCalendar(BPoint where)
|
|||||||
where.y -= (Bounds().Height() + 4.0);
|
where.y -= (Bounds().Height() + 4.0);
|
||||||
|
|
||||||
CalendarMenuWindow* window = new CalendarMenuWindow(where, fEuroDate);
|
CalendarMenuWindow* window = new CalendarMenuWindow(where, fEuroDate);
|
||||||
|
fCalendarWindow = BMessenger(window);
|
||||||
|
|
||||||
window->Show();
|
window->Show();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -585,11 +565,9 @@ 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,
|
item = new BMenuItem("Show Calendar" B_UTF8_ELLIPSIS,
|
||||||
new BMessage(kShowCalendar));
|
new BMessage(kShowCalendar));
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
#endif
|
|
||||||
|
|
||||||
menu->SetTargetForItems(this);
|
menu->SetTargetForItems(this);
|
||||||
// Changed to accept screen coord system point;
|
// Changed to accept screen coord system point;
|
||||||
|
|||||||
@@ -34,9 +34,12 @@ All rights reserved.
|
|||||||
#ifndef TIME_VIEW_H
|
#ifndef TIME_VIEW_H
|
||||||
#define TIME_VIEW_H
|
#define TIME_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
#include <Messenger.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
|
|
||||||
const uint32 kShowSeconds = 'ShSc';
|
const uint32 kShowSeconds = 'ShSc';
|
||||||
const uint32 kMilTime = 'MilT';
|
const uint32 kMilTime = 'MilT';
|
||||||
const uint32 kFullDate = 'FDat';
|
const uint32 kFullDate = 'FDat';
|
||||||
@@ -129,6 +132,7 @@ class TTimeView : public BView {
|
|||||||
BPoint fTimeLocation;
|
BPoint fTimeLocation;
|
||||||
BPoint fDateLocation;
|
BPoint fDateLocation;
|
||||||
|
|
||||||
|
BMessenger fCalendarWindow;
|
||||||
BMessageRunner* fLongClickMessageRunner;
|
BMessageRunner* fLongClickMessageRunner;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user