mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-01 03:13:07 +02:00
win32: cleanup calendar code, implement ShowWeekNumbers option
git-svn-id: trunk@19084 -
This commit is contained in:
parent
7e563aa986
commit
e82b00defb
@ -33,12 +33,6 @@ uses
|
||||
Windows, Classes, LCLType;
|
||||
|
||||
const
|
||||
// Used by TCalendar
|
||||
MCM_FIRST = $1000;
|
||||
MCM_GETCURSEL = MCM_FIRST + 1;
|
||||
MCM_SETCURSEL = MCM_FIRST + 2;
|
||||
MCM_GETMINREQRECT = MCM_FIRST + 9;
|
||||
|
||||
// it is not good to use WM_USER since many programs use it.
|
||||
WM_LCL_SOCK_ASYNC = WM_USER + $500;
|
||||
|
||||
@ -56,4 +50,4 @@ var
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
end.
|
||||
|
@ -33,9 +33,9 @@ uses
|
||||
// To get as little as posible circles,
|
||||
// uncomment only when needed for registration
|
||||
////////////////////////////////////////////////////
|
||||
Calendar, SysUtils, Controls, LCLType,
|
||||
CommCtrl, SysUtils, Controls, LCLType, Calendar,
|
||||
////////////////////////////////////////////////////
|
||||
WSCalendar, WSLCLClasses, Windows, Win32Def, Win32WSControls;
|
||||
WSCalendar, WSLCLClasses, WSProc, Windows, Win32WSControls;
|
||||
|
||||
type
|
||||
|
||||
@ -74,10 +74,12 @@ begin
|
||||
pClassName := 'SysMonthCal32';
|
||||
WindowTitle := StrCaption;
|
||||
Flags := WS_CHILD or WS_VISIBLE;
|
||||
if dsShowWeekNumbers in TCustomCalendar(AWinControl).DisplaySettings then
|
||||
Flags := Flags or MCS_WEEKNUMBERS;
|
||||
SubClassWndProc := @WindowProc;
|
||||
end;
|
||||
// create window
|
||||
FinishCreateWindow(AWinControl, Params, false);
|
||||
FinishCreateWindow(AWinControl, Params, False);
|
||||
Result := Params.Window;
|
||||
SetClassLong(Result, GCL_STYLE, GetClassLong(Result, GCL_STYLE) or CS_DBLCLKS);
|
||||
// resize to proper size
|
||||
@ -114,8 +116,17 @@ begin
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomCalendar.SetDisplaySettings(const ACalendar: TCustomCalendar; const ASettings: TDisplaySettings);
|
||||
var
|
||||
Style: LongInt;
|
||||
begin
|
||||
// TODO: implement me!
|
||||
if not WSCheckHandleAllocated(ACalendar, 'TWin32WSCustomCalendar.SetDisplaySettings') then
|
||||
Exit;
|
||||
Style := GetWindowLong(ACalendar.Handle, GWL_STYLE);
|
||||
if dsShowWeekNumbers in ASettings then
|
||||
Style := Style or MCS_WEEKNUMBERS
|
||||
else
|
||||
Style := Style and not MCS_WEEKNUMBERS;
|
||||
SetWindowLong(ACalendar.Handle, GWL_STYLE, Style);
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomCalendar.SetReadOnly(const ACalendar: TCustomCalendar; const AReadOnly: boolean);
|
||||
|
Loading…
Reference in New Issue
Block a user