The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Interface of SDL_MiniCal

const
{$IFDEF PAIDVERS}
  SDLVersionInfo = 'calendar_r1050_full';
  IsLightEd = false;
{$ELSE}
  SDLVersionInfo = 'calendar_r1050_lighted';
  IsLightEd = true;
{$ENDIF}
  release = 1050;


type
  TDayOfWeek = (dwMon, dwTue, dwWed, dwThu, dwFri, dwSat, dwSun);
                // days of week according to ISO 8601
                // (Monday is the first day of the week)
  TDayColors = array[TDayOfWeek] of TColor; // colors assigned to indiv. week days

  TMiniCal = class(TCustomDrawGrid)
             private
               FAutoSwitch    : boolean;
               FColorActMon   : TColor;
               FColorInactMon : TColor;
               FColorWknBg    : TColor;
               FColorWknFg    : TColor;
               FColorDayIdBg  : TColor;
               FColorDayIdFg  : TColor;
               FColorSelBg    : TColor;
               FColorSelFg    : TColor;
               FColorHdayBg   : TColor;
               FColorHdayFg   : TColor;
               FColorToday    : TColor;
               FShowHDayHint  : boolean;
               FIndicateHolid : boolean;
               FShowMovHdays  : boolean;
               FHDayList      : TIntMatrix;
               FHDayCaptions  : TStringList;
               FDate          : TDateTime;
               FDayColors     : TDayColors;
               FLanguage      : TLanguage;
               FMarkToday     : boolean;
               FMonOfs        : integer;
               FMonthShort    : boolean;
               FOnChange      : TNotifyEvent;
               FUpdating      : Boolean;
               F1stDayWeek    : TDayOfWeek;
               function  GetDay: integer;
               function  GetDayColors(day: TDayOfWeek): TColor;
               function  GetMonth: integer;
               function  GetNumHolidays: integer;
               function  GetYear: integer;
               procedure MonthStep(Delta: integer);
               procedure Set1stDayWeek (Value: TDayOfWeek);
               procedure SetDate(Value: TDateTime);
               procedure SetDay (day: integer);
               procedure SetDayColors(day: TDayOfWeek; color: TColor);
               procedure SetColorActMon (cl: TColor);
               procedure SetColorInactMon (cl: TColor);
               procedure SetColorDayIdBg (cl: TColor);
               procedure SetColorDayIdFg (cl: TColor);
               procedure SetColorSelBg (cl: TColor);
               procedure SetColorSelFg (cl: TColor);
               procedure SetColorHDayBg (cl: TColor);
               procedure SetColorHDayFg (cl: TColor);
               procedure SetColorToday (cl: TColor);
               procedure SetColorWknBg (cl: TColor);
               procedure SetColorWknFg (cl: TColor);
               procedure SetLanguage (lg: TLanguage);
               procedure SetMarkToday (mark: boolean);
               procedure SetIndicateHolidays (value: boolean);
               procedure SetShowMovHDays (value: boolean);
               procedure SetFShowHDayHint (value: boolean);
               procedure SetMonth (mon: integer);
               procedure SetMonthShort (ms: boolean);
               procedure SetYear (yr: integer);
             protected
               procedure Changed; dynamic;
               procedure DrawBtnFrame (cv: TCanvas; rect: TRect);
               procedure DrawCell (ACol, ARow: Longint; ARect: TRect;
                                   AState: TGridDrawState); override;
               procedure MouseDown (Button: TMouseButton; Shift: TShiftState;
                                    X, Y: integer); override;
               procedure MouseUp (Button: TMouseButton; Shift: TShiftState;
                                    X, Y: integer); override;
               procedure UpdateCal;
               procedure WMSize(var Message: TWMSize); message WM_SIZE;
             public
               constructor Create(AOwner: TComponent); override;
               destructor Destroy; override;
               function  CheckHoliday (Year,Month,Day: integer;
                                       var Caption: string): boolean;
               procedure ClearHolidayList;
               procedure AddHoliday (day,mon,year: integer; Caption: string);
               procedure AddRepeatHoliday (day,mon: integer; Caption: string);
               property Date: TDateTime read FDate write SetDate;
               property DayColors[day: TDayOfWeek]: TColor
                           read GetDayColors write SetDayColors;
               procedure LastDayOfMonth;
               procedure NextMonth;
               procedure NextYear;
               property NumHolidays: integer read GetNumHolidays;
               procedure PrevMonth;
               procedure PrevYear;
               function RetrieveHoliday (HDIndex: integer; var Day, Month,
                                Year: integer; var IsRepeatHDay: boolean;
                                var Description: string): boolean;
             published
               property Align;
               property Anchors;
               property AutoSwitch: boolean read FAutoSwitch write FAutoSwitch;
               property Constraints;
               property ColorActiveMonth: TColor
                           read FColorActMon write SetColorActMon;
               property ColorInactiveMonth: TColor
                           read FColorInactMon write SetColorInactMon;
               property ColorWeekNoBg: TColor read FColorWknBg write SetColorWknBg;
               property ColorWeekNoFg: TColor read FColorWknFg write SetColorWknFg;
               property ColorDayIdBg: TColor
                           read FColorDayIdBg write SetColorDayIdBg;
               property ColorDayIdFg: TColor
                           read FColorDayIdFg write SetColorDayIdFg;
               property ColorSelectedBg: TColor
                           read FColorSelBg write SetColorSelBg;
               property ColorSelectedFg: TColor
                           read FColorSelFg write SetColorSelFg;
               property ColorHolidayBg: TColor
                           read FColorHDayBg write SetColorHDayBg;
               property ColorHolidayFg: TColor
                           read FColorHDayFg write SetColorHDayFg;
               property ColorToday: TColor read FColorToday write SetColorToday;
               property Ctl3D;
               property Day: integer read GetDay write SetDay stored False;
               property FirstDayOfWeek: TDayOfWeek
                           read F1stDayWeek write Set1stDayWeek;
               property Font;
               property IndicateHolidays: boolean
                           read FIndicateHolid write SetIndicateHolidays;
               property Language: TLanguage read FLanguage write SetLanguage;
               property MarkToday: boolean read FMarkToday write SetMarkToday;
               property Month: integer read GetMonth write SetMonth stored False;
               property ParentFont;
               property ParentShowHint;
               property PopupMenu;
               property ShowHint;
               property ShowHolidayHint: boolean
                           read FShowHDayHint write SetFShowHDayHint;
               property ShowMonthShort: boolean
                           read FMonthShort write SetMonthShort;
               property ShowMovableHolidays: boolean
                           read FShowMovHdays write SetShowMovHDays;
{$IFDEF GE_LEV17}
               property StyleElements;
{$ENDIF}
               property Visible;
               property Year: integer read GetYear write SetYear stored False;
               property OnClick;
               property OnChange: TNotifyEvent read FOnChange write FOnChange;
               property OnDblClick;
             end;


procedure CalcEasterSunday
                (Year : integer;            { year to used for the calculation }
         var Day, Mon : integer);{ day and month of Easter Sunday in that year }






Last Update: 2012-Oct-20