/*
Copyright 2012 Justin LeCheminant
This file is part of WindowsFormsCalendar.
indowsFormsCalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
indowsFormsCalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with indowsFormsCalendar. If not, see .
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace WindowsFormsCalendar
{
///
/// A class that represents a month view day
///
public class MonthViewDay
{
#region Fields
Rectangle _bounds;
private DateTime _date;
private MonthViewMonth _month;
private MonthView _monthView;
#endregion
#region Propserties
///
/// Gets the parent MonthView
///
public MonthView MonthView
{
get { return _monthView; }
set { _monthView = value; }
}
///
/// Gets the parent MonthViewMonth
///
public MonthViewMonth Month
{
get { return _month; }
}
///
/// Gets the bounds of the day
///
public Rectangle Bounds
{
get { return _bounds; }
}
///
/// Gets the date this day represents
///
public DateTime Date
{
get { return _date; }
}
///
/// Gets or sets if the day is currently selected
///
public bool Selected
{
get { return Date >= MonthView.SelectionStart && Date <= MonthView.SelectionEnd; }
}
///
/// Gets if the day is grayed
///
public bool Grayed
{
get { return Month.Date.Month != Date.Month; }
}
///
/// Gets a value indicating if the day instance is visible on the calendar
///
public bool Visible
{
get
{
return !( Grayed && ( Date > MonthView.ViewStart && Date < MonthView.ViewEnd ) );
}
}
#endregion
///
/// Initializes a new instance of the class.
///
/// The month.
/// The date.
internal MonthViewDay(MonthViewMonth month, DateTime date)
{
_month = month;
_monthView = month.MonthView;
_date = date;
}
#region Methods
///
/// Sets the value of the property
///
///
internal void SetBounds(Rectangle bounds)
{
_bounds = bounds;
}
#endregion
}
}