lazarus/lcl/interfaces/win32/win32wscalendar.pp
2004-09-19 18:50:28 +00:00

95 lines
3.6 KiB
ObjectPascal

{ $Id$}
{
*****************************************************************************
* Win32WSCalendar.pp *
* ------------------ *
* *
* *
*****************************************************************************
*****************************************************************************
* *
* This file is part of the Lazarus Component Library (LCL) *
* *
* See the file COPYING.LCL, included in this distribution, *
* for details about the copyright. *
* *
* This program 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. *
* *
*****************************************************************************
}
unit Win32WSCalendar;
{$mode objfpc}{$H+}
interface
uses
////////////////////////////////////////////////////
// I M P O R T A N T
////////////////////////////////////////////////////
// To get as little as posible circles,
// uncomment only when needed for registration
////////////////////////////////////////////////////
Calendar, SysUtils,
////////////////////////////////////////////////////
WSCalendar, WSLCLClasses, Windows, Win32Def;
type
{ TWin32WSCalendar }
TWin32WSCalendar = class(TWSCalendar)
private
protected
public
class function GetDateTime(const ACalendar: TCustomCalendar): TDateTime; override;
class procedure SetDateTime(const ACalendar: TCustomCalendar; const ADateTime: TDateTime); override;
class procedure SetDisplaySettings(const ACalendar: TCustomCalendar; const ASettings: TDisplaySettings); override;
class procedure SetReadOnly(const ACalendar: TCustomCalendar; const AReadOnly: boolean); override;
end;
implementation
function TWin32WSCalendar.GetDateTime(const ACalendar: TCustomCalendar): TDateTime;
var
ST: SystemTime;
begin
SendMessage(ACalendar.Handle, MCM_GETCURSEL, 0, LPARAM(@ST));
with ST do
Result := EncodeDate(WYear,WMonth,WDay);
end;
procedure TWin32WSCalendar.SetDateTime(const ACalendar: TCustomCalendar; const ADateTime: TDateTime);
var
ST: SystemTime;
begin
DecodeDate(ADateTime, ST.WYear, ST.WMonth, ST.WDay);
SendMessage(ACalendar.Handle, MCM_SETCURSEL, 0, Windows.LParam(@ST));
end;
procedure TWin32WSCalendar.SetDisplaySettings(const ACalendar: TCustomCalendar; const ASettings: TDisplaySettings);
begin
// TODO: implement me!
end;
procedure TWin32WSCalendar.SetReadOnly(const ACalendar: TCustomCalendar; const AReadOnly: boolean);
begin
// TODO: implement me!
end;
initialization
////////////////////////////////////////////////////
// I M P O R T A N T
////////////////////////////////////////////////////
// To improve speed, register only classes
// which actually implement something
////////////////////////////////////////////////////
RegisterWSComponent(TCalendar, TWin32WSCalendar);
////////////////////////////////////////////////////
end.