mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 18:08:35 +02:00
lcl: add TStatusBar.GetPanelIndexAt()
git-svn-id: trunk@19818 -
This commit is contained in:
parent
e4adaec4ef
commit
c72ee51dc8
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user