Author: axeld Date: 2009-10-21 13:30:21 +0200 (Wed, 21 Oct 2009) New Revision: 33698 Changeset: http://dev.haiku-os.org/changeset/33698/haiku Modified: haiku/trunk/src/apps/deskbar/CalendarMenuWindow.cpp haiku/trunk/src/apps/deskbar/CalendarMenuWindow.h Log: * Made the font size depend on the be_plain_font size, instead of a hard coded one. * Some coding style cleanups. Modified: haiku/trunk/src/apps/deskbar/CalendarMenuWindow.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/CalendarMenuWindow.cpp 2009-10-21 10:14:09 UTC (rev 33697) +++ haiku/trunk/src/apps/deskbar/CalendarMenuWindow.cpp 2009-10-21 11:30:21 UTC (rev 33698) @@ -2,9 +2,10 @@ * Copyright Karsten Heimrich, host.haiku@xxxxxxx All rights reserved. * Distributed under the terms of the MIT License. */ + + #include "CalendarMenuWindow.h" - #include <Button.h> #include <CalendarView.h> #include <GridLayoutBuilder.h> @@ -12,9 +13,9 @@ #include <GroupLayoutBuilder.h> #include <GroupView.h> #include <Screen.h> +#include <SpaceLayoutItem.h> #include <String.h> #include <StringView.h> -#include <SpaceLayoutItem.h> using BPrivate::BCalendarView; @@ -127,7 +128,7 @@ AddChild(groupView); MoveTo(where); - _UpdateUi(BDate::CurrentDate(B_LOCAL_TIME)); + _UpdateUI(BDate::CurrentDate(B_LOCAL_TIME)); } @@ -178,7 +179,8 @@ PostMessage(B_QUIT_REQUESTED); } else { if (fSuppressFirstClose && !active) { - fSuppressFirstClose = false; return; + fSuppressFirstClose = false; + return; } if (!fSuppressFirstClose && !active) @@ -191,17 +193,20 @@ CalendarMenuWindow::MessageReceived(BMessage* message) { switch (message->what) { - case kInvokationMessage: { + case kInvokationMessage: + { int32 day, month, year; message->FindInt32("day", &day); message->FindInt32("month", &month); message->FindInt32("year", &year); - _UpdateUi(BDate(year, month, day)); - } break; + _UpdateUI(BDate(year, month, day)); + break; + } - case kMonthDownMessage: { + case kMonthDownMessage: case kMonthUpMessage: + { BDate date = fCalendarView->Date(); int32 day = date.Day(); @@ -221,25 +226,28 @@ if (day > date.DaysInMonth()) day = date.DaysInMonth(); - _UpdateUi(BDate(year, month, day)); - } break; + _UpdateUI(BDate(year, month, day)); + break; + } - case kYearDownMessage: { + case kYearDownMessage: case kYearUpMessage: + { BDate date = fCalendarView->Date(); int32 i = kYearDownMessage == message->what ? -1 : 1; - _UpdateUi(BDate(date.Year() + i, date.Month(), date.Day())); - } break; + _UpdateUI(BDate(date.Year() + i, date.Month(), date.Day())); + break; + } - default: { + default: BWindow::MessageReceived(message); - } break; + break; } } void -CalendarMenuWindow::_UpdateUi(const BDate& date) +CalendarMenuWindow::_UpdateUI(const BDate& date) { if (!date.IsValid()) return; @@ -259,7 +267,7 @@ { FlatButton* button = new FlatButton(label, what); button->SetExplicitMinSize(BSize(height, height)); - button->SetFontSize(10.0); + button->SetFontSize(be_plain_font->Size() * 0.8); return button; } Modified: haiku/trunk/src/apps/deskbar/CalendarMenuWindow.h =================================================================== --- haiku/trunk/src/apps/deskbar/CalendarMenuWindow.h 2009-10-21 10:14:09 UTC (rev 33697) +++ haiku/trunk/src/apps/deskbar/CalendarMenuWindow.h 2009-10-21 11:30:21 UTC (rev 33698) @@ -31,7 +31,7 @@ virtual void MessageReceived(BMessage* message); private: - void _UpdateUi(const BDate& date); + void _UpdateUI(const BDate& date); BButton* _SetupButton(const char* label, uint32 what, float height); private: