blob: 32cc4c5f16444a5c9bffc7b3f8b328838d1b0bb5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
{
fpGUI - Free Pascal Graphical User Interface
Copyright (C) 2000 - 2001 by
Areca Systems GmbH / Sebastian Guenther
Copyright (C) 2006 by Graeme Geldenhuys
member of the fpGUI development team.
Separator class declarations
See the file COPYING.fpGUI, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
{%mainunit fpgui.pp}
{$IFDEF read_interface}
TCustomSeparator = class(TWidget)
private
procedure SetOrientation(AOrientation: TOrientation);
procedure SetSpacing(ASpacing: Integer);
protected
FOrientation: TOrientation;
FSpacing: Integer;
procedure Paint(Canvas: TFCanvas); override;
procedure CalcSizes; override;
property Orientation: TOrientation read FOrientation write SetOrientation default Horizontal;
property Spacing: Integer read FSpacing write SetSpacing default 4;
public
constructor Create(AOwner: TComponent); override;
end;
TSeparator = class(TCustomSeparator)
published
property Enabled;
property Orientation;
property Spacing;
end;
{$ENDIF read_interface}
{$IFDEF read_implementation}
// ===================================================================
// TCustomSeparator
// ===================================================================
constructor TCustomSeparator.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FCanExpandWidth := True;
FSpacing := 4;
end;
procedure TCustomSeparator.Paint(Canvas: TFCanvas);
begin
Style.DrawSeparator(Canvas, Rect(0, 0, Width, Height), Orientation);
end;
procedure TCustomSeparator.CalcSizes;
begin
if Orientation = Horizontal then
begin
FCanExpandWidth := True;
FCanExpandHeight := False;
FMinSize.cy := Style.GetSeparatorSize + 2 * Spacing
end else
begin
FCanExpandWidth := False;
FCanExpandHeight := True;
FMinSize.cx := Style.GetSeparatorSize + 2 * Spacing;
end;
end;
procedure TCustomSeparator.SetOrientation(AOrientation: TOrientation);
begin
if AOrientation <> Orientation then
begin
FOrientation := AOrientation;
Update;
end;
end;
procedure TCustomSeparator.SetSpacing(ASpacing: Integer);
begin
if ASpacing <> Spacing then
begin
FSpacing := ASpacing;
Update;
end;
end;
{$ENDIF read_implementation}
|