source: trunk/Packages/CoolDocking/UCDClient.pas

Last change on this file was 73, checked in by chronos, 12 years ago
  • Modified: Packages are now stored as uncomporessed and are linked with relative path to project.
File size: 2.7 KB
Line 
1unit UCDClient;
2
3{$mode delphi}{$H+}
4
5// Date: 2010-09-17
6
7interface
8
9uses
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
15const
16 GrabberSize = 22;
17
18type
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
40procedure Register;
41
42resourcestring
43 SWrongOwner = 'Owner of TCoolDockClient have to be TForm';
44
45
46implementation
47
48uses
49 UCDManagerRegions;
50
51procedure Register;
52begin
53 RegisterComponents('CoolDocking', [TCDClient]);
54 RegisterComponents('CoolDocking', [TCDCustomize]);
55end;
56
57
58
59{ TCDClient }
60
61procedure TCDClient.SetDockable(const AValue: Boolean);
62begin
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;
76end;
77
78procedure TCDClient.SetFloatable(const AValue: Boolean);
79begin
80 if FFloatable = AValue then Exit;
81 FFloatable := AValue;
82end;
83
84procedure TCDClient.SetPanel(const AValue: TPanel);
85begin
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;
95end;
96
97constructor TCDClient.Create(AOwner: TComponent);
98begin
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;
115end;
116
117destructor TCDClient.Destroy;
118begin
119 inherited Destroy;
120 Master := nil;
121end;
122
123
124end.
125
Note: See TracBrowser for help on using the repository browser.