DateTimePicker: code cleanup

git-svn-id: trunk@45316 -
This commit is contained in:
zoran 2014-06-03 07:18:58 +00:00
parent 51c0c59b2b
commit ef1f0b14a6

View File

@ -46,8 +46,7 @@ uses
clocale, // needed to initialize default locale settings on Linux. clocale, // needed to initialize default locale settings on Linux.
{$endif} {$endif}
Classes, SysUtils, Controls, LCLType, Graphics, Math, StdCtrls, Buttons, Classes, SysUtils, Controls, LCLType, Graphics, Math, StdCtrls, Buttons,
ExtCtrls, Forms, ComCtrls, Types, LMessages, LCLProc, CalControlWrapper ExtCtrls, Forms, ComCtrls, Types, LMessages, LCLProc, CalControlWrapper;
;
const const
{ We will deal with the NullDate value the special way. It will be especially { We will deal with the NullDate value the special way. It will be especially
@ -245,8 +244,7 @@ type
procedure MoveSelectionLR(const ToLeft: Boolean); procedure MoveSelectionLR(const ToLeft: Boolean);
procedure DestroyCalendarForm; procedure DestroyCalendarForm;
procedure DropDownCalendarForm; procedure DropDownCalendarForm;
procedure UpdateShowArrowButton(NewDateMode: TDTDateMode; procedure UpdateShowArrowButton;
NewKind: TDateTimeKind);
procedure DestroyUpDown; procedure DestroyUpDown;
procedure DestroyArrowBtn; procedure DestroyArrowBtn;
procedure ArrowMouseDown(Sender: TObject; Button: TMouseButton; procedure ArrowMouseDown(Sender: TObject; Button: TMouseButton;
@ -863,7 +861,7 @@ end;
procedure TCustomDateTimePicker.SetDateMode(const AValue: TDTDateMode); procedure TCustomDateTimePicker.SetDateMode(const AValue: TDTDateMode);
begin begin
FDateMode := AValue; FDateMode := AValue;
UpdateShowArrowButton(AValue, FKind); UpdateShowArrowButton;
end; end;
procedure TCustomDateTimePicker.SetHideDateTimeParts(AValue: TDateTimeParts); procedure TCustomDateTimePicker.SetHideDateTimeParts(AValue: TDateTimeParts);
@ -1763,7 +1761,7 @@ begin
MoveSelectionLR(False); MoveSelectionLR(False);
FRecalculatingTextSizesNeeded := True; FRecalculatingTextSizesNeeded := True;
UpdateShowArrowButton(FDateMode, FKind); UpdateShowArrowButton;
UpdateDate; UpdateDate;
end; end;
end; end;
@ -3470,8 +3468,7 @@ begin
end; end;
end; end;
procedure TCustomDateTimePicker.UpdateShowArrowButton( procedure TCustomDateTimePicker.UpdateShowArrowButton;
NewDateMode: TDTDateMode; NewKind: TDateTimeKind);
procedure CreateArrowBtn; procedure CreateArrowBtn;
begin begin
@ -3519,12 +3516,12 @@ var
ReallyShowArrowButton: Boolean; ReallyShowArrowButton: Boolean;
begin begin
if NewDateMode = dmNone then begin if FDateMode = dmNone then begin
DestroyArrowBtn; DestroyArrowBtn;
DestroyUpDown; DestroyUpDown;
end else begin end else begin
ReallyShowArrowButton := (NewDateMode = dmComboBox) and ReallyShowArrowButton := (FDateMode = dmComboBox) and
not (dtpDay in FEffectiveHideDateTimeParts); not (dtpDay in FEffectiveHideDateTimeParts);
if (ReallyShowArrowButton <> Assigned(FArrowButton)) or if (ReallyShowArrowButton <> Assigned(FArrowButton)) or