unit BarBase;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  PCMSBar,PCTypesUtils,PowerCad;

type
  TBarBase = class(TPCOfficeBar)
  private
    { Private declarations }
    FControl : TPowerCad;
    FBarName : string;
    Procedure SetControl(value: TPowerCad);
  protected
    { Protected declarations }
    procedure Notification (AComponent: TComponent;
      Operation: TOperation); override;
    Procedure DoSetControl(Control: TPowerCad);virtual;
  public
    { Public declarations }
    Constructor create(aowner: TComponent);override;
    Destructor Destroy;override;
    Property BarName:string read FBarName write FBarName;
    Procedure Syncronize;virtual;
  published
    { Published declarations }
    Property CadControl: TPowerCad read FControl write SetControl;
  end;

implementation

Constructor TBarBase.create(aowner: TComponent);
Begin
  inherited create(aowner);
//  CadControl := nil;
End;

Destructor TBarBase.Destroy;
Begin
  //If assigned(FControl) then FControl.unregisterbar(self);
  inherited destroy;
End;


Procedure TBarBase.SetControl(value:TPowerCad);
begin
  If assigned(value) then begin
    FControl := value;
    //Value.RegisterBar(self);
    Syncronize;
  end
  else
  begin
    //If assigned(FControl) then FControl.UnRegisterBar(self);
    FControl := value;
  end;
  DoSetControl(Value);
end;

Procedure TBarBase.Syncronize;
begin
end;




Procedure TBarBase.Notification (AComponent: TComponent; Operation: TOperation);
begin
  inherited Notification(AComponent, Operation);
  if (Operation = opRemove) and (AComponent = CadControl) then
    FControl := nil;
end;

procedure TBarBase.DoSetControl(Control: TPowerCad);
begin

end;

end.
