TDatePicker added property CalAlignment - Delphi compatible

git-svn-id: trunk@50024 -
This commit is contained in:
zoran 2015-10-10 13:23:42 +00:00
parent 218cce9fe2
commit 468f3f322b
2 changed files with 25 additions and 1 deletions

View File

@ -114,12 +114,17 @@ type
TDTDateMode = (dmComboBox, dmUpDown, dmNone);
{ calendar alignment - left or right,
dtaDefault means it is determined by BiDiMode }
TDTCalAlignment = (dtaLeft, dtaRight, dtaDefault);
{ TCustomDateTimePicker }
TCustomDateTimePicker = class(TCustomControl)
private
FAutoAdvance: Boolean;
FAutoButtonSize: Boolean;
FCalAlignment: TDTCalAlignment;
FCalendarWrapperClass: TCalendarControlWrapperClass;
FCascade: Boolean;
FCenturyFrom, FEffectiveCenturyFrom: Word;
@ -186,10 +191,12 @@ type
function GetChecked: Boolean;
function GetDate: TDate;
function GetDateTime: TDateTime;
function GetDroppedDown: Boolean;
function GetShowCheckBox: Boolean;
function GetTime: TTime;
procedure SetArrowShape(const AValue: TArrowShape);
procedure SetAutoButtonSize(AValue: Boolean);
procedure SetCalAlignment(AValue: TDTCalAlignment);
procedure SetCalendarWrapperClass(AValue: TCalendarControlWrapperClass);
procedure SetCenturyFrom(const AValue: Word);
procedure SetChecked(const AValue: Boolean);
@ -380,6 +387,8 @@ type
property MonthNames: String read FMonthNames write SetMonthNames;
property ShowMonthNames: Boolean
read FShowMonthNames write SetShowMonthNames default False;
property DroppedDown: Boolean read GetDroppedDown;
property CalAlignment: TDTCalAlignment read FCalAlignment write SetCalAlignment default dtaDefault;
public
constructor Create(AOwner: TComponent); override;
@ -449,6 +458,7 @@ type
property ParentBiDiMode;
property MonthNames;
property ShowMonthNames;
property CalAlignment;
// events:
property OnChange;
property OnCheckBoxChange;
@ -580,7 +590,8 @@ begin
H := Height;
W := Width;
if IsRightToLeft then
if (DTPicker.CalAlignment = dtaRight) or
((DTPicker.CalAlignment = dtaDefault) and IsRightToLeft) then
P := DTPicker.ControlToScreen(Point(DTPicker.Width - W, DTPicker.Height))
else
P := DTPicker.ControlToScreen(Point(0, DTPicker.Height));
@ -3293,6 +3304,11 @@ begin
Result := FDateTime;
end;
function TCustomDateTimePicker.GetDroppedDown: Boolean;
begin
Result := Assigned(FCalendarForm);
end;
function TCustomDateTimePicker.GetShowCheckBox: Boolean;
begin
Result := Assigned(FCheckBox);
@ -3335,6 +3351,12 @@ begin
end;
end;
procedure TCustomDateTimePicker.SetCalAlignment(AValue: TDTCalAlignment);
begin
if FCalAlignment = AValue then Exit;
FCalAlignment := AValue;
end;
procedure TCustomDateTimePicker.SetCalendarWrapperClass(
AValue: TCalendarControlWrapperClass);
begin
@ -3637,6 +3659,7 @@ begin
with GetControlClassDefaultSize do
SetInitialBounds(0, 0, cx, cy);
FCalAlignment := dtaDefault;
FCorrectedDTP := dtpAMPM;
FCorrectedValue := 0;
FChangeInRecursiveCall := False;

View File

@ -115,6 +115,7 @@ type
property ParentBiDiMode;
property MonthNames;
property ShowMonthNames;
property CalAlignment;
//events:
property OnChange;
property OnCheckBoxChange;