1 | unit UCDClient;
|
---|
2 |
|
---|
3 | {$mode delphi}{$H+}
|
---|
4 |
|
---|
5 | // Date: 2010-09-17
|
---|
6 |
|
---|
7 | interface
|
---|
8 |
|
---|
9 | uses
|
---|
10 | Classes, SysUtils, Controls, LCLType, LMessages, Graphics, StdCtrls,
|
---|
11 | Buttons, ExtCtrls, Contnrs, Forms, ComCtrls, Dialogs, Menus, FileUtil,
|
---|
12 | UCDCustomize, DOM, XMLWrite, XMLRead, UCDCommon,
|
---|
13 | DateUtils, UCDPopupMenu, UCDManager;
|
---|
14 |
|
---|
15 | const
|
---|
16 | GrabberSize = 22;
|
---|
17 |
|
---|
18 | type
|
---|
19 |
|
---|
20 | { TCDClient }
|
---|
21 |
|
---|
22 | TCDClient = class(TCDClientBase)
|
---|
23 | private
|
---|
24 | FDockable: Boolean;
|
---|
25 | FFloatable: Boolean;
|
---|
26 | procedure SetDockable(const AValue: Boolean);
|
---|
27 | procedure SetFloatable(const AValue: Boolean);
|
---|
28 | procedure SetPanel(const AValue: TPanel); override;
|
---|
29 | public
|
---|
30 | constructor Create(AOwner: TComponent); override;
|
---|
31 | destructor Destroy; override;
|
---|
32 | published
|
---|
33 | property Dockable: Boolean read FDockable
|
---|
34 | write SetDockable default True;
|
---|
35 | property Floatable: Boolean read FFloatable
|
---|
36 | write SetFloatable default True;
|
---|
37 | end;
|
---|
38 |
|
---|
39 |
|
---|
40 | procedure Register;
|
---|
41 |
|
---|
42 | resourcestring
|
---|
43 | SWrongOwner = 'Owner of TCoolDockClient have to be TForm';
|
---|
44 |
|
---|
45 |
|
---|
46 | implementation
|
---|
47 |
|
---|
48 | uses
|
---|
49 | UCDManagerRegions;
|
---|
50 |
|
---|
51 | procedure Register;
|
---|
52 | begin
|
---|
53 | RegisterComponents('CoolDocking', [TCDClient]);
|
---|
54 | RegisterComponents('CoolDocking', [TCDCustomize]);
|
---|
55 | end;
|
---|
56 |
|
---|
57 |
|
---|
58 |
|
---|
59 | { TCDClient }
|
---|
60 |
|
---|
61 | procedure TCDClient.SetDockable(const AValue: Boolean);
|
---|
62 | begin
|
---|
63 | if FDockable = AValue then Exit;
|
---|
64 | FDockable := AValue;
|
---|
65 | if (Owner is TForm) then
|
---|
66 | with (Owner as TForm) do
|
---|
67 | if AValue then begin
|
---|
68 | DragKind := dkDock;
|
---|
69 | DragMode := dmAutomatic;
|
---|
70 | DockSite := True;
|
---|
71 | end else begin
|
---|
72 | DragKind := dkDrag;
|
---|
73 | DragMode := dmManual;
|
---|
74 | DockSite := False;
|
---|
75 | end;
|
---|
76 | end;
|
---|
77 |
|
---|
78 | procedure TCDClient.SetFloatable(const AValue: Boolean);
|
---|
79 | begin
|
---|
80 | if FFloatable = AValue then Exit;
|
---|
81 | FFloatable := AValue;
|
---|
82 | end;
|
---|
83 |
|
---|
84 | procedure TCDClient.SetPanel(const AValue: TPanel);
|
---|
85 | begin
|
---|
86 | inherited SetPanel(AValue);
|
---|
87 | if not (csDesigning in ComponentState) then begin
|
---|
88 | if Assigned(Panel) then
|
---|
89 | with Panel do begin
|
---|
90 | DockSite := True;
|
---|
91 | UseDockManager := True;
|
---|
92 | DockManager := TCDManagerRegions.Create(Panel);
|
---|
93 | end;
|
---|
94 | end;
|
---|
95 | end;
|
---|
96 |
|
---|
97 | constructor TCDClient.Create(AOwner: TComponent);
|
---|
98 | begin
|
---|
99 | inherited Create(AOwner);
|
---|
100 | FDockable := True;
|
---|
101 | if not (AOwner is TForm) then
|
---|
102 | raise Exception.Create(SWrongOwner);
|
---|
103 | with (AOwner as TForm) do begin
|
---|
104 | if not (csDesigning in ComponentState) then begin
|
---|
105 | if Dockable then begin
|
---|
106 | DragKind := dkDock;
|
---|
107 | DragMode := dmAutomatic;
|
---|
108 | DockSite := True;
|
---|
109 | end;
|
---|
110 | UseDockManager := True;
|
---|
111 | DockManager := TCDManagerRegions.Create(TWinControl(AOwner));
|
---|
112 | //FormStyle := fsStayOnTop;
|
---|
113 | end;
|
---|
114 | end;
|
---|
115 | end;
|
---|
116 |
|
---|
117 | destructor TCDClient.Destroy;
|
---|
118 | begin
|
---|
119 | inherited Destroy;
|
---|
120 | Master := nil;
|
---|
121 | end;
|
---|
122 |
|
---|
123 |
|
---|
124 | end.
|
---|
125 |
|
---|