You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-06-12 22:07:39 +02:00
Added Views Framework support #244
Added ToolBoxBrowser2 demo Added TCEFBrowserViewComponent. Added TCEFLabelButtonComponent. Added TCEFMenuButtonComponent. Added TCEFPanelComponent. Added TCEFTextfieldComponent. Added TCEFScrollViewComponent. Added TCEFWindowComponent.
This commit is contained in:
@ -66,10 +66,47 @@ type
|
||||
class function UnWrap(data: Pointer): ICefButtonDelegate;
|
||||
end;
|
||||
|
||||
TCefButtonDelegateOwn = class(TCefViewDelegateOwn, ICefButtonDelegate)
|
||||
protected
|
||||
procedure OnButtonPressed(const button: ICefButton); virtual;
|
||||
procedure OnButtonStateChanged(const button: ICefButton); virtual;
|
||||
|
||||
procedure InitializeCEFMethods; override;
|
||||
public
|
||||
constructor Create; override;
|
||||
end;
|
||||
|
||||
TCustomButtonDelegate = class(TCefButtonDelegateOwn)
|
||||
protected
|
||||
FEvents : Pointer;
|
||||
|
||||
// ICefViewDelegate
|
||||
procedure OnGetPreferredSize(const view: ICefView; var aResult : TCefSize); override;
|
||||
procedure OnGetMinimumSize(const view: ICefView; var aResult : TCefSize); override;
|
||||
procedure OnGetMaximumSize(const view: ICefView; var aResult : TCefSize); override;
|
||||
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); override;
|
||||
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); override;
|
||||
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); override;
|
||||
procedure OnFocus(const view: ICefView); override;
|
||||
procedure OnBlur(const view: ICefView); override;
|
||||
|
||||
// ICefButtonDelegate
|
||||
procedure OnButtonPressed(const button: ICefButton); override;
|
||||
procedure OnButtonStateChanged(const button: ICefButton); override;
|
||||
|
||||
public
|
||||
constructor Create(const events: ICefButtonDelegateEvents); reintroduce;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
uCEFLibFunctions, uCEFMiscFunctions;
|
||||
uCEFLibFunctions, uCEFMiscFunctions, uCEFButton;
|
||||
|
||||
|
||||
// **************************************************************
|
||||
// ****************** TCefButtonDelegateRef *********************
|
||||
// **************************************************************
|
||||
|
||||
procedure TCefButtonDelegateRef.OnButtonPressed(const button: ICefButton);
|
||||
begin
|
||||
@ -91,5 +128,179 @@ begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
// **************************************************************
|
||||
// ****************** TCefButtonDelegateOwn *********************
|
||||
// **************************************************************
|
||||
|
||||
procedure cef_button_delegate_on_button_pressed(self: PCefButtonDelegate; button: PCefButton); stdcall;
|
||||
var
|
||||
TempObject : TObject;
|
||||
begin
|
||||
TempObject := CefGetObject(self);
|
||||
|
||||
if (TempObject <> nil) and (TempObject is TCefButtonDelegateOwn) then
|
||||
TCefButtonDelegateOwn(TempObject).OnButtonPressed(TCefButtonRef.UnWrap(button));
|
||||
end;
|
||||
|
||||
procedure cef_button_delegate_on_button_state_changed(self: PCefButtonDelegate; button: PCefButton); stdcall;
|
||||
var
|
||||
TempObject : TObject;
|
||||
begin
|
||||
TempObject := CefGetObject(self);
|
||||
|
||||
if (TempObject <> nil) and (TempObject is TCefButtonDelegateOwn) then
|
||||
TCefButtonDelegateOwn(TempObject).OnButtonStateChanged(TCefButtonRef.UnWrap(button));
|
||||
end;
|
||||
|
||||
|
||||
constructor TCefButtonDelegateOwn.Create;
|
||||
begin
|
||||
inherited CreateData(SizeOf(TCefButtonDelegate));
|
||||
|
||||
InitializeCEFMethods;
|
||||
end;
|
||||
|
||||
procedure TCefButtonDelegateOwn.InitializeCEFMethods;
|
||||
begin
|
||||
inherited InitializeCEFMethods;
|
||||
|
||||
with PCefButtonDelegate(FData)^ do
|
||||
begin
|
||||
on_button_pressed := {$IFDEF FPC}@{$ENDIF}cef_button_delegate_on_button_pressed;
|
||||
on_button_state_changed := {$IFDEF FPC}@{$ENDIF}cef_button_delegate_on_button_state_changed;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCefButtonDelegateOwn.OnButtonPressed(const button: ICefButton);
|
||||
begin
|
||||
//
|
||||
end;
|
||||
|
||||
procedure TCefButtonDelegateOwn.OnButtonStateChanged(const button: ICefButton);
|
||||
begin
|
||||
//
|
||||
end;
|
||||
|
||||
// **************************************************************
|
||||
// ****************** TCustomButtonDelegate *********************
|
||||
// **************************************************************
|
||||
|
||||
constructor TCustomButtonDelegate.Create(const events: ICefButtonDelegateEvents);
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
FEvents := Pointer(events);
|
||||
end;
|
||||
|
||||
procedure TCustomButtonDelegate.OnGetPreferredSize(const view: ICefView; var aResult : TCefSize);
|
||||
begin
|
||||
try
|
||||
if (FEvents <> nil) then
|
||||
ICefButtonDelegateEvents(FEvents).doOnGetPreferredSize(view, aResult);
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCustomButtonDelegate.OnGetPreferredSize', e) then raise;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomButtonDelegate.OnGetMinimumSize(const view: ICefView; var aResult : TCefSize);
|
||||
begin
|
||||
try
|
||||
if (FEvents <> nil) then
|
||||
ICefButtonDelegateEvents(FEvents).doOnGetMinimumSize(view, aResult);
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCustomButtonDelegate.OnGetMinimumSize', e) then raise;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomButtonDelegate.OnGetMaximumSize(const view: ICefView; var aResult : TCefSize);
|
||||
begin
|
||||
try
|
||||
if (FEvents <> nil) then
|
||||
ICefButtonDelegateEvents(FEvents).doOnGetMaximumSize(view, aResult);
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCustomButtonDelegate.OnGetMaximumSize', e) then raise;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomButtonDelegate.OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
|
||||
begin
|
||||
try
|
||||
if (FEvents <> nil) then
|
||||
ICefButtonDelegateEvents(FEvents).doOnGetHeightForWidth(view, width, aResult);
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCustomButtonDelegate.OnGetHeightForWidth', e) then raise;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomButtonDelegate.OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView);
|
||||
begin
|
||||
try
|
||||
if (FEvents <> nil) then
|
||||
ICefButtonDelegateEvents(FEvents).doOnParentViewChanged(view, added, parent);
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCustomButtonDelegate.OnParentViewChanged', e) then raise;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomButtonDelegate.OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView);
|
||||
begin
|
||||
try
|
||||
if (FEvents <> nil) then
|
||||
ICefButtonDelegateEvents(FEvents).doOnChildViewChanged(view, added, child);
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCustomButtonDelegate.OnChildViewChanged', e) then raise;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomButtonDelegate.OnFocus(const view: ICefView);
|
||||
begin
|
||||
try
|
||||
if (FEvents <> nil) then
|
||||
ICefButtonDelegateEvents(FEvents).doOnFocus(view);
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCustomButtonDelegate.OnFocus', e) then raise;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomButtonDelegate.OnBlur(const view: ICefView);
|
||||
begin
|
||||
try
|
||||
if (FEvents <> nil) then
|
||||
ICefButtonDelegateEvents(FEvents).doOnBlur(view);
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCustomButtonDelegate.OnBlur', e) then raise;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomButtonDelegate.OnButtonPressed(const button: ICefButton);
|
||||
begin
|
||||
try
|
||||
if (FEvents <> nil) then
|
||||
ICefButtonDelegateEvents(FEvents).doOnButtonPressed(button);
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCustomButtonDelegate.OnButtonPressed', e) then raise;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomButtonDelegate.OnButtonStateChanged(const button: ICefButton);
|
||||
begin
|
||||
try
|
||||
if (FEvents <> nil) then
|
||||
ICefButtonDelegateEvents(FEvents).doOnButtonStateChanged(button);
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCustomButtonDelegate.OnButtonStateChanged', e) then raise;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
Reference in New Issue
Block a user