statusbar: publish OnCreatePanelClass for better compatibility with Delphi

git-svn-id: trunk@14590 -
This commit is contained in:
paul 2008-03-20 06:25:50 +00:00
parent f0081cc693
commit 63d551e608
2 changed files with 15 additions and 11 deletions

View File

@ -109,6 +109,8 @@ type
property StatusBar: TStatusBar read FStatusBar; property StatusBar: TStatusBar read FStatusBar;
end; end;
TSBCreatePanelClassEvent = procedure(Sender: TStatusBar;
var PanelClass: TStatusPanelClass) of object;
{ TStatusBar } { TStatusBar }
@ -118,10 +120,11 @@ type
FHandlePanelCount: integer; // realized panels in the Handle object FHandlePanelCount: integer; // realized panels in the Handle object
FHandleObjectNeedsUpdate: boolean; FHandleObjectNeedsUpdate: boolean;
FHandleUpdatePanelIndex: integer; // which panel in the handle object needs update FHandleUpdatePanelIndex: integer; // which panel in the handle object needs update
FOnCreatePanelClass: TSBCreatePanelClassEvent;
FUpdateLock: integer; // set by BeginUpdate/EndUpdate FUpdateLock: integer; // set by BeginUpdate/EndUpdate
FPanels : TStatusPanels; FPanels: TStatusPanels;
FSimpleText : String; FSimpleText: String;
FSimplePanel : Boolean; FSimplePanel: Boolean;
FOnHint: TNotifyEvent; FOnHint: TNotifyEvent;
procedure SetPanels(Value: TStatusPanels); procedure SetPanels(Value: TStatusPanels);
procedure SetSimpleText(const Value : String); procedure SetSimpleText(const Value : String);
@ -140,7 +143,6 @@ type
function CreatePanel: TStatusPanel; virtual; function CreatePanel: TStatusPanel; virtual;
function CreatePanels: TStatusPanels; virtual; function CreatePanels: TStatusPanels; virtual;
function GetPanelClass: TStatusPanelClass; virtual; function GetPanelClass: TStatusPanelClass; virtual;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -161,6 +163,7 @@ type
property Color default clBtnFace; property Color default clBtnFace;
property OnClick; property OnClick;
property OnContextPopup; property OnContextPopup;
property OnCreatePanelClass: TSBCreatePanelClassEvent read FOnCreatePanelClass write FOnCreatePanelClass;
property OnDblClick; property OnDblClick;
property OnDragDrop; property OnDragDrop;
property OnDragOver; property OnDragOver;

View File

@ -46,14 +46,14 @@ begin
end; end;
procedure TStatusBar.SetSimplePanel(Value : Boolean); procedure TStatusBar.SetSimplePanel(Value : Boolean);
Begin begin
if FSimplePanel <> Value then if FSimplePanel <> Value then
Begin begin
FSimplePanel := Value; FSimplePanel := Value;
//debugln('TStatusBar.SetSimplePanel FSimplePanel=',dbgs(FSimplePanel),' ',dbgsName(Self)); //debugln('TStatusBar.SetSimplePanel FSimplePanel=',dbgs(FSimplePanel),' ',dbgsName(Self));
UpdateHandleObject(-1); UpdateHandleObject(-1);
end; end;
End; end;
procedure TStatusBar.SetPanels(Value: TStatusPanels); procedure TStatusBar.SetPanels(Value: TStatusPanels);
begin begin
@ -188,10 +188,12 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TStatusBar.CreatePanel: TStatusPanel; function TStatusBar.CreatePanel: TStatusPanel;
var var
LClass: TStatusPanelClass; AClass: TStatusPanelClass;
begin begin
LClass := GetPanelClass; AClass := GetPanelClass;
Result := LClass.Create(Panels); if Assigned(FOnCreatePanelClass) then
OnCreatePanelClass(Self, AClass);
Result := AClass.Create(Panels);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
function TStatusBar.CreatePanels(): TStatusPanels; function TStatusBar.CreatePanels(): TStatusPanels;
@ -208,5 +210,4 @@ begin
Result := TStatusPanel; Result := TStatusPanel;
end; end;
// included by comctrls.pp // included by comctrls.pp