@@ -89,6 +89,352 @@ namespace CefSharp
8989
9090 return _menu->AddItem ((int )commandId, StringUtils::ToNative (label));
9191 }
92+
93+ virtual bool AddCheckItem (CefMenuCommand commandId, String^ label)
94+ {
95+ ThrowIfDisposed ();
96+
97+ return _menu->AddCheckItem ((int )commandId, StringUtils::ToNative (label));
98+ }
99+
100+ virtual bool AddRadioItem (CefMenuCommand commandId, String^ label, int groupId)
101+ {
102+ ThrowIfDisposed ();
103+
104+ return _menu->AddRadioItem ((int )commandId, StringUtils::ToNative (label), groupId);
105+ }
106+
107+ virtual IMenuModel^ AddSubMenu(CefMenuCommand commandId, String^ label)
108+ {
109+ ThrowIfDisposed ();
110+
111+ auto subMenu =_menu->AddSubMenu ((int )commandId, StringUtils::ToNative (label));
112+
113+ if (subMenu.get ())
114+ {
115+ return gcnew CefMenuModelWrapper (subMenu);
116+ }
117+
118+ return nullptr ;
119+ }
120+
121+ virtual bool InsertSeparatorAt (int index)
122+ {
123+ ThrowIfDisposed ();
124+
125+ return _menu->InsertSeparatorAt (index);
126+ }
127+
128+ virtual bool InsertItemAt (int index, CefMenuCommand commandId, String^ label)
129+ {
130+ ThrowIfDisposed ();
131+
132+ return _menu->InsertItemAt (index, (int )commandId, StringUtils::ToNative (label));
133+ }
134+
135+ virtual bool InsertCheckItemAt (int index, CefMenuCommand commandId, String^ label)
136+ {
137+ ThrowIfDisposed ();
138+
139+ return _menu->InsertCheckItemAt (index, (int )commandId, StringUtils::ToNative (label));
140+ }
141+
142+ virtual bool InsertRadioItemAt (int index, CefMenuCommand commandId, String^ label, int groupId)
143+ {
144+ ThrowIfDisposed ();
145+
146+ return _menu->InsertRadioItemAt (index, (int )commandId, StringUtils::ToNative (label), groupId);
147+ }
148+
149+ virtual IMenuModel^ InsertSubMenuAt(int index, CefMenuCommand commandId, String^ label)
150+ {
151+ ThrowIfDisposed ();
152+
153+ auto subMenu = _menu->InsertSubMenuAt (index, (int )commandId, StringUtils::ToNative (label));
154+
155+ if (subMenu.get ())
156+ {
157+ return gcnew CefMenuModelWrapper (subMenu);
158+ }
159+
160+ return nullptr ;
161+ }
162+
163+ virtual bool RemoveAt (int index)
164+ {
165+ ThrowIfDisposed ();
166+
167+ return _menu->RemoveAt (index);
168+ }
169+
170+ virtual int GetIndexOf (CefMenuCommand commandId)
171+ {
172+ ThrowIfDisposed ();
173+
174+ return _menu->GetIndexOf ((int )commandId);
175+ }
176+
177+ virtual bool SetCommandIdAt (int index, CefMenuCommand commandId)
178+ {
179+ ThrowIfDisposed ();
180+
181+ return _menu->SetCommandIdAt (index, (int )commandId);
182+ }
183+
184+ virtual String^ GetLabel(CefMenuCommand commandId)
185+ {
186+ ThrowIfDisposed ();
187+
188+ return StringUtils::ToClr (_menu->GetLabel ((int )commandId));
189+ }
190+
191+ virtual bool SetLabel (CefMenuCommand commandId, String^ label)
192+ {
193+ ThrowIfDisposed ();
194+
195+ return _menu->SetLabel ((int )commandId, StringUtils::ToNative (label));
196+ }
197+
198+ virtual bool SetLabelAt (int index, String^ label)
199+ {
200+ ThrowIfDisposed ();
201+
202+ return _menu->SetLabelAt (index, StringUtils::ToNative (label));
203+ }
204+
205+ virtual MenuItemType GetType (CefMenuCommand commandId)
206+ {
207+ ThrowIfDisposed ();
208+
209+ return (CefSharp::MenuItemType)_menu->GetType ((int )commandId);
210+ }
211+
212+ virtual MenuItemType GetTypeAt (int index)
213+ {
214+ ThrowIfDisposed ();
215+
216+ return (MenuItemType)_menu->GetTypeAt (index);
217+ }
218+
219+ virtual int GetGroupId (CefMenuCommand commandId)
220+ {
221+ ThrowIfDisposed ();
222+
223+ return _menu->GetGroupId ((int )commandId);
224+ }
225+
226+ virtual int GetGroupIdAt (int index)
227+ {
228+ ThrowIfDisposed ();
229+
230+ return _menu->GetGroupIdAt (index);
231+ }
232+
233+ virtual bool SetGroupId (CefMenuCommand commandId, int groupId)
234+ {
235+ ThrowIfDisposed ();
236+
237+ return _menu->SetGroupId ((int )commandId, groupId);
238+ }
239+
240+ virtual bool SetGroupIdAt (int index, int groupId)
241+ {
242+ ThrowIfDisposed ();
243+
244+ return _menu->SetGroupIdAt (index, groupId);
245+ }
246+
247+ virtual IMenuModel^ GetSubMenu(CefMenuCommand commandId)
248+ {
249+ ThrowIfDisposed ();
250+
251+ auto subMenu =_menu->GetSubMenu ((int )commandId);
252+
253+ if (subMenu.get ())
254+ {
255+ return gcnew CefMenuModelWrapper (subMenu);
256+ }
257+
258+ return nullptr ;
259+ }
260+
261+ virtual IMenuModel^ GetSubMenuAt(int index)
262+ {
263+ ThrowIfDisposed ();
264+
265+ auto subMenu = _menu->GetSubMenuAt (index);
266+
267+ if (subMenu.get ())
268+ {
269+ return gcnew CefMenuModelWrapper (subMenu);
270+ }
271+
272+ return nullptr ;
273+ }
274+
275+ virtual bool IsVisible (CefMenuCommand commandId)
276+ {
277+ ThrowIfDisposed ();
278+
279+ return _menu->IsVisible ((int )commandId);
280+ }
281+
282+ virtual bool IsVisibleAt (int index)
283+ {
284+ ThrowIfDisposed ();
285+
286+ return _menu->IsVisibleAt (index);
287+ }
288+
289+ virtual bool SetVisible (CefMenuCommand commandId, bool visible)
290+ {
291+ ThrowIfDisposed ();
292+
293+ return _menu->SetVisible ((int )commandId, visible);
294+ }
295+
296+ virtual bool SetVisibleAt (int index, bool visible)
297+ {
298+ ThrowIfDisposed ();
299+
300+ return _menu->SetVisibleAt (index, visible);
301+ }
302+
303+ virtual bool IsEnabled (CefMenuCommand commandId)
304+ {
305+ ThrowIfDisposed ();
306+
307+ return _menu->IsEnabled ((int )commandId);
308+ }
309+
310+ virtual bool IsEnabledAt (int index)
311+ {
312+ ThrowIfDisposed ();
313+
314+ return _menu->IsEnabledAt (index);
315+ }
316+
317+ virtual bool SetEnabled (CefMenuCommand commandId, bool enabled)
318+ {
319+ ThrowIfDisposed ();
320+
321+ return _menu->SetEnabled ((int )commandId, enabled);
322+ }
323+
324+ virtual bool SetEnabledAt (int index, bool enabled)
325+ {
326+ ThrowIfDisposed ();
327+
328+ return _menu->SetEnabledAt (index, enabled);
329+ }
330+
331+ virtual bool IsChecked (CefMenuCommand commandId)
332+ {
333+ ThrowIfDisposed ();
334+
335+ return _menu->IsChecked ((int )commandId);
336+ }
337+
338+ virtual bool IsCheckedAt (int index)
339+ {
340+ ThrowIfDisposed ();
341+
342+ return _menu->IsCheckedAt (index);
343+ }
344+
345+ virtual bool SetChecked (CefMenuCommand commandId, bool isChecked)
346+ {
347+ ThrowIfDisposed ();
348+
349+ return _menu->SetChecked ((int )commandId, isChecked);
350+ }
351+
352+ virtual bool SetCheckedAt (int index, bool isChecked)
353+ {
354+ ThrowIfDisposed ();
355+
356+ return _menu->SetCheckedAt (index, isChecked);
357+ }
358+
359+ virtual bool HasAccelerator (CefMenuCommand commandId)
360+ {
361+ ThrowIfDisposed ();
362+
363+ return _menu->HasAccelerator ((int )commandId);
364+ }
365+
366+ virtual bool HasAcceleratorAt (int index)
367+ {
368+ ThrowIfDisposed ();
369+
370+ return _menu->HasAcceleratorAt (index);
371+ }
372+
373+ virtual bool SetAccelerator (CefMenuCommand commandId, int keyCode, bool shiftPressed, bool ctrlPressed, bool altPressed)
374+ {
375+ ThrowIfDisposed ();
376+
377+ return _menu->SetAccelerator ((int )commandId, keyCode, shiftPressed, ctrlPressed, altPressed);
378+ }
379+
380+ virtual bool SetAcceleratorAt (int index, int keyCode, bool shiftPressed, bool ctrlPressed, bool altPressed)
381+ {
382+ ThrowIfDisposed ();
383+
384+ return _menu->SetAcceleratorAt (index, keyCode, shiftPressed, ctrlPressed, altPressed);
385+ }
386+
387+ virtual bool RemoveAccelerator (CefMenuCommand commandId)
388+ {
389+ ThrowIfDisposed ();
390+
391+ return _menu->RemoveAccelerator ((int )commandId);
392+ }
393+
394+ virtual bool RemoveAcceleratorAt (int index)
395+ {
396+ ThrowIfDisposed ();
397+
398+ return _menu->RemoveAcceleratorAt (index);
399+ }
400+
401+ virtual bool GetAccelerator (CefMenuCommand commandId, int % keyCode, bool % shiftPressed, bool % ctrlPressed, bool % altPressed)
402+ {
403+ ThrowIfDisposed ();
404+
405+ int key;
406+ bool shift;
407+ bool ctrl;
408+ bool alt;
409+
410+ auto result = _menu->GetAccelerator ((int )commandId, key, shift, ctrl, alt);
411+
412+ keyCode = key;
413+ shiftPressed = shift;
414+ ctrlPressed = ctrl;
415+ altPressed = alt;
416+
417+ return result;
418+ }
419+
420+ virtual bool GetAcceleratorAt (int index, int % keyCode, bool % shiftPressed, bool % ctrlPressed, bool % altPressed)
421+ {
422+ ThrowIfDisposed ();
423+
424+ int key;
425+ bool shift;
426+ bool ctrl;
427+ bool alt;
428+
429+ auto result = _menu->GetAcceleratorAt (index, key, shift, ctrl, alt);
430+
431+ keyCode = key;
432+ shiftPressed = shift;
433+ ctrlPressed = ctrl;
434+ altPressed = alt;
435+
436+ return result;
437+ }
92438 };
93439 }
94440}
0 commit comments