You've already forked lazarus-ccr
CalLite: Initial commit
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5312 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
36
components/callite/callight_pkg.lpk
Normal file
36
components/callite/callight_pkg.lpk
Normal file
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<Package Version="4">
|
||||
<Name Value="callight_pkg"/>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<Author Value="Howard Page-Clark, Ariel Rodriguez and Werner Pamler"/>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<SearchPaths>
|
||||
<OtherUnitFiles Value="source"/>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
</CompilerOptions>
|
||||
<Description Value="A lightweight calendar component"/>
|
||||
<License Value="Modified LGL2 (with linking exception)"/>
|
||||
<Version Minor="1"/>
|
||||
<Files Count="1">
|
||||
<Item1>
|
||||
<Filename Value="source/calendarlite.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="CalendarLite"/>
|
||||
</Item1>
|
||||
</Files>
|
||||
<RequiredPkgs Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="LCLBase"/>
|
||||
</Item1>
|
||||
</RequiredPkgs>
|
||||
<UsageOptions>
|
||||
<UnitPath Value="$(PkgOutDir)"/>
|
||||
</UsageOptions>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
</Package>
|
||||
</CONFIG>
|
85
components/callite/demo1/CalLiteTest.lpi
Normal file
85
components/callite/demo1/CalLiteTest.lpi
Normal file
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="CalLiteTest"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="callight_pkg"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="CalLiteTest.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="callite;C:\Lazarus\AviControls\;C:\Lazarus\AviControls\StickyStuff\"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="4">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
<Name Value="Exception"/>
|
||||
</Item4>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
21
components/callite/demo1/CalLiteTest.lpr
Normal file
21
components/callite/demo1/CalLiteTest.lpr
Normal file
@ -0,0 +1,21 @@
|
||||
program CalLiteTest;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, main
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource := True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
58
components/callite/demo1/main.lfm
Normal file
58
components/callite/demo1/main.lfm
Normal file
@ -0,0 +1,58 @@
|
||||
object Form1: TForm1
|
||||
Left = 400
|
||||
Height = 272
|
||||
Top = 115
|
||||
Width = 256
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 272
|
||||
ClientWidth = 256
|
||||
Font.Height = -13
|
||||
Font.Name = 'Tahoma'
|
||||
KeyPreview = True
|
||||
OnCreate = FormCreate
|
||||
OnResize = FormResize
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.7'
|
||||
object edtYear: TEdit
|
||||
Left = 122
|
||||
Height = 18
|
||||
Top = 15
|
||||
Width = 38
|
||||
Alignment = taCenter
|
||||
AutoSize = False
|
||||
BorderStyle = bsNone
|
||||
OnKeyDown = edtYearKeyDown
|
||||
ParentColor = True
|
||||
TabOrder = 1
|
||||
Text = 'Year'
|
||||
end
|
||||
object edtMonth: TEdit
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = edtYear
|
||||
AnchorSideRight.Control = edtYear
|
||||
Left = 84
|
||||
Height = 18
|
||||
Top = 15
|
||||
Width = 38
|
||||
Alignment = taCenter
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = False
|
||||
BorderStyle = bsNone
|
||||
OnKeyDown = edtMonthKeyDown
|
||||
ParentColor = True
|
||||
TabOrder = 0
|
||||
Text = 'Month'
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 5
|
||||
Height = 30
|
||||
Top = 237
|
||||
Width = 246
|
||||
Align = alBottom
|
||||
BorderSpacing.Around = 5
|
||||
Caption = 'Use Up/Down Arrows to change the Month/Year. Press and hold for long jumps.'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
WordWrap = True
|
||||
end
|
||||
end
|
115
components/callite/demo1/main.pas
Normal file
115
components/callite/demo1/main.pas
Normal file
@ -0,0 +1,115 @@
|
||||
unit main;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||
LclType, Buttons, StdCtrls, ComCtrls, Grids, DateUtils, CalendarLite;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
edtYear: TEdit;
|
||||
edtMonth: TEdit;
|
||||
Label1: TLabel;
|
||||
procedure btnCloseClick(Sender: TObject);
|
||||
procedure edtYearKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure edtMonthKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormResize(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
CalendarLite1: TCalendarLite;
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
var
|
||||
AYear: Integer;
|
||||
AMonth: Integer;
|
||||
MonthsList: TStringList;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
CalendarLite1 := TCalendarLite.Create(self);
|
||||
with CalendarLite1 do begin
|
||||
Parent := self;
|
||||
Left := 20;
|
||||
// Height := 160;
|
||||
Top := 40;
|
||||
Width := self.Width - 2*Left;
|
||||
Height := label1.Top - Top - 20;
|
||||
ParentColor := false;
|
||||
Date := 41574;
|
||||
DisplayTexts := '"Today is",dd/mm/yyyy,"Holidays during","There are no holidays set for"';
|
||||
WeekendDays := [dowSaturday];
|
||||
Anchors := [akLeft, akTop, akRight, akBottom];
|
||||
end;
|
||||
|
||||
MonthsList:= TStringList.Create;
|
||||
for I:= 0 to 11 do begin
|
||||
MonthsList.Add(AnsiToUTF8(ShortMonthNames[I+1]));
|
||||
end;
|
||||
|
||||
AYear:= YearOf(Now);
|
||||
AMonth:= MonthOf(Now)-1;
|
||||
edtYear.Caption := IntToStr(AYear);
|
||||
edtMonth.Caption := MonthsList[AMonth];
|
||||
end;
|
||||
|
||||
procedure TForm1.FormResize(Sender: TObject);
|
||||
begin
|
||||
edtMonth.Left := Width div 2 - edtMonth.Width - 2;
|
||||
edtYear.Left := Width div 2 + 2;
|
||||
end;
|
||||
|
||||
procedure TForm1.btnCloseClick(Sender: TObject);
|
||||
begin
|
||||
FreeAndNil(MonthsList);
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TForm1.edtYearKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
case Key of
|
||||
VK_Up : Inc(AYear);
|
||||
VK_Down : Dec(AYear);
|
||||
end;
|
||||
edtYear.Caption := IntToStr(AYear);
|
||||
CalendarLite1.Date := RecodeYear(CalendarLite1.Date,AYear);
|
||||
end;
|
||||
|
||||
procedure TForm1.edtMonthKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
case Key of
|
||||
VK_Up : Inc(AMonth);
|
||||
VK_Down : Dec(AMonth);
|
||||
end;
|
||||
case AMonth of
|
||||
-1: AMonth := 11;
|
||||
12: AMonth := 0;
|
||||
end;
|
||||
edtMonth.Text:= MonthsList[AMonth];
|
||||
CalendarLite1.Date:= RecodeMonth(CalendarLite1.Date,AMonth+1);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
104
components/callite/demo2/testCalLite.lpi
Normal file
104
components/callite/demo2/testCalLite.lpi
Normal file
@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="testCalLite"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="3">
|
||||
<Item1>
|
||||
<PackageName Value="callight_pkg"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="RunTimeTypeInfoControls"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item3>
|
||||
</RequiredPackages>
|
||||
<Units Count="3">
|
||||
<Unit0>
|
||||
<Filename Value="testCalLite.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="umaintestcallite.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="uMainTestCalLite"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="calendarlite.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="CalendarLite"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="testCalLite"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Checks>
|
||||
<IOChecks Value="True"/>
|
||||
<RangeChecks Value="True"/>
|
||||
<OverflowChecks Value="True"/>
|
||||
<StackChecks Value="True"/>
|
||||
</Checks>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
<UseExternalDbgSyms Value="True"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
16
components/callite/demo2/testCalLite.lpr
Normal file
16
components/callite/demo2/testCalLite.lpr
Normal file
@ -0,0 +1,16 @@
|
||||
program testCalLite;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Interfaces, Forms, uMainTestCalLite;
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource := True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
177
components/callite/demo2/umaintestcallite.lfm
Normal file
177
components/callite/demo2/umaintestcallite.lfm
Normal file
@ -0,0 +1,177 @@
|
||||
object Form1: TForm1
|
||||
Left = 536
|
||||
Height = 845
|
||||
Top = 72
|
||||
Width = 648
|
||||
Caption = 'Examples of the TCalendaLite component'
|
||||
ClientHeight = 845
|
||||
ClientWidth = 648
|
||||
Color = clWindow
|
||||
Font.CharSet = ANSI_CHARSET
|
||||
OnCreate = FormCreate
|
||||
OnResize = FormResize
|
||||
LCLVersion = '1.7'
|
||||
object PSettings: TPanel
|
||||
Left = 0
|
||||
Height = 376
|
||||
Top = 0
|
||||
Width = 648
|
||||
Align = alTop
|
||||
ClientHeight = 376
|
||||
ClientWidth = 648
|
||||
TabOrder = 0
|
||||
object cgOptions: TCheckGroup
|
||||
Left = 24
|
||||
Height = 296
|
||||
Top = 40
|
||||
Width = 185
|
||||
AutoFill = True
|
||||
Caption = 'Set calendar Options'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 276
|
||||
ClientWidth = 181
|
||||
Items.Strings = (
|
||||
'coBoldDayNames'
|
||||
'coBoldHolidays'
|
||||
'coBoldToday'
|
||||
'coBoldTopRow'
|
||||
'coBoldWeekend'
|
||||
'coDayLine'
|
||||
'coShowBorder'
|
||||
'coShowHolidays'
|
||||
'coShowTodayFrame'
|
||||
'coShowTodayName'
|
||||
'coShowTodayRow'
|
||||
'coShowWeekend'
|
||||
'coUseTopRowColors'
|
||||
)
|
||||
OnItemClick = cgOptionsItemClick
|
||||
TabOrder = 0
|
||||
Data = {
|
||||
0D00000002020202020202020202020202
|
||||
}
|
||||
end
|
||||
object cbUseHolidays: TCheckBox
|
||||
Left = 239
|
||||
Height = 19
|
||||
Top = 40
|
||||
Width = 169
|
||||
Caption = 'Ignore OnGetHolidays event'
|
||||
OnChange = cbUseHolidaysChange
|
||||
TabOrder = 1
|
||||
end
|
||||
object LTitle: TLabel
|
||||
Left = 28
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 318
|
||||
Caption = 'Various calendar property settings can be changed below:'
|
||||
Font.CharSet = ANSI_CHARSET
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object LWidth: TLabel
|
||||
Left = 239
|
||||
Height = 15
|
||||
Top = 81
|
||||
Width = 32
|
||||
Caption = 'Width'
|
||||
ParentColor = False
|
||||
end
|
||||
object seWidth: TSpinEdit
|
||||
Left = 296
|
||||
Height = 23
|
||||
Top = 79
|
||||
Width = 66
|
||||
MaxValue = 430
|
||||
MinValue = 120
|
||||
OnChange = seWidthChange
|
||||
TabOrder = 2
|
||||
Value = 300
|
||||
end
|
||||
object seHeight: TSpinEdit
|
||||
Left = 296
|
||||
Height = 23
|
||||
Top = 112
|
||||
Width = 66
|
||||
MaxValue = 250
|
||||
MinValue = 120
|
||||
OnChange = seHeightChange
|
||||
TabOrder = 3
|
||||
Value = 200
|
||||
end
|
||||
object lHeight: TLabel
|
||||
Left = 239
|
||||
Height = 15
|
||||
Top = 112
|
||||
Width = 36
|
||||
Caption = 'Height'
|
||||
ParentColor = False
|
||||
end
|
||||
object rgLanguage: TRadioGroup
|
||||
Left = 239
|
||||
Height = 160
|
||||
Top = 176
|
||||
Width = 180
|
||||
AutoFill = True
|
||||
Caption = 'Language to use'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 140
|
||||
ClientWidth = 176
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'English (default)'
|
||||
'French'
|
||||
'German'
|
||||
'Hebrew'
|
||||
'Spanish'
|
||||
)
|
||||
OnClick = rgLanguageClick
|
||||
TabOrder = 4
|
||||
end
|
||||
object rgStartingDOW: TRadioGroup
|
||||
Left = 440
|
||||
Height = 192
|
||||
Top = 40
|
||||
Width = 176
|
||||
AutoFill = True
|
||||
Caption = 'Starting day of the week'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 172
|
||||
ClientWidth = 172
|
||||
Items.Strings = (
|
||||
'Sunday'
|
||||
'Monday'
|
||||
'Tuesday'
|
||||
'Wednesday'
|
||||
'Thursday'
|
||||
'Friday'
|
||||
'Saturday'
|
||||
)
|
||||
OnClick = rgStartingDOWClick
|
||||
TabOrder = 5
|
||||
end
|
||||
end
|
||||
end
|
231
components/callite/demo2/umaintestcallite.pp
Normal file
231
components/callite/demo2/umaintestcallite.pp
Normal file
@ -0,0 +1,231 @@
|
||||
unit uMainTestCalLite;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Graphics, ExtCtrls, StdCtrls, Spin, CalendarLite;
|
||||
// Easysize;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
cbUseHolidays: TCheckBox;
|
||||
cgOptions: TCheckGroup;
|
||||
//FormResizer1: TFormResizer;
|
||||
LTitle: TLabel;
|
||||
LWidth: TLabel;
|
||||
lHeight: TLabel;
|
||||
PSettings: TPanel;
|
||||
rgLanguage: TRadioGroup;
|
||||
rgStartingDOW: TRadioGroup;
|
||||
seWidth: TSpinEdit;
|
||||
seHeight: TSpinEdit;
|
||||
procedure cbUseHolidaysChange(Sender: TObject);
|
||||
procedure cgOptionsItemClick(Sender: TObject; Index: integer);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormResize(Sender: TObject);
|
||||
procedure rgLanguageClick(Sender: TObject);
|
||||
procedure rgStartingDOWClick(Sender: TObject);
|
||||
procedure seHeightChange(Sender: TObject);
|
||||
procedure seWidthChange(Sender: TObject);
|
||||
private
|
||||
copyCal, demoCal: TCalendarLite;
|
||||
FnoHolidays: boolean;
|
||||
procedure RespondToDateChange(Sender: tObject);
|
||||
procedure GetHolidays(Sender: TObject; AMonth, AYear: Integer; // wp
|
||||
var Holidays: THolidays);
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
function Easter(year:integer) : TDateTime; // wp
|
||||
var
|
||||
Day, Month : integer;
|
||||
a,b,c,d,e,m,n : integer;
|
||||
begin
|
||||
case Year div 100 of
|
||||
17 : begin m := 23; n := 3; end;
|
||||
18 : begin m := 23; n := 4; end;
|
||||
19,20 : begin m := 24; n := 5; end;
|
||||
21 : begin m := 24; n := 6; end;
|
||||
else raise Exception.Create('Only years above 1700 supported.');
|
||||
end;
|
||||
a := Year mod 19;
|
||||
b := Year mod 4;
|
||||
c := Year mod 7;
|
||||
d := (19*a + m) mod 30;
|
||||
e := (2*b + 4*c + 6*d + n) mod 7;
|
||||
day := 22 + d + e;
|
||||
Month := 3;
|
||||
if Day>31 then begin
|
||||
Day := d + e - 9;
|
||||
Month := 4;
|
||||
if (d=28) and (e=6) and (a>10) then begin
|
||||
if day=26 then day := 19;
|
||||
if day=25 then day := 18;
|
||||
end;
|
||||
end;
|
||||
result := EncodeDate(year, month, day);
|
||||
end;
|
||||
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
var opt: TCalOption;
|
||||
begin
|
||||
// FormResizer1.InitializeForm;
|
||||
demoCal:= TCalendarLite.Create(Self);
|
||||
demoCal.Parent:= Self;
|
||||
demoCal.Left:= 10;
|
||||
demoCal.Top:= PSettings.Height + 10;
|
||||
demoCal.Width := seWidth.Value;
|
||||
demoCal.Height := seHeight.Value;
|
||||
demoCal.OnGetHolidays := @GetHolidays;
|
||||
demoCal.OnDateChange:= @RespondToDateChange;
|
||||
FNoHolidays:= False;
|
||||
for opt in demoCal.Options do
|
||||
if (opt in demoCal.Options) then cgOptions.Checked[integer(opt)] := True;
|
||||
seHeight.Value := demoCal.Height;
|
||||
seWidth.Value:= demoCal.Width;
|
||||
rgStartingDOW.ItemIndex:= integer(demoCal.StartingDayOfWeek)-1;
|
||||
|
||||
copyCal:= TCalendarLite.Create(Self);
|
||||
copyCal.Parent := Self;
|
||||
copyCal.Width := 270;
|
||||
copyCal.Height := 205;
|
||||
copyCal.Left := Width - copyCal.Width;
|
||||
copyCal.Top := Height - copyCal.Height;
|
||||
copyCal.Font.Name := 'Lucida Calligraphy';
|
||||
copyCal.Colors.SelectedDateColor := clYellow;
|
||||
copyCal.Colors.ArrowBorderColor := clYellow;
|
||||
copyCal.Colors.ArrowColor := clYellow;
|
||||
copyCal.Colors.TodayFrameColor := clWhite;
|
||||
copyCal.Colors.BackgroundColor:= clGradientActiveCaption;
|
||||
copyCal.StartingDayOfWeek:= dowSaturday;
|
||||
copyCal.OnGetHolidays := @GetHolidays;
|
||||
copyCal.Options := copyCal.Options + [coShowBorder,coUseTopRowColors,coDayLine];
|
||||
end;
|
||||
|
||||
procedure TForm1.FormResize(Sender: TObject);
|
||||
begin
|
||||
// FormResizer1.ResizeAll;
|
||||
end;
|
||||
|
||||
procedure TForm1.rgLanguageClick(Sender: TObject);
|
||||
begin
|
||||
case rgLanguage.ItemIndex of
|
||||
0: demoCal.Languages := lgEnglish;
|
||||
1: demoCal.Languages := lgFrench;
|
||||
2: demoCal.Languages := lgGerman;
|
||||
3: demoCal.Languages := lgHebrew;
|
||||
4: demoCal.Languages := lgSpanish;
|
||||
end;
|
||||
|
||||
{
|
||||
case rgLanguage.ItemIndex of
|
||||
0: begin
|
||||
demoCal.DayNames := EnglishDays;
|
||||
demoCal.MonthNames := EnglishMonths;
|
||||
demoCal.DisplayTexts := DefaultDisplayText;
|
||||
demoCal.BiDiMode:= bdLeftToRight;
|
||||
end;
|
||||
1: begin
|
||||
demoCal.DayNames := FrenchDays;
|
||||
demoCal.MonthNames := FrenchMonths;
|
||||
demoCal.DisplayTexts := FrenchTexts;
|
||||
demoCal.BiDiMode:= bdLeftToRight;
|
||||
end;
|
||||
2: begin
|
||||
demoCal.DayNames := GermanDays;
|
||||
demoCal.MonthNames := GermanMonths;
|
||||
demoCal.DisplayTexts := GermamTexts;
|
||||
demoCal.BiDiMode:= bdLeftToRight;
|
||||
end;
|
||||
3: begin
|
||||
demoCal.DayNames := HebrewDays;
|
||||
demoCal.MonthNames := HebrewMonths;
|
||||
demoCal.DisplayTexts := HebrewTexts;
|
||||
demoCal.BiDiMode:= bdRightToLeft;
|
||||
end;
|
||||
4: begin
|
||||
demoCal.DayNames := SpanishDays;
|
||||
demoCal.MonthNames := SpanishMonths;
|
||||
demoCal.DisplayTexts := SpanishTexts;
|
||||
demoCal.BiDiMode:= bdLeftToRight;
|
||||
end;
|
||||
end;
|
||||
}
|
||||
end;
|
||||
|
||||
procedure TForm1.rgStartingDOWClick(Sender: TObject);
|
||||
begin
|
||||
demoCal.StartingDayOfWeek := TDayOfWeek(rgStartingDOW.ItemIndex + 1);
|
||||
end;
|
||||
|
||||
procedure TForm1.seHeightChange(Sender: TObject);
|
||||
begin
|
||||
demoCal.Height := seHeight.Value;
|
||||
end;
|
||||
|
||||
procedure TForm1.seWidthChange(Sender: TObject);
|
||||
begin
|
||||
demoCal.Width := seWidth.Value;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbUseHolidaysChange(Sender: TObject);
|
||||
begin
|
||||
FnoHolidays := not FnoHolidays;
|
||||
end;
|
||||
|
||||
procedure TForm1.cgOptionsItemClick(Sender: TObject; Index: integer);
|
||||
var opt: TCalOption;
|
||||
begin
|
||||
opt := TCalOption(Index);
|
||||
if (opt in demoCal.Options) then
|
||||
demoCal.Options := demoCal.Options - [opt]
|
||||
else demoCal.Options := demoCal.Options + [opt];
|
||||
end;
|
||||
|
||||
procedure TForm1.RespondToDateChange(Sender: tObject);
|
||||
begin
|
||||
copyCal.Date:= TCalendarLite(Sender).Date;
|
||||
end;
|
||||
|
||||
// wp
|
||||
procedure TForm1.GetHolidays(Sender: TObject; AMonth, AYear: Integer;
|
||||
var Holidays: THolidays);
|
||||
var
|
||||
d, m, y: Word;
|
||||
e: TDate;
|
||||
begin
|
||||
ClearHolidays(Holidays);
|
||||
if not FNoHolidays then
|
||||
begin
|
||||
// Fixed holidays
|
||||
case AMonth of
|
||||
1: AddHoliday(1, Holidays); // New Year
|
||||
12: AddHoliday(25, Holidays); // Christmas
|
||||
end;
|
||||
// Easter
|
||||
e := Easter(AYear);
|
||||
DecodeDate(e, y,m,d);
|
||||
if m = AMonth then
|
||||
AddHoliday(d, Holidays);
|
||||
// Whit Sunday --> 49 days after easter
|
||||
DecodeDate(e+49, y,m,d);
|
||||
if m = AMonth then
|
||||
AddHoliday(d, Holidays);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
BIN
components/callite/icon/TCALENDARLITE.PNG
Normal file
BIN
components/callite/icon/TCALENDARLITE.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 886 B |
5
components/callite/icon/icon-source.txt
Normal file
5
components/callite/icon/icon-source.txt
Normal file
@ -0,0 +1,5 @@
|
||||
The TCalendarLite palette icon is the image
|
||||
|
||||
calendar-day.png
|
||||
|
||||
of the Fugue Icons collection (http://p.yusukekamiyamane.com/)
|
1
components/callite/icon/make_lrs.bat
Normal file
1
components/callite/icon/make_lrs.bat
Normal file
@ -0,0 +1 @@
|
||||
lazres ..\source\calendarlite_icon.lrs TCALENDARLITE.PNG
|
1295
components/callite/source/calendarlite.pas
Normal file
1295
components/callite/source/calendarlite.pas
Normal file
File diff suppressed because it is too large
Load Diff
38
components/callite/source/calendarlite_icon.lrs
Normal file
38
components/callite/source/calendarlite_icon.lrs
Normal file
@ -0,0 +1,38 @@
|
||||
LazarusResources.Add('TCALENDARLITE','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#25'tEXtSoftware'#0'Adobe ImageReadyq'#201'e<'#0#0#3#24'IDATx'#218#172'U'
|
||||
+'KK'#28'A'#16#174#158#153'}*q#j'#2#1#215#131#202#198#24'1'#174'$'#168#172#186
|
||||
+#130#130#134'<'#14#130'7'#227'_'#200#31'0D'#127#129#7'!'#162' '#30#19#246#226
|
||||
+'EC'#14'*('#132#8#10'9'#172'&'#172'b'#212#5'C'#18#15'Q'#216#247'L'#167#186'f'
|
||||
+'f'#179';>2'#129'-({'#218#234#250#190#170#174#234'Zv'#204#24'0'#0#210#143#168
|
||||
+#195#156'?'#194'%'#128#250'%'#194#216#167#14#184'^'#174#242#225#134'2'#131
|
||||
+#224'5~'#223#19#14#139#156#215#133'wv'#130#171'MM['#207#24#251#6'6'#228#10
|
||||
+#159'('#18#188'RT}'#211#226#159#152'x'#14#185#28#244#174#172'@,'#22#131#222
|
||||
+'P(x'#167#175'/h'#135#224#130#143#162#192#225#248#184',lJV?'#227#228#169#20
|
||||
+#240'd'#18'~'#157#157#193#238#216#24#248'jkA;?'#183#131#127#193#135'y<'#128
|
||||
+#184'N"H'#235'g'#28'<'#147#129#28#234#131#246'vhhh'#128#242#138#10#218#219#17
|
||||
+#171#143'"'#203#128#184#14#157#128's'#202'@'#195#12'T'#212#242#217'Yp..B*'#28
|
||||
+#134#228#242'2'#252#238#236#132#234#201#201'k'#9#20#172#163#207#231#163'o'
|
||||
+#129'!'#225#30'q'#245#12#140#24#157#154#145#193#225#208#16'x'#203#202' 13C'
|
||||
+#171#182#176#0#185#154#26#248#31#145'1'#131#140'yEF'#13#20'qE'#130#228#166#17
|
||||
+#137#171'`'#213'l^'#149')'#28#9#16'W'#161'M@'#215#151#188#196'"0'#3#20#185'N'
|
||||
+'*'#209#195#224#28'J!'#12'k'#128'H'#18']'#141#241'?ICpM'#211'JB I'#132#173#19
|
||||
+#24'1'#203#130'@-'#200' vp'#0#239#215#214#232'['#216':'#218#218#224'ak+'#237
|
||||
+#227''''''#16'YZ"'#160#254'P'#8#238#214#215'['#138#192'E'#6'r'#158#197#204'@'
|
||||
+#197#12'L'#189'UU'#5'O'#7#6#224#197#240'0'#212#215#213#193#250#230'f'#222'V'
|
||||
+#230#245'B'#127'w7'#164#211'i|'#252#185'"?'#161#154#30'hQ'#6#146#136'>'#167
|
||||
+#170#249' \n7'#220'F5#r9'#157'y'#187#23#9#170'++!'#133'='#159'E'#130'B?'#170
|
||||
+#1'fv'#161#6'D`'#169#193#225#241'1|'#221#219#131#207#209'('#140#142#140#20
|
||||
+#217#179#8#154''''#176#248'I'#5#25'H'#198'X'#149#173'W$'#244#231#233')'#196
|
||||
+#246#247#225#28#231#203#135#213'U'#2'3m"'#234'$'#206#174'L6{'#233#21#9'L'#254
|
||||
+#175#12#238'77'#147#30#197#227#240'fn'#14'Z'#240';'#208#216'H6A'#144'H$'#136
|
||||
+#192#234#167'\R'#3'Y3'#162#186'LD!E'#180#162'k'#196#153#173#237'm'#152#157
|
||||
+#159''''#219'4'#142#148'''8^'#30#15#14#230#207#11','#179#139#138'2P-'#145'd1'
|
||||
+#186#232#238'.,'#225#208#11#247#244#128#223#239#167'3'#173#216#174#211'SSEg'
|
||||
+#11'}'#213#162#12#24#163#166#209','#4#235#27#27#240'.'#18#161#150#28#194#232
|
||||
+#186#177#223'U'#155#15#145'j'#192#152#139#8#12#23#143#246#151#153#164#179#171
|
||||
+#139#212#18#149'='#2']=D'#240#29#255#224'0'#246'8'#28#14#26#207#165#16#129'%'
|
||||
+#8'~'#8#130#20#231#190'$c'#241#160#219#253#22'J('#248#139'v'#132#216'7D'#1
|
||||
+#196's'#245#24'++'#17#190'h'#199#164#224#249'#'#192#0'`'#167'&'#202'X'#24#179
|
||||
+#213#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
Reference in New Issue
Block a user