* Made the font size depend on the be_plain_font size, instead of a hard coded
one. * Some coding style cleanups. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33698 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2,9 +2,10 @@
|
|||||||
* Copyright Karsten Heimrich, [email protected]. All rights reserved.
|
* Copyright Karsten Heimrich, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#include "CalendarMenuWindow.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "CalendarMenuWindow.h"
|
||||||
|
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <CalendarView.h>
|
#include <CalendarView.h>
|
||||||
#include <GridLayoutBuilder.h>
|
#include <GridLayoutBuilder.h>
|
||||||
@@ -12,9 +13,9 @@
|
|||||||
#include <GroupLayoutBuilder.h>
|
#include <GroupLayoutBuilder.h>
|
||||||
#include <GroupView.h>
|
#include <GroupView.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
|
#include <SpaceLayoutItem.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
#include <SpaceLayoutItem.h>
|
|
||||||
|
|
||||||
|
|
||||||
using BPrivate::BCalendarView;
|
using BPrivate::BCalendarView;
|
||||||
@@ -127,7 +128,7 @@ CalendarMenuWindow::CalendarMenuWindow(BPoint where, bool euroDate)
|
|||||||
AddChild(groupView);
|
AddChild(groupView);
|
||||||
|
|
||||||
MoveTo(where);
|
MoveTo(where);
|
||||||
_UpdateUi(BDate::CurrentDate(B_LOCAL_TIME));
|
_UpdateUI(BDate::CurrentDate(B_LOCAL_TIME));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -178,7 +179,8 @@ CalendarMenuWindow::WindowActivated(bool active)
|
|||||||
PostMessage(B_QUIT_REQUESTED);
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
} else {
|
} else {
|
||||||
if (fSuppressFirstClose && !active) {
|
if (fSuppressFirstClose && !active) {
|
||||||
fSuppressFirstClose = false; return;
|
fSuppressFirstClose = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fSuppressFirstClose && !active)
|
if (!fSuppressFirstClose && !active)
|
||||||
@@ -191,17 +193,20 @@ void
|
|||||||
CalendarMenuWindow::MessageReceived(BMessage* message)
|
CalendarMenuWindow::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case kInvokationMessage: {
|
case kInvokationMessage:
|
||||||
|
{
|
||||||
int32 day, month, year;
|
int32 day, month, year;
|
||||||
message->FindInt32("day", &day);
|
message->FindInt32("day", &day);
|
||||||
message->FindInt32("month", &month);
|
message->FindInt32("month", &month);
|
||||||
message->FindInt32("year", &year);
|
message->FindInt32("year", &year);
|
||||||
|
|
||||||
_UpdateUi(BDate(year, month, day));
|
_UpdateUI(BDate(year, month, day));
|
||||||
} break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kMonthDownMessage: {
|
case kMonthDownMessage:
|
||||||
case kMonthUpMessage:
|
case kMonthUpMessage:
|
||||||
|
{
|
||||||
BDate date = fCalendarView->Date();
|
BDate date = fCalendarView->Date();
|
||||||
|
|
||||||
int32 day = date.Day();
|
int32 day = date.Day();
|
||||||
@@ -221,25 +226,28 @@ CalendarMenuWindow::MessageReceived(BMessage* message)
|
|||||||
if (day > date.DaysInMonth())
|
if (day > date.DaysInMonth())
|
||||||
day = date.DaysInMonth();
|
day = date.DaysInMonth();
|
||||||
|
|
||||||
_UpdateUi(BDate(year, month, day));
|
_UpdateUI(BDate(year, month, day));
|
||||||
} break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kYearDownMessage: {
|
case kYearDownMessage:
|
||||||
case kYearUpMessage:
|
case kYearUpMessage:
|
||||||
|
{
|
||||||
BDate date = fCalendarView->Date();
|
BDate date = fCalendarView->Date();
|
||||||
int32 i = kYearDownMessage == message->what ? -1 : 1;
|
int32 i = kYearDownMessage == message->what ? -1 : 1;
|
||||||
_UpdateUi(BDate(date.Year() + i, date.Month(), date.Day()));
|
_UpdateUI(BDate(date.Year() + i, date.Month(), date.Day()));
|
||||||
} break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default: {
|
default:
|
||||||
BWindow::MessageReceived(message);
|
BWindow::MessageReceived(message);
|
||||||
} break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CalendarMenuWindow::_UpdateUi(const BDate& date)
|
CalendarMenuWindow::_UpdateUI(const BDate& date)
|
||||||
{
|
{
|
||||||
if (!date.IsValid())
|
if (!date.IsValid())
|
||||||
return;
|
return;
|
||||||
@@ -259,7 +267,7 @@ CalendarMenuWindow::_SetupButton(const char* label, uint32 what, float height)
|
|||||||
{
|
{
|
||||||
FlatButton* button = new FlatButton(label, what);
|
FlatButton* button = new FlatButton(label, what);
|
||||||
button->SetExplicitMinSize(BSize(height, height));
|
button->SetExplicitMinSize(BSize(height, height));
|
||||||
button->SetFontSize(10.0);
|
button->SetFontSize(be_plain_font->Size() * 0.8);
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public:
|
|||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _UpdateUi(const BDate& date);
|
void _UpdateUI(const BDate& date);
|
||||||
BButton* _SetupButton(const char* label, uint32 what, float height);
|
BButton* _SetupButton(const char* label, uint32 what, float height);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user