unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, ToolWin, ImgList, ExtCtrls, Menus, StdCtrls;
type
TForm1 = class(TForm)
ControlBar1: TControlBar;
ImageList1: TImageList;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
ToolButton7: TToolButton;
MainMenu1: TMainMenu;
File1: TMenuItem;
New1: TMenuItem;
Open1: TMenuItem;
Save1: TMenuItem;
N1: TMenuItem;
Exit1: TMenuItem;
Edit1: TMenuItem;
Copy1: TMenuItem;
Cut1: TMenuItem;
Paste1: TMenuItem;
View1: TMenuItem;
MnuTestWindow: TMenuItem;
Panel: TPanel;
procedure PanelGetSiteInfo(Sender: TObject; DockClient: TControl;
var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean);
procedure MnuTestWindowClick(Sender: TObject);
procedure PanelDockOver(Sender: TObject; Source: TDragDockObject;
X, Y: Integer; State: TDragState; var Accept: Boolean);
procedure ControlBar1DockDrop(Sender: TObject; Source: TDragDockObject;
X, Y: Integer);
procedure ControlBar1GetSiteInfo(Sender: TObject; DockClient: TControl;
var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean);
procedure FormDockDrop(Sender: TObject; Source: TDragDockObject; X,
Y: Integer);
procedure FormGetSiteInfo(Sender: TObject; DockClient: TControl;
var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.DFM}
procedure TForm1.PanelGetSiteInfo(Sender: TObject;
DockClient: TControl; var InfluenceRect: TRect; MousePos: TPoint;
var CanDock: Boolean);
begin
CanDock := DockClient.Tag = 2;
end;
procedure TForm1.PanelDockOver(Sender: TObject;
Source: TDragDockObject; X, Y: Integer; State: TDragState;
var Accept: Boolean);
var
ARect: TRect;
begin
Accept := Source.Control.Tag = 2;
if Accept then
begin
ARect.TopLeft := Panel.ClientToScreen(Point(0, 0));
ARect.BottomRight := Panel.ClientToScreen(
Point(Self.ClientWidth div 3, Panel.Height));
Source.DockRect := ARect;
end;
end;
procedure TForm1.MnuTestWindowClick(Sender: TObject);
begin
FrmTest.Show;
if FrmTest.HostDockSite <> nil then
FrmTest.Width := ClientWidth div 3;
end;
procedure TForm1.FormGetSiteInfo(Sender: TObject; DockClient: TControl;
var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean);
begin
CanDock := DockClient.Tag = 1;
end;
procedure TForm1.FormDockDrop(Sender: TObject; Source: TDragDockObject; X,
Y: Integer);
begin
Source.Control.Align := alBottom;
end;
procedure TForm1.ControlBar1GetSiteInfo(Sender: TObject;
DockClient: TControl; var InfluenceRect: TRect; MousePos: TPoint;
var CanDock: Boolean);
begin
CanDock := DockClient.Tag = 1;
end;
procedure TForm1.ControlBar1DockDrop(Sender: TObject;
Source: TDragDockObject; X, Y: Integer);
begin
Source.Control.Align := alTop;
end;
end.