cocoa: introducing lclSetColumnAlign to allow set allignment for cell and view based tables

git-svn-id: trunk@62724 -
This commit is contained in:
dmitry 2020-03-09 02:19:37 +00:00
parent 7d8ad4dd58
commit cc3d447e35
2 changed files with 17 additions and 2 deletions

View File

@ -125,6 +125,7 @@ type
function lclGetIconRect(ARow, ACol: Integer; const BoundsRect: TRect): TRect; message 'lclGetIconRect:::'; function lclGetIconRect(ARow, ACol: Integer; const BoundsRect: TRect): TRect; message 'lclGetIconRect:::';
procedure lclInsDelRow(Arow: Integer; inserted: Boolean); message 'lclInsDelRow::'; procedure lclInsDelRow(Arow: Integer; inserted: Boolean); message 'lclInsDelRow::';
procedure lclSetColumnAlign(acolumn: NSTableColumn; aalignment: NSTextAlignment); message 'lclSetColumn:Align:';
// NSTableViewDataSourceProtocol // NSTableViewDataSourceProtocol
function numberOfRowsInTableView(tableView: NSTableView): NSInteger; message 'numberOfRowsInTableView:'; 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:'; 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:'; function tableView_dataCellForTableColumn_row(tableView: NSTableView; tableColumn: NSTableColumn; row: NSInteger): NSCell; message 'tableView:dataCellForTableColumn:row:';
procedure lclInsDelRow(Arow: Integer; inserted: Boolean); override; procedure lclInsDelRow(Arow: Integer; inserted: Boolean); override;
procedure lclSetColumnAlign(acolumn: NSTableColumn; aalignment: NSTextAlignment); override;
end; end;
TCellCocoaTableListView1013 = objcclass(TCellCocoaTableListView, NSTableViewDelegateProtocol, NSTableViewDataSourceProtocol) 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 // as well as number of total items in the table should be marked as modified
end; end;
procedure TCocoaTableListView.lclSetColumnAlign(acolumn: NSTableColumn;
aalignment: NSTextAlignment);
begin
end;
function TCocoaTableListView.acceptsFirstResponder: LCLObjCBoolean; function TCocoaTableListView.acceptsFirstResponder: LCLObjCBoolean;
begin begin
Result := NSViewCanFocus(Self); Result := NSViewCanFocus(Self);
@ -946,6 +954,14 @@ begin
noteNumberOfRowsChanged; noteNumberOfRowsChanged;
end; 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( function TCellCocoaTableListView.tableView_objectValueForTableColumn_row(
tableView: NSTableView; tableColumn: NSTableColumn; row: NSInteger): id; tableView: NSTableView; tableColumn: NSTableColumn; row: NSInteger): id;
var var

View File

@ -1136,8 +1136,7 @@ const
); );
begin begin
if not CheckColumnParams(lTableLV, lNSColumn, ALV, AIndex) then Exit; if not CheckColumnParams(lTableLV, lNSColumn, ALV, AIndex) then Exit;
NSCell(lNSColumn.headerCell).setAlignment( txtAlign[AAlignment] ); lTableLV.lclSetColumnAlign(lNSColumn, txtAlign[AAlignment]);
NSCell(lNSColumn.dataCell).setAlignment( txtAlign[AAlignment] );
end; end;
class procedure TCocoaWSCustomListView.ColumnSetAutoSize( class procedure TCocoaWSCustomListView.ColumnSetAutoSize(