From cc3d447e35dc21b3ef49e22b320296dafc26899e Mon Sep 17 00:00:00 2001 From: dmitry Date: Mon, 9 Mar 2020 02:19:37 +0000 Subject: [PATCH] cocoa: introducing lclSetColumnAlign to allow set allignment for cell and view based tables git-svn-id: trunk@62724 - --- lcl/interfaces/cocoa/cocoatables.pas | 16 ++++++++++++++++ lcl/interfaces/cocoa/cocoawscomctrls.pas | 3 +-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lcl/interfaces/cocoa/cocoatables.pas b/lcl/interfaces/cocoa/cocoatables.pas index a496ad73f7..9fabe9b75e 100644 --- a/lcl/interfaces/cocoa/cocoatables.pas +++ b/lcl/interfaces/cocoa/cocoatables.pas @@ -125,6 +125,7 @@ type function lclGetIconRect(ARow, ACol: Integer; const BoundsRect: TRect): TRect; message 'lclGetIconRect:::'; procedure lclInsDelRow(Arow: Integer; inserted: Boolean); message 'lclInsDelRow::'; + procedure lclSetColumnAlign(acolumn: NSTableColumn; aalignment: NSTextAlignment); message 'lclSetColumn:Align:'; // NSTableViewDataSourceProtocol function numberOfRowsInTableView(tableView: NSTableView): NSInteger; message 'numberOfRowsInTableView:'; @@ -201,6 +202,7 @@ type procedure tableView_setObjectValue_forTableColumn_row(tableView: NSTableView; object_: id; tableColumn: NSTableColumn; row: NSInteger); message 'tableView:setObjectValue:forTableColumn:row:'; function tableView_dataCellForTableColumn_row(tableView: NSTableView; tableColumn: NSTableColumn; row: NSInteger): NSCell; message 'tableView:dataCellForTableColumn:row:'; procedure lclInsDelRow(Arow: Integer; inserted: Boolean); override; + procedure lclSetColumnAlign(acolumn: NSTableColumn; aalignment: NSTextAlignment); override; end; TCellCocoaTableListView1013 = objcclass(TCellCocoaTableListView, NSTableViewDelegateProtocol, NSTableViewDataSourceProtocol) @@ -467,6 +469,12 @@ begin // as well as number of total items in the table should be marked as modified end; +procedure TCocoaTableListView.lclSetColumnAlign(acolumn: NSTableColumn; + aalignment: NSTextAlignment); +begin + +end; + function TCocoaTableListView.acceptsFirstResponder: LCLObjCBoolean; begin Result := NSViewCanFocus(Self); @@ -946,6 +954,14 @@ begin noteNumberOfRowsChanged; end; +procedure TCellCocoaTableListView.lclSetColumnAlign(acolumn: NSTableColumn; + aalignment: NSTextAlignment); +begin + if not Assigned(acolumn) then Exit; + NSCell(acolumn.headerCell).setAlignment( aalignment ); + NSCell(acolumn.dataCell).setAlignment( aalignment ); +end; + function TCellCocoaTableListView.tableView_objectValueForTableColumn_row( tableView: NSTableView; tableColumn: NSTableColumn; row: NSInteger): id; var diff --git a/lcl/interfaces/cocoa/cocoawscomctrls.pas b/lcl/interfaces/cocoa/cocoawscomctrls.pas index e19f7825b3..e4417fd1e9 100644 --- a/lcl/interfaces/cocoa/cocoawscomctrls.pas +++ b/lcl/interfaces/cocoa/cocoawscomctrls.pas @@ -1136,8 +1136,7 @@ const ); begin if not CheckColumnParams(lTableLV, lNSColumn, ALV, AIndex) then Exit; - NSCell(lNSColumn.headerCell).setAlignment( txtAlign[AAlignment] ); - NSCell(lNSColumn.dataCell).setAlignment( txtAlign[AAlignment] ); + lTableLV.lclSetColumnAlign(lNSColumn, txtAlign[AAlignment]); end; class procedure TCocoaWSCustomListView.ColumnSetAutoSize(