unit UToolbarImplement;
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, Buttons, ExtCtrls, Menus, StdCtrls, SynEdit, IdeIntf;
type
TToolbarImplementer =
class(TInterfacedObject, IToolbarManager)
private
FDockBars: TObjectList;
FToolBars: TObjectList;
FForm: TForm;
public
function GetDocks(
Index: Integer): TComponent;
function GetToolBars(DockIndex, TBIndex: Integer): TComponent;
function GetControls(DockIndex, TBIndex, CtrlIndex: Integer): TComponent;
procedure AddDock(ADock: TComponent);
procedure AddToolBar(ToDock: TComponent; TheToolBar: TComponent);
virtual;
abstract;
procedure AddControl(ToDock, ToToolBar: TComponent; TheTBControl: TComponent);
virtual;
abstract;
procedure AddToolBarIX(ADockIndex: Integer; TheToolBar: TComponent);
virtual;
abstract;
procedure AddControlIX(ADockIndex, AToolbarIndex: Integer; TheTBControl: TComponent);
virtual;
abstract;
constructor Create;
destructor Destroy;
override;
procedure InsertAllControls;
//fügt die Controls ins Formular ein
property Dockbars[
Index: Integer]:TComponent
read GetDocks;
property ToolBars[DockIndex, TBIndex: Integer]:TComponent
read GetToolBars;
property Controls[DockIndex, TBIndex, CtrlIndex: Integer]:TComponent
read GetControls;
property VisibleWindow: TForm
read FFOrm
write FForm;
end;
implementation
function TToolbarImplementer.GetDocks(
Index: Integer): TComponent;
begin
Result := FDockBars[
Index];
end;
function TToolbarImplementer.GetToolBars(DockIndex, TBIndex: Integer): TComponent;
var
TheDock: TComponent;
begin
TheDock := FDockBars[DockIndex];
Result := TheDock.Components[TBIndex];
end;
function TToolbarImplementer.GetControls(DockIndex, TBIndex, CtrlIndex: Integer): TComponent;
var
TheDock: TComponent;
TheTBar: TComponent;
begin
TheDock := FDockBars[DockIndex];
TheTBar := TheDock.Components[TBIndex];
Result := TheTBar.Components[CtrlIndex];
end;
procedure AddDock(ADock: TComponent);
begin
FDockBars.Add(ADock);
end;
constructor TToolbarImplementer.Create;
begin
inherited
FDockBars := TObjectList.Create;
end;
destructor TToolbarImplementer.Destroy;
begin
FDockBars.Free;
inherited
end;
end.