From 096157088ebd5c0285446d373f14ccf494994c6f Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 24 Mar 2009 09:19:31 +0000 Subject: [PATCH] wince: port win32 ShowWeekNumber option for TCalendar (patch by haword, issue #0013392) git-svn-id: trunk@19087 - --- lcl/interfaces/wince/wincedef.pp | 4 +++- lcl/interfaces/wince/wincewscalendar.pp | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lcl/interfaces/wince/wincedef.pp b/lcl/interfaces/wince/wincedef.pp index fd129c312e..4e9d347e87 100644 --- a/lcl/interfaces/wince/wincedef.pp +++ b/lcl/interfaces/wince/wincedef.pp @@ -33,11 +33,13 @@ Uses Windows, Classes, LCLType; Const - // Used by TCalendar +// Used by TCalendar MCM_FIRST = $1000; MCM_GETCURSEL = MCM_FIRST + 1; MCM_SETCURSEL = MCM_FIRST + 2; MCM_GETMINREQRECT = MCM_FIRST + 9; + MCS_WEEKNUMBERS = $0004; + Type TGDIType = (gdiBitmap, gdiBrush, gdiFont, gdiPen, gdiRegion); diff --git a/lcl/interfaces/wince/wincewscalendar.pp b/lcl/interfaces/wince/wincewscalendar.pp index e8d39e45e7..fb2738fe35 100644 --- a/lcl/interfaces/wince/wincewscalendar.pp +++ b/lcl/interfaces/wince/wincewscalendar.pp @@ -27,11 +27,11 @@ unit WinCEWSCalendar; interface uses - Calendar, SysUtils, Controls, LCLType, commctrl, + Calendar, SysUtils, Controls, LCLType, commctrl,WSProc, WSCalendar, WSLCLClasses, Windows, WinCEDef, WinCEWSControls; type - + { TWinCEWSCustomCalendar } TWinCEWSCustomCalendar = class(TWSCustomCalendar) @@ -46,7 +46,6 @@ type class procedure SetReadOnly(const ACalendar: TCustomCalendar; const AReadOnly: boolean); override; end; - implementation uses @@ -75,6 +74,8 @@ 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 @@ -115,8 +116,17 @@ begin end; class procedure TWinCEWSCustomCalendar.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 TWinCEWSCustomCalendar.SetReadOnly(const ACalendar: TCustomCalendar; const AReadOnly: boolean);