tvplanit: Cosmetic changes in MonthView
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5053 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
88e7a16ba7
commit
08b4caa46c
@ -56,8 +56,7 @@ type
|
|||||||
|
|
||||||
TVpMVDayNameStyle = (dsLong, dsShort, dsLetter);
|
TVpMVDayNameStyle = (dsLong, dsShort, dsLetter);
|
||||||
|
|
||||||
TVpOnEventClick =
|
TVpOnEventClick = procedure(Sender: TObject; Event: TVpEvent) of object;
|
||||||
procedure(Sender: TObject; Event: TVpEvent) of object;
|
|
||||||
|
|
||||||
TVpMvHeadAttr = class(TPersistent)
|
TVpMvHeadAttr = class(TPersistent)
|
||||||
protected{ private }
|
protected{ private }
|
||||||
@ -114,50 +113,50 @@ type
|
|||||||
|
|
||||||
TVpMonthView = class(TVpLinkableControl)
|
TVpMonthView = class(TVpLinkableControl)
|
||||||
protected{ private }
|
protected{ private }
|
||||||
FKBNavigate : Boolean;
|
FKBNavigate: Boolean;
|
||||||
FColumnWidth : Integer;
|
FColumnWidth: Integer;
|
||||||
FColor : TColor;
|
FColor: TColor;
|
||||||
FLineColor : TColor;
|
FLineColor: TColor;
|
||||||
FLineCount : Integer;
|
FLineCount: Integer;
|
||||||
FVisibleLines : Integer;
|
FVisibleLines: Integer;
|
||||||
FDayNameStyle : TVpMVDayNameStyle;
|
FDayNameStyle: TVpMVDayNameStyle;
|
||||||
FOffDayColor : TColor;
|
FOffDayColor: TColor;
|
||||||
FOffDayFontColor : TColor;
|
FOffDayFontColor: TColor;
|
||||||
FSelectedDayColor : TColor;
|
FSelectedDayColor: TColor;
|
||||||
FWeekStartsOn : TVpDayType;
|
FWeekStartsOn: TVpDayType;
|
||||||
FShowEvents : Boolean;
|
FShowEvents: Boolean;
|
||||||
FEventDayStyle : TFontStyles;
|
FEventDayStyle: TFontStyles;
|
||||||
FDateLabelFormat : string;
|
FDateLabelFormat: string;
|
||||||
FShowEventTime : Boolean;
|
FShowEventTime: Boolean;
|
||||||
FTopLine : Integer;
|
FTopLine: Integer;
|
||||||
FDayHeadAttr : TVpDayHeadAttr;
|
FDayHeadAttr: TVpDayHeadAttr;
|
||||||
FHeadAttr : TVpMvHeadAttr;
|
FHeadAttr: TVpMvHeadAttr;
|
||||||
FTodayAttr : TVpMvTodayAttr;
|
FTodayAttr: TVpMvTodayAttr;
|
||||||
FDayNumberFont : TVpFont;
|
FDayNumberFont: TVpFont;
|
||||||
FEventFont : TVpFont;
|
FEventFont: TVpFont;
|
||||||
FTimeFormat : TVpTimeFormat;
|
FTimeFormat: TVpTimeFormat;
|
||||||
FDrawingStyle : TVpDrawingStyle;
|
FDrawingStyle: TVpDrawingStyle;
|
||||||
FDate : TDateTime;
|
FDate: TDateTime;
|
||||||
FDefaultPopup : TPopupMenu;
|
FDefaultPopup: TPopupMenu;
|
||||||
FRightClickChangeDate : Boolean;
|
FRightClickChangeDate: Boolean;
|
||||||
{ event variables }
|
{ event variables }
|
||||||
FOwnerDrawCells : TVpOwnerDrawDayEvent;
|
FOwnerDrawCells: TVpOwnerDrawDayEvent;
|
||||||
FOnEventClick : TVpOnEventClick;
|
FOnEventClick: TVpOnEventClick;
|
||||||
FOnEventDblClick : TVpOnEventClick;
|
FOnEventDblClick: TVpOnEventClick;
|
||||||
{ internal variables }
|
{ internal variables }
|
||||||
// mvDayNumberHeight : Integer;
|
// mvDayNumberHeight : Integer;
|
||||||
// mvEventTextHeight : Integer;
|
// mvEventTextHeight : Integer;
|
||||||
mvLoaded : Boolean;
|
mvLoaded: Boolean;
|
||||||
// mvInLinkHandler : Boolean;
|
// mvInLinkHandler : Boolean;
|
||||||
// mvRowHeight : Integer;
|
// mvRowHeight : Integer;
|
||||||
// mvLineHeight : Integer;
|
// mvLineHeight : Integer;
|
||||||
// mvColWidth : Integer;
|
// mvColWidth : Integer;
|
||||||
mvDayHeadHeight : Integer;
|
mvDayHeadHeight: Integer;
|
||||||
mvSpinButtons : TUpDown;
|
mvSpinButtons: TUpDown;
|
||||||
mvEventArray : TVpEventArray;
|
mvEventArray: TVpEventArray;
|
||||||
mvMonthDayArray : TVpMonthdayArray;
|
mvMonthDayArray: TVpMonthdayArray;
|
||||||
mvActiveEvent : TVpEvent;
|
mvActiveEvent: TVpEvent;
|
||||||
mvActiveEventRec : TRect;
|
mvActiveEventRec: TRect;
|
||||||
// mvEventList : TList;
|
// mvEventList : TList;
|
||||||
// mvCreatingEditor : Boolean;
|
// mvCreatingEditor : Boolean;
|
||||||
// mvPainting : Boolean;
|
// mvPainting : Boolean;
|
||||||
@ -196,7 +195,7 @@ type
|
|||||||
procedure CreateParams(var Params: TCreateParams); override;
|
procedure CreateParams(var Params: TCreateParams); override;
|
||||||
procedure CreateWnd; override;
|
procedure CreateWnd; override;
|
||||||
{$IFNDEF LCL}
|
{$IFNDEF LCL}
|
||||||
procedure WMLButtonDown(var Msg : TWMLButtonDown); message WM_LBUTTONDOWN;
|
procedure WMLButtonDown(var Msg: TWMLButtonDown); message WM_LBUTTONDOWN;
|
||||||
procedure WMLButtonDblClick(var Msg: TWMLButtonDblClk);message WM_LBUTTONDBLCLK;
|
procedure WMLButtonDblClick(var Msg: TWMLButtonDblClk);message WM_LBUTTONDBLCLK;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
procedure WMLButtonDown(var Msg: TLMLButtonDown); message LM_LBUTTONDOWN;
|
procedure WMLButtonDown(var Msg: TLMLButtonDown); message LM_LBUTTONDOWN;
|
||||||
@ -230,22 +229,14 @@ type
|
|||||||
procedure LoadLanguage;
|
procedure LoadLanguage;
|
||||||
procedure Invalidate; override;
|
procedure Invalidate; override;
|
||||||
procedure LinkHandler(Sender: TComponent;
|
procedure LinkHandler(Sender: TComponent;
|
||||||
NotificationType: TVpNotificationType;
|
NotificationType: TVpNotificationType; const Value: Variant); override;
|
||||||
const Value: Variant); override;
|
function GetControlType: TVpItemType; override;
|
||||||
function GetControlType : TVpItemType; override;
|
procedure PaintToCanvas(ACanvas: TCanvas; ARect: TRect; Angle: TVpRotationAngle;
|
||||||
procedure PaintToCanvas (ACanvas : TCanvas;
|
ADate: TDateTime);
|
||||||
ARect : TRect;
|
procedure RenderToCanvas(RenderCanvas: TCanvas; RenderIn: TRect;
|
||||||
Angle : TVpRotationAngle;
|
Angle: TVpRotationAngle; Scale: Extended; RenderDate: TDateTime;
|
||||||
ADate : TDateTime);
|
StartLine, StopLine: Integer; UseGran: TVpGranularity;
|
||||||
procedure RenderToCanvas (RenderCanvas : TCanvas;
|
DisplayOnly: Boolean); override;
|
||||||
RenderIn : TRect;
|
|
||||||
Angle : TVpRotationAngle;
|
|
||||||
Scale : Extended;
|
|
||||||
RenderDate : TDateTime;
|
|
||||||
StartLine : Integer;
|
|
||||||
StopLine : Integer;
|
|
||||||
UseGran : TVpGranularity;
|
|
||||||
DisplayOnly : Boolean); override;
|
|
||||||
|
|
||||||
property Date: TDateTime read FDate write SetDate;
|
property Date: TDateTime read FDate write SetDate;
|
||||||
|
|
||||||
@ -255,56 +246,34 @@ type
|
|||||||
property Anchors;
|
property Anchors;
|
||||||
property TabStop;
|
property TabStop;
|
||||||
property TabOrder;
|
property TabOrder;
|
||||||
property KBNavigation: Boolean
|
property KBNavigation: Boolean read FKBNavigate write FKBNavigate;
|
||||||
read FKBNavigate write FKBNavigate;
|
property Color: TColor read FColor write SetColor;
|
||||||
property Color: TColor
|
property DateLabelFormat: string read FDateLabelFormat write SetDateLabelFormat;
|
||||||
read FColor write SetColor;
|
property DayHeadAttributes: TVpDayHeadAttr read FDayHeadAttr write FDayHeadAttr;
|
||||||
property DateLabelFormat:
|
property DayNameStyle: TVpMVDayNameStyle read FDayNameStyle write SetDayNameStyle;
|
||||||
string read FDateLabelFormat write SetDateLabelFormat;
|
property DayNumberFont: TVpFont read FDayNumberFont write SetDayNumberFont;
|
||||||
property DayHeadAttributes: TVpDayHeadAttr
|
property DrawingStyle: TVpDrawingStyle read FDrawingStyle write SetDrawingStyle stored True;
|
||||||
read FDayHeadAttr write FDayHeadAttr;
|
property EventDayStyle: TFontStyles read FEventDayStyle write SetEventDayStyle;
|
||||||
property DayNameStyle: TVpMVDayNameStyle
|
property EventFont: TVpFont read FEventFont write SetEventFont;
|
||||||
read FDayNameStyle write SetDayNameStyle;
|
property HeadAttributes: TVpMvHeadAttr read FHeadAttr write FHeadAttr;
|
||||||
property DayNumberFont: TVpFont
|
property LineColor: TColor read FLineColor write SetLineColor;
|
||||||
read FDayNumberFont write SetDayNumberFont;
|
property TimeFormat: TVpTimeFormat read FTimeFormat write SetTimeFormat;
|
||||||
property DrawingStyle: TVpDrawingStyle
|
property TodayAttributes: TVpMvTodayAttr read FTodayAttr write FTodayAttr;
|
||||||
read FDrawingStyle write SetDrawingStyle stored True;
|
property OffDayColor: TColor read FOffDayColor write SetOffDayColor;
|
||||||
property EventDayStyle: TFontStyles
|
property OffDayFontColor: TColor read FOffDayFontColor write SetOffDayFontColor default clGray;
|
||||||
read FEventDayStyle write SetEventDayStyle;
|
property OwnerDrawCells: TVpOwnerDrawDayEvent read FOwnerDrawCells write FOwnerDrawCells;
|
||||||
property EventFont: TVpFont
|
property RightClickChangeDate: Boolean
|
||||||
read FEventFont write SetEventFont;
|
read FRightClickChangeDate write SetRightClickChangeDate default vpDefWVRClickChangeDate;
|
||||||
property HeadAttributes: TVpMvHeadAttr
|
property SelectedDayColor: TColor read FSelectedDayColor write SetSelectedDayColor;
|
||||||
read FHeadAttr write FHeadAttr;
|
property ShowEvents: Boolean read FShowEvents write SetShowEvents;
|
||||||
property LineColor: TColor
|
property ShowEventTime: Boolean read FShowEventTime write SetShowEventTime;
|
||||||
read FLineColor write SetLineColor;
|
property WeekStartsOn: TVpDayType read FWeekStartsOn write SetWeekStartsOn;
|
||||||
property TimeFormat: TVpTimeFormat
|
|
||||||
read FTimeFormat write SetTimeFormat;
|
|
||||||
property TodayAttributes: TVpMvTodayAttr
|
|
||||||
read FTodayAttr write FTodayAttr;
|
|
||||||
property OffDayColor: TColor
|
|
||||||
read FOffDayColor write SetOffDayColor;
|
|
||||||
property OffDayFontColor: TColor
|
|
||||||
read FOffDayFontColor write SetOffDayFontColor default clGray;
|
|
||||||
property OwnerDrawCells: TVpOwnerDrawDayEvent
|
|
||||||
read FOwnerDrawCells write FOwnerDrawCells;
|
|
||||||
property RightClickChangeDate : Boolean
|
|
||||||
read FRightClickChangeDate write SetRightClickChangeDate
|
|
||||||
default vpDefWVRClickChangeDate;
|
|
||||||
property SelectedDayColor: TColor
|
|
||||||
read FSelectedDayColor write SetSelectedDayColor;
|
|
||||||
property ShowEvents: Boolean
|
|
||||||
read FShowEvents write SetShowEvents;
|
|
||||||
property ShowEventTime: Boolean
|
|
||||||
read FShowEventTime write SetShowEventTime;
|
|
||||||
property WeekStartsOn : TVpDayType
|
|
||||||
read FWeekStartsOn write SetWeekStartsOn;
|
|
||||||
{events}
|
{events}
|
||||||
property OnEventClick: TVpOnEventClick
|
property OnEventClick: TVpOnEventClick read FOnEventClick write FOnEventClick;
|
||||||
read FOnEventClick write FOnEventClick;
|
property OnEventDblClick: TVpOnEventClick read FOnEventDblClick write FOnEventDblClick;
|
||||||
property OnEventDblClick: TVpOnEventClick
|
|
||||||
read FOnEventDblClick write FOnEventDblClick;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -492,7 +461,7 @@ begin
|
|||||||
Height := 225;
|
Height := 225;
|
||||||
Width := 300;
|
Width := 300;
|
||||||
|
|
||||||
FDefaultPopup := TPopupMenu.Create (Self);
|
FDefaultPopup := TPopupMenu.Create(Self);
|
||||||
Self.PopupMenu := FDefaultPopup;
|
Self.PopupMenu := FDefaultPopup;
|
||||||
LoadLanguage;
|
LoadLanguage;
|
||||||
|
|
||||||
@ -570,42 +539,26 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
function TVpMonthView.GetControlType : TVpItemType;
|
function TVpMonthView.GetControlType: TVpItemType;
|
||||||
begin
|
begin
|
||||||
Result := itMonthView;
|
Result := itMonthView;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVpMonthView.Paint;
|
procedure TVpMonthView.Paint;
|
||||||
begin
|
begin
|
||||||
RenderToCanvas (Canvas,
|
RenderToCanvas(Canvas, Rect (0, 0, Width, Height), ra0, 1, Self.Date,
|
||||||
Rect (0, 0, Width, Height),
|
-1, -1, gr30Min, False);
|
||||||
ra0,
|
|
||||||
1,
|
|
||||||
Self.Date,
|
|
||||||
-1,
|
|
||||||
-1,
|
|
||||||
gr30Min,
|
|
||||||
False);
|
|
||||||
end;
|
end;
|
||||||
{=====}
|
|
||||||
procedure TVpMonthView.PaintToCanvas (ACanvas : TCanvas;
|
procedure TVpMonthView.PaintToCanvas(ACanvas: TCanvas; ARect: TRect;
|
||||||
ARect : TRect;
|
Angle: TVpRotationAngle; ADate: TDateTime);
|
||||||
Angle : TVpRotationAngle;
|
|
||||||
ADate : TDateTime);
|
|
||||||
begin
|
begin
|
||||||
RenderToCanvas (ACanvas, ARect, Angle, 1, ADate,
|
RenderToCanvas(ACanvas, ARect, Angle, 1, ADate, -1, -1, gr30Min, True);
|
||||||
-1, -1, gr30Min, True);
|
|
||||||
end;
|
end;
|
||||||
{=====}
|
|
||||||
procedure TVpMonthView.RenderToCanvas (RenderCanvas : TCanvas;
|
procedure TVpMonthView.RenderToCanvas(RenderCanvas: TCanvas; RenderIn: TRect;
|
||||||
RenderIn : TRect;
|
Angle: TVpRotationAngle; Scale: Extended; RenderDate: TDateTime;
|
||||||
Angle : TVpRotationAngle;
|
StartLine, StopLine: Integer; UseGran: TVpGranularity; DisplayOnly: Boolean);
|
||||||
Scale : Extended;
|
|
||||||
RenderDate : TDateTime;
|
|
||||||
StartLine : Integer;
|
|
||||||
StopLine : Integer;
|
|
||||||
UseGran : TVpGranularity;
|
|
||||||
DisplayOnly : Boolean);
|
|
||||||
var
|
var
|
||||||
painter: TVpMonthViewPainter;
|
painter: TVpMonthViewPainter;
|
||||||
begin
|
begin
|
||||||
@ -629,7 +582,7 @@ end;
|
|||||||
|
|
||||||
procedure TVpMonthView.mvSpinButtonClick(Sender: TObject; Button: TUDBtnType);
|
procedure TVpMonthView.mvSpinButtonClick(Sender: TObject; Button: TUDBtnType);
|
||||||
var
|
var
|
||||||
M, D, Y : Word;
|
M, D, Y: Word;
|
||||||
begin
|
begin
|
||||||
DecodeDate(Date, Y, M, D);
|
DecodeDate(Date, Y, M, D);
|
||||||
if Button = btNext then begin
|
if Button = btNext then begin
|
||||||
@ -823,9 +776,9 @@ end;
|
|||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
{$IFNDEF LCL}
|
{$IFNDEF LCL}
|
||||||
procedure TVpMonthView.WMLButtonDown(var Msg : TWMLButtonDown);
|
procedure TVpMonthView.WMLButtonDown(var Msg: TWMLButtonDown);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
procedure TVpMonthView.WMLButtonDown(var Msg : TLMLButtonDown);
|
procedure TVpMonthView.WMLButtonDown(var Msg: TLMLButtonDown);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
@ -888,13 +841,12 @@ end;
|
|||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
{$IFNDEF LCL}
|
{$IFNDEF LCL}
|
||||||
procedure TVpMonthView.WMRButtonDown(var Msg : TWMRButtonDown);
|
procedure TVpMonthView.WMRButtonDown(var Msg: TWMRButtonDown);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
procedure TVpMonthView.WMRButtonDown(var Msg : TLMRButtonDown);
|
procedure TVpMonthView.WMRButtonDown(var Msg: TLMRButtonDown);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
if not Assigned (PopupMenu) then begin
|
if not Assigned (PopupMenu) then begin
|
||||||
if not focused then
|
if not focused then
|
||||||
SetFocus;
|
SetFocus;
|
||||||
@ -907,38 +859,37 @@ end;
|
|||||||
procedure TVpMonthView.InitializeDefaultPopup;
|
procedure TVpMonthView.InitializeDefaultPopup;
|
||||||
var
|
var
|
||||||
NewItem : TMenuItem;
|
NewItem : TMenuItem;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if RSMonthPopupToday <> '' then begin
|
if RSMonthPopupToday <> '' then begin
|
||||||
NewItem := TMenuItem.Create (Self);
|
NewItem := TMenuItem.Create(Self);
|
||||||
NewItem.Caption := RSMonthPopupToday;
|
NewItem.Caption := RSMonthPopupToday;
|
||||||
NewItem.OnClick := PopupToday;
|
NewItem.OnClick := PopupToday;
|
||||||
FDefaultPopup.Items.Add (NewItem);
|
FDefaultPopup.Items.Add (NewItem);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if RSMonthPopupNextMonth <> '' then begin
|
if RSMonthPopupNextMonth <> '' then begin
|
||||||
NewItem := TMenuItem.Create (Self);
|
NewItem := TMenuItem.Create(Self);
|
||||||
NewItem.Caption := RSMonthPopupNextMonth;
|
NewItem.Caption := RSMonthPopupNextMonth;
|
||||||
NewItem.OnClick := PopupNextMonth;
|
NewItem.OnClick := PopupNextMonth;
|
||||||
FDefaultPopup.Items.Add (NewItem);
|
FDefaultPopup.Items.Add (NewItem);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if RSMonthPopupPrevMonth <> '' then begin
|
if RSMonthPopupPrevMonth <> '' then begin
|
||||||
NewItem := TMenuItem.Create (Self);
|
NewItem := TMenuItem.Create(Self);
|
||||||
NewItem.Caption := RSMonthPopupPrevMonth;
|
NewItem.Caption := RSMonthPopupPrevMonth;
|
||||||
NewItem.OnClick := PopupPrevMonth;
|
NewItem.OnClick := PopupPrevMonth;
|
||||||
FDefaultPopup.Items.Add (NewItem);
|
FDefaultPopup.Items.Add (NewItem);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if RSMonthPopupNextYear <> '' then begin
|
if RSMonthPopupNextYear <> '' then begin
|
||||||
NewItem := TMenuItem.Create (Self);
|
NewItem := TMenuItem.Create(Self);
|
||||||
NewItem.Caption := RSMonthPopupNextYear;
|
NewItem.Caption := RSMonthPopupNextYear;
|
||||||
NewItem.OnClick := PopupNextYear;
|
NewItem.OnClick := PopupNextYear;
|
||||||
FDefaultPopup.Items.Add (NewItem);
|
FDefaultPopup.Items.Add (NewItem);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if RSMonthPopupPrevYear <> '' then begin
|
if RSMonthPopupPrevYear <> '' then begin
|
||||||
NewItem := TMenuItem.Create (Self);
|
NewItem := TMenuItem.Create(Self);
|
||||||
NewItem.Caption := RSMonthPopupPrevYear;
|
NewItem.Caption := RSMonthPopupPrevYear;
|
||||||
NewItem.OnClick := PopupPrevYear;
|
NewItem.OnClick := PopupPrevYear;
|
||||||
FDefaultPopup.Items.Add (NewItem);
|
FDefaultPopup.Items.Add (NewItem);
|
||||||
@ -946,41 +897,39 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
procedure TVpMonthView.PopupToday (Sender : TObject);
|
procedure TVpMonthView.PopupToday(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Date := Now;
|
Date := Now;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
procedure TVpMonthView.PopupNextMonth (Sender : TObject);
|
procedure TVpMonthView.PopupNextMonth(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
mvSpinButtonClick (self, btNext);
|
mvSpinButtonClick(self, btNext);
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
procedure TVpMonthView.PopupPrevMonth (Sender : TObject);
|
procedure TVpMonthView.PopupPrevMonth(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
mvSpinButtonClick (self, btPrev);
|
mvSpinButtonClick(self, btPrev);
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
procedure TVpMonthView.PopupNextYear (Sender : TObject);
|
procedure TVpMonthView.PopupNextYear(Sender: TObject);
|
||||||
var
|
var
|
||||||
M, D, Y : Word;
|
M, D, Y: Word;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
DecodeDate (Date, Y, M, D);
|
DecodeDate(Date, Y, M, D);
|
||||||
Date := EncodeDate (Y + 1, M, 1);
|
Date := EncodeDate(Y + 1, M, 1);
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
procedure TVpMonthView.PopupPrevYear (Sender : TObject);
|
procedure TVpMonthView.PopupPrevYear(Sender: TObject);
|
||||||
var
|
var
|
||||||
M, D, Y : Word;
|
M, D, Y: Word;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
DecodeDate (Date, Y, M, D);
|
DecodeDate(Date, Y, M, D);
|
||||||
Date := EncodeDate (Y - 1, M, 1);
|
Date := EncodeDate(Y - 1, M, 1);
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
@ -1018,89 +967,88 @@ procedure TVpMonthView.mvSetDateByCoord(Point: TPoint);
|
|||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
for I := 0 to pred(Length(mvMonthdayArray)) do begin
|
for I := 0 to pred(Length(mvMonthdayArray)) do
|
||||||
if (Point.X >= mvMonthdayArray[I].Rec.Left)
|
if PointInRect(Point, mvMonthdayArray[I].Rec) then begin
|
||||||
and (Point.X <= mvMonthdayArray[I].Rec.Right)
|
|
||||||
and (Point.Y >= mvMonthdayArray[I].Rec.Top)
|
|
||||||
and (Point.Y <= mvMonthdayArray[I].Rec.Bottom) then
|
|
||||||
Date := mvMonthdayArray[I].Date;
|
Date := mvMonthdayArray[I].Date;
|
||||||
end;
|
break;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
procedure TVpMonthView.KeyDown(var Key: Word; Shift: TShiftState);
|
procedure TVpMonthView.KeyDown(var Key: Word; Shift: TShiftState);
|
||||||
var
|
var
|
||||||
M, D, Y : Word;
|
M, D, Y: Word;
|
||||||
PopupPoint : TPoint;
|
PopupPoint: TPoint;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if FKBNavigate then
|
if FKBNavigate then
|
||||||
case Key of
|
case Key of
|
||||||
VK_UP :
|
VK_UP :
|
||||||
if ssCtrl in Shift then begin
|
if ssCtrl in Shift then begin
|
||||||
DecodeDate(Date, Y, M, D);
|
DecodeDate(Date, Y, M, D);
|
||||||
Date := EncodeDate(Y - 1, M, 1);
|
Date := EncodeDate(Y - 1, M, 1);
|
||||||
end else
|
end else
|
||||||
Date := Date - 7;
|
Date := Date - 7;
|
||||||
VK_DOWN :
|
VK_DOWN:
|
||||||
if ssCtrl in Shift then begin
|
if ssCtrl in Shift then begin
|
||||||
DecodeDate(Date, Y, M, D);
|
DecodeDate(Date, Y, M, D);
|
||||||
Date := EncodeDate(Y + 1, M, 1);
|
Date := EncodeDate(Y + 1, M, 1);
|
||||||
end else
|
end else
|
||||||
Date := Date + 7;
|
Date := Date + 7;
|
||||||
VK_NEXT : mvSpinButtonClick(self, btNext);
|
VK_NEXT:
|
||||||
VK_PRIOR : mvSpinButtonClick(self, btPrev);
|
mvSpinButtonClick(self, btNext);
|
||||||
VK_LEFT :
|
VK_PRIOR:
|
||||||
|
mvSpinButtonClick(self, btPrev);
|
||||||
|
VK_LEFT:
|
||||||
if ssCtrl in Shift then
|
if ssCtrl in Shift then
|
||||||
mvSpinButtonClick(self, btPrev)
|
mvSpinButtonClick(self, btPrev)
|
||||||
else
|
else
|
||||||
Date := Date - 1;
|
Date := Date - 1;
|
||||||
VK_RIGHT :
|
VK_RIGHT:
|
||||||
if ssCtrl in Shift then
|
if ssCtrl in Shift then
|
||||||
mvSpinButtonClick(self, btNext)
|
mvSpinButtonClick(self, btNext)
|
||||||
else
|
else
|
||||||
Date := Date + 1;
|
Date := Date + 1;
|
||||||
VK_HOME : begin
|
VK_HOME:
|
||||||
DecodeDate(Date, Y, M, D);
|
begin
|
||||||
if D = 1 then
|
DecodeDate(Date, Y, M, D);
|
||||||
mvSpinButtonClick(self, btPrev)
|
if D = 1 then
|
||||||
else
|
mvSpinButtonClick(self, btPrev)
|
||||||
Date := EncodeDate(Y, M, 1);
|
else
|
||||||
end;
|
Date := EncodeDate(Y, M, 1);
|
||||||
VK_END : begin
|
end;
|
||||||
DecodeDate(Date, Y, M, D);
|
VK_END:
|
||||||
if D = DaysInMonth(Y, M) then begin
|
begin
|
||||||
if M = 12 then begin
|
DecodeDate(Date, Y, M, D);
|
||||||
M := 1;
|
if D = DaysInMonth(Y, M) then begin
|
||||||
Inc(Y);
|
if M = 12 then begin
|
||||||
end else
|
M := 1;
|
||||||
Inc(M);
|
Inc(Y);
|
||||||
|
end else
|
||||||
|
Inc(M);
|
||||||
|
end;
|
||||||
|
Date := EncodeDate(Y, M, DaysInMonth(Y, M));
|
||||||
end;
|
end;
|
||||||
Date := EncodeDate(Y, M, DaysInMonth(Y, M));
|
|
||||||
end;
|
|
||||||
{$IFNDEF LCL}
|
{$IFNDEF LCL}
|
||||||
VK_TAB :
|
VK_TAB:
|
||||||
if ssShift in Shift then
|
if ssShift in Shift then
|
||||||
Windows.SetFocus (GetNextDlgTabItem (GetParent (Handle), Handle, False))
|
Windows.SetFocus(GetNextDlgTabItem(GetParent(Handle), Handle, False))
|
||||||
else
|
else
|
||||||
Windows.SetFocus (GetNextDlgTabItem (GetParent (Handle), Handle, True));
|
Windows.SetFocus(GetNextDlgTabItem(GetParent(Handle), Handle, True));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
VK_F10 :
|
VK_F10:
|
||||||
if (ssShift in Shift) and not (Assigned (PopupMenu)) then begin
|
if (ssShift in Shift) and not Assigned(PopupMenu) then begin
|
||||||
PopupPoint := GetClientOrigin;
|
PopupPoint := GetClientOrigin;
|
||||||
FDefaultPopup.Popup (PopupPoint.x + 10,
|
FDefaultPopup.Popup(PopupPoint.x + 10, PopupPoint.y + 10);
|
||||||
PopupPoint.y + 10);
|
|
||||||
end;
|
end;
|
||||||
VK_APPS :
|
VK_APPS:
|
||||||
if not Assigned (PopupMenu) then begin
|
if not Assigned(PopupMenu) then begin
|
||||||
PopupPoint := GetClientOrigin;
|
PopupPoint := GetClientOrigin;
|
||||||
FDefaultPopup.Popup (PopupPoint.x + 10,
|
FDefaultPopup.Popup(PopupPoint.x + 10, PopupPoint.y + 10);
|
||||||
PopupPoint.y + 10);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
procedure TVpMonthView.SetRightClickChangeDate (const v : Boolean);
|
procedure TVpMonthView.SetRightClickChangeDate(const v: Boolean);
|
||||||
begin
|
begin
|
||||||
if v <> FRightClickChangeDate then
|
if v <> FRightClickChangeDate then
|
||||||
FRightClickChangeDate := v;
|
FRightClickChangeDate := v;
|
||||||
|
@ -5,8 +5,8 @@ unit VpMonthViewPainter;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils, LCLType, LCLIntf, Types,
|
SysUtils, LCLType, LCLIntf, Types, Classes, Graphics,
|
||||||
Classes, Graphics, VpConst, VPBase, VpData, VpMonthView, VpBasePainter;
|
VpConst, VPBase, VpData, VpMonthView, VpBasePainter;
|
||||||
|
|
||||||
type
|
type
|
||||||
TVpMonthViewPainter = class(TVpBasePainter)
|
TVpMonthViewPainter = class(TVpBasePainter)
|
||||||
@ -30,7 +30,7 @@ type
|
|||||||
TodayAttrColor: TColor;
|
TodayAttrColor: TColor;
|
||||||
DotDotDotColor: TColor;
|
DotDotDotColor: TColor;
|
||||||
|
|
||||||
// protected values from the original monthview needed only for painting
|
// protected variables of the original monthview needed only for painting
|
||||||
mvEventTextHeight: Integer;
|
mvEventTextHeight: Integer;
|
||||||
mvDayNumberHeight: Integer;
|
mvDayNumberHeight: Integer;
|
||||||
mvRowHeight: Integer;
|
mvRowHeight: Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user