mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-09 01:58:12 +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;
|
Windows, Classes, LCLType;
|
||||||
|
|
||||||
const
|
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.
|
// it is not good to use WM_USER since many programs use it.
|
||||||
WM_LCL_SOCK_ASYNC = WM_USER + $500;
|
WM_LCL_SOCK_ASYNC = WM_USER + $500;
|
||||||
|
|
||||||
|
@ -33,9 +33,9 @@ uses
|
|||||||
// To get as little as posible circles,
|
// To get as little as posible circles,
|
||||||
// uncomment only when needed for registration
|
// 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
|
type
|
||||||
|
|
||||||
@ -74,10 +74,12 @@ begin
|
|||||||
pClassName := 'SysMonthCal32';
|
pClassName := 'SysMonthCal32';
|
||||||
WindowTitle := StrCaption;
|
WindowTitle := StrCaption;
|
||||||
Flags := WS_CHILD or WS_VISIBLE;
|
Flags := WS_CHILD or WS_VISIBLE;
|
||||||
|
if dsShowWeekNumbers in TCustomCalendar(AWinControl).DisplaySettings then
|
||||||
|
Flags := Flags or MCS_WEEKNUMBERS;
|
||||||
SubClassWndProc := @WindowProc;
|
SubClassWndProc := @WindowProc;
|
||||||
end;
|
end;
|
||||||
// create window
|
// create window
|
||||||
FinishCreateWindow(AWinControl, Params, false);
|
FinishCreateWindow(AWinControl, Params, False);
|
||||||
Result := Params.Window;
|
Result := Params.Window;
|
||||||
SetClassLong(Result, GCL_STYLE, GetClassLong(Result, GCL_STYLE) or CS_DBLCLKS);
|
SetClassLong(Result, GCL_STYLE, GetClassLong(Result, GCL_STYLE) or CS_DBLCLKS);
|
||||||
// resize to proper size
|
// resize to proper size
|
||||||
@ -114,8 +116,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWin32WSCustomCalendar.SetDisplaySettings(const ACalendar: TCustomCalendar; const ASettings: TDisplaySettings);
|
class procedure TWin32WSCustomCalendar.SetDisplaySettings(const ACalendar: TCustomCalendar; const ASettings: TDisplaySettings);
|
||||||
|
var
|
||||||
|
Style: LongInt;
|
||||||
begin
|
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;
|
end;
|
||||||
|
|
||||||
class procedure TWin32WSCustomCalendar.SetReadOnly(const ACalendar: TCustomCalendar; const AReadOnly: boolean);
|
class procedure TWin32WSCustomCalendar.SetReadOnly(const ACalendar: TCustomCalendar; const AReadOnly: boolean);
|
||||||
|
Loading…
Reference in New Issue
Block a user