|
From: Peter T. <pe...@us...> - 2003-12-15 08:47:48
|
Update of /cvsroot/jvcl/dev/JVCL3/run
In directory sc8-pr-cvs1:/tmp/cvs-serv7953/JVCL3/run
Modified Files:
JvCheckBox.pas
Log Message:
- Added Alignment, Layout, ReadOnly and RightButton from Ain Valtin
Index: JvCheckBox.pas
===================================================================
RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvCheckBox.pas,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** JvCheckBox.pas 3 Dec 2003 12:23:39 -0000 1.15
--- JvCheckBox.pas 15 Dec 2003 08:47:45 -0000 1.16
***************
*** 15,21 ****
All Rights Reserved.
! Contributor(s): Michael Beck [mb...@bi...].
! Last Modified: 2002-06-03
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
--- 15,23 ----
All Rights Reserved.
! Contributor(s):
! Michael Beck [mb...@bi...].
! Ain Valtin - ReadOnly, Alignment, Layout, RightButton
! Last Modified: 2003-12-15
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
***************
*** 54,57 ****
--- 56,63 ----
FHotTrackFontOptions: TJvTrackFOntOptions;
FWordWrap: boolean;
+ FReadOnly: boolean;
+ FAlignment: TAlignment;
+ FLayout: TTextLayout;
+ FRightButton: boolean;
procedure SetHotFont(const Value: TFont);
procedure SetAssociated(const Value: TControl);
***************
*** 59,62 ****
--- 65,72 ----
procedure SetHotTrackFontOptions(const Value: TJvTrackFOntOptions);
procedure SetWordWrap(const Value: boolean);
+ procedure SetAlignment(const Value: TAlignment);
+ procedure SetLayout(const Value: TTextLayout);
+ procedure SetReadOnly(const Value: boolean);
+ procedure SetRightButton(const Value: boolean);
protected
procedure SetAutoSize(Value: boolean);
***************
*** 75,78 ****
--- 85,89 ----
procedure CalcAutoSize; virtual;
public
+
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
***************
*** 84,87 ****
--- 95,103 ----
published
property AboutJVCL: TJVCLAboutInfo read FAboutJVCL write FAboutJVCL stored False;
+ property Alignment:TAlignment read FAlignment write SetAlignment default taLeftJustify;
+ property Layout:TTextLayout read FLayout write SetLayout default tlTop;
+ property ReadOnly:boolean read FReadOnly write SetReadOnly default false;
+ // show button on right side of control
+ property RightButton:boolean read FRightButton write SetRightButton;
property Associated: TControl read FAssociated write SetAssociated;
property AutoSize: boolean read FAutoSize write SetAutoSize default true;
***************
*** 111,123 ****
FCanvas := TControlCanvas.Create;
FCanvas.Control := Self;
! FHotTrack := false;
FHotFont := TFont.Create;
FFontSave := TFont.Create;
FColor := clInfoBk;
! FOver := false;
! ControlStyle := ControlStyle + [csAcceptsControls];
FHotTrackFontOptions := DefaultTrackFontOptions;
! FAutoSize := true;
! FWordWrap := false;
end;
--- 127,143 ----
FCanvas := TControlCanvas.Create;
FCanvas.Control := Self;
! FHotTrack := False;
FHotFont := TFont.Create;
FFontSave := TFont.Create;
FColor := clInfoBk;
! FOver := False;
! // ControlStyle := ControlStyle + [csAcceptsControls];
FHotTrackFontOptions := DefaultTrackFontOptions;
! FAutoSize := True;
! FWordWrap := False;
! FReadOnly := False;
! FAlignment := taLeftJustify;
! FRightButton := false;
! FLayout := tlTop;
end;
***************
*** 133,146 ****
procedure TJvCheckBox.Toggle;
begin
! inherited Toggle;
! if Assigned(FAssociated) then
! FAssociated.Enabled := Checked;
end;
procedure TJvCheckBox.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
! if WordWrap then
! Params.Style := Params.Style or BS_MULTILINE or BS_TOP;
end;
--- 153,174 ----
procedure TJvCheckBox.Toggle;
begin
! if not ReadOnly then
! begin
! inherited Toggle;
! if Assigned(FAssociated) then
! FAssociated.Enabled := Checked;
! end;
end;
procedure TJvCheckBox.CreateParams(var Params: TCreateParams);
+ const
+ cAlign:array[TAlignment] of word = (BS_LEFT, BS_RIGHT, BS_CENTER);
+ cRightButton:array[boolean] of word = (0, BS_RIGHTBUTTON);
+ cLayout:array[TTextLayout] of word = (BS_TOP, BS_VCENTER, BS_BOTTOM);
+ cWordWrap:array[boolean] of word = (0,BS_MULTILINE);
begin
inherited CreateParams(Params);
! with Params do
! Style := Style or cAlign[Alignment] or cLayout[Layout] or cRightButton[RightButton] or cWordWrap[WordWrap];
end;
***************
*** 322,325 ****
--- 350,386 ----
FWordWrap := Value;
if Value then AutoSize := false;
+ RecreateWnd;
+ end;
+ end;
+
+ procedure TJvCheckBox.SetAlignment(const Value: TAlignment);
+ begin
+ if FAlignment <> Value then
+ begin
+ FAlignment := Value;
+ recreateWnd;
+ end;
+ end;
+
+ procedure TJvCheckBox.SetLayout(const Value: TTextLayout);
+ begin
+ if FLayout <> Value then
+ begin
+ FLayout := Value;
+ RecreateWnd;
+ end;
+ end;
+
+ procedure TJvCheckBox.SetReadOnly(const Value: boolean);
+ begin
+ if FReadOnly <> Value then
+ FReadOnly := Value;
+ end;
+
+ procedure TJvCheckBox.SetRightButton(const Value: boolean);
+ begin
+ if FRightButton <> Value then
+ begin
+ FRightButton := Value;
RecreateWnd;
end;
|