var VarIHeighAutoHEigt:Integer;
implementation
procedure TMiPanelDiary.Alarm(Sender: TObject);
begin
if Assigned(FOnAlarm) then FOnAlarm(Sender);
if FClock.FMessageAlarm<>'' then ShowMessage(FClock.FMessageAlarm);
end;
procedure TMiPanelDiary.AutoDestroy;
begin
FClock.Free;
FClock.FFontClock.Free;
FDay.FFontDay.Free;
FDayExt.FFontDayExt.Free;
FMonth.FFontMonth.Free;
FStation.FFontStation.Free;
FWeeksDays.FFontWeekDays.Free;
FYear.FFontYear.Free;
FPanelNotice.Free;
FPanelStation.Free;
FPanelDayExt.Free;
FPanelDayX.Free;
FPanelMonth.Free;
FPanelYear.Free;
FPanelWeeksDay.Free;
FPanelClock.Free;
FMyTimer.free;
FTexto1.Free;
FTexto2.Free;
end;
procedure TMiPanelDiary.AutoInitialize;
begin
FOnlyOneFont := False;
FDate := Now;
FLanguage := Espanol;
Height := 318;
Width := 177;
FUsarComentarios := True;
Ftipo := Completo;
FAutoheight := False;
FNotice := TNotice.Create;
Fnotice.FNoticeColor := clBlue;
FNotice.FPanelVisible := False;
FNotice.FText1 := '';
FNotice.FText2 := '';
FNotice.Height := 40;
FNotice.FNoticeFont := TFont.Create;
with FNotice.FNoticeFont do
begin
Color := clYellow;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
FStation := TStation.Create;
FStation.FColorStation := $0033CCFF;
FStation.FPanelVisible := True;
FStation.FFontStation := TFont.Create;
with FStation.FFontStation do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
FStation.FColorStation := clRed;
FDayExt := TDayExt.Create;
FDayExt.FColorDayExt := $0033CCFF;
FDayExt.FPanelVisible := True;
FDayExt.FFontDayExt := TFont.Create;
with FDayExt.FFontDayExt do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
FDay := TDayX.Create;
FDay.FColorDay := clWhite;
FDay.FHeight := 100;
FDay.FFontDay := TFont.Create;
with FDay.FFontDay do
begin
Color := clBlack;
Name := 'Arial';
Size := 70;
Style := [fsBold]
end;
FMonth := TMonth.Create;
FMonth.FColorMonth := $0033CCFF;
FMonth.FPanelVisible := True;
FMonth.FFontMonth := TFont.Create;
with FMonth.FFontMonth do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
FYear := TYear.Create;
FYear.FColorYear := $0033CCFF;
FYear.FPanelVisible := True;
FYear.FFontYear := TFont.Create;
with FYear.FFontYear do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
FWeeksDays := TWeeksDay.Create;
FWeeksDays.FColorWeeksDays := $0033CCFF;
FWeeksDays.FPanelVisible := True;
FWeeksDays.FFontWeekDays := TFont.Create;
with FWeeksDays.FFontWeekDays do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
FClock := TClock.Create;
FClock.FClockEnable := True;
FClock.FPanelVisible := True;
FClock.FFontClock := TFont.Create;
FClock.FClock12_24 := Select12;
FClock.FColorClock := $00FFCCCC;
FClock.FFontClock.color := $00003333;
FClock.FInterval := 1000;
FClock.FAlarmActive := False;
FClock.FHourAlarm := Now;
FClock.FMessageAlarm := '';
FClock.FHour := Now;
FMyTimer:=TTimer.Create(Self); with FMyTimer do
begin
Enabled := FClock.FClockEnable;
Interval := FClock.FInterval;
OnTimer := FOnTimer;
end;
FPanelNotice:=TPanel.Create(Self); with FPanelNotice do
begin
Parent := Self;
TabOrder := 0;
Align := alTop;
Visible := False;
Font := FNotice.FNoticeFont;
Color := FNotice.FNoticeColor;
Visible := FNotice.FPanelVisible;
ParentColor :=false;
ParentBackground :=False;
Height := FNotice.Height;
Caption :='';
end;
FTexto1:=TLabel.Create(Self);
with FTexto1 do
begin
Parent := FPanelNotice;
Top := 3;
Left := 3;
AutoSize := False;
Width := FPanelNotice.Width-6;
Font := FNotice.FNoticeFont;
Transparent:= True;
Alignment := taCenter
end;
FTexto2:=TLabel.Create(Self);
with FTexto2 do
begin
Parent := FPanelNotice;
Top := 3+FNotice.FNoticeFont.Size+1; Left := 3;
AutoSize := False;
Width := FPanelNotice.Width;
Font := FNotice.FNoticeFont;
Transparent:= True;
Alignment := taCenter
end;
FPanelDayExt:=TPanel.Create(Self); with FPanelDayExt do
begin
Parent := Self;
TabOrder := 1;
Align := alTop;
Font := FDayExt.FontDayExt;
Color := FDayExt.FColorDayExt;
Visible := FDayExt.FPanelVisible;
ParentColor := false;
ParentBackground :=False;
Height := 30;
Caption :=' Dia ';
end;
FPaneldayx:=TPanel.Create(Self); with FPanelDayX do
begin
Parent := Self;
TabOrder := 2;
Align := alTop;
Font := FDay.FFontDay;
Color := FDay.FColorDay;
Caption := FormatDateTime('dd',Date);
ParentColor := false;
ParentBackground :=False;
Height := FDay.FHeight;
end;
FPanelMonth:=TPanel.Create(Self); with FPanelMonth do
begin
Parent := Self;
TabOrder := 3;
Align := alTop;
Font := FMonth.FFontMonth;
Color := FMonth.FColorMonth;
Visible := FMonth.FPanelVisible;
ParentColor := false;
ParentBackground :=False;
Height := 30;
Caption :='MES';
end;
FPanelYear:=TPanel.Create(Self); with FPanelYear do
begin
Parent := Self;
TabOrder := 4;
Align := alTop;
Font := FYear.FFontYear;
Color := FYear.FColorYear;
Visible := FYear.FPanelVisible;
ParentColor := false;
ParentBackground :=False;
Height := 30;
Caption :=' AÑO ';
end;
FPanelWeeksDay:=TPanel.Create(Self); with FPanelWeeksDay do
begin
Parent := Self;
TabOrder := 5;
Align := alTop;
Font := FWeeksDays.FFontWeekDays;
Color := FWeeksDays.FColorWeeksDays;
Visible := FWeeksDays.FPanelVisible;
ParentColor :=false;
ParentBackground :=False;
Height := 30;
Caption :='Semanas Dias';
end;
FPanelStation:=TPanel.Create(Self); with FPanelStation do
begin
Parent := Self;
TabOrder := 6;
Align := alTop;
Visible := FStation.FPanelVisible;
Font := FStation.FFontStation;
Color := FStation.FColorStation;
ParentColor :=false;
ParentBackground :=False;
Height := 30;
Caption :=' ESTACION ';
end;
FPanelClock:=TPanel.Create(Self); with FPanelClock do
begin
Parent := Self;
TabOrder := 7;
Align := alTop;
Font := FClock.FFontClock;
Color := FClock.FColorClock;
Visible := FClock.FPanelVisible;
ParentColor :=false;
ParentBackground :=False;
Visible := True;
Height := 30;
Caption :='Reloj';
end;
end;
procedure TMiPanelDiary.Calculos;
var VariNumeroPaneles:Integer;
begin
VariNumeroPaneles:=1;
if FNotice.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FDayExt.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FMonth.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FYear.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FWeeksDays.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FStation.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FClock.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
VarIHeighAutoHEigt:=(Self.Height-FDay.FHeight) div (VariNumeroPaneles-1);
end;
procedure TMiPanelDiary.Click;
begin
inherited Click;
end;
procedure TMiPanelDiary.ClickClock(Sender: TObject);
begin
if Assigned(FOnClickClock) then FOnClickClock(Sender);
end;
procedure TMiPanelDiary.ClickDay(Sender: TObject);
begin
if Assigned(FOnClickDay) then FOnClickDay(Sender);
end;
procedure TMiPanelDiary.ClickDayExt(Sender: TObject);
begin
if Assigned(FOnClickDayExt) then FOnClickDayExt(Sender);
end;
procedure TMiPanelDiary.ClickMonth(Sender: TObject);
begin
if Assigned(FOnClickMonth) then FOnClickMonth(Sender);
end;
procedure TMiPanelDiary.ClickNotice(Sender: TObject);
begin
if Assigned(FOnClickNotice) then FOnClickNotice(Sender);
end;
procedure TMiPanelDiary.ClickStation(Sender: TObject);
begin
if Assigned(FOnClickStation) then FOnClickStation(Sender);
end;
procedure TMiPanelDiary.ClickWeeksDays(Sender: TObject);
begin
if Assigned(FOnClickWeeksDays) then FOnClickWeeksDays(Sender);
end;
procedure TMiPanelDiary.ClickYEar(Sender: TObject);
begin
if Assigned(FOnClickYEar) then FOnClickYEar(Sender);
end;
constructor TMiPanelDiary.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
AutoInitialize;
end;
procedure TMiPanelDiary.DateChanged(Sender: TObject);
begin
if Assigned(FOnDateChanged) then FOnDateChanged(Sender);
end;
destructor TMiPanelDiary.Destroy;
begin
AutoDestroy;
inherited Destroy;
end;
procedure TMiPanelDiary.Loaded;
begin
inherited Loaded;
end;