mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 12:52:11 +02:00
cocoa: adding the support for TDisplayCode to determine a rectangle in ListView. Based on patch by David Jenkins. #34312
git-svn-id: trunk@59105 -
This commit is contained in:
parent
940eb3dd6a
commit
ceb8d157e4
@ -112,6 +112,12 @@ type
|
||||
function lclGetSmallImage(idx: INteger): NSImage; message 'lclGetSmallImage:';
|
||||
function lclGetItemImageAt(ARow, ACol: Integer): NSImage; message 'lclGetItemImageAt::';
|
||||
|
||||
// BoundsRect - is the rectangle of the cell, speciifed of aRow, acol.
|
||||
// so the function lclGetLabelRect, lclGetIconRect should only adjust "BoundsRect"
|
||||
// and return the adjusted rectangle
|
||||
function lclGetLabelRect(ARow, ACol: Integer; const BoundsRect: TRect): TRect; message 'lclGetLabelRect:::';
|
||||
function lclGetIconRect(ARow, ACol: Integer; const BoundsRect: TRect): TRect; message 'lclGetIconRect:::';
|
||||
|
||||
// NSTableViewDataSourceProtocol
|
||||
function numberOfRowsInTableView(tableView: NSTableView): NSInteger; message 'numberOfRowsInTableView:';
|
||||
//procedure tableView_sortDescriptorsDidChange(tableView: NSTableView; oldDescriptors: NSArray); message 'tableView:sortDescriptorsDidChange:';
|
||||
@ -227,6 +233,8 @@ type
|
||||
|
||||
procedure textFieldAction(sender: NSTextField); message 'textFieldAction:';
|
||||
procedure checkboxAction(sender: NSButton); message 'checkboxAction:';
|
||||
|
||||
function lclGetLabelRect(ARow, ACol: Integer; const BoundsRect: TRect): TRect; override;
|
||||
end;
|
||||
|
||||
function AllocCocoaTableListView: TCocoaTableListView;
|
||||
@ -413,6 +421,18 @@ begin
|
||||
Result := img;
|
||||
end;
|
||||
|
||||
function TCocoaTableListView.lclGetLabelRect(ARow, ACol: Integer;
|
||||
const BoundsRect: TRect): TRect;
|
||||
begin
|
||||
Result := BoundsRect;
|
||||
end;
|
||||
|
||||
function TCocoaTableListView.lclGetIconRect(ARow, ACol: Integer;
|
||||
const BoundsRect: TRect): TRect;
|
||||
begin
|
||||
Result := BoundsRect;
|
||||
end;
|
||||
|
||||
function TCocoaTableListView.acceptsFirstResponder: Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
@ -1127,5 +1147,16 @@ begin
|
||||
reloadDataForRow_column(row, 0);
|
||||
end;
|
||||
|
||||
function TViewCocoaTableListView.lclGetLabelRect(ARow, ACol: Integer;
|
||||
const BoundsRect: TRect): TRect;
|
||||
var
|
||||
lTableItemLV: TCocoaTableListItem;
|
||||
begin
|
||||
Result := BoundsRect;
|
||||
lTableItemLV := TCocoaTableListItem(viewAtColumn_row_makeIfNecessary(ACol, ARow, False));
|
||||
Result.Left := Round(lTableItemLV.textFrame.origin.x - 1);
|
||||
Result.Width := Round(lTableItemLV.textFrame.size.width);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -1026,6 +1026,10 @@ begin
|
||||
Result:=Bounds(0,0,0,0);
|
||||
if not CheckParams(lCocoaLV, lTableLV, ALV) then Exit;
|
||||
LCLGetItemRect(lTableLV, AIndex, ASubItem, Result);
|
||||
case ACode of
|
||||
drLabel: Result := lTableLV.lclGetLabelRect(AIndex, ASubItem, Result);
|
||||
drIcon: Result := lTableLV.lclGetIconRect(AIndex, ASubItem, Result);
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TCocoaWSCustomListView.ItemGetChecked(
|
||||
|
Loading…
Reference in New Issue
Block a user