gtk3: implemented TPopupMenu.OnClose.

git-svn-id: trunk@47301 -
This commit is contained in:
zeljko 2015-01-04 19:48:38 +00:00
parent 5082db081f
commit a257e58d2a

View File

@ -360,7 +360,7 @@ begin
Result := HMENU(TGtk3MenuItem.Create(AMenuItem)); Result := HMENU(TGtk3MenuItem.Create(AMenuItem));
if AMenuItem.Visible then if AMenuItem.Visible then
gtk_widget_show(TGtk3MenuItem(Result).Widget); TGtk3MenuItem(Result).show;
// create the menuitem widget (normal, check or radio) // create the menuitem widget (normal, check or radio)
(* (*
@ -692,19 +692,19 @@ end;
function gtkWSPopupDelayedClose(Data: Pointer): gboolean; cdecl; function gtkWSPopupDelayedClose(Data: Pointer): gboolean; cdecl;
var var
PopupMenu: TPopupMenu absolute data; PopupMenu: TMenu absolute Data;
begin begin
Result := False; Result := False;
if PopupMenu is TPopupMenu then if Assigned(PopupMenu) and (PopupMenu is TPopupMenu) then
PopupMenu.Close; TPopupMenu(PopupMenu).Close;
end; end;
procedure gtkWSPopupMenuDeactivate(widget: PGtkWidget; data: gPointer); cdecl; procedure gtkWSPopupMenuDeactivate(widget: PGtkWidget; data: gPointer); cdecl;
begin begin
if widget = MenuWidget then if widget = MenuWidget then
MenuWidget := nil; MenuWidget := nil;
// if data <> nil then if data <> nil then
// g_idle_add(@gtkWSPopupDelayedClose, TGtk3Widget(data)^.LCLObject); g_idle_add(@gtkWSPopupDelayedClose, TGtk3Menu(data).MenuObject);
end; end;
class function TGtk3WSPopupMenu.CreateHandle(const AMenu: TMenu): HMENU; class function TGtk3WSPopupMenu.CreateHandle(const AMenu: TMenu): HMENU;
@ -728,6 +728,9 @@ begin
DebugLn('****** TGtk3WSPopupMenu.CreateHandle ******'); DebugLn('****** TGtk3WSPopupMenu.CreateHandle ******');
{$ENDIF} {$ENDIF}
Result := HMENU(TGtk3Menu.Create(AMenu, nil)); Result := HMENU(TGtk3Menu.Create(AMenu, nil));
g_signal_connect_data(TGtk3Menu(Result).Widget,'deactivate',
TGCallback(@gtkWSPopupMenuDeactivate), TGtk3Menu(Result), nil, 0);
end; end;
class procedure TGtk3WSPopupMenu.Popup(const APopupMenu: TPopupMenu; const X, class procedure TGtk3WSPopupMenu.Popup(const APopupMenu: TPopupMenu; const X,