wince: port win32 ShowWeekNumber option for TCalendar (patch by haword, issue #0013392)

git-svn-id: trunk@19087 -
This commit is contained in:
paul 2009-03-24 09:19:31 +00:00
parent b4f0c63393
commit 096157088e
2 changed files with 17 additions and 5 deletions

View File

@ -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);

View File

@ -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);