Repository navigation
Expand file tree
/
Copy pathuWVCoreWebView2WindowFeatures.pas
More file actions
186 lines (157 loc) · 5.38 KB
/
Copy pathuWVCoreWebView2WindowFeatures.pas
File metadata and controls
186 lines (157 loc) · 5.38 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
unit uWVCoreWebView2WindowFeatures;
{$IFDEF FPC}{$MODE Delphi}{$ENDIF}
{$I webview2.inc}
interface
uses
uWVTypeLibrary, uWVTypes;
type
TCoreWebView2WindowFeatures = class
protected
FBaseIntf : ICoreWebView2WindowFeatures;
function GetInitialized : boolean;
function GetHasPosition : boolean;
function GetHasSize : boolean;
function GetLeft : cardinal;
function GetTop : cardinal;
function GetWidth : cardinal;
function GetHeight : cardinal;
function GetShouldDisplayMenuBar : boolean;
function GetShouldDisplayStatus : boolean;
function GetShouldDisplayToolbar : boolean;
function GetShouldDisplayScrollBars : boolean;
public
constructor Create(const aBaseIntf : ICoreWebView2WindowFeatures); reintroduce;
destructor Destroy; override;
procedure CopyToRecord(var aWindowFeatures : TWVWindowFeatures);
property Initialized : boolean read GetInitialized;
property BaseIntf : ICoreWebView2WindowFeatures read FBaseIntf;
property HasPosition : boolean read GetHasPosition;
property HasSize : boolean read GetHasSize;
property Left : cardinal read GetLeft;
property Top : cardinal read GetTop;
property Width : cardinal read GetWidth;
property Height : cardinal read GetHeight;
property ShouldDisplayMenuBar : boolean read GetShouldDisplayMenuBar;
property ShouldDisplayStatus : boolean read GetShouldDisplayStatus;
property ShouldDisplayToolbar : boolean read GetShouldDisplayToolbar;
property ShouldDisplayScrollBars : boolean read GetShouldDisplayScrollBars;
end;
implementation
uses
{$IFDEF DELPHI16_UP}
Winapi.ActiveX;
{$ELSE}
ActiveX;
{$ENDIF}
constructor TCoreWebView2WindowFeatures.Create(const aBaseIntf: ICoreWebView2WindowFeatures);
begin
inherited Create;
FBaseIntf := aBaseIntf;
end;
destructor TCoreWebView2WindowFeatures.Destroy;
begin
FBaseIntf := nil;
inherited Destroy;
end;
procedure TCoreWebView2WindowFeatures.CopyToRecord(var aWindowFeatures : TWVWindowFeatures);
begin
aWindowFeatures.HasPosition := HasPosition;
aWindowFeatures.HasSize := HasSize;
aWindowFeatures.Left := Left;
aWindowFeatures.Top := Top;
aWindowFeatures.Width := Width;
aWindowFeatures.Height := Height;
aWindowFeatures.ShouldDisplayMenuBar := ShouldDisplayMenuBar;
aWindowFeatures.ShouldDisplayStatus := ShouldDisplayStatus;
aWindowFeatures.ShouldDisplayToolbar := ShouldDisplayToolbar;
aWindowFeatures.ShouldDisplayScrollBars := ShouldDisplayScrollBars;
end;
function TCoreWebView2WindowFeatures.GetInitialized : boolean;
begin
Result := assigned(FBaseIntf);
end;
function TCoreWebView2WindowFeatures.GetHasPosition : boolean;
var
TempResult : integer;
begin
Result := Initialized and
succeeded(FBaseIntf.Get_HasPosition(TempResult)) and
(TempResult <> 0);
end;
function TCoreWebView2WindowFeatures.GetHasSize : boolean;
var
TempResult : integer;
begin
Result := Initialized and
succeeded(FBaseIntf.Get_HasSize(TempResult)) and
(TempResult <> 0);
end;
function TCoreWebView2WindowFeatures.GetLeft : cardinal;
var
TempResult : SYSUINT;
begin
if Initialized and succeeded(FBaseIntf.Get_Left(TempResult)) then
Result := TempResult
else
Result := 0;
end;
function TCoreWebView2WindowFeatures.GetTop : cardinal;
var
TempResult : SYSUINT;
begin
if Initialized and succeeded(FBaseIntf.Get_Top(TempResult)) then
Result := TempResult
else
Result := 0;
end;
function TCoreWebView2WindowFeatures.GetWidth : cardinal;
var
TempResult : SYSUINT;
begin
if Initialized and succeeded(FBaseIntf.Get_Width(TempResult)) then
Result := TempResult
else
Result := 0;
end;
function TCoreWebView2WindowFeatures.GetHeight : cardinal;
var
TempResult : SYSUINT;
begin
if Initialized and succeeded(FBaseIntf.Get_Height(TempResult)) then
Result := TempResult
else
Result := 0;
end;
function TCoreWebView2WindowFeatures.GetShouldDisplayMenuBar : boolean;
var
TempResult : integer;
begin
Result := Initialized and
succeeded(FBaseIntf.Get_ShouldDisplayMenuBar(TempResult)) and
(TempResult <> 0);
end;
function TCoreWebView2WindowFeatures.GetShouldDisplayStatus : boolean;
var
TempResult : integer;
begin
Result := Initialized and
succeeded(FBaseIntf.Get_ShouldDisplayStatus(TempResult)) and
(TempResult <> 0);
end;
function TCoreWebView2WindowFeatures.GetShouldDisplayToolbar : boolean;
var
TempResult : integer;
begin
Result := Initialized and
succeeded(FBaseIntf.Get_ShouldDisplayToolbar(TempResult)) and
(TempResult <> 0);
end;
function TCoreWebView2WindowFeatures.GetShouldDisplayScrollBars : boolean;
var
TempResult : integer;
begin
Result := Initialized and
succeeded(FBaseIntf.Get_ShouldDisplayScrollBars(TempResult)) and
(TempResult <> 0);
end;
end.