mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-24 08:02:15 +02:00
ca8bc9dff4
Added the PDS file to extract the HTML Help files using PasDoc Added more XML documentation Fixed some XML errors. Removed the license copy from the pas units. Updated the LICENSE.md file
81 lines
2.1 KiB
ObjectPascal
81 lines
2.1 KiB
ObjectPascal
unit uCEFMenuButton;
|
|
|
|
{$IFDEF FPC}
|
|
{$MODE OBJFPC}{$H+}
|
|
{$ENDIF}
|
|
|
|
{$I cef.inc}
|
|
|
|
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
|
|
{$MINENUMSIZE 4}
|
|
|
|
interface
|
|
|
|
uses
|
|
{$IFDEF DELPHI16_UP}
|
|
System.Classes, System.SysUtils,
|
|
{$ELSE}
|
|
Classes, SysUtils,
|
|
{$ENDIF}
|
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFLabelButton;
|
|
|
|
type
|
|
TCefMenuButtonRef = class(TCefLabelButtonRef, ICefMenuButton)
|
|
protected
|
|
procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: TCefPoint; anchor_position: TCefMenuAnchorPosition);
|
|
procedure TriggerMenu;
|
|
|
|
public
|
|
class function UnWrap(data: Pointer): ICefMenuButton;
|
|
class function CreateMenuButton(const delegate: ICefMenuButtonDelegate; const text: ustring): ICefMenuButton;
|
|
end;
|
|
|
|
implementation
|
|
|
|
uses
|
|
uCEFLibFunctions, uCEFMiscFunctions;
|
|
|
|
procedure TCefMenuButtonRef.ShowMenu(const menu_model : ICefMenuModel;
|
|
const screen_point : TCefPoint;
|
|
anchor_position : TCefMenuAnchorPosition);
|
|
begin
|
|
PCefMenuButton(FData)^.show_menu(PCefMenuButton(FData),
|
|
CefGetData(menu_model),
|
|
@screen_point,
|
|
anchor_position);
|
|
end;
|
|
|
|
procedure TCefMenuButtonRef.TriggerMenu;
|
|
begin
|
|
PCefMenuButton(FData)^.trigger_menu(PCefMenuButton(FData));
|
|
end;
|
|
|
|
class function TCefMenuButtonRef.UnWrap(data: Pointer): ICefMenuButton;
|
|
begin
|
|
if (data <> nil) then
|
|
Result := Create(data) as ICefMenuButton
|
|
else
|
|
Result := nil;
|
|
end;
|
|
|
|
class function TCefMenuButtonRef.CreateMenuButton(const delegate : ICefMenuButtonDelegate;
|
|
const text : ustring): ICefMenuButton;
|
|
var
|
|
TempText : TCefString;
|
|
TempButton : PCefMenuButton;
|
|
begin
|
|
Result := nil;
|
|
|
|
if (delegate <> nil) then
|
|
begin
|
|
TempText := CefString(text);
|
|
TempButton := cef_menu_button_create(CefGetData(delegate), @TempText);
|
|
|
|
if (TempButton <> nil) then
|
|
Result := Create(TempButton) as ICefMenuButton;
|
|
end;
|
|
end;
|
|
|
|
end.
|
|
|