2009-08-30 Christian Hoff <christian_hoff@gmx.net>

* gtk/StatusIcon.custom: Use managed code to pass the address of
	gtk_status_icon_position_menu to gtk_menu_popup.

svn path=/trunk/gtk-sharp/; revision=140939
This commit is contained in:
Christian Hoff 2009-08-30 19:14:00 +00:00
parent 50355ad102
commit 7552545b46
4 changed files with 17 additions and 41 deletions

View file

@ -1,3 +1,8 @@
2009-08-30 Christian Hoff <christian_hoff@gmx.net>
* gtk/StatusIcon.custom: Use managed code to pass the address of
gtk_status_icon_position_menu to gtk_menu_popup.
2009-08-19 Christian Hoff <christian_hoff@gmx.net>
* generator/*.cs: Add the "partial" keyword to each generated class,

View file

@ -26,12 +26,21 @@
return GetGeometry (out junk, out area, out orientation);
}
[DllImport("gtksharpglue-2")]
static extern void gtksharp_gtk_status_icon_present_menu (IntPtr raw, IntPtr menu, uint button, uint activate_time);
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void MenuPositionFuncNative (IntPtr menu, out int x, out int y, out bool push_in, IntPtr user_data);
static MenuPositionFuncNative StatusIconPositionMenuFunc = null;
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_menu_popup (IntPtr menu, IntPtr parent_menu_shell, IntPtr parent_menu_item, MenuPositionFuncNative func, IntPtr data, uint button, uint activate_time);
public void PresentMenu (Menu menu, uint button, uint activate_time)
{
gtksharp_gtk_status_icon_present_menu (Handle, menu == null ? IntPtr.Zero : menu.Handle, button, activate_time);
if (StatusIconPositionMenuFunc == null)
// gtk_status_icon_position_menu already defined by autogenerated code
StatusIconPositionMenuFunc = new MenuPositionFuncNative (gtk_status_icon_position_menu);
gtk_menu_popup (menu == null ? IntPtr.Zero : menu.Handle, IntPtr.Zero, IntPtr.Zero, StatusIconPositionMenuFunc, Handle, button, activate_time);
}
[Obsolete ("use the File property instead")]

View file

@ -4,7 +4,6 @@ libgtksharpglue_2_la_SOURCES = \
cellrenderer.c \
container.c \
object.c \
statusicon.c \
style.c \
vmglueheaders.h \
widget.c

View file

@ -1,37 +0,0 @@
/*
* statusicon.c - Glue methods for GtkStatusIcon
*
* Authors:
* Mike Kestner <mkestner@novell.com)
*
* Copyright (c) 2007 Novell, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the Lesser GNU General
* Public License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gtk/gtkmenu.h>
#include <gtk/gtkstatusicon.h>
/* Forward declarations */
void gtksharp_gtk_status_icon_present_menu (GtkStatusIcon *icon, GtkMenu* menu, guint button, guint32 activate_time);
/* */
void
gtksharp_gtk_status_icon_present_menu (GtkStatusIcon *icon, GtkMenu* menu, guint button, guint32 activate_time)
{
gtk_menu_popup (menu, NULL, NULL, gtk_status_icon_position_menu, icon, button, activate_time);
}