mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-22 18:29:26 +01:00
cocoa: common code to determine a rect of a cell in NSTableView
git-svn-id: trunk@58997 -
This commit is contained in:
parent
fac617af9b
commit
463f479224
@ -235,6 +235,7 @@ type
|
|||||||
function AllocCocoaTableListView: TCocoaTableListView;
|
function AllocCocoaTableListView: TCocoaTableListView;
|
||||||
|
|
||||||
function LCLCoordToRow(tbl: NSTableView; X,Y: Integer): Integer;
|
function LCLCoordToRow(tbl: NSTableView; X,Y: Integer): Integer;
|
||||||
|
function LCLGetItemRect(tbl: NSTableView; row, col: Integer; var r: TRect): Boolean;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -256,6 +257,20 @@ begin
|
|||||||
Result := tbl.rowAtPoint(pt);
|
Result := tbl.rowAtPoint(pt);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function LCLGetItemRect(tbl: NSTableView; row, col: Integer; var r: TRect): Boolean;
|
||||||
|
var
|
||||||
|
nsr : NSRect;
|
||||||
|
begin
|
||||||
|
if not Assigned(tbl) then begin
|
||||||
|
Result := false;
|
||||||
|
r := Bounds(0,0,0,0);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
nsr:=tbl.frameOfCellAtColumn_row(col,row);
|
||||||
|
r:=NSRectToRect(nsr);
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
// not yet!
|
// not yet!
|
||||||
{.$DEFINE DYNAMIC_NSTABLEVIEW_BASE}
|
{.$DEFINE DYNAMIC_NSTABLEVIEW_BASE}
|
||||||
|
|
||||||
|
|||||||
@ -1013,17 +1013,10 @@ class function TCocoaWSCustomListView.ItemDisplayRect(
|
|||||||
var
|
var
|
||||||
lCocoaLV: TCocoaListView;
|
lCocoaLV: TCocoaListView;
|
||||||
lTableLV: TCocoaTableListView;
|
lTableLV: TCocoaTableListView;
|
||||||
lRowRect, lColRect, lNSRect: NSRect;
|
|
||||||
begin
|
|
||||||
if not CheckParams(lCocoaLV, lTableLV, ALV) then
|
|
||||||
begin
|
begin
|
||||||
Result:=Bounds(0,0,0,0);
|
Result:=Bounds(0,0,0,0);
|
||||||
Exit;
|
if not CheckParams(lCocoaLV, lTableLV, ALV) then Exit;
|
||||||
end;
|
LCLGetItemRect(lTableLV, AIndex, ASubItem, Result);
|
||||||
lRowRect := lTableLV.rectOfRow(AIndex);
|
|
||||||
lColRect := lTableLV.rectOfColumn(ASubItem);
|
|
||||||
lNSRect := NSIntersectionRect(lRowRect, lColRect);
|
|
||||||
NSToLCLRect(lNSRect, lCocoaLV.frame.size.height, Result);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TCocoaWSCustomListView.ItemGetChecked(
|
class function TCocoaWSCustomListView.ItemGetChecked(
|
||||||
|
|||||||
@ -1819,10 +1819,7 @@ begin
|
|||||||
|
|
||||||
view := GetListBox(ACustomListBox);
|
view := GetListBox(ACustomListBox);
|
||||||
if not Assigned(view) then Exit(False);
|
if not Assigned(view) then Exit(False);
|
||||||
|
Result := LCLGetItemRect(view, Index, 0, ARect);
|
||||||
r:=view.frameOfCellAtColumn_row(0,index);
|
|
||||||
Arect:=NSRectToRect(r);
|
|
||||||
Result := True;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TCocoaWSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox): integer;
|
class function TCocoaWSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox): integer;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user