lcl: add TStatusBar.GetPanelIndexAt()

git-svn-id: trunk@19818 -
This commit is contained in:
paul 2009-05-06 07:03:16 +00:00
parent e4adaec4ef
commit c72ee51dc8
2 changed files with 27 additions and 0 deletions

View File

@ -166,6 +166,7 @@ type
procedure BeginUpdate;
procedure EndUpdate;
function ExecuteAction(ExeAction: TBasicAction): Boolean; override;
function GetPanelIndexAt(X, Y: Integer): Integer;
function SizeGripEnabled: Boolean;
function UpdatingStatusBar: boolean;
property Canvas: TCanvas read FCanvas;

View File

@ -239,6 +239,32 @@ begin
Result := inherited ExecuteAction(ExeAction);
end;
function TStatusBar.GetPanelIndexAt(X, Y: Integer): Integer;
var
R, PanelRect: TRect;
P: TPoint;
i: integer;
begin
Result := -1;
if Panels.Count = 0 then
Exit;
R := GetChildsRect(False);
P := Point(X, Y);
if not PtInRect(R, P) then
Exit;
PanelRect := R;
for i := 0 to Panels.Count - 1 do
begin
if i <> Panels.Count - 1 then
PanelRect.Right := PanelRect.Left + Panels[i].Width
else
PanelRect.Right := R.Right;
if PtInRect(PanelRect, P) then
Exit(i);
PanelRect.Left := PanelRect.Right;
end;
end;
function TStatusBar.SizeGripEnabled: Boolean;
begin