comparison dwt/widgets/Display.d @ 48:8e9ea24111fd

Menu, MenuItem
author Frank Benoit <benoit@tionex.de>
date Fri, 11 Jan 2008 10:04:18 +0100
parents f646579f309c
children 8f049b136add
comparison
equal deleted inserted replaced
47:f646579f309c 48:8e9ea24111fd
2642 wchar [] result = Converter.mbcsToWcs (null, buffer); 2642 wchar [] result = Converter.mbcsToWcs (null, buffer);
2643 if (result.length is 0) return 0; 2643 if (result.length is 0) return 0;
2644 return result [0]; 2644 return result [0];
2645 } 2645 }
2646 2646
2647 int /*long*/ menuPositionProcMeth (GtkWidget * menu, int /*long*/ x, int /*long*/ y, int /*long*/ push_in, int /*long*/ user_data) { 2647
2648 Widget widget = getWidget (menu); 2648 package void doMenuPositionProc( GtkMenu* window, bool hasLocation ){
2649 /*
2650 * Bug in GTK. The timestamp passed into gtk_menu_popup is used
2651 * to perform an X pointer grab. It cannot be zero, else the grab
2652 * will fail. The fix is to ensure that the timestamp of the last
2653 * event processed is used.
2654 */
2655 OS.gtk_menu_popup (window, null, null,
2656 hasLocation ? &menuPositionProcFunc : null,
2657 cast(void*)this, 0, getLastEventTime() );
2658 }
2659
2660 private static extern(C) void menuPositionProcFunc (GtkMenu* menu, int* x, int* y, int* push_in, void* user_data) {
2661 auto display = cast(Display)user_data;
2662 display.menuPositionProc( menu, x, y, push_in, null );
2663 }
2664
2665 void menuPositionProc (GtkMenu* menu, int* x, int* y, int* push_in, void* user_data) {
2666 Widget widget = getWidget (cast(GtkWidget*)menu);
2649 if (widget is null) return 0; 2667 if (widget is null) return 0;
2650 return widget.menuPositionProc (menu, x, y, push_in, user_data); 2668 widget.menuPositionProc (menu, x, y, push_in, user_data);
2651 } 2669 }
2652 2670
2653 /** 2671 /**
2654 * Maps a point from one coordinate system to another. 2672 * Maps a point from one coordinate system to another.
2655 * When the control is null, coordinates are mapped to 2673 * When the control is null, coordinates are mapped to