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