Class TBaseCalendar (unit Enhcalnd)

Inherits from

TCustomGrid

Constructors


constructor Create(AOwner: TComponent);

Public declarations

TBaseCalendar



Functions

function DaysThisMonth: Integer;

DaysThisMonth - support routine to return the days in the current month

destructor Destroy;

defaults

function GetComponentImage: TBitmap;

GetComponentImage - method to turn on-screen rendering into a bitmap.

function IsWeekend(ADay: integer): boolean;

IsWeekend - support routine to determine if a given day is a weekend

procedure MouseToCell(X, Y: Integer; var ACol, ARow: Longint);

MouseToCell - support routine to convert the mouse position to cell coords

procedure NextMonth;

NextMonth

procedure NextYear;

NextYear

procedure PrevMonth;

PrevMonth

procedure PrevYear;

PrevYear

procedure UpdateCalendar;

UpdateCalendar - central "engine"

procedure Click;

Click override - sets day to the cell clicked

function DaysPerMonth(AYear, AMonth: Integer): Integer;

DaysPerMonth - protected implementation of DaysThisMonth

procedure DrawCell(ACol, ARow: Longint; ARect: TRect; AState: TGridDrawState);

DrawCell override

function IsLeapYear(AYear: Integer): Boolean;

IsLeapYear - support routine

procedure Loaded;

Protected declarations

Loaded override


function SelectCell(ACol, ARow: Longint): Boolean;

SelectCell override - returns false for cells that shouldn't be selected

function GetCellText(ACol, ARow: Integer): string;

GetCellText - property access method to return the selected date as a string.

function GetDateElement(Index: Integer): Integer;

SetDateElement - internal method to get day, month or year

procedure SetBlockedColor(Value: TColor);

SetBlockedColor - property access method to set the color for blocked days.

procedure SetBlockWeekends(Value: Boolean);

SetBlockWeekends - property access method to toggle weekend blocking.

procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer);

trigger OnDateChange and all HookEvents

procedure SetCalendarDate(Value: TDateTime);

SetCalendarDate - property access method to set calendar focused date

procedure SetDateElement(Index: Integer; Value: Integer);

SetDateElement - internal method to set day, month or year

procedure SetFixedHeader(Value: Boolean);

SetFixedHeader - property access method to toggle fixed header

procedure SetHookEvent(Value: TNotifyEvent);

SetHookEvent - property access method to attach a HookEvent

procedure SetStartOfWeek(Value: TDayOfWeek);

SetStartOfWeek - property access method to change the starting day of the week.

Properties

property BlockedColor : TColor


property BlockWeekends : Boolean


property CalendarDate : TDateTime


property CellText : string


property Day : Integer


property FixedHeader : Boolean


property HookEvent : TNotifyEvent


property Month : Integer


property ReadOnly : Boolean


property StartOfWeek : TDayOfWeek


property Year : Integer


Events

event OnDateChange : TDateChange


event OnMonthChange : TMonthChange


event OnYearChange : TYearChange


Variables

FBlockedColor : TColor;


FBlockWeekends : Boolean;

Private declarations

FDate : TDateTime;


FDateChange : TDateChange;


FEventList : TEventList;


FFixedHeader : Boolean;


FHookEvent : TNotifyEvent;


FMonthChange : TMonthChange;


FMonthOffset : Integer;


FReadOnly : Boolean;


FStartOfWeek : TDayOfWeek;


FUpdating : Boolean;


FYearChange : TYearChange;



Constructors


constructor Create(AOwner: TComponent);

Public declarations

TBaseCalendar


Functions


function DaysThisMonth: Integer;

DaysThisMonth - support routine to return the days in the current month


destructor Destroy;

defaults


function GetComponentImage: TBitmap;

GetComponentImage - method to turn on-screen rendering into a bitmap. Allows easy printing } {$IFDEF WIN32


function IsWeekend(ADay: integer): boolean;

IsWeekend - support routine to determine if a given day is a weekend


procedure MouseToCell(X, Y: Integer; var ACol, ARow: Longint);

MouseToCell - support routine to convert the mouse position to cell coords


procedure NextMonth;

NextMonth


procedure NextYear;

NextYear


procedure PrevMonth;

PrevMonth


procedure PrevYear;

PrevYear


procedure UpdateCalendar;

UpdateCalendar - central "engine"


procedure Click;

Click override - sets day to the cell clicked


function DaysPerMonth(AYear, AMonth: Integer): Integer;

DaysPerMonth - protected implementation of DaysThisMonth


procedure DrawCell(ACol, ARow: Longint; ARect: TRect; AState: TGridDrawState);

DrawCell override


function IsLeapYear(AYear: Integer): Boolean;

IsLeapYear - support routine


procedure Loaded;

Protected declarations

Loaded override


function SelectCell(ACol, ARow: Longint): Boolean;

SelectCell override - returns false for cells that shouldn't be selected


function GetCellText(ACol, ARow: Integer): string;

GetCellText - property access method to return the selected date as a string. Acts as a storage device for the dates


function GetDateElement(Index: Integer): Integer;

SetDateElement - internal method to get day, month or year


procedure SetBlockedColor(Value: TColor);

SetBlockedColor - property access method to set the color for blocked days. clSilver doesn't look good.


procedure SetBlockWeekends(Value: Boolean);

SetBlockWeekends - property access method to toggle weekend blocking.


procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer);

trigger OnDateChange and all HookEvents


procedure SetCalendarDate(Value: TDateTime);

SetCalendarDate - property access method to set calendar focused date


procedure SetDateElement(Index: Integer; Value: Integer);

SetDateElement - internal method to set day, month or year


procedure SetFixedHeader(Value: Boolean);

SetFixedHeader - property access method to toggle fixed header


procedure SetHookEvent(Value: TNotifyEvent);

SetHookEvent - property access method to attach a HookEvent


procedure SetStartOfWeek(Value: TDayOfWeek);

SetStartOfWeek - property access method to change the starting day of the week.


Properties


property BlockedColor : TColor


property BlockWeekends : Boolean


property CalendarDate : TDateTime


property CellText : string


property Day : Integer


property FixedHeader : Boolean


property HookEvent : TNotifyEvent


property Month : Integer


property ReadOnly : Boolean


property StartOfWeek : TDayOfWeek


property Year : Integer


Events


event OnDateChange : TDateChange


event OnMonthChange : TMonthChange


event OnYearChange : TYearChange


Variables


FBlockedColor : TColor;


FBlockWeekends : Boolean;

Private declarations


FDate : TDateTime;


FDateChange : TDateChange;


FEventList : TEventList;


FFixedHeader : Boolean;


FHookEvent : TNotifyEvent;


FMonthChange : TMonthChange;


FMonthOffset : Integer;


FReadOnly : Boolean;


FStartOfWeek : TDayOfWeek;


FUpdating : Boolean;


FYearChange : TYearChange;