@@ -43,6 +43,21 @@ TGridColWidthsAccess = class(TContainerAccess)
43
43
property Container : TCustomDrawGrid read GetContainer;
44
44
end ;
45
45
46
+ TGridRowHeightsAccess = class (TContainerAccess)
47
+ private
48
+ function GetContainer : TCustomDrawGrid;
49
+ public
50
+ function GetItem (AIndex : Integer) : PPyObject; override;
51
+ function GetSize : Integer; override;
52
+ function SetItem (AIndex : Integer; AValue : PPyObject) : Boolean; override;
53
+
54
+ class function ExpectedContainerClass : TClass; override;
55
+ class function SupportsWrite : Boolean; override;
56
+ class function Name : string; override;
57
+
58
+ property Container : TCustomDrawGrid read GetContainer;
59
+ end ;
60
+
46
61
TPyDelphiCustomGrid = class (TPyDelphiWinControl)
47
62
private
48
63
function GetDelphiObject : TCustomGrid;
@@ -73,7 +88,7 @@ TPyDelphiCustomDrawGrid = class (TPyDelphiCustomGrid)
73
88
function Get_LeftCol (AContext : Pointer): PPyObject; cdecl;
74
89
function Get_Selection (AContext : Pointer): PPyObject; cdecl;
75
90
function Get_Row (AContext : Pointer): PPyObject; cdecl;
76
- // function Get_RowHeights(AContext : Pointer): PPyObject; cdecl;
91
+ function Get_RowHeights (AContext : Pointer): PPyObject; cdecl;
77
92
// function Get_TabStops(AContext : Pointer): PPyObject; cdecl;
78
93
function Get_TopRow (AContext : Pointer): PPyObject; cdecl;
79
94
@@ -307,6 +322,9 @@ class function TSelectCellEventHandler.GetTypeInfo: PTypeInfo;
307
322
308
323
{ TGridColWidthsAccess }
309
324
325
+ type
326
+ TCustomDrawGridAccess = class (TCustomDrawGrid);
327
+
310
328
class function TGridColWidthsAccess.ExpectedContainerClass : TClass;
311
329
begin
312
330
result:=TCustomGrid;
@@ -323,9 +341,6 @@ function TGridColWidthsAccess.GetItem(AIndex: Integer): PPyObject;
323
341
Result:=PyLong_FromLong(Container.ColWidths[AIndex]);
324
342
end ;
325
343
326
- type
327
- TCustomDrawGridAccess = class (TCustomDrawGrid);
328
-
329
344
function TGridColWidthsAccess.GetSize : Integer;
330
345
begin
331
346
result:=TCustomDrawGridAccess(Container).ColCount;
@@ -349,6 +364,47 @@ class function TGridColWidthsAccess.SupportsWrite: Boolean;
349
364
result:=True;
350
365
end ;
351
366
367
+ { TGridRowHeightsAccess }
368
+
369
+ class function TGridRowHeightsAccess.ExpectedContainerClass : TClass;
370
+ begin
371
+ result:=TCustomGrid;
372
+ end ;
373
+
374
+ function TGridRowHeightsAccess.GetContainer : TCustomDrawGrid;
375
+ begin
376
+ result:=TCustomDrawGrid(inherited Container);
377
+ end ;
378
+
379
+ function TGridRowHeightsAccess.GetItem (AIndex: Integer): PPyObject;
380
+ begin
381
+ with GetPythonEngine do
382
+ Result:=PyLong_FromLong(Container.RowHeights[AIndex]);
383
+ end ;
384
+
385
+ function TGridRowHeightsAccess.GetSize : Integer;
386
+ begin
387
+ result:=TCustomDrawGridAccess(Container).RowCount;
388
+ end ;
389
+
390
+ class function TGridRowHeightsAccess.Name : string;
391
+ begin
392
+ result:=' TCustomGrid.RowHeights' ;
393
+ end ;
394
+
395
+ function TGridRowHeightsAccess.SetItem (AIndex: Integer;
396
+ AValue: PPyObject): Boolean;
397
+ begin
398
+ result:=True;
399
+ with GetPythonEngine do
400
+ Container.RowHeights[AIndex]:=PyLong_AsLong(AValue);
401
+ end ;
402
+
403
+ class function TGridRowHeightsAccess.SupportsWrite : Boolean;
404
+ begin
405
+ result:=True;
406
+ end ;
407
+
352
408
{ TPyDelphiCustomGrid }
353
409
354
410
class function TPyDelphiCustomGrid.DelphiObjectClass : TClass;
@@ -432,6 +488,15 @@ function TPyDelphiCustomDrawGrid.Get_Row(AContext: Pointer): PPyObject;
432
488
Result := GetPythonEngine.PyLong_FromLong(DelphiObject.Row);
433
489
end ;
434
490
491
+ function TPyDelphiCustomDrawGrid.Get_RowHeights (
492
+ AContext: Pointer): PPyObject;
493
+ begin
494
+ Adjust(@Self);
495
+ Result := Self.PyDelphiWrapper.DefaultContainerType.CreateInstance;
496
+ with PythonToDelphi(Result) as TPyDelphiContainer do
497
+ Setup(Self.PyDelphiWrapper, TGridRowHeightsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
498
+ end ;
499
+
435
500
function TPyDelphiCustomDrawGrid.Get_Selection (
436
501
AContext: Pointer): PPyObject;
437
502
begin
@@ -474,6 +539,8 @@ class procedure TPyDelphiCustomDrawGrid.RegisterGetSets(
474
539
' Indicates the boundaries of the current selection.' , nil );
475
540
AddGetSet(' Row' , @TPyDelphiCustomDrawGrid.Get_Row, @TPyDelphiCustomDrawGrid.Set_Row,
476
541
' Specifies the index of the row that contains the selected cell.' , nil );
542
+ AddGetSet(' RowHeights' , @TPyDelphiCustomDrawGrid.Get_RowHeights, nil ,
543
+ ' Specifies row heights of the grid' , nil );
477
544
AddGetSet(' TopRow' , @TPyDelphiCustomDrawGrid.Get_TopRow, @TPyDelphiCustomDrawGrid.Set_TopRow,
478
545
' Specifies the index of the first visible scrollable row in the grid.' , nil );
479
546
end ;
0 commit comments