mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-20 23:59:40 +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 LCLCoordToRow(tbl: NSTableView; X,Y: Integer): Integer;
|
||||
function LCLGetItemRect(tbl: NSTableView; row, col: Integer; var r: TRect): Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
@ -256,6 +257,20 @@ begin
|
||||
Result := tbl.rowAtPoint(pt);
|
||||
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!
|
||||
{.$DEFINE DYNAMIC_NSTABLEVIEW_BASE}
|
||||
|
||||
|
||||
@ -1013,17 +1013,10 @@ class function TCocoaWSCustomListView.ItemDisplayRect(
|
||||
var
|
||||
lCocoaLV: TCocoaListView;
|
||||
lTableLV: TCocoaTableListView;
|
||||
lRowRect, lColRect, lNSRect: NSRect;
|
||||
begin
|
||||
if not CheckParams(lCocoaLV, lTableLV, ALV) then
|
||||
begin
|
||||
Result:=Bounds(0,0,0,0);
|
||||
Exit;
|
||||
end;
|
||||
lRowRect := lTableLV.rectOfRow(AIndex);
|
||||
lColRect := lTableLV.rectOfColumn(ASubItem);
|
||||
lNSRect := NSIntersectionRect(lRowRect, lColRect);
|
||||
NSToLCLRect(lNSRect, lCocoaLV.frame.size.height, Result);
|
||||
Result:=Bounds(0,0,0,0);
|
||||
if not CheckParams(lCocoaLV, lTableLV, ALV) then Exit;
|
||||
LCLGetItemRect(lTableLV, AIndex, ASubItem, Result);
|
||||
end;
|
||||
|
||||
class function TCocoaWSCustomListView.ItemGetChecked(
|
||||
|
||||
@ -1819,10 +1819,7 @@ begin
|
||||
|
||||
view := GetListBox(ACustomListBox);
|
||||
if not Assigned(view) then Exit(False);
|
||||
|
||||
r:=view.frameOfCellAtColumn_row(0,index);
|
||||
Arect:=NSRectToRect(r);
|
||||
Result := True;
|
||||
Result := LCLGetItemRect(view, Index, 0, ARect);
|
||||
end;
|
||||
|
||||
class function TCocoaWSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox): integer;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user