|
| 1 | +{$I ..\Definition.Inc} |
| 2 | + |
| 3 | +unit WrapFmxMenus; |
| 4 | + |
| 5 | +interface |
| 6 | + |
| 7 | +uses |
| 8 | + WrapFmxControls, FMX.Menus, WrapFmxTypes; |
| 9 | + |
| 10 | +type |
| 11 | + TPyDelphiMenuItem = class(TPyDelphiTextControl) |
| 12 | + private |
| 13 | + function GetDelphiObject: TMenuItem; |
| 14 | + procedure SetDelphiObject(const Value: TMenuItem); |
| 15 | + public |
| 16 | + class function DelphiObjectClass: TClass; override; |
| 17 | + property DelphiObject: TMenuItem read GetDelphiObject write SetDelphiObject; |
| 18 | + end; |
| 19 | + |
| 20 | + TPyDelphiPopupMenu = class(TPyDelphiCustomPopupMenu) |
| 21 | + private |
| 22 | + function GetDelphiObject: TPopupMenu; |
| 23 | + procedure SetDelphiObject(const Value: TPopupMenu); |
| 24 | + public |
| 25 | + class function DelphiObjectClass: TClass; override; |
| 26 | + property DelphiObject: TPopupMenu read GetDelphiObject write SetDelphiObject; |
| 27 | + end; |
| 28 | + |
| 29 | + TPyDelphiMenuBar = class(TPyDelphiStyledControl) |
| 30 | + private |
| 31 | + function GetDelphiObject: TMenuBar; |
| 32 | + procedure SetDelphiObject(const Value: TMenuBar); |
| 33 | + public |
| 34 | + class function DelphiObjectClass: TClass; override; |
| 35 | + property DelphiObject: TMenuBar read GetDelphiObject write SetDelphiObject; |
| 36 | + end; |
| 37 | + |
| 38 | + TPyDelphiMainMenu = class(TPyDelphiFmxObject) |
| 39 | + private |
| 40 | + function GetDelphiObject: TMainMenu; |
| 41 | + procedure SetDelphiObject(const Value: TMainMenu); |
| 42 | + public |
| 43 | + class function DelphiObjectClass: TClass; override; |
| 44 | + property DelphiObject: TMainMenu read GetDelphiObject write SetDelphiObject; |
| 45 | + end; |
| 46 | + |
| 47 | +implementation |
| 48 | + |
| 49 | +uses |
| 50 | + WrapDelphi; |
| 51 | + |
| 52 | +{ Register the wrappers, the globals and the constants } |
| 53 | +type |
| 54 | + TMenusRegistration = class(TRegisteredUnit) |
| 55 | + public |
| 56 | + function Name : string; override; |
| 57 | + procedure RegisterWrappers(APyDelphiWrapper : TPyDelphiWrapper); override; |
| 58 | + procedure DefineVars(APyDelphiWrapper : TPyDelphiWrapper); override; |
| 59 | + end; |
| 60 | + |
| 61 | +{ TMenusRegistration } |
| 62 | + |
| 63 | +function TMenusRegistration.Name: string; |
| 64 | +begin |
| 65 | + Result := 'Menus'; |
| 66 | +end; |
| 67 | + |
| 68 | +procedure TMenusRegistration.DefineVars(APyDelphiWrapper: TPyDelphiWrapper); |
| 69 | +begin |
| 70 | + inherited; |
| 71 | +end; |
| 72 | + |
| 73 | +procedure TMenusRegistration.RegisterWrappers( |
| 74 | + APyDelphiWrapper: TPyDelphiWrapper); |
| 75 | +begin |
| 76 | + inherited; |
| 77 | + APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiMenuItem); |
| 78 | + APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiPopupMenu); |
| 79 | + APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiMenuBar); |
| 80 | + APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiMainMenu); |
| 81 | +end; |
| 82 | + |
| 83 | +{ TPyDelphiMenuItem } |
| 84 | + |
| 85 | +class function TPyDelphiMenuItem.DelphiObjectClass: TClass; |
| 86 | +begin |
| 87 | + Result := TMenuItem; |
| 88 | +end; |
| 89 | + |
| 90 | +function TPyDelphiMenuItem.GetDelphiObject: TMenuItem; |
| 91 | +begin |
| 92 | + Result := TMenuItem(inherited DelphiObject); |
| 93 | +end; |
| 94 | + |
| 95 | +procedure TPyDelphiMenuItem.SetDelphiObject(const Value: TMenuItem); |
| 96 | +begin |
| 97 | + inherited DelphiObject := Value; |
| 98 | +end; |
| 99 | + |
| 100 | +{ TPyDelphiPopupMenu } |
| 101 | + |
| 102 | +class function TPyDelphiPopupMenu.DelphiObjectClass: TClass; |
| 103 | +begin |
| 104 | + Result := TPopupMenu; |
| 105 | +end; |
| 106 | + |
| 107 | +function TPyDelphiPopupMenu.GetDelphiObject: TPopupMenu; |
| 108 | +begin |
| 109 | + Result := TPopupMenu(inherited DelphiObject); |
| 110 | +end; |
| 111 | + |
| 112 | +procedure TPyDelphiPopupMenu.SetDelphiObject(const Value: TPopupMenu); |
| 113 | +begin |
| 114 | + inherited DelphiObject := Value; |
| 115 | +end; |
| 116 | + |
| 117 | +{ TPyDelphiMenuBar } |
| 118 | + |
| 119 | +class function TPyDelphiMenuBar.DelphiObjectClass: TClass; |
| 120 | +begin |
| 121 | + Result := TMenuBar; |
| 122 | +end; |
| 123 | + |
| 124 | +function TPyDelphiMenuBar.GetDelphiObject: TMenuBar; |
| 125 | +begin |
| 126 | + Result := TMenuBar(inherited DelphiObject); |
| 127 | +end; |
| 128 | + |
| 129 | +procedure TPyDelphiMenuBar.SetDelphiObject(const Value: TMenuBar); |
| 130 | +begin |
| 131 | + inherited DelphiObject := Value; |
| 132 | +end; |
| 133 | + |
| 134 | +{ TPyDelphiMainMenu } |
| 135 | + |
| 136 | +class function TPyDelphiMainMenu.DelphiObjectClass: TClass; |
| 137 | +begin |
| 138 | + Result := TMainMenu; |
| 139 | +end; |
| 140 | + |
| 141 | +function TPyDelphiMainMenu.GetDelphiObject: TMainMenu; |
| 142 | +begin |
| 143 | + Result := TMainMenu(inherited DelphiObject); |
| 144 | +end; |
| 145 | + |
| 146 | +procedure TPyDelphiMainMenu.SetDelphiObject(const Value: TMainMenu); |
| 147 | +begin |
| 148 | + inherited DelphiObject := Value; |
| 149 | +end; |
| 150 | + |
| 151 | +initialization |
| 152 | + RegisteredUnits.Add(TMenusRegistration.Create()); |
| 153 | + |
| 154 | +end. |
0 commit comments