mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 15:30:52 +02:00
gtk3: implemented LM_CONTEXTMENU and popup menu showing. patch by Cedric, modified by me. issue #27231
git-svn-id: trunk@47298 -
This commit is contained in:
parent
4cb443b660
commit
f75635d419
@ -2068,6 +2068,7 @@ function TGtk3Widget.GtkEventMouse(Sender: PGtkWidget; Event: PGdkEvent): Boolea
|
|||||||
cdecl;
|
cdecl;
|
||||||
var
|
var
|
||||||
Msg: TLMMouse;
|
Msg: TLMMouse;
|
||||||
|
MsgPopup : TLMMouse;
|
||||||
MousePos: TPoint;
|
MousePos: TPoint;
|
||||||
MButton: guint;
|
MButton: guint;
|
||||||
begin
|
begin
|
||||||
@ -2127,6 +2128,17 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
NotifyApplicationUserInput(LCLObject, Msg.Msg);
|
NotifyApplicationUserInput(LCLObject, Msg.Msg);
|
||||||
Event^.button.send_event := NO_PROPAGATION_TO_PARENT;
|
Event^.button.send_event := NO_PROPAGATION_TO_PARENT;
|
||||||
|
|
||||||
|
Result := false;
|
||||||
|
if Msg.Msg = LM_RBUTTONDOWN then
|
||||||
|
begin
|
||||||
|
MsgPopup := Msg;
|
||||||
|
MsgPopup.Msg := LM_CONTEXTMENU;
|
||||||
|
MsgPopup.XPos := SmallInt(Round(Event^.button.x_root));
|
||||||
|
MsgPopup.YPos := SmallInt(Round(Event^.button.y_root));
|
||||||
|
Result := DeliverMessage(MsgPopup, True) <> 0;
|
||||||
|
end;
|
||||||
|
if not Result then
|
||||||
Result := DeliverMessage(Msg, True) <> 0;
|
Result := DeliverMessage(Msg, True) <> 0;
|
||||||
if Event^.type_ = GDK_BUTTON_RELEASE then
|
if Event^.type_ = GDK_BUTTON_RELEASE then
|
||||||
begin
|
begin
|
||||||
|
@ -274,7 +274,7 @@ begin
|
|||||||
' IsMenuItem ',dbgs(Gtk3IsWidget(MenuItem.Widget)));
|
' IsMenuItem ',dbgs(Gtk3IsWidget(MenuItem.Widget)));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
if (AMenuItem.GetParentMenu is TPopupMenu) then
|
if not(Assigned(AMenuItem.Parent)) and (AMenuItem.GetParentMenu is TPopupMenu) then
|
||||||
ParentMenuWidget := TGtk3Menu(AMenuItem.GetParentMenu.Handle).Widget
|
ParentMenuWidget := TGtk3Menu(AMenuItem.GetParentMenu.Handle).Widget
|
||||||
else
|
else
|
||||||
ParentMenuWidget := MenuItem.Widget^.get_parent;
|
ParentMenuWidget := MenuItem.Widget^.get_parent;
|
||||||
@ -359,6 +359,9 @@ begin
|
|||||||
else
|
else
|
||||||
Result := HMENU(TGtk3MenuItem.Create(AMenuItem));
|
Result := HMENU(TGtk3MenuItem.Create(AMenuItem));
|
||||||
|
|
||||||
|
if AMenuItem.Visible then
|
||||||
|
gtk_widget_show(TGtk3MenuItem(Result).Widget);
|
||||||
|
|
||||||
// create the menuitem widget (normal, check or radio)
|
// create the menuitem widget (normal, check or radio)
|
||||||
(*
|
(*
|
||||||
if AMenuItem.Caption = cLineCaption then // create separator
|
if AMenuItem.Caption = cLineCaption then // create separator
|
||||||
|
Loading…
Reference in New Issue
Block a user