source: Docking/CoolDocking/Demo/Testing/UMainForm.pas

Last change on this file was 359, checked in by chronos, 13 years ago
  • Fixed: Regions size update on Control visible state change.
  • Added: Support for custom center region selection. Surrounding regions are aligned to edges and keep size on docksite resize.
File size: 4.3 KB
Line 
1unit UMainForm;
2
3{$mode Delphi}{$H+}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
9 ComCtrls, ExtCtrls, Buttons, Menus, UCDMaster, UCDCustomize, UCDClient,
10 UDockForm, UComponentTree, UCDWindowList, UCDConjoinForm, UCDManager,
11 UCDCommon, UCDManagerRegions;
12
13type
14
15 { TMainForm }
16
17 TMainForm = class(TForm)
18 Button1: TButton;
19 Button2: TButton;
20 CoolDockClient1: TCDClient;
21 CoolDockCustomize1: TCDCustomize;
22 CoolDockMaster1: TCDMaster;
23 CoolDockWindowList1: TCDWindowList;
24 MainMenu1: TMainMenu;
25 MenuItem1: TMenuItem;
26 MenuItem2: TMenuItem;
27 MenuItem3: TMenuItem;
28 MenuItem4: TMenuItem;
29 Panel1: TPanel;
30 procedure Button1Click(Sender: TObject);
31 procedure Button2Click(Sender: TObject);
32 procedure FormCreate(Sender: TObject);
33 procedure FormDestroy(Sender: TObject);
34 procedure FormShow(Sender: TObject);
35 procedure MenuItem2Click(Sender: TObject);
36 procedure MenuItem4Click(Sender: TObject);
37 procedure PageControl1Change(Sender: TObject);
38 private
39 procedure DockSiteShowExecute(Sender: TObject);
40 procedure DockSiteHideExecute(Sender: TObject);
41 public
42 FormIndex: Integer;
43 DockForms: TList;
44 function NewDockForm: TDockForm;
45 end;
46
47var
48 MainForm: TMainForm;
49
50implementation
51
52{$R *.lfm}
53
54{ TMainForm }
55
56procedure TMainForm.FormCreate(Sender: TObject);
57begin
58 DockForms := TList.Create;
59end;
60
61procedure TMainForm.FormDestroy(Sender: TObject);
62begin
63 DockForms.Free;
64end;
65
66procedure TMainForm.FormShow(Sender: TObject);
67var
68 ConjoinedDockForm1: TCDConjoinForm;
69 ConjoinedDockForm2: TCDConjoinForm;
70 Form1: TDockForm;
71 Form2: TDockForm;
72 Form3: TDockForm;
73begin
74 Form1 := NewDockForm;
75 Form1.ManualDock(Panel1, nil, alRight);
76 Form2 := NewDockForm;
77 Form2.ManualDock(Panel1, nil, alRight);
78 Form3 := NewDockForm;
79 Form3.ManualDock(Panel1, nil, alRight);
80 TCDManagerRegionsItem(TCDPanelHeader(Form2.Parent.Parent).DockItem).SetCenter;
81
82 //Form1 := NewDockForm;
83 //Form1.ManualDock(Panel1);
84 //NewDockForm.ManualDock(Form1);
85 //TCDManager(Panel1.DockManager).DockStyle := dsTabs;
86 //NewDockForm.ManualDock(Panel1);
87(* ConjoinedDockForm1 := TCDManager(Panel1.DockManager).CreateConjoinForm;
88 ConjoinedDockForm1.Name := 'Model';;
89 ConjoinedDockForm1.Show;
90 //TCoolDockManager(ConjoinedDockForm1.Panel.DockManager).TabsPos := hpLeft;
91 ConjoinedDockForm1.ManualDock(Panel1);
92 //TCDManager(ConjoinedDockForm1.DockManager).DockStyle := dsTabs;
93 NewDockForm.ManualDock(ConjoinedDockForm1);
94 NewDockForm.ManualDock(ConjoinedDockForm1);
95 //NewDockForm.ManualDock(ConjoinedDockForm1);
96 //NewDockForm.ManualDock(TForm(DockForms[0]));
97 //NewDockForm.ManualDock(TForm(DockForms[0]));
98 //NewDockForm.ManualDock(TForm(DockForms[0]));
99 //TCustomDockManager(TDockForm(DockForms[0]).DockManager).DockStyle := dsTabs; *)
100end;
101
102procedure TMainForm.MenuItem2Click(Sender: TObject);
103begin
104 CoolDockCustomize1.Execute;
105end;
106
107procedure TMainForm.MenuItem4Click(Sender: TObject);
108begin
109 CoolDockWindowList1.Execute;
110end;
111
112procedure TMainForm.PageControl1Change(Sender: TObject);
113begin
114
115end;
116
117procedure TMainForm.DockSiteShowExecute(Sender: TObject);
118begin
119 if Sender is TControl then
120 DebugLog(TControl(Sender).Name + ' Show');
121end;
122
123procedure TMainForm.DockSiteHideExecute(Sender: TObject);
124begin
125 if Sender is TControl then
126 DebugLog(TControl(Sender).Name + ' Hide');
127end;
128
129function TMainForm.NewDockForm: TDockForm;
130begin
131 Application.CreateForm(TDockForm, Result);
132// Result := TDockForm.Create(Self);
133 Result.Name := 'Form' + IntToStr(FormIndex);
134 Result.CoolDockClient1.Name := 'CoolDockClient' + IntToStr(FormIndex);
135 Result.Caption := Result.Name;
136 Result.Memo1.Text := Result.Name;
137 TCDManager(Result.DockManager).OnDockSiteHide := DockSiteHideExecute;
138 TCDManager(Result.DockManager).OnDockSiteShow := DockSiteShowExecute;
139 //Result.DragKind := dkDock;
140 //Result.DragMode := dmAutomatic;
141 //Result.DockSite := True;
142 //Result.UseDockManager := True;
143 Inc(FormIndex);
144 Result.Show;
145 DockForms.Add(Result);
146end;
147
148procedure TMainForm.Button1Click(Sender: TObject);
149begin
150 NewDockForm;
151end;
152
153procedure TMainForm.Button2Click(Sender: TObject);
154begin
155 ComponentTree.Show;
156end;
157
158end.
159
Note: See TracBrowser for help on using the repository browser.