-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmPanelBorder.pas
148 lines (127 loc) · 3.65 KB
/
mPanelBorder.pas
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
unit mPanelBorder;
interface
uses
Windows, Messages,
SysUtils, Classes, Controls, ExtCtrls, mPanel;
type
TpPanelBorder = (tpbTop, tpbLeft, tpbRight, tpbBottom);
TpPanelBorders = set of TpPanelBorder;
TmPanelBorder = class(TmPanel)
private
FBevelTop,
FBevelLeft,
FBevelRight,
FBevelBottom : TBevel;
FTpPanelBorders: TpPanelBorders;
procedure SetTpPanelBorders(const Value: TpPanelBorders);
protected
procedure createComp();
procedure SetName(const NewName: TComponentName); override;
public
constructor create(Aowner : TComponent); override;
procedure PanelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
published
property _TpPanelBorders : TpPanelBorders read FTpPanelBorders write SetTpPanelBorders;
end;
procedure Register;
implementation
uses
mControl;
const
cREC_LIN = 4;
cREC_COL = 4;
procedure Register;
begin
RegisterComponents('Comps MIGUEL', [TmPanelBorder]);
end;
{ TmPanelBorder }
procedure TmPanelBorder.createComp();
begin
if not (Assigned(FBevelTop)) then begin
FBevelTop := TBevel.Create(Self);
with FBevelTop do begin
Parent := Self;
Align := alTop;
Height := cREC_LIN;
Shape := bsSpacer;
end;
end;
if not (Assigned(FBevelLeft)) then begin
FBevelLeft := TBevel.Create(Self);
with FBevelLeft do begin
Parent := Self;
Align := alLeft;
Width := cREC_COL;
Shape := bsSpacer;
end;
end;
if not (Assigned(FBevelRight)) then begin
FBevelRight := TBevel.Create(Self);
with FBevelRight do begin
Parent := Self;
Align := alRight;
Width := cREC_COL;
Shape := bsSpacer;
end;
end;
if not (Assigned(FBevelBottom)) then begin
FBevelBottom := TBevel.Create(Self);
with FBevelBottom do begin
Parent := Self;
Align := alBottom;
Height := cREC_LIN;
Shape := bsSpacer;
end;
end;
end;
constructor TmPanelBorder.create(Aowner: TComponent);
begin
inherited; //
BevelOuter := bvNone;
createComp();
end;
procedure TmPanelBorder.SetName(const NewName: TComponentName);
begin
inherited;
if (Assigned(FBevelTop)) then begin
//FBevelTop.Name := TmFormVal.NewControlName(Self, NewName + 'BevelTop');
FBevelTop.Name := NewName + 'BevelTop';
end;
if (Assigned(FBevelLeft)) then begin
//FBevelLeft.Name := TmFormVal.NewControlName(Self, NewName + 'BevelLeft');
FBevelLeft.Name := NewName + 'BevelLeft';
end;
if (Assigned(FBevelRight)) then begin
//FBevelRight.Name := TmFormVal.NewControlName(Self, NewName + 'BevelRight');
FBevelRight.Name := NewName + 'BevelRight';
end;
if (Assigned(FBevelBottom)) then begin
//FBevelBottom.Name := TmFormVal.NewControlName(Self, NewName + 'BevelBottom');
FBevelBottom.Name := NewName + 'BevelBottom';
end;
end;
procedure TmPanelBorder.SetTpPanelBorders(const Value: TpPanelBorders);
begin
FTpPanelBorders := Value;
if (Assigned(FBevelTop)) then begin
FBevelTop.Visible := tpbTop in FTpPanelBorders;
end;
if (Assigned(FBevelLeft)) then begin
FBevelLeft.Visible := tpbLeft in FTpPanelBorders;
end;
if (Assigned(FBevelRight)) then begin
FBevelRight.Visible := tpbRight in FTpPanelBorders;
end;
if (Assigned(FBevelBottom)) then begin
FBevelBottom.Visible := tpbBottom in FTpPanelBorders;
end;
end;
procedure TmPanelBorder.PanelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
const
SC_MOVE = $F012;
begin
//inherited MouseDown(Button, Shift, X, Y);
ReleaseCapture;
Self.Perform(WM_SYSCOMMAND, SC_MOVE, 0);
end;
end.