mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 02:59:21 +02:00
LCL: TCustomTabControl: overload IndexOfTabAt and IndexOfPageAt to further use TPoint
git-svn-id: trunk@53952 -
This commit is contained in:
parent
32b4763c04
commit
684c92d6d4
@ -482,8 +482,10 @@ type
|
|||||||
function GetCapabilities: TNoteBookCapabilities; virtual;
|
function GetCapabilities: TNoteBookCapabilities; virtual;
|
||||||
function TabToPageIndex(AIndex: integer): integer;
|
function TabToPageIndex(AIndex: integer): integer;
|
||||||
function PageToTabIndex(AIndex: integer): integer;
|
function PageToTabIndex(AIndex: integer): integer;
|
||||||
function IndexOfTabAt(X, Y: Integer): Integer;
|
function IndexOfTabAt(X, Y: Integer): Integer; overload;
|
||||||
function IndexOfPageAt(X, Y: Integer): Integer;
|
function IndexOfTabAt(P: TPoint): Integer; overload;
|
||||||
|
function IndexOfPageAt(X, Y: Integer): Integer; overload;
|
||||||
|
function IndexOfPageAt(P: TPoint): Integer; overload;
|
||||||
public
|
public
|
||||||
procedure DoCloseTabClicked(APage: TCustomPage); virtual;
|
procedure DoCloseTabClicked(APage: TCustomPage); virtual;
|
||||||
property Images: TCustomImageList read FImages write SetImages;
|
property Images: TCustomImageList read FImages write SetImages;
|
||||||
|
@ -458,19 +458,39 @@ end;
|
|||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
function TCustomTabControl.IndexOfTabAt(X, Y: Integer): Integer;
|
function TCustomTabControl.IndexOfTabAt(X, Y: Integer): Integer;
|
||||||
|
|
||||||
|
Returns the index of the visible tab at the client position.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TCustomTabControl.IndexOfTabAt(X, Y: Integer): Integer;
|
||||||
|
begin
|
||||||
|
Result := IndexOfTabAt(Point(X, Y));
|
||||||
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
function TCustomTabControl.IndexOfTabAt(P: TPoint): Integer;
|
||||||
|
|
||||||
Returns the index of the visible tab at the client position.
|
Returns the index of the visible tab at the client position.
|
||||||
For example:
|
For example:
|
||||||
Index:=NoteBook1.IndexOfTabAt(
|
Index:=NoteBook1.IndexOfTabAt(
|
||||||
NoteBook1.ScreenToClient(Mouse.CursorPos));
|
NoteBook1.ScreenToClient(Mouse.CursorPos));
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TCustomTabControl.IndexOfTabAt(X, Y: Integer): Integer;
|
function TCustomTabControl.IndexOfTabAt(P: TPoint): Integer;
|
||||||
begin
|
begin
|
||||||
if HandleAllocated then
|
if HandleAllocated then
|
||||||
Result := TWSCustomTabControlClass(WidgetSetClass).GetTabIndexAtPos(Self, Point(X, Y))
|
Result := TWSCustomTabControlClass(WidgetSetClass).GetTabIndexAtPos(Self, P)
|
||||||
else
|
else
|
||||||
Result := -1;
|
Result := -1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
function TCustomTabControl.IndexOfPageAt(X, Y: Integer): Integer;
|
||||||
|
|
||||||
|
Returns the index of the page at the client position.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TCustomTabControl.IndexOfPageAt(X, Y: Integer): Integer;
|
||||||
|
begin
|
||||||
|
Result := IndexOfPageAt(Point(X, Y));
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
function TCustomTabControl.IndexOfPageAt(X, Y: Integer): Integer;
|
function TCustomTabControl.IndexOfPageAt(X, Y: Integer): Integer;
|
||||||
|
|
||||||
@ -479,9 +499,9 @@ end;
|
|||||||
Index:=NoteBook1.IndexOfPageAt(
|
Index:=NoteBook1.IndexOfPageAt(
|
||||||
NoteBook1.ScreenToClient(Mouse.CursorPos));
|
NoteBook1.ScreenToClient(Mouse.CursorPos));
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TCustomTabControl.IndexOfPageAt(X, Y: Integer): Integer;
|
function TCustomTabControl.IndexOfPageAt(P: TPoint): Integer;
|
||||||
begin
|
begin
|
||||||
Result := IndexOfTabAt(X, Y);
|
Result := IndexOfTabAt(P);
|
||||||
if Result <> -1 then
|
if Result <> -1 then
|
||||||
Result := TabToPageIndex(Result);
|
Result := TabToPageIndex(Result);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user