|
| 1 | +{$I Definition.Inc} |
| 2 | + |
| 3 | +unit WrapFmxListBox; |
| 4 | + |
| 5 | +interface |
| 6 | + |
| 7 | +uses |
| 8 | + FMX.ListBox, WrapFmxTypes, PythonEngine; |
| 9 | + |
| 10 | +type |
| 11 | + TPyListBoxItem = class(TPyDelphiFMXObject) |
| 12 | + private |
| 13 | + function GetDelphiObject: TListBoxItem; |
| 14 | + procedure SetDelphiObject(const Value: TListBoxItem); |
| 15 | + public |
| 16 | + class function DelphiObjectClass: TClass; override; |
| 17 | + property DelphiObject: TListBoxItem read GetDelphiObject |
| 18 | + write SetDelphiObject; |
| 19 | + end; |
| 20 | + TPyDelphiListBox = class(TPyDelphiFMXObject) |
| 21 | + private |
| 22 | + function GetDelphiObject: TListBox; |
| 23 | + procedure SetDelphiObject(const Value: TListBox); |
| 24 | + public |
| 25 | + class function DelphiObjectClass: TClass; override; |
| 26 | + // Properties |
| 27 | + property DelphiObject: TListBox read GetDelphiObject |
| 28 | + write SetDelphiObject; |
| 29 | + end; |
| 30 | + |
| 31 | +implementation |
| 32 | + |
| 33 | +uses |
| 34 | + WrapDelphi; |
| 35 | + |
| 36 | +{ Register the wrappers, the globals and the constants } |
| 37 | +type |
| 38 | + TListBoxRegistration = class(TRegisteredUnit) |
| 39 | + public |
| 40 | + function Name: string; override; |
| 41 | + procedure RegisterWrappers(APyDelphiWrapper: TPyDelphiWrapper); override; |
| 42 | + procedure DefineVars(APyDelphiWrapper: TPyDelphiWrapper); override; |
| 43 | + end; |
| 44 | + |
| 45 | +{ TListBoxRegistration } |
| 46 | + |
| 47 | +procedure TListBoxRegistration.DefineVars(APyDelphiWrapper: TPyDelphiWrapper); |
| 48 | +begin |
| 49 | + inherited; |
| 50 | +end; |
| 51 | + |
| 52 | +function TListBoxRegistration.Name: string; |
| 53 | +begin |
| 54 | + Result := 'ListBox'; |
| 55 | +end; |
| 56 | + |
| 57 | +procedure TListBoxRegistration.RegisterWrappers( |
| 58 | + APyDelphiWrapper: TPyDelphiWrapper); |
| 59 | +begin |
| 60 | + inherited; |
| 61 | + APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiListBox); |
| 62 | +end; |
| 63 | + |
| 64 | +{ TPyDelphiListBox } |
| 65 | + |
| 66 | +class function TPyDelphiListBox.DelphiObjectClass: TClass; |
| 67 | +begin |
| 68 | + Result := TListBox; |
| 69 | +end; |
| 70 | + |
| 71 | +function TPyDelphiListBox.GetDelphiObject: TListBox; |
| 72 | +begin |
| 73 | + Result := TListBox(inherited DelphiObject); |
| 74 | +end; |
| 75 | + |
| 76 | + |
| 77 | +procedure TPyDelphiListBox.SetDelphiObject(const Value: TListBox); |
| 78 | +begin |
| 79 | + inherited DelphiObject := Value; |
| 80 | +end; |
| 81 | + |
| 82 | +{ TPyListBoxItem } |
| 83 | + |
| 84 | +class function TPyListBoxItem.DelphiObjectClass: TClass; |
| 85 | +begin |
| 86 | + Result := TListBox; |
| 87 | +end; |
| 88 | + |
| 89 | +function TPyListBoxItem.GetDelphiObject: TListBoxItem; |
| 90 | +begin |
| 91 | + Result := TListBox(inherited DelphiObject); |
| 92 | +end; |
| 93 | + |
| 94 | +procedure TPyListBoxItem.SetDelphiObject(const Value: TListBoxItem); |
| 95 | +begin |
| 96 | + inherited DelphiObject := Value; |
| 97 | +end; |
| 98 | + |
| 99 | +initialization |
| 100 | + RegisteredUnits.Add(TListBoxRegistration.Create); |
| 101 | + |
| 102 | +end. |
0 commit comments