cocoa: updating drawing processing for cocoa table

git-svn-id: trunk@62732 -
This commit is contained in:
dmitry 2020-03-10 00:14:48 +00:00
parent 8dda0c3323
commit 965242b45e
3 changed files with 12 additions and 4 deletions

View File

@ -78,7 +78,7 @@ type
isImagesInCell: Boolean;
isFirstColumnCheckboxes: Boolean;
isCustomDraw : Boolean;
isOwnerDraw : Boolean;
isDynamicRowHeight: Boolean;
CustomRowHeight: Integer;
@ -97,6 +97,7 @@ type
procedure resetCursorRects; override;
procedure drawRow_clipRect(row: NSInteger; clipRect: NSRect); override;
procedure drawRect(dirtyRect: NSRect); override;
// mouse
procedure mouseDown(event: NSEvent); override;
@ -510,7 +511,6 @@ var
ItemState: TOwnerDrawState;
begin
inherited;
if not isCustomDraw then Exit;
if not Assigned(callback) then Exit;
ctx := TCocoaContext.Create(NSGraphicsContext.currentContext);
try
@ -526,6 +526,13 @@ begin
end;
end;
procedure TCocoaTableListView.drawRect(dirtyRect: NSRect);
begin
inherited drawRect(dirtyRect);
if CheckMainThread and Assigned(callback) then
callback.Draw(NSGraphicsContext.currentContext, bounds, dirtyRect);
end;
function TCocoaTableListView.getIndexOfColumn(ACol: NSTableColumn): Integer;
var
idx : NSUInteger;

View File

@ -230,7 +230,7 @@ begin
list.readOnly := true;
//todo:
//list.AllowMixedState := TCustomCheckListBox(AWinControl).AllowGrayed;
list.isCustomDraw := TCustomCheckListBox(AWinControl).Style in [lbOwnerDrawFixed, lbOwnerDrawVariable];
list.isOwnerDraw := TCustomCheckListBox(AWinControl).Style in [lbOwnerDrawFixed, lbOwnerDrawVariable];
scroll := EmbedInScrollView(list);
if not Assigned(scroll) then

View File

@ -648,6 +648,7 @@ procedure TLCLListBoxCallback.DrawRow(rowidx: Integer; ctx: TCocoaContext;
var
DrawStruct: TDrawListItemStruct;
begin
if not listview.isOwnerDraw then Exit;
DrawStruct.ItemState := state;
DrawStruct.Area := r;
DrawStruct.DC := HDC(ctx);
@ -2074,7 +2075,7 @@ end;
procedure ListBoxSetStyle(list: TCocoaTableListView; AStyle: TListBoxStyle);
begin
if not Assigned(list) then Exit;
list.isCustomDraw := AStyle in [lbOwnerDrawFixed, lbOwnerDrawVariable];
list.isOwnerDraw := AStyle in [lbOwnerDrawFixed, lbOwnerDrawVariable];
list.isDynamicRowHeight := AStyle = lbOwnerDrawVariable;
//todo: if flag isCustomRowHeight changes in runtime
// noteHeightOfRowsWithIndexesChanged, should be sent to listview