* Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31375 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,52 +1,53 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007-2008, Haiku, Inc. All Rights Reserved.
|
* Copyright 2007-2009, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Julun <[email protected]>
|
* Julun <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "CalendarView.h"
|
#include "CalendarView.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
float
|
|
||||||
FontHeight(const BView *view)
|
|
||||||
{
|
|
||||||
if (!view)
|
|
||||||
return 0.0;
|
|
||||||
|
|
||||||
BFont font;
|
float
|
||||||
view->GetFont(&font);
|
FontHeight(const BView *view)
|
||||||
font_height fheight;
|
{
|
||||||
font.GetHeight(&fheight);
|
if (!view)
|
||||||
return ceilf(fheight.ascent + fheight.descent + fheight.leading);
|
return 0.0;
|
||||||
}
|
|
||||||
|
BFont font;
|
||||||
|
view->GetFont(&font);
|
||||||
|
font_height fheight;
|
||||||
|
font.GetHeight(&fheight);
|
||||||
|
return ceilf(fheight.ascent + fheight.descent + fheight.leading);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // private namespace
|
||||||
|
|
||||||
|
|
||||||
BCalendarView::BCalendarView(BRect frame, const char *name,
|
BCalendarView::BCalendarView(BRect frame, const char *name,
|
||||||
uint32 resizeMask, uint32 flags)
|
uint32 resizeMask, uint32 flags)
|
||||||
: BView(frame, name, resizeMask, flags),
|
:
|
||||||
BInvoker(),
|
BView(frame, name, resizeMask, flags),
|
||||||
fSelectionMessage(NULL),
|
BInvoker(),
|
||||||
fDay(0),
|
fSelectionMessage(NULL),
|
||||||
fYear(0),
|
fDay(0),
|
||||||
fMonth(0),
|
fYear(0),
|
||||||
fFocusChanged(false),
|
fMonth(0),
|
||||||
fSelectionChanged(false),
|
fFocusChanged(false),
|
||||||
fWeekStart(B_WEEK_START_SUNDAY),
|
fSelectionChanged(false),
|
||||||
fDayNameHeaderVisible(true),
|
fWeekStart(B_WEEK_START_SUNDAY),
|
||||||
fWeekNumberHeaderVisible(true)
|
fDayNameHeaderVisible(true),
|
||||||
|
fWeekNumberHeaderVisible(true)
|
||||||
{
|
{
|
||||||
_InitObject();
|
_InitObject();
|
||||||
}
|
}
|
||||||
@@ -54,17 +55,18 @@ BCalendarView::BCalendarView(BRect frame, const char *name,
|
|||||||
|
|
||||||
BCalendarView::BCalendarView(BRect frame, const char *name, week_start start,
|
BCalendarView::BCalendarView(BRect frame, const char *name, week_start start,
|
||||||
uint32 resizeMask, uint32 flags)
|
uint32 resizeMask, uint32 flags)
|
||||||
: BView(frame, name, resizeMask, flags),
|
:
|
||||||
BInvoker(),
|
BView(frame, name, resizeMask, flags),
|
||||||
fSelectionMessage(NULL),
|
BInvoker(),
|
||||||
fDay(0),
|
fSelectionMessage(NULL),
|
||||||
fYear(0),
|
fDay(0),
|
||||||
fMonth(0),
|
fYear(0),
|
||||||
fFocusChanged(false),
|
fMonth(0),
|
||||||
fSelectionChanged(false),
|
fFocusChanged(false),
|
||||||
fWeekStart(start),
|
fSelectionChanged(false),
|
||||||
fDayNameHeaderVisible(true),
|
fWeekStart(start),
|
||||||
fWeekNumberHeaderVisible(true)
|
fDayNameHeaderVisible(true),
|
||||||
|
fWeekNumberHeaderVisible(true)
|
||||||
{
|
{
|
||||||
_InitObject();
|
_InitObject();
|
||||||
}
|
}
|
||||||
@@ -77,17 +79,18 @@ BCalendarView::~BCalendarView()
|
|||||||
|
|
||||||
|
|
||||||
BCalendarView::BCalendarView(BMessage *archive)
|
BCalendarView::BCalendarView(BMessage *archive)
|
||||||
: BView(archive),
|
:
|
||||||
BInvoker(),
|
BView(archive),
|
||||||
fSelectionMessage(NULL),
|
BInvoker(),
|
||||||
fDay(0),
|
fSelectionMessage(NULL),
|
||||||
fYear(0),
|
fDay(0),
|
||||||
fMonth(0),
|
fYear(0),
|
||||||
fFocusChanged(false),
|
fMonth(0),
|
||||||
fSelectionChanged(false),
|
fFocusChanged(false),
|
||||||
fWeekStart(B_WEEK_START_SUNDAY),
|
fSelectionChanged(false),
|
||||||
fDayNameHeaderVisible(true),
|
fWeekStart(B_WEEK_START_SUNDAY),
|
||||||
fWeekNumberHeaderVisible(true)
|
fDayNameHeaderVisible(true),
|
||||||
|
fWeekNumberHeaderVisible(true)
|
||||||
{
|
{
|
||||||
if (archive->HasMessage("_invokeMsg")) {
|
if (archive->HasMessage("_invokeMsg")) {
|
||||||
BMessage *invokationMessage = new BMessage;
|
BMessage *invokationMessage = new BMessage;
|
||||||
@@ -104,8 +107,8 @@ BCalendarView::BCalendarView(BMessage *archive)
|
|||||||
if (archive->FindInt32("_day", &fDay) != B_OK
|
if (archive->FindInt32("_day", &fDay) != B_OK
|
||||||
|| archive->FindInt32("_month", &fMonth) != B_OK
|
|| archive->FindInt32("_month", &fMonth) != B_OK
|
||||||
|| archive->FindInt32("_year", &fYear) != B_OK) {
|
|| archive->FindInt32("_year", &fYear) != B_OK) {
|
||||||
BDate date = BDate::CurrentDate(B_LOCAL_TIME);
|
BDate date = BDate::CurrentDate(B_LOCAL_TIME);
|
||||||
date.GetDate(&fYear, &fMonth, &fDay);
|
date.GetDate(&fYear, &fMonth, &fDay);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 start;
|
int32 start;
|
||||||
@@ -335,6 +338,7 @@ BCalendarView::MakeFocus(bool state)
|
|||||||
|
|
||||||
BView::MakeFocus(state);
|
BView::MakeFocus(state);
|
||||||
|
|
||||||
|
// TODO: solve this better
|
||||||
fFocusChanged = true;
|
fFocusChanged = true;
|
||||||
Draw(_RectOfDay(fFocusedDay));
|
Draw(_RectOfDay(fFocusedDay));
|
||||||
fFocusChanged = false;
|
fFocusChanged = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user