Mercurial > projects > dwt-linux
changeset 26:09f5459a5014
Display in work
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 08 Jan 2008 08:07:04 +0100 |
parents | fc2b263b8a3f |
children | ffa3c27c4328 |
files | dwt/dwthelper/System.d dwt/dwthelper/utils.d dwt/events/SelectionEvent.d dwt/events/TypedEvent.d dwt/internal/gtk/OS.d dwt/internal/gtk/c/gobjecttypes.d dwt/internal/gtk/c/gtktypes.d dwt/widgets/Control.d dwt/widgets/Display.d dwt/widgets/Event.d dwt/widgets/EventTable.d dwt/widgets/Shell.d dwt/widgets/Synchronizer.d dwt/widgets/Widget.d todo.txt |
diffstat | 15 files changed, 3344 insertions(+), 3125 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/dwthelper/System.d Tue Jan 08 01:23:25 2008 +0100 +++ b/dwt/dwthelper/System.d Tue Jan 08 08:07:04 2008 +0100 @@ -114,5 +114,6 @@ alias SimpleType!(wchar[]).arraycopy arraycopy; alias SimpleType!(Object[]).arraycopy arraycopy; alias SimpleType!(void*[]).arraycopy arraycopy; + alias SimpleType!(void*[]).arraycopy arraycopy; }
--- a/dwt/dwthelper/utils.d Tue Jan 08 01:23:25 2008 +0100 +++ b/dwt/dwthelper/utils.d Tue Jan 08 08:07:04 2008 +0100 @@ -14,3 +14,16 @@ exit(1); } +abstract class ArrayWrapper{ +} + +class ArrayWrapperT(T) : ArrayWrapper { + T[] array; +} + +alias ArrayWrapperT!(int) ArrayWrapperInt; +alias ArrayWrapperT!(Object) ArrayWrapperObject; + + + +
--- a/dwt/events/SelectionEvent.d Tue Jan 08 01:23:25 2008 +0100 +++ b/dwt/events/SelectionEvent.d Tue Jan 08 08:07:04 2008 +0100 @@ -12,6 +12,7 @@ import dwt.widgets.Event; +import dwt.widgets.Widget; import dwt.events.TypedEvent; import tango.text.convert.Format;
--- a/dwt/events/TypedEvent.d Tue Jan 08 01:23:25 2008 +0100 +++ b/dwt/events/TypedEvent.d Tue Jan 08 08:07:04 2008 +0100 @@ -12,6 +12,8 @@ import dwt.widgets.Event; +import dwt.widgets.Display; +import dwt.widgets.Widget; import dwt.internal.SWTEventObject; import tango.text.convert.Format;
--- a/dwt/internal/gtk/OS.d Tue Jan 08 01:23:25 2008 +0100 +++ b/dwt/internal/gtk/OS.d Tue Jan 08 08:07:04 2008 +0100 @@ -28,6 +28,17 @@ dwt.internal.gtk.c.gdkpixbuf; // temporary added, because was not yet available +struct XAnyEvent { + int type; + uint serial; + int send_event; + void * display; + uint window; +} +union XEvent{ + int type; + XAnyEvent xany; +} struct XRenderPictureAttributes{ int repeat; @@ -65,26 +76,80 @@ struct XTransform { int [3][3] matrix; } - struct XRectangle { - short x; - short y; - ushort width; - ushort height; - } -private extern (C) uint XRenderCreatePicture(void *, uint, XRenderPictFormat *, uint, XRenderPictureAttributes *); -private extern (C) XRenderPictFormat * XRenderFindStandardFormat (dwt.internal.gtk.c.cairotypes.Display *dpy, int format); -private extern (C) XRenderPictFormat * XRenderFindVisualFormat (dwt.internal.gtk.c.cairotypes.Display *dpy, void *visual); -private extern (C) void XRenderSetPictureTransform (void *dpy,uint picture, XTransform *transform); -private extern (C) void XRenderSetPictureClipRectangles(void *, uint, int, int, XRectangle *, int); -private extern (C) void XRenderFreePicture(void *, uint); -private extern (C) void XRenderComposite(void *, int, uint, uint, uint, int, int, int, int, int, int, uint, uint); +struct XRectangle { + short x; + short y; + ushort width; + ushort height; +} +struct XExposeEvent { + int type; + uint serial; + int send_event; + void * display; + uint window; + int x; + int y; + int width; + int height; + int count; +} +struct XVisibilityEvent { + int type; + uint serial; + int send_event; + void * display; + uint window; + int state; +} -private extern (C) cairo_font_options_t * pango_cairo_context_get_font_options(void *); -private extern (C) void pango_cairo_context_set_font_options(void *, cairo_font_options_t *); +struct XButtonEvent { + int type; + uint serial; + int send_event; + void * display; + uint window; + uint root; + uint subwindow; + uint time; + int x; + int y; + int x_root; + int y_root; + uint state; + uint button; + int same_screen; +} + +private extern (C){ + GdkWindow * gdk_window_lookup(uint); + uint XRenderCreatePicture(void *, uint, XRenderPictFormat *, uint, XRenderPictureAttributes *); + XRenderPictFormat * XRenderFindStandardFormat (dwt.internal.gtk.c.cairotypes.Display *dpy, int format); + XRenderPictFormat * XRenderFindVisualFormat (dwt.internal.gtk.c.cairotypes.Display *dpy, void *visual); + void XRenderSetPictureTransform (void *dpy,uint picture, XTransform *transform); + void XRenderSetPictureClipRectangles(void *, uint, int, int, XRectangle *, int); + void XRenderFreePicture(void *, uint); + void XRenderComposite(void *, int, uint, uint, uint, int, int, int, int, int, int, uint, uint); + + cairo_font_options_t * pango_cairo_context_get_font_options(void *); + void pango_cairo_context_set_font_options(void *, cairo_font_options_t *); + + alias int function(void *, XEvent *, void *) _BCD_func__1812; + int XCheckIfEvent(void *, XEvent *, _BCD_func__1812, void *); + + extern uint gtk_major_version; + extern uint gtk_minor_version; + extern uint gtk_micro_version; +} + + //void function(GtkWidget* widget, gchar* firstPropertyName, ... )gtk_widget_style_get; private void gtk_widget_style_get1( GtkWidget* widget, gchar* firstPropertyName, int* res ){ gtk_widget_style_get( widget, firstPropertyName, res, null ); } +private void g_object_get1( void* obj, gchar* firstPropertyName, int* res ){ + g_object_get( obj, firstPropertyName, res, null ); +} private extern(C) PangoLayout *pango_cairo_create_layout (cairo_t *cr); @@ -122,25 +187,24 @@ //struct Visual{} //private extern(C) Visual* gdk_x11_visual_get_xvisual(GdkVisual* visual); -GdkDisplay* GDK_DISPLAY(){ - return gtk_display; -} +private extern (C) GdkDisplay* GDK_DISPLAY(); -XID GDK_PIXMAP_XID(GdkDrawable* win){ - return gdk_x11_drawable_get_xid(win); -} +private extern (C) XID GDK_PIXMAP_XID(GdkDrawable* win); +struct XErrorEvent {} -struct XErrorEvent {} +private extern (C) bool GDK_WINDOWING_X11(); +private extern (C) int XFlush(void *); public alias extern(C) int function(dwt.internal.gtk.c.cairotypes.Display*) XIOErrorHandler; public alias extern(C) int function(dwt.internal.gtk.c.cairotypes.Display*, XErrorEvent *) XErrorHandler; -extern (C) XIOErrorHandler XSetIOErrorHandler(XIOErrorHandler); -extern (C) XErrorHandler XSetErrorHandler(XErrorHandler); - -int PANGO_PIXELS( int v ){ - return (v+512) >> 10; -} - +private extern (C) XIOErrorHandler XSetIOErrorHandler(XIOErrorHandler); +private extern (C) XErrorHandler XSetErrorHandler(XErrorHandler); +private extern (C) int PANGO_PIXELS( int v ); +private GType GTK_TYPE_FIXED(); +private GType GTK_TYPE_CELL_RENDERER_TEXT(); +private GType GTK_TYPE_CELL_RENDERER_PIXBUF(); +private GType GTK_TYPE_CELL_RENDERER_TOGGLE(); +private bool GTK_IS_WINDOW(GtkWidget *); template NameOfFunc(alias f) { // Note: highly dependent on the .stringof formatting @@ -784,34 +848,40 @@ public static const int PictOpSrc = 1; public static const int PictOpOver = 3; - -/++ + public static int gtk_major_version(){ + return .gtk_major_version; + } + public static int gtk_minor_version(){ + return .gtk_minor_version; + } + public static int gtk_micro_version(){ + return .gtk_micro_version; + } // mixin ForwardGtkOsCFunc!(localeconv_decimal_point); // mixin ForwardGtkOsCFunc!(realpath); - mixin ForwardGtkOsCFunc!(X_EVENT_TYPE); - mixin ForwardGtkOsCFunc!(X_EVENT_WINDOW); +// mixin ForwardGtkOsCFunc!(X_EVENT_TYPE); +// mixin ForwardGtkOsCFunc!(X_EVENT_WINDOW); // mixin ForwardGtkOsCFunc!(.Call); // mixin ForwardGtkOsCFunc!(.call ); - mixin ForwardGtkOsCFunc!(GDK_WINDOWING_X11); -++/ + mixin ForwardGtkOsCFunc!(.GDK_WINDOWING_X11); mixin ForwardGtkOsCFunc!(.GDK_PIXMAP_XID); -/++ - mixin ForwardGtkOsCFunc!(.XCheckMaskEvent); - mixin ForwardGtkOsCFunc!(.XCheckWindowEvent); - mixin ForwardGtkOsCFunc!(.XCheckIfEvent); - mixin ForwardGtkOsCFunc!(.XDefaultScreen); - mixin ForwardGtkOsCFunc!(.XDefaultRootWindow); + +// mixin ForwardGtkOsCFunc!(.XCheckMaskEvent); +// mixin ForwardGtkOsCFunc!(.XCheckWindowEvent); + mixin ForwardGtkOsCFunc!(.XCheckIfEvent); +// mixin ForwardGtkOsCFunc!(.XDefaultScreen); +// mixin ForwardGtkOsCFunc!(.XDefaultRootWindow); mixin ForwardGtkOsCFunc!(.XFlush); - mixin ForwardGtkOsCFunc!(.XFree); - mixin ForwardGtkOsCFunc!(.XGetSelectionOwner); - mixin ForwardGtkOsCFunc!(.XInternAtom); - mixin ForwardGtkOsCFunc!(.XQueryTree); - mixin ForwardGtkOsCFunc!(.XKeysymToKeycode); - mixin ForwardGtkOsCFunc!(.XListProperties); - mixin ForwardGtkOsCFunc!(.XReconfigureWMWindow); - mixin ForwardGtkOsCFunc!(.XSendEvent); - +/ +// mixin ForwardGtkOsCFunc!(.XFree); +// mixin ForwardGtkOsCFunc!(.XGetSelectionOwner); +// mixin ForwardGtkOsCFunc!(.XInternAtom); +// mixin ForwardGtkOsCFunc!(.XQueryTree); +// mixin ForwardGtkOsCFunc!(.XKeysymToKeycode); +// mixin ForwardGtkOsCFunc!(.XListProperties); +// mixin ForwardGtkOsCFunc!(.XReconfigureWMWindow); +// mixin ForwardGtkOsCFunc!(.XSendEvent); + mixin ForwardGtkOsCFunc!(.XSetIOErrorHandler); mixin ForwardGtkOsCFunc!(.XSetErrorHandler); //mixin ForwardGtkOsCFunc!(.XSetInputFocus); @@ -830,15 +900,14 @@ //mixin ForwardGtkOsCFunc!(.gdk_x11_screen_lookup_visual); //mixin ForwardGtkOsCFunc!(.gdk_x11_screen_get_window_manager_name); mixin ForwardGtkOsCFunc!(.gdk_x11_visual_get_xvisual); - /+ - mixin ForwardGtkOsCFunc!(.gdk_pixmap_foreign_new); +// mixin ForwardGtkOsCFunc!(.gdk_pixmap_foreign_new); mixin ForwardGtkOsCFunc!(.gdk_window_lookup); mixin ForwardGtkOsCFunc!(.gdk_window_add_filter); - mixin ForwardGtkOsCFunc!(.gdk_window_remove_filter); +// mixin ForwardGtkOsCFunc!(.gdk_window_remove_filter); /** X render natives and constants */ // mixin ForwardGtkOsCFunc!(XRenderPictureAttributes_sizeof); - +/ + mixin ForwardGtkOsCFunc!(.XRenderQueryExtension); mixin ForwardGtkOsCFunc!(.XRenderQueryVersion); mixin ForwardGtkOsCFunc!(.XRenderCreatePicture); @@ -851,43 +920,41 @@ //mixin ForwardGtkOsCFunc!(Call ); mixin ForwardGtkOsCFunc!(.GDK_DISPLAY); mixin ForwardGtkOsCFunc!(.GDK_ROOT_PARENT); - /+ - mixin ForwardGtkOsCFunc!(.GDK_TYPE_COLOR); - mixin ForwardGtkOsCFunc!(.GDK_TYPE_PIXBUF); - mixin ForwardGtkOsCFunc!(.GTK_IS_BUTTON); - mixin ForwardGtkOsCFunc!(.GTK_IS_WINDOW); - mixin ForwardGtkOsCFunc!(.GTK_IS_CELL_RENDERER_PIXBUF); - mixin ForwardGtkOsCFunc!(.GTK_IS_CELL_RENDERER_TEXT); - mixin ForwardGtkOsCFunc!(.GTK_IS_CELL_RENDERER_TOGGLE); - mixin ForwardGtkOsCFunc!(.GTK_IS_CONTAINER); - mixin ForwardGtkOsCFunc!(.GTK_IS_IMAGE_MENU_ITEM); - mixin ForwardGtkOsCFunc!(.GTK_IS_PLUG); - mixin ForwardGtkOsCFunc!(.GTK_STOCK_CANCEL); - mixin ForwardGtkOsCFunc!(.GTK_STOCK_OK); - mixin ForwardGtkOsCFunc!(.GTK_TYPE_CELL_RENDERER_TEXT); - mixin ForwardGtkOsCFunc!(.GTK_TYPE_CELL_RENDERER_PIXBUF); - mixin ForwardGtkOsCFunc!(.GTK_TYPE_CELL_RENDERER_TOGGLE); - mixin ForwardGtkOsCFunc!(.GTK_TYPE_FIXED); - mixin ForwardGtkOsCFunc!(.GTK_TYPE_MENU); - mixin ForwardGtkOsCFunc!(.GTK_TYPE_WIDGET); - mixin ForwardGtkOsCFunc!(.GTK_WIDGET_FLAGS); - mixin ForwardGtkOsCFunc!(.GTK_WIDGET_STATE); - mixin ForwardGtkOsCFunc!(.GTK_WIDGET_HAS_DEFAULT); - mixin ForwardGtkOsCFunc!(.GTK_WIDGET_HAS_FOCUS); - mixin ForwardGtkOsCFunc!(.GTK_WIDGET_IS_SENSITIVE); - mixin ForwardGtkOsCFunc!(.GTK_WIDGET_MAPPED); - mixin ForwardGtkOsCFunc!(.GTK_WIDGET_SENSITIVE); - mixin ForwardGtkOsCFunc!(.GTK_WIDGET_SET_FLAGS); - mixin ForwardGtkOsCFunc!(.GTK_WIDGET_UNSET_FLAGS); - mixin ForwardGtkOsCFunc!(.GTK_WIDGET_VISIBLE); - mixin ForwardGtkOsCFunc!(.G_OBJECT_CLASS ); - mixin ForwardGtkOsCFunc!(.G_OBJECT_GET_CLASS ); - mixin ForwardGtkOsCFunc!(.G_OBJECT_TYPE_NAME ); - mixin ForwardGtkOsCFunc!(.G_TYPE_BOOLEAN); - mixin ForwardGtkOsCFunc!(.G_TYPE_INT); - mixin ForwardGtkOsCFunc!(.G_OBJECT_TYPE ); - mixin ForwardGtkOsCFunc!(.G_TYPE_STRING); - +/ +// mixin ForwardGtkOsCFunc!(.GDK_TYPE_COLOR); +// mixin ForwardGtkOsCFunc!(.GDK_TYPE_PIXBUF); +// mixin ForwardGtkOsCFunc!(.GTK_IS_BUTTON); + mixin ForwardGtkOsCFunc!(.GTK_IS_WINDOW); +// mixin ForwardGtkOsCFunc!(.GTK_IS_CELL_RENDERER_PIXBUF); +// mixin ForwardGtkOsCFunc!(.GTK_IS_CELL_RENDERER_TEXT); +// mixin ForwardGtkOsCFunc!(.GTK_IS_CELL_RENDERER_TOGGLE); +// mixin ForwardGtkOsCFunc!(.GTK_IS_CONTAINER); +// mixin ForwardGtkOsCFunc!(.GTK_IS_IMAGE_MENU_ITEM); +// mixin ForwardGtkOsCFunc!(.GTK_IS_PLUG); +// mixin ForwardGtkOsCFunc!(.GTK_STOCK_CANCEL); +// mixin ForwardGtkOsCFunc!(.GTK_STOCK_OK); + mixin ForwardGtkOsCFunc!(.GTK_TYPE_CELL_RENDERER_TEXT); + mixin ForwardGtkOsCFunc!(.GTK_TYPE_CELL_RENDERER_PIXBUF); + mixin ForwardGtkOsCFunc!(.GTK_TYPE_CELL_RENDERER_TOGGLE); + mixin ForwardGtkOsCFunc!(.GTK_TYPE_FIXED); +// mixin ForwardGtkOsCFunc!(.GTK_TYPE_MENU); +// mixin ForwardGtkOsCFunc!(.GTK_TYPE_WIDGET); +// mixin ForwardGtkOsCFunc!(.GTK_WIDGET_FLAGS); +// mixin ForwardGtkOsCFunc!(.GTK_WIDGET_STATE); +// mixin ForwardGtkOsCFunc!(.GTK_WIDGET_HAS_DEFAULT); +// mixin ForwardGtkOsCFunc!(.GTK_WIDGET_HAS_FOCUS); +// mixin ForwardGtkOsCFunc!(.GTK_WIDGET_IS_SENSITIVE); +// mixin ForwardGtkOsCFunc!(.GTK_WIDGET_MAPPED); +// mixin ForwardGtkOsCFunc!(.GTK_WIDGET_SENSITIVE); +// mixin ForwardGtkOsCFunc!(.GTK_WIDGET_SET_FLAGS); +// mixin ForwardGtkOsCFunc!(.GTK_WIDGET_UNSET_FLAGS); +// mixin ForwardGtkOsCFunc!(.GTK_WIDGET_VISIBLE); +// mixin ForwardGtkOsCFunc!(.G_OBJECT_CLASS ); +// mixin ForwardGtkOsCFunc!(.G_OBJECT_GET_CLASS ); +// mixin ForwardGtkOsCFunc!(.G_OBJECT_TYPE_NAME ); +// mixin ForwardGtkOsCFunc!(.G_TYPE_BOOLEAN); +// mixin ForwardGtkOsCFunc!(.G_TYPE_INT); +// mixin ForwardGtkOsCFunc!(.G_OBJECT_TYPE ); +// mixin ForwardGtkOsCFunc!(.G_TYPE_STRING); mixin ForwardGtkOsCFunc!(.PANGO_PIXELS); //mixin ForwardGtkOsCFunc!(.PANGO_TYPE_FONT_DESCRIPTION); @@ -930,7 +997,7 @@ mixin ForwardGtkOsCFunc!(.g_log_remove_handler); mixin ForwardGtkOsCFunc!(.g_log_set_handler); mixin ForwardGtkOsCFunc!(.g_malloc); - mixin ForwardGtkOsCFunc!(.g_object_get); + mixin ForwardGtkOsCFunc!(.g_object_get1); mixin ForwardGtkOsCFunc!(.g_object_get_qdata); mixin ForwardGtkOsCFunc!(.g_object_new ); mixin ForwardGtkOsCFunc!(.g_object_ref); @@ -1922,14 +1989,14 @@ GtkIMContext* GTK_TEXTVIEW_IM_CONTEXT( GtkTextView* arg0) { return arg0.im_context; } - GtkWidget* GTK_TOOLTIPS_TIP_WINDOW( GtkTooltips* arg0) + static GtkWidget* GTK_TOOLTIPS_TIP_WINDOW( GtkTooltips* arg0) { return arg0.tip_window; } - void GTK_TOOLTIPS_SET_ACTIVE( GtkTooltips* arg0, GtkTooltipsData* arg1 ) + static void GTK_TOOLTIPS_SET_ACTIVE( GtkTooltips* arg0, GtkTooltipsData* arg1 ) { arg0.active_tips_data = arg1; } - int GDK_EVENT_TYPE( GdkEvent* arg0 ) + static int GDK_EVENT_TYPE( GdkEvent* arg0 ) { return arg0.type; } - GdkWindow* GDK_EVENT_WINDOW( GdkEventAny* arg0 ) + static GdkWindow* GDK_EVENT_WINDOW( GdkEventAny* arg0 ) { return arg0.window; } /+ int X_EVENT_TYPE( XEvent* arg0 )
--- a/dwt/internal/gtk/c/gobjecttypes.d Tue Jan 08 01:23:25 2008 +0100 +++ b/dwt/internal/gtk/c/gobjecttypes.d Tue Jan 08 08:07:04 2008 +0100 @@ -264,7 +264,18 @@ * across invocation of g_type_register_static(). * guint16class_size; */ -public struct GTypeInfo{} +public struct GTypeInfo{ + ushort class_size; + extern(C) void function(void *) base_init; + extern(C) void function(void *) base_finalize; + extern(C) void function(void *, void *) class_init; + extern(C) void function(void *, void *) class_finalize; + void * class_data; + ushort instance_size; + ushort n_preallocs; + extern(C) void function(GTypeInstance *, void *) instance_init; + GTypeValueTable * value_table; +} // /+* interface types, classed types, instantiated types +/ // gobject-Type-Information.html // ushort classSize;
--- a/dwt/internal/gtk/c/gtktypes.d Tue Jan 08 01:23:25 2008 +0100 +++ b/dwt/internal/gtk/c/gtktypes.d Tue Jan 08 08:07:04 2008 +0100 @@ -6,7 +6,7 @@ it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + gtkD 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 @@ -28,6 +28,7 @@ dwt.internal.gtk.c.gobjecttypes, dwt.internal.gtk.c.gdkpixbuftypes; +extern(C): /****************************************************************************** ******************************************************************************/ @@ -2620,10 +2621,10 @@ GdkWindow *text_area; GtkIMContext *im_context; GtkWidget *popup_menu; - + gint current_pos; gint selection_bound; - + PangoLayout *cached_layout; guint flags2; @@ -2647,7 +2648,7 @@ gint scroll_offset; gint ascent; /* font ascent, in pango units */ gint descent; /* font descent, in pango units */ - + guint16 text_size; /* allocated size, in bytes */ guint16 n_bytes; /* length in use, in bytes */ @@ -2658,7 +2659,7 @@ gint drag_start_x; gint drag_start_y; - + gunichar invisible_char; gint width_chars; @@ -2877,7 +2878,7 @@ gint pixels_above_lines; gint pixels_below_lines; gint pixels_inside_wrap; - GtkWrapMode wrap_mode; + GtkWrapMode wrap_mode; GtkJustification justify; gint left_margin; gint right_margin; @@ -2888,11 +2889,11 @@ // guint overwrite_mode : 1; // guint cursor_visible : 1; - /* if we have reset the IM since the last character entered */ -// guint need_im_reset : 1; + /* if we have reset the IM since the last character entered */ +// guint need_im_reset : 1; // guint accepts_tab : 1; // guint width_changed : 1; - + /* debug flag - means that we've validated onscreen since the * last "invalidate" signal from the layout */ @@ -3310,10 +3311,36 @@ /** * Main Gtk struct. */ -public struct GtkCellRenderer{} - - -public struct GtkCellRendererClass{} +public struct GtkCellRenderer{ +GtkObject parent; +float xalign; +float yalign; +int width; +int height; +ushort xpad; +ushort ypad; +uint flags; +//bitfield: uint mode; +//bitfield: uint visible; +//bitfield: uint is_expander; +//bitfield: uint is_expanded; +//bitfield: uint cell_background_set; +//bitfield: uint sensitive; +//bitfield: uint editing; +} + +struct GtkCellRendererClass { + GtkObjectClass parent_class; + extern(C) void function(GtkCellRenderer *, GtkWidget *, GdkRectangle *, int *, int *, int *, int *) get_size; + extern(C) void function(GtkCellRenderer *, GdkDrawable *, GtkWidget *, GdkRectangle *, GdkRectangle *, GdkRectangle *, int) render; + extern(C) int function(GtkCellRenderer *, GdkEvent *, GtkWidget *, char *, GdkRectangle *, GdkRectangle *, int) activate; + extern(C) void * function(GtkCellRenderer *, GdkEvent *, GtkWidget *, char *, GdkRectangle *, GdkRectangle *, int) start_editing; + extern(C) void function(GtkCellRenderer *) editing_canceled; + extern(C) void function(GtkCellRenderer *, void *, char *) editing_started; + extern(C) void function() _gtk_reserved1; + extern(C) void function() _gtk_reserved2; +} + // GtkObjectClass parentClass; // GtkCellRenderer.html // /+* vtable - not signals +/ @@ -3430,7 +3457,19 @@ /** * Main Gtk struct. */ -public struct GtkCellRendererPixbuf{} +struct GtkCellRendererPixbufClass { + GtkCellRendererClass parent_class; + extern(C) void function() _gtk_reserved1; + extern(C) void function() _gtk_reserved2; + extern(C) void function() _gtk_reserved3; + extern(C) void function() _gtk_reserved4; +} +struct GtkCellRendererPixbuf { + GtkCellRenderer parent; + void * pixbuf; + void * pixbuf_expander_open; + void * pixbuf_expander_closed; +} /** @@ -3448,14 +3487,59 @@ /** * Main Gtk struct. */ -public struct GtkCellRendererText{} - + +struct GtkCellRendererTextClass { + GtkCellRendererClass parent_class; + extern(C) void function(GtkCellRendererText *, char *, char *) edited; + extern(C) void function() _gtk_reserved1; + extern(C) void function() _gtk_reserved2; + extern(C) void function() _gtk_reserved3; + extern(C) void function() _gtk_reserved4; +} + +struct GtkCellRendererText { + GtkCellRenderer parent; + char * text; + void * font; + double font_scale; + PangoColor foreground; + PangoColor background; + void * extra_attrs; + int underline_style; + int rise; + int fixed_height_rows; + uint flags; +//uint strikethrough; +//uint editable; +//uint scale_set; +//uint foreground_set; +//uint background_set; +//uint underline_set; +//uint rise_set; +//uint strikethrough_set; +//uint editable_set; +//uint calc_fixed_height; +} /** * Main Gtk struct. */ public struct GtkCellRendererToggle{} - +struct GtkCellRendererToggleClass { + GtkCellRendererClass parent_class; + void function(GtkCellRendererToggle *, char *) toggled; + void function() _gtk_reserved1; + void function() _gtk_reserved2; + void function() _gtk_reserved3; + void function() _gtk_reserved4; +} +struct _GtkCellRendererToggle { + GtkCellRenderer parent; + uint flags; + //uint active; + //uint activatable; + //uint radio; +} /** * Main Gtk struct. @@ -3915,6 +3999,12 @@ public struct GtkVButtonBox{} + + +struct GtkFixedClass { + GtkContainerClass parent_class; +} + /** * Main Gtk struct. * The GtkFixed struct contains the following fields. @@ -3924,7 +4014,10 @@ * a list of GtkFixedChild elements, containing the child widgets and * their positions. */ -public struct GtkFixed{} +public struct GtkFixed { + GtkContainer container; + GList * children; +} /** @@ -3940,7 +4033,11 @@ * the vertical position of the widget within the GtkFixed * container. */ -public struct GtkFixedChild{} +public struct GtkFixedChild{ + GtkWidget * widget; + int x; + int y; +} // GtkWidget *widget; // GtkFixed.html // int x; @@ -4105,7 +4202,7 @@ // guint hscrollbar_visible : 1; // guint vscrollbar_visible : 1; // guint window_placement : 2; -// guint focus_out : 1; +// guint focus_out : 1; guint16 shadow_type; } @@ -4121,7 +4218,7 @@ public struct GtkScrolledWindowClass { GtkBinClass parent_class; - + gint scrollbar_spacing; /* Action signals for keybindings. Do not connect to these signals @@ -4410,9 +4507,9 @@ public struct GtkContainer { GtkWidget widget; - + GtkWidget *focus_child; - + guint flags; // guint border_width : 16; @@ -4470,7 +4567,7 @@ public struct GtkObject { GInitiallyUnowned parent_instance; - + /* 32 bits of flags. GtkObject only uses 4 of these bits and * GtkWidget uses the rest. This is done because structs are * aligned on 4 or 8 byte boundaries. If a new bitfield were @@ -4535,7 +4632,7 @@ guint8 state; guint8 saved_state; gchar* name; - + /*< public >*/ /* The style for the widget. The style contains the @@ -4544,21 +4641,21 @@ * the font to use for text. */ GtkStyle *style; - + /* The widget's desired size. */ GtkRequisition requisition; - + /* The widget's allocated size. */ GtkAllocation allocation; - + /* The widget's window or its parent window if it does * not have a window. (Which will be indicated by the * GTK_NO_WINDOW flag being set). */ GdkWindow *window; - + /* The widget's parent. */ GtkWidget *parent; @@ -4619,7 +4716,7 @@ struct GtkObjectClass { GInitiallyUnownedClass parent_class; - + /* Non overridable class methods to set and get per class arguments */ void (*set_arg) (GtkObject *object, GtkArg *arg, @@ -4627,7 +4724,7 @@ void (*get_arg) (GtkObject *object, GtkArg *arg, guint arg_id); - + /* Default signal handler for the ::destroy signal, which is * invoked to request that references to the widget be dropped. * If an object class overrides destroy() in order to perform class @@ -4650,13 +4747,13 @@ GtkObjectClass parent_class; /*< public >*/ - + guint activate_signal; guint set_scroll_adjustments_signal; /*< private >*/ - + /* seldomly overidden */ void (*dispatch_child_properties_changed) (GtkWidget *widget, guint n_pspecs, @@ -4689,16 +4786,16 @@ gboolean was_grabbed); void (* child_notify) (GtkWidget *widget, GParamSpec *pspec); - + /* Mnemonics */ gboolean (* mnemonic_activate) (GtkWidget *widget, gboolean group_cycling); - + /* explicit focus */ void (* grab_focus) (GtkWidget *widget); gboolean (* focus) (GtkWidget *widget, GtkDirectionType direction); - + /* events */ gboolean (* event) (GtkWidget *widget, GdkEvent *event); @@ -4754,7 +4851,7 @@ GdkEventAny *event); gboolean (* window_state_event) (GtkWidget *widget, GdkEventWindowState *event); - + /* selection */ void (* selection_get) (GtkWidget *widget, GtkSelectionData *selection_data, @@ -4809,8 +4906,8 @@ */ gboolean (* show_help) (GtkWidget *widget, GtkWidgetHelpType help_type); - - /* accessibility support + + /* accessibility support */ AtkObject* (*get_accessible) (GtkWidget *widget); @@ -7554,536 +7651,536 @@ // StockIDs enum StockID { - + /** * The "About" item. * Since 2.6 */ ABOUT, - + /** * The "Add" item. */ ADD, - + /** * The "Apply" item. */ APPLY, - + /** * The "Bold" item. */ BOLD, - + /** * The "Cancel" item. */ CANCEL, - + /** * The "CD-Rom" item. */ CDROM, - + /** * The "Clear" item. */ CLEAR, - + /** * The "Close" item. */ CLOSE, - + /** * The "Color Picker" item. * Since 2.2 */ COLOR_PICKER, - + /** * The "Convert" item. */ CONVERT, - + /** * The "Connect" icon. * Since 2.6 */ CONNECT, - + /** * The "Copy" item. */ COPY, - + /** * The "Cut" item. */ CUT, - + /** * The "Delete" item. */ DELETE, - + /** * The "Error" item. */ DIALOG_ERROR, - + /** * The "Information" item. */ DIALOG_INFO, - + /** * The "Question" item. */ DIALOG_QUESTION, - + /** * The "Warning" item. */ DIALOG_WARNING, - + /** * The "Directory" icon. * Since 2.6 */ DIRECTORY, - + /** * The "Discard" item. * Since 2.12 */ DISCARD, - + /** * The "Disconnect" icon. * Since 2.6 */ DISCONNECT, - + /** * The "Drag-And-Drop" icon. */ DND, - + /** * The "Drag-And-Drop multiple" icon. */ DND_MULTIPLE, - + /** * The "Edit" item. * Since 2.6 */ EDIT, - + /** * The "Execute" item. */ EXECUTE, - + /** * The "File" icon. * Since 2.6 */ FILE, - + /** * The "Find" item. */ FIND, - + /** * The "Find and Replace" item. */ FIND_AND_REPLACE, - + /** * The "Floppy" item. */ FLOPPY, - + /** * The "Fullscreen" item. * Since 2.8 */ FULLSCREEN, - + /** * The "Bottom" item. */ GOTO_BOTTOM, - + /** * The "First" item. * RTL variant */ GOTO_FIRST, - + /** * The "Last" item. * RTL variant */ GOTO_LAST, - + /** * The "Top" item. */ GOTO_TOP, - + /** * The "Back" item. * RTL variant */ GO_BACK, - + /** * The "Down" item. */ GO_DOWN, - + /** * The "Forward" item. * RTL variant */ GO_FORWARD, - + /** * The "Up" item. */ GO_UP, - + /** * The "Harddisk" item. * Since 2.4 */ HARDDISK, - + /** * The "Help" item. */ HELP, - + /** * The "Home" item. */ HOME, - + /** * The "Indent" item. * RTL variant * Since 2.4 */ INDENT, - + /** * The "Index" item. */ INDEX, - + /** * The "Info" item. * Since 2.8 */ INFO, - + /** * The "Italic" item. */ ITALIC, - + /** * The "Jump to" item. * RTL-variant */ JUMP_TO, - + /** * The "Center" item. */ JUSTIFY_CENTER, - + /** * The "Fill" item. */ JUSTIFY_FILL, - + /** * The "Left" item. */ JUSTIFY_LEFT, - + /** * The "Right" item. */ JUSTIFY_RIGHT, - + /** * The "Leave Fullscreen" item. * Since 2.8 */ LEAVE_FULLSCREEN, - + /** * The "Media Forward" item. * RTL variant * Since 2.6 */ MEDIA_FORWARD, - + /** * The "Media Next" item. * RTL variant * Since 2.6 */ MEDIA_NEXT, - + /** * The "Media Pause" item. * Since 2.6 */ MEDIA_PAUSE, - + /** * The "Media Play" item. * RTL variant * Since 2.6 */ MEDIA_PLAY, - + /** * The "Media Previous" item. * RTL variant * Since 2.6 */ MEDIA_PREVIOUS, - + /** * The "Media Record" item. * Since 2.6 */ MEDIA_RECORD, - + /** * The "Media Rewind" item. * RTL variant * Since 2.6 */ MEDIA_REWIND, - + /** * The "Media Stop" item. * Since 2.6 */ MEDIA_STOP, - + /** * The "Missing image" icon. */ MISSING_IMAGE, - + /** * The "Network" item. * Since 2.4 */ NETWORK, - + /** * The "New" item. */ NEW, - + /** * The "No" item. */ NO, - + /** * The "OK" item. */ OK, - + /** * The "Open" item. */ OPEN, - + /** * The "Landscape Orientation" item. * Since 2.10 */ ORIENTATION_LANDSCAPE, - + /** * The "Portrait Orientation" item. * Since 2.10 */ ORIENTATION_PORTRAIT, - + /** * The "Reverse Landscape Orientation" item. * Since 2.10 */ ORIENTATION_REVERSE_LANDSCAPE, - + /** * The "Reverse Portrait Orientation" item. * Since 2.10 */ ORIENTATION_REVERSE_PORTRAIT, - + /** * The "Paste" item. */ PASTE, - + /** * The "Preferences" item. */ PREFERENCES, - + /** * The "Print" item. */ PRINT, - + /** * The "Print Preview" item. */ PRINT_PREVIEW, - + /** * The "Properties" item. */ PROPERTIES, - + /** * The "Quit" item. */ QUIT, - + /** * The "Redo" item. * RTL variant */ REDO, - + /** * The "Refresh" item. */ REFRESH, - + /** * The "Remove" item. */ REMOVE, - + /** * The "Revert" item. * RTL variant */ REVERT_TO_SAVED, - + /** * The "Save" item. */ SAVE, - + /** * The "Save As" item. */ SAVE_AS, - + /** * The "Select All" item. * Since 2.10 */ SELECT_ALL, - + /** * The "Color" item. */ SELECT_COLOR, - + /** * The "Font" item. */ SELECT_FONT, - + /** * The "Ascending" item. */ SORT_ASCENDING, - + /** * The "Descending" item. */ SORT_DESCENDING, - + /** * The "Spell Check" item. */ SPELL_CHECK, - + /** * The "Stop" item. */ STOP, - + /** * The "Strikethrough" item. */ STRIKETHROUGH, - + /** * The "Undelete" item. * RTL variant */ UNDELETE, - + /** * The "Underline" item. */ UNDERLINE, - + /** * The "Undo" item. * RTL variant */ UNDO, - + /** * The "Unindent" item. * RTL variant * Since 2.4 */ UNINDENT, - + /** * The "Yes" item. */ YES, - + /** * The "Zoom 100%" item. */ ZOOM_100, - + /** * The "Zoom to Fit" item. */ ZOOM_FIT, - + /** * The "Zoom In" item. */ ZOOM_IN, - + /** * The "Zoom Out" item. */ @@ -8092,7 +8189,7 @@ } // Stock strings -char[][] StockDesc = +char[][] StockDesc = [ "gtk-about", "gtk-add", "gtk-apply", @@ -8193,3 +8290,5 @@ "gtk-zoom-out", ]; + +
--- a/dwt/widgets/Control.d Tue Jan 08 01:23:25 2008 +0100 +++ b/dwt/widgets/Control.d Tue Jan 08 08:07:04 2008 +0100 @@ -10,13 +10,19 @@ *******************************************************************************/ module dwt.widgets.Control; -class Control { +import dwt.internal.gtk.c.gtktypes; +import dwt.widgets.Widget; +import dwt.widgets.Shell; + +class Control : Widget { + GdkWindow* paintWindow () { return null; }; + public Shell getShell(); + bool isEnabled(); } /+++ import dwt.*; import dwt.internal.Converter; import dwt.internal.accessibility.gtk.ATK; -import dwt.internal.gtk.*; import dwt.graphics.*; import dwt.events.*; import dwt.accessibility.*;
--- a/dwt/widgets/Display.d Tue Jan 08 01:23:25 2008 +0100 +++ b/dwt/widgets/Display.d Tue Jan 08 08:07:04 2008 +0100 @@ -41,12 +41,13 @@ import dwt.widgets.Tray; import dwt.widgets.Widget; -class Display{ -} +import tango.io.Stdout; +import tango.stdc.string; +import tango.stdc.stringz; +import dwt.dwthelper.utils; +import dwt.dwthelper.Runnable; - -/++ - +import tango.core.Thread : Thread; /** * Instances of this class are responsible for managing the @@ -125,7 +126,7 @@ */ public class Display : Device { - /* Events Dispatching and void*/*Callback*/ */ + /* Events Dispatching and Callback */ int gdkEventCount; GdkEvent* [] gdkEvents; Widget [] gdkEventWidgets; @@ -133,7 +134,7 @@ Event [] eventQueue; int /*long*/ fds; int allocated_nfds; - bool wake; + bool wake_state; int max_priority, timeout; void*/*Callback*/ eventCallback, filterCallback; int /*long*/ eventProc, filterProc, windowProc2, windowProc3, windowProc4, windowProc5; @@ -156,14 +157,6 @@ static const int SWT_OBJECT_INDEX; static const int SWT_OBJECT_INDEX1; static const int SWT_OBJECT_INDEX2; - static this(){ - byte [] buffer = Converter.wcsToMbcs (null, "SWT_OBJECT_INDEX", true); - SWT_OBJECT_INDEX = OS.g_quark_from_string (buffer); - buffer = Converter.wcsToMbcs (null, "SWT_OBJECT_INDEX1", true); - SWT_OBJECT_INDEX1 = OS.g_quark_from_string (buffer); - buffer = Converter.wcsToMbcs (null, "SWT_OBJECT_INDEX2", true); - SWT_OBJECT_INDEX2 = OS.g_quark_from_string (buffer); - } /* Focus */ int focusEvent; @@ -177,7 +170,7 @@ int /*long*/ preeditWindow, preeditLabel; /* Sync/Async Widget Communication */ - Synchronizer synchronizer = new Synchronizer (this); + Synchronizer synchronizer; Thread thread; /* Display Shutdown */ @@ -226,9 +219,9 @@ int /*long*/ idleProc; int idleHandle; void*/*Callback*/ idleCallback; - static const char[] ADD_IDLE_PROC_KEY = "dwt.internal.gtk2.addIdleProc"; - static const char[] REMOVE_IDLE_PROC_KEY = "dwt.internal.gtk2.removeIdleProc"; - Object idleLock = new Object(); + static const char[] ADD_IDLE_PROC_KEY; + static const char[] REMOVE_IDLE_PROC_KEY; + Object idleLock; bool idleNeeded; /* GtkTreeView callbacks */ @@ -236,7 +229,7 @@ int treeSelectionLength; int /*long*/ treeSelectionProc; void*/*Callback*/ treeSelectionCallback; - int /*long*/ cellDataProc; + int /*long*/ cellDataProcFld; void*/*Callback*/ cellDataCallback; /* Set direction callback */ @@ -244,13 +237,14 @@ void*/*Callback*/ setDirectionCallback; /* Get all children callback */ - int /*long*/ allChildrenProc, allChildren; + int /*long*/ allChildrenProc; + GList* allChildren; void*/*Callback*/ allChildrenCallback; /* Settings callbacks */ int /*long*/ styleSetProc; void*/*Callback*/ styleSetCallback; - int /*long*/ shellHandle; + GtkWidget* shellHandle; bool settingsChanged, runSettings; /* Entry focus behaviour */ @@ -262,17 +256,17 @@ /* Flush exposes */ int /*long*/ checkIfEventProc; void*/*Callback*/ checkIfEventCallback; - int /*long*/ flushWindow; + GdkWindow* flushWindow; bool flushAll; - GdkRectangle flushRect = new GdkRectangle (); - XExposeEvent exposeEvent = new XExposeEvent (); - XVisibilityEvent visibilityEvent = new XVisibilityEvent (); - int /*long*/ [] flushData = new int /*long*/ [1]; + GdkRectangle* flushRect; + XExposeEvent* exposeEvent; + XVisibilityEvent* visibilityEvent; + //int /*long*/ [] flushData = new int /*long*/ [1]; /* System Resources */ Font systemFont; Image errorImage, infoImage, questionImage, warningImage; - Cursor [] cursors = new Cursor [SWT.CURSOR_HAND + 1]; + Cursor [] cursors; Resource [] resources; static const int RESOURCE_SIZE = 1 + 4 + SWT.CURSOR_HAND + 1; @@ -296,8 +290,10 @@ /* Fixed Subclass */ static int /*long*/ fixed_type; static int /*long*/ fixed_info_ptr; - static void*/*Callback*/ fixedClassInitCallback, fixedMapCallback; - static int /*long*/ fixedClassInitProc, fixedMapProc; + static void*/*Callback*/ fixedClassInitCallback; + //static void* fixedMapCallback; + static int /*long*/ fixedClassInitProc; + //static int fixedMapProc; /* Renderer Subclass */ static int /*long*/ text_renderer_type, pixbuf_renderer_type, toggle_renderer_type; @@ -417,16 +413,14 @@ * it does not compile on some Java compilers when they are * targeted for CLDC. Use Class.forName() instead. */ - static const Class OS_LOCK; static this(){ - Class lock = null; - try { - lock = Class.forName ("dwt.internal.gtk.OS"); - } catch (Throwable th) { - } - OS_LOCK = lock; Displays = new Display [4]; initDeviceFinder(); + SWT_OBJECT_INDEX = OS.g_quark_from_string ("SWT_OBJECT_INDEX"); + SWT_OBJECT_INDEX1 = OS.g_quark_from_string ("SWT_OBJECT_INDEX1"); + SWT_OBJECT_INDEX2 = OS.g_quark_from_string ("SWT_OBJECT_INDEX2"); + ADD_IDLE_PROC_KEY = "dwt.internal.gtk2.addIdleProc"; + REMOVE_IDLE_PROC_KEY = "dwt.internal.gtk2.removeIdleProc"; } /* GTK Version */ @@ -504,6 +498,12 @@ */ public this (DeviceData data) { super (data); + synchronizer = new Synchronizer (this); + idleLock = new Object(); + flushRect = new GdkRectangle (); + exposeEvent = new XExposeEvent (); + visibilityEvent = new XVisibilityEvent (); + cursors = new Cursor [SWT.CURSOR_HAND + 1]; } /** @@ -549,24 +549,24 @@ filterTable.hook (eventType, listener); } -void addGdkEvent (int /*long*/ event) { +void addGdkEvent (GdkEvent* event) { if (gdkEvents is null) { int length = GROW_SIZE; - gdkEvents = new int /*long*/ [length]; - gdkEventWidgets = new Widget [length]; + gdkEvents.length = length; + gdkEventWidgets.length = length; gdkEventCount = 0; } if (gdkEventCount is gdkEvents.length) { int length = gdkEventCount + GROW_SIZE; - int /*long*/ [] newEvents = new int /*long*/ [length]; - System.arraycopy (gdkEvents, 0, newEvents, 0, gdkEventCount); + GdkEvent* [] newEvents = new GdkEvent* [length]; + SimpleType!(GdkEvent*).arraycopy (gdkEvents, 0, newEvents, 0, gdkEventCount); gdkEvents = newEvents; Widget [] newWidgets = new Widget [length]; System.arraycopy (gdkEventWidgets, 0, newWidgets, 0, gdkEventCount); gdkEventWidgets = newWidgets; } Widget widget = null; - int /*long*/ handle = OS.gtk_get_event_widget (event); + GtkWidget* handle = OS.gtk_get_event_widget (event); if (handle !is null) { do { widget = getWidget (handle); @@ -580,8 +580,8 @@ void addIdleProc() { synchronized (idleLock){ this.idleNeeded = true; - if (idleHandle is null) { - idleHandle = OS.g_idle_add (idleProc, 0); + if (idleHandle is 0) { + idleHandle = OS.g_idle_add ( &idleProcFunc, cast(void*) this ); } } } @@ -617,20 +617,20 @@ eventTable.hook (eventType, listener); } -int /*long*/ allChildrenProc (int /*long*/ widget, int /*long*/ recurse) { - allChildren = OS.g_list_append (allChildren, widget); - if (recurse !is null && OS.GTK_IS_CONTAINER (widget)) { - OS.gtk_container_forall (widget, allChildrenProc, recurse); - } - return 0; -} - -void addMouseHoverTimeout (int /*long*/ handle) { - if (mouseHoverId !is null) OS.gtk_timeout_remove (mouseHoverId); - mouseHoverId = OS.gtk_timeout_add (400, mouseHoverProc, handle); - mouseHoverHandle = handle; -} - +//PORTING_LEFT int /*long*/ allChildrenProcMeth (GtkWidget* widget, int /*long*/ recurse) { +//PORTING_LEFT allChildren = OS.g_list_append (allChildren, widget); +//PORTING_LEFT if (recurse !is null && OS.GTK_IS_CONTAINER (widget)) { +//PORTING_LEFT OS.gtk_container_forall (widget, allChildrenProc, recurse); +//PORTING_LEFT } +//PORTING_LEFT return 0; +//PORTING_LEFT } +//PORTING_LEFT +//PORTING_LEFT void addMouseHoverTimeout (int /*long*/ handle) { +//PORTING_LEFT if (mouseHoverId !is 0) OS.gtk_timeout_remove (mouseHoverId); +//PORTING_LEFT mouseHoverId = OS.gtk_timeout_add (400, &mouseHoverProcFunc, handle); +//PORTING_LEFT mouseHoverHandle = handle; +//PORTING_LEFT } +//PORTING_LEFT void addPopup (Menu menu) { if (popups is null) popups = new Menu [4]; int length = popups.length; @@ -650,23 +650,23 @@ popups [index] = menu; } -void addWidget (int /*long*/ handle, Widget widget) { - if (handle is null) return; +void addWidget (int/**/ handle, Widget widget) { + if (handle is 0) return; if (freeSlot is -1) { - int length = (freeSlot = indexTable.length) + GROW_SIZE; - int[] newIndexTable = new int[length]; - Widget[] newWidgetTable = new Widget [length]; + int len = (freeSlot = indexTable.length) + GROW_SIZE; + int[] newIndexTable = new int[len]; + Widget[] newWidgetTable = new Widget [len]; System.arraycopy (indexTable, 0, newIndexTable, 0, freeSlot); System.arraycopy (widgetTable, 0, newWidgetTable, 0, freeSlot); - for (int i = freeSlot; i < length - 1; i++) { + for (int i = freeSlot; i < len - 1; i++) { newIndexTable[i] = i + 1; } - newIndexTable[length - 1] = -1; + newIndexTable[len - 1] = -1; indexTable = newIndexTable; widgetTable = newWidgetTable; } int index = freeSlot + 1; - OS.g_object_set_qdata (handle, SWT_OBJECT_INDEX, index); + OS.g_object_set_qdata (cast(GObject*)handle, SWT_OBJECT_INDEX, cast(void*)index); int oldSlot = freeSlot; freeSlot = indexTable[oldSlot]; indexTable [oldSlot] = -2; @@ -698,9 +698,9 @@ public void asyncExec (Runnable runnable) { if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED); synchronized (idleLock) { - if (idleNeeded && idleHandle is null) { + if (idleNeeded && idleHandle is 0) { //NOTE: calling unlocked function in OS - idleHandle = OS._g_idle_add (idleProc, 0); + idleHandle = OS.g_idle_add (&idleProcFunc, cast(void*) this); } } synchronizer.asyncExec (runnable); @@ -721,12 +721,12 @@ if (!OS.GDK_WINDOWING_X11 ()) { OS.gdk_flush (); } else { - int /*long*/ xDisplay = OS.GDK_DISPLAY (); + GdkDisplay* xDisplay = OS.GDK_DISPLAY (); OS.XFlush (xDisplay); } } -int /*long*/ cellDataProc (int /*long*/ tree_column, int /*long*/ cell, int /*long*/ tree_model, int /*long*/ iter, int /*long*/ data) { +int /*long*/ cellDataProc (int /*long*/ tree_column, int /*long*/ cell, int /*long*/ tree_model, int /*long*/ iter, GtkWidget* data) { Widget widget = getWidget (data); if (widget is null) return 0; return widget.cellDataProc (tree_column, cell, tree_model, iter, data); @@ -734,7 +734,7 @@ protected void checkDevice () { if (thread is null) error (SWT.ERROR_WIDGET_DISPOSED); - if (thread !is Thread.currentThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS); + if (thread !is Thread.getThis ()) error (SWT.ERROR_THREAD_INVALID_ACCESS); if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED); } @@ -747,8 +747,13 @@ } } -int /*long*/ checkIfEventProc (int /*long*/ display, int /*long*/ xEvent, int /*long*/ userData) { - int type = OS.X_EVENT_TYPE (xEvent); +private static extern(C) int checkIfEventProcFunc (void* display, XEvent* xEvent, void* userData) { + auto disp = cast(Display)userData; + return disp.checkIfEventProcMeth( display, xEvent ); +} + +int checkIfEventProcMeth (void* display, XEvent* xEvent) { + int type = xEvent.type; switch (type) { case OS.VisibilityNotify: case OS.Expose: @@ -757,11 +762,11 @@ default: return 0; } - int /*long*/ window = OS.gdk_window_lookup (OS.X_EVENT_WINDOW (xEvent)); + GdkWindow* window = OS.gdk_window_lookup ( xEvent.xany.window ); if (window is null) return 0; if (flushWindow !is null) { if (flushAll) { - int /*long*/ tempWindow = window; + auto tempWindow = window; do { if (tempWindow is flushWindow) break; } while ((tempWindow = OS.gdk_window_get_parent (tempWindow)) !is null); @@ -770,7 +775,7 @@ if (window !is flushWindow) return 0; } } - OS.memmove (exposeEvent, xEvent, XExposeEvent.sizeof); + *exposeEvent = *cast(XExposeEvent*)xEvent; switch (type) { case OS.Expose: case OS.GraphicsExpose: { @@ -780,16 +785,15 @@ flushRect.height = exposeEvent.height; OS.gdk_window_invalidate_rect (window, flushRect, true); exposeEvent.type = -1; - OS.memmove (xEvent, exposeEvent, XExposeEvent.sizeof); + memmove (xEvent, exposeEvent, XExposeEvent.sizeof); break; } case OS.VisibilityNotify: { - OS.memmove (visibilityEvent, xEvent, XVisibilityEvent.sizeof); - OS.gdk_window_get_user_data (window, flushData); - int /*long*/ handle = flushData [0]; + memmove (visibilityEvent, xEvent, XVisibilityEvent.sizeof); + GtkWidget* handle; + OS.gdk_window_get_user_data (window, cast(void**) & handle); Widget widget = handle !is null ? getWidget (handle) : null; - if (widget !is null && (null !is cast(Control)widget)) { - Control control = (Control) widget; + if (auto control = cast(Control)widget ) { if (window is control.paintWindow ()) { if (visibilityEvent.state is OS.VisibilityFullyObscured) { control.state |= Widget.OBSCURED; @@ -817,7 +821,7 @@ * @see Widget#checkSubclass */ protected void checkSubclass () { - if (!isValidClass (getClass ())) error (SWT.ERROR_INVALID_SUBCLASS); +//PORTING_TODO if (!isValidClass (getClass ())) error (SWT.ERROR_INVALID_SUBCLASS); } /** @@ -854,7 +858,7 @@ */ protected void create (DeviceData data) { checkSubclass (); - checkDisplay(thread = Thread.currentThread (), false); + checkDisplay(thread = Thread.getThis (), false); createDisplay (data); register (); if (Default is null) Default = this; @@ -863,123 +867,84 @@ synchronized void createDisplay (DeviceData data) { /* Required for g_main_context_wakeup */ if (!OS.g_thread_supported ()) { - OS.g_thread_init (0); + OS.g_thread_init (null); } OS.gtk_set_locale(); - if (!OS.gtk_init_check (new int /*long*/ [] {0}, null)) { + int cnt = 0; + if (!OS.gtk_init_check (&cnt, null)) { SWT.error (SWT.ERROR_NO_HANDLES, null, " [gtk_init_check() failed]"); } - if (OS.GDK_WINDOWING_X11 ()) xDisplay = OS.GDK_DISPLAY (); - int /*long*/ ptr = OS.gtk_check_version (MAJOR, MINOR, MICRO); + if (OS.GDK_WINDOWING_X11 ()) xDisplay = cast(dwt.internal.gtk.c.cairotypes.Display*) OS.GDK_DISPLAY (); + char* ptr = OS.gtk_check_version (MAJOR, MINOR, MICRO); if (ptr !is null) { - int length = OS.strlen (ptr); - byte [] buffer = new byte [length]; - OS.memmove (buffer, ptr, length); - System.out.println ("***WARNING: " + new String (Converter.mbcsToWcs (null, buffer))); - System.out.println ("***WARNING: SWT requires GTK " + MAJOR+ "." + MINOR + "." + MICRO); + char [] buffer = fromUtf8z(ptr); + Stdout.formatln ("***WARNING: {}", buffer ); + Stdout.formatln ("***WARNING: SWT requires GTK {}.{}.{}", MAJOR, MINOR, MICRO ); int major = OS.gtk_major_version (), minor = OS.gtk_minor_version (), micro = OS.gtk_micro_version (); - System.out.println ("***WARNING: Detected: " + major + "." + minor + "." + micro); + Stdout.formatln ("***WARNING: Detected: {}.{}.{}", major, minor, micro); } - if (fixed_type is null) { - byte [] type_name = Converter.wcsToMbcs (null, "SwtFixed", true); - fixedClassInitCallback = new void*/*Callback*/ (getClass (), "fixedClassInitProc", 2); - fixedClassInitProc = fixedClassInitCallback.getAddress (); - if (fixedClassInitProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - fixedMapCallback = new void*/*Callback*/ (getClass (), "fixedMapProc", 1); - fixedMapProc = fixedMapCallback.getAddress (); - if (fixedMapProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - GTypeInfo fixed_info = new GTypeInfo (); - fixed_info.class_size = cast(short) OS.GtkFixedClass_sizeof (); - fixed_info.class_init = fixedClassInitProc; - fixed_info.instance_size = cast(short) OS.GtkFixed_sizeof (); - fixed_info_ptr = OS.g_malloc (GTypeInfo.sizeof); - OS.memmove (fixed_info_ptr, fixed_info, GTypeInfo.sizeof); - fixed_type = OS.g_type_register_static (OS.GTK_TYPE_FIXED (), type_name, fixed_info_ptr, 0); - } - if (rendererClassInitProc is null) { - rendererClassInitCallback = new void*/*Callback*/ (getClass (), "rendererClassInitProc", 2); - rendererClassInitProc = rendererClassInitCallback.getAddress (); - if (rendererClassInitProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); + if (fixed_type is 0) { + GTypeInfo* fixed_info = new GTypeInfo (); + fixed_info.class_size = GtkFixedClass.sizeof; + fixed_info.class_init = & fixedClassInitProcFunc; + fixed_info.instance_size = GtkFixed.sizeof; + fixed_type = OS.g_type_register_static (OS.GTK_TYPE_FIXED (), "SwtFixed".ptr, fixed_info, cast(GTypeFlags)0); } - if (rendererRenderProc is null) { - rendererRenderCallback = new void*/*Callback*/ (getClass (), "rendererRenderProc", 7); - rendererRenderProc = rendererRenderCallback.getAddress (); - if (rendererRenderProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - } - if (rendererGetSizeProc is null) { - rendererGetSizeCallback = new void*/*Callback*/ (getClass (), "rendererGetSizeProc", 7); - rendererGetSizeProc = rendererGetSizeCallback.getAddress (); - if (rendererGetSizeProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - } - if (text_renderer_type is null) { - GTypeInfo renderer_info = new GTypeInfo (); - renderer_info.class_size = cast(short) OS.GtkCellRendererTextClass_sizeof (); - renderer_info.class_init = rendererClassInitProc; - renderer_info.instance_size = cast(short) OS.GtkCellRendererText_sizeof (); - text_renderer_info_ptr = OS.g_malloc (GTypeInfo.sizeof); - OS.memmove (text_renderer_info_ptr, renderer_info, GTypeInfo.sizeof); - byte [] type_name = Converter.wcsToMbcs (null, "SwtTextRenderer", true); - text_renderer_type = OS.g_type_register_static (OS.GTK_TYPE_CELL_RENDERER_TEXT (), type_name, text_renderer_info_ptr, 0); + if (text_renderer_type is 0) { + GTypeInfo* renderer_info = new GTypeInfo (); + renderer_info.class_size = GtkCellRendererTextClass.sizeof; + renderer_info.class_init = & rendererClassInitProcFunc; + renderer_info.instance_size = GtkCellRendererText.sizeof; + text_renderer_type = OS.g_type_register_static (OS.GTK_TYPE_CELL_RENDERER_TEXT (), "SwtTextRenderer".ptr, renderer_info, cast(GTypeFlags)0); } - if (pixbuf_renderer_type is null) { - GTypeInfo renderer_info = new GTypeInfo (); - renderer_info.class_size = cast(short) OS.GtkCellRendererPixbufClass_sizeof (); - renderer_info.class_init = rendererClassInitProc; - renderer_info.instance_size = cast(short) OS.GtkCellRendererPixbuf_sizeof (); - pixbuf_renderer_info_ptr = OS.g_malloc (GTypeInfo.sizeof); - OS.memmove (pixbuf_renderer_info_ptr, renderer_info, GTypeInfo.sizeof); - byte [] type_name = Converter.wcsToMbcs (null, "SwtPixbufRenderer", true); - pixbuf_renderer_type = OS.g_type_register_static (OS.GTK_TYPE_CELL_RENDERER_PIXBUF (), type_name, pixbuf_renderer_info_ptr, 0); + if (pixbuf_renderer_type is 0) { + GTypeInfo* renderer_info = new GTypeInfo (); + renderer_info.class_size = GtkCellRendererPixbufClass.sizeof; + renderer_info.class_init = & rendererClassInitProcFunc; + renderer_info.instance_size = GtkCellRendererPixbuf.sizeof; + pixbuf_renderer_type = OS.g_type_register_static (OS.GTK_TYPE_CELL_RENDERER_PIXBUF (), "SwtPixbufRenderer".ptr, renderer_info, cast(GTypeFlags)0); } - if (toggle_renderer_type is null) { - GTypeInfo renderer_info = new GTypeInfo (); - renderer_info.class_size = cast(short) OS.GtkCellRendererToggleClass_sizeof (); - renderer_info.class_init = rendererClassInitProc; - renderer_info.instance_size = cast(short) OS.GtkCellRendererToggle_sizeof (); - toggle_renderer_info_ptr = OS.g_malloc (GTypeInfo.sizeof); - OS.memmove (toggle_renderer_info_ptr, renderer_info, GTypeInfo.sizeof); - byte [] type_name = Converter.wcsToMbcs (null, "SwtToggleRenderer", true); - toggle_renderer_type = OS.g_type_register_static (OS.GTK_TYPE_CELL_RENDERER_TOGGLE (), type_name, toggle_renderer_info_ptr, 0); + if (toggle_renderer_type is 0) { + GTypeInfo* renderer_info = new GTypeInfo (); + renderer_info.class_size = GtkCellRendererToggleClass.sizeof; + renderer_info.class_init = & rendererClassInitProcFunc; + renderer_info.instance_size = GtkCellRendererToggle.sizeof; + toggle_renderer_type = OS.g_type_register_static (OS.GTK_TYPE_CELL_RENDERER_TOGGLE (), "SwtToggleRenderer".ptr, renderer_info, cast(GTypeFlags)0); } - OS.gtk_widget_set_default_direction (OS.GTK_TEXT_DIR_LTR); + OS.gtk_widget_set_default_direction (cast(GtkTextDirection)OS.GTK_TEXT_DIR_LTR); OS.gdk_rgb_init (); - byte [] buffer = Converter.wcsToMbcs (null, APP_NAME, true); - OS.g_set_prgname (buffer); - OS.gdk_set_program_class (buffer); - byte [] flatStyle = Converter.wcsToMbcs (null, "style \"swt-flat\" { GtkToolbar::shadow-type = none } widget \"*.swt-toolbar-flat\" style : highest \"swt-flat\"", true); - OS.gtk_rc_parse_string (flatStyle); + char* p = toStringz(APP_NAME); + OS.g_set_prgname (p); + OS.gdk_set_program_class (p); + OS.gtk_rc_parse_string ("style \"swt-flat\" { GtkToolbar::shadow-type = none } widget \"*.swt-toolbar-flat\" style : highest \"swt-flat\"".ptr); /* Initialize the hidden shell */ - shellHandle = OS.gtk_window_new (OS.GTK_WINDOW_TOPLEVEL); + shellHandle = OS.gtk_window_new (cast(GtkWindowType)OS.GTK_WINDOW_TOPLEVEL); if (shellHandle is null) SWT.error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_realize (shellHandle); /* Initialize the filter and event callback */ - eventCallback = new void*/*Callback*/ (this, "eventProc", 2); - eventProc = eventCallback.getAddress (); - if (eventProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - OS.gdk_event_handler_set (eventProc, 0, 0); - filterCallback = new void*/*Callback*/ (this, "filterProc", 3); - filterProc = filterCallback.getAddress (); - if (filterProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); - OS.gdk_window_add_filter (0, filterProc, 0); + OS.gdk_event_handler_set (&eventProcFunc, cast(void*)this, cast(GDestroyNotify) 0); + OS.gdk_window_add_filter (null, &filterProcFunc, cast(void*)this ); } Image createImage (char[] name) { - int /*long*/ style = OS.gtk_widget_get_default_style (); - byte[] buffer = Converter.wcsToMbcs (null, name, true); - int /*long*/ pixbuf = OS.gtk_icon_set_render_icon ( - OS.gtk_icon_factory_lookup_default (buffer), style, - OS.GTK_TEXT_DIR_NONE, OS.GTK_STATE_NORMAL, OS.GTK_ICON_SIZE_DIALOG, 0, 0); + auto style = OS.gtk_widget_get_default_style (); + char[] buffer = name; + auto pixbuf = OS.gtk_icon_set_render_icon ( + OS.gtk_icon_factory_lookup_default (buffer.ptr), style, + cast(GtkTextDirection)OS.GTK_TEXT_DIR_NONE, + cast(GtkStateType)OS.GTK_STATE_NORMAL, + cast(GtkIconSize)OS.GTK_ICON_SIZE_DIALOG, null, null ); if (pixbuf is null) return null; int width = OS.gdk_pixbuf_get_width (pixbuf); int height = OS.gdk_pixbuf_get_height (pixbuf); int stride = OS.gdk_pixbuf_get_rowstride (pixbuf); - bool hasAlpha = OS.gdk_pixbuf_get_has_alpha (pixbuf); - int /*long*/ pixels = OS.gdk_pixbuf_get_pixels (pixbuf); + bool hasAlpha = cast(bool)OS.gdk_pixbuf_get_has_alpha (pixbuf); + char* pixels = OS.gdk_pixbuf_get_pixels (pixbuf); byte [] data = new byte [stride * height]; - OS.memmove (data, pixels, data.length); + memmove (data.ptr, pixels, data.length); OS.g_object_unref (pixbuf); ImageData imageData = null; if (hasAlpha) { @@ -1002,56 +967,56 @@ return new Image (this, imageData); } -static int /*long*/ createPixbuf(Image image) { - int [] w = new int [1], h = new int [1]; - OS.gdk_drawable_get_size (image.pixmap, w, h); - int /*long*/ colormap = OS.gdk_colormap_get_system (); - int /*long*/ pixbuf; +static GdkPixbuf* createPixbuf(Image image) { + int w, h; + OS.gdk_drawable_get_size (image.pixmap, &w, &h); + auto colormap = OS.gdk_colormap_get_system (); + GdkPixbuf* pixbuf; bool hasMask = image.mask !is null && OS.gdk_drawable_get_depth (image.mask) is 1; if (hasMask) { - pixbuf = OS.gdk_pixbuf_new (OS.GDK_COLORSPACE_RGB, true, 8, w [0], h [0]); + pixbuf = OS.gdk_pixbuf_new (cast(GdkColorspace)OS.GDK_COLORSPACE_RGB, true, 8, w, h ); if (pixbuf is null) SWT.error (SWT.ERROR_NO_HANDLES); - OS.gdk_pixbuf_get_from_drawable (pixbuf, image.pixmap, colormap, 0, 0, 0, 0, w [0], h [0]); - int /*long*/ maskPixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, w [0], h [0]); + OS.gdk_pixbuf_get_from_drawable (pixbuf, image.pixmap, colormap, 0, 0, 0, 0, w, h); + auto maskPixbuf = OS.gdk_pixbuf_new(cast(GdkColorspace)OS.GDK_COLORSPACE_RGB, false, 8, w, h); if (maskPixbuf is null) SWT.error (SWT.ERROR_NO_HANDLES); - OS.gdk_pixbuf_get_from_drawable(maskPixbuf, image.mask, 0, 0, 0, 0, 0, w [0], h [0]); + OS.gdk_pixbuf_get_from_drawable(maskPixbuf, image.mask, null, 0, 0, 0, 0, w, h); int stride = OS.gdk_pixbuf_get_rowstride(pixbuf); - int /*long*/ pixels = OS.gdk_pixbuf_get_pixels(pixbuf); + auto pixels = OS.gdk_pixbuf_get_pixels(pixbuf); byte[] line = new byte[stride]; int maskStride = OS.gdk_pixbuf_get_rowstride(maskPixbuf); - int /*long*/ maskPixels = OS.gdk_pixbuf_get_pixels(maskPixbuf); + auto maskPixels = OS.gdk_pixbuf_get_pixels(maskPixbuf); byte[] maskLine = new byte[maskStride]; - for (int y=0; y<h[0]; y++) { - int /*long*/ offset = pixels + (y * stride); - OS.memmove(line, offset, stride); - int /*long*/ maskOffset = maskPixels + (y * maskStride); - OS.memmove(maskLine, maskOffset, maskStride); - for (int x=0; x<w[0]; x++) { + for (int y=0; y<h; y++) { + auto offset = pixels + (y * stride); + memmove(line.ptr, offset, stride); + auto maskOffset = maskPixels + (y * maskStride); + memmove(maskLine.ptr, maskOffset, maskStride); + for (int x=0; x<w; x++) { if (maskLine[x * 3] is 0) { line[x * 4 + 3] = 0; } } - OS.memmove(offset, line, stride); + memmove(offset, line.ptr, stride); } OS.g_object_unref(maskPixbuf); } else { ImageData data = image.getImageData (); bool hasAlpha = data.getTransparencyType () is SWT.TRANSPARENCY_ALPHA; - pixbuf = OS.gdk_pixbuf_new (OS.GDK_COLORSPACE_RGB, hasAlpha, 8, w [0], h [0]); + pixbuf = OS.gdk_pixbuf_new (cast(GdkColorspace)OS.GDK_COLORSPACE_RGB, hasAlpha, 8, w, h); if (pixbuf is null) SWT.error (SWT.ERROR_NO_HANDLES); - OS.gdk_pixbuf_get_from_drawable (pixbuf, image.pixmap, colormap, 0, 0, 0, 0, w [0], h [0]); + OS.gdk_pixbuf_get_from_drawable (pixbuf, image.pixmap, colormap, 0, 0, 0, 0, w, h); if (hasAlpha) { byte [] alpha = data.alphaData; int stride = OS.gdk_pixbuf_get_rowstride (pixbuf); - int /*long*/ pixels = OS.gdk_pixbuf_get_pixels (pixbuf); + auto pixels = OS.gdk_pixbuf_get_pixels (pixbuf); byte [] line = new byte [stride]; - for (int y = 0; y < h [0]; y++) { - int /*long*/ offset = pixels + (y * stride); - OS.memmove (line, offset, stride); - for (int x = 0; x < w [0]; x++) { - line [x*4+3] = alpha [y*w [0]+x]; + for (int y = 0; y < h; y++) { + auto offset = pixels + (y * stride); + memmove (line.ptr, offset, stride); + for (int x = 0; x < w; x++) { + line [x*4+3] = alpha [y*w+x]; } - OS.memmove (offset, line, stride); + memmove (offset, line.ptr, stride); } } } @@ -1126,7 +1091,7 @@ } } Runnable [] newDisposeList = new Runnable [disposeList.length + 4]; - System.arraycopy (disposeList, 0, newDisposeList, 0, disposeList.length); + SimpleType!(Runnable).arraycopy (disposeList, 0, newDisposeList, 0, disposeList.length); newDisposeList [disposeList.length] = runnable; disposeList = newDisposeList; } @@ -1143,7 +1108,11 @@ SWT.error (code); } -int /*long*/ eventProc (int /*long*/ event, int /*long*/ data) { +private static extern(C) void eventProcFunc (GdkEvent* event, void* data) { + Display disp = cast(Display)data; + disp.eventProcMeth(event); +} +void eventProcMeth (GdkEvent* event) { /* * Use gdk_event_get_time() rather than event.time or * gtk_get_current_event_time(). If the event does not @@ -1189,8 +1158,8 @@ */ Shell shell = null; Control control = null; - int /*long*/ grabHandle = OS.gtk_grab_get_current (); - if (grabHandle !is null && OS.GTK_IS_WINDOW (grabHandle) && OS.gtk_window_get_modal (grabHandle)) { + auto grabHandle = OS.gtk_grab_get_current (); + if (grabHandle !is null && OS.GTK_IS_WINDOW (grabHandle) && OS.gtk_window_get_modal (cast(GtkWindow*)grabHandle)) { switch (eventType) { case OS.GDK_KEY_PRESS: case OS.GDK_KEY_RELEASE: @@ -1201,15 +1170,14 @@ case OS.GDK_3BUTTON_PRESS: case OS.GDK_BUTTON_RELEASE: case OS.GDK_MOTION_NOTIFY: { - int /*long*/ window = OS.GDK_EVENT_WINDOW (event); - int /*long*/ [] user_data = new int /*long*/ [1]; + auto window = OS.GDK_EVENT_WINDOW (cast(GdkEventAny*)event); do { - OS.gdk_window_get_user_data (window, user_data); - int /*long*/ handle = user_data [0]; + GtkWidget* handle; + OS.gdk_window_get_user_data (window, cast(void**) &handle); if (handle !is null) { Widget widget = getWidget (handle); if (widget !is null && (null !is cast(Control)widget)) { - control = (Control) widget; + control = cast(Control) widget; break; } } @@ -1251,7 +1219,7 @@ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> * </ul> */ -public Widget findWidget (int /*long*/ handle) { +public Widget findWidget (GtkWidget* handle) { checkDevice (); return getWidget (handle); } @@ -1278,7 +1246,7 @@ * * @since 3.1 */ -public Widget findWidget (int /*long*/ handle, int id) { +public Widget findWidget (GtkWidget* handle, int id) { checkDevice (); return null; } @@ -1305,55 +1273,44 @@ return null; } -static int /*long*/ fixedClassInitProc (int /*long*/ g_class, int /*long*/ class_data) { - GtkWidgetClass klass = new GtkWidgetClass (); - OS.memmove (klass, g_class); - klass.map = fixedMapProc; - OS.memmove (g_class, klass); - return 0; +private static extern(C) void fixedClassInitProcFunc (void* g_class, void* class_data) { + GtkWidgetClass* klass = cast(GtkWidgetClass*)g_class; + klass.map = &fixedMapProcFunc; } -static int /*long*/ fixedMapProc (int /*long*/ handle) { +private static extern(C) void fixedMapProcFunc (GtkWidget * handle) { Display display = getCurrent (); Widget widget = display.getWidget (handle); - if (widget !is null) return widget.fixedMapProc (handle); - return 0; + if (widget !is null) widget.fixedMapProc (handle); } -static int /*long*/ rendererClassInitProc (int /*long*/ g_class, int /*long*/ class_data) { - GtkCellRendererClass klass = new GtkCellRendererClass (); - OS.memmove (klass, g_class); - klass.render = rendererRenderProc; - klass.get_size = rendererGetSizeProc; - OS.memmove (g_class, klass); - return 0; +private static extern(C) void rendererClassInitProcFunc (void* g_class, void* class_data) { + GtkCellRendererClass* klass = cast(GtkCellRendererClass*)g_class; + klass.render = &rendererRenderProcFunc; + klass.get_size = &rendererGetSizeProcFunc; } - -static int /*long*/ rendererGetSizeProc (int /*long*/ cell, int /*long*/ handle, int /*long*/ cell_area, int /*long*/ x_offset, int /*long*/ y_offset, int /*long*/ width, int /*long*/ height) { +private static extern(C) void rendererGetSizeProcFunc(GtkCellRenderer *cell, GtkWidget *handle, GdkRectangle *cell_area, int *x_offset, int *y_offset, int *width, int *height) { Display display = getCurrent (); Widget widget = display.getWidget (handle); - if (widget !is null) return widget.rendererGetSizeProc (cell, handle, cell_area, x_offset, y_offset, width, height); - return 0; + if (widget !is null) widget.rendererGetSizeProc (cell, handle, cell_area, x_offset, y_offset, width, height); +} +private static extern(C) void rendererRenderProcFunc(GtkCellRenderer * cell, GdkDrawable * window, GtkWidget * handle, GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, int flags){ + Display display = getCurrent (); + Widget widget = display.getWidget (handle); + if (widget !is null) widget.rendererRenderProc (cell, window, handle, background_area, cell_area, expose_area, flags); } -static int /*long*/ rendererRenderProc (int /*long*/ cell, int /*long*/ window, int /*long*/ handle, int /*long*/ background_area, int /*long*/ cell_area, int /*long*/ expose_area, int /*long*/ flags) { - Display display = getCurrent (); - Widget widget = display.getWidget (handle); - if (widget !is null) return widget.rendererRenderProc (cell, window, handle, background_area, cell_area, expose_area, flags); - return 0; -} - -void flushExposes (int /*long*/ window, bool all) { +void flushExposes (GdkWindow* window, bool all) { OS.gdk_flush (); OS.gdk_flush (); if (OS.GDK_WINDOWING_X11 ()) { this.flushWindow = window; this.flushAll = all; - int /*long*/ xDisplay = OS.GDK_DISPLAY (); - int /*long*/ xEvent = OS.g_malloc (XEvent.sizeof); - OS.XCheckIfEvent (xDisplay, xEvent, checkIfEventProc, 0); + auto xDisplay = OS.GDK_DISPLAY (); + auto xEvent = cast(XEvent*)OS.g_malloc (XEvent.sizeof); + OS.XCheckIfEvent (xDisplay, xEvent, &checkIfEventProcFunc, cast(void*)this ); OS.g_free (xEvent); - this.flushWindow = 0; + this.flushWindow = null; } } @@ -1397,7 +1354,7 @@ * @return the current display */ public static synchronized Display getCurrent () { - Thread current = Thread.currentThread (); + Thread current = Thread.getThis (); for (int i=0; i<Displays.length; i++) { Display display = Displays [i]; if (display !is null && display.thread is current) return display; @@ -1407,19 +1364,19 @@ int getCaretBlinkTime () { // checkDevice (); - int /*long*/ settings = OS.gtk_settings_get_default (); + auto settings = OS.gtk_settings_get_default (); if (settings is null) return 500; - int [] buffer = new int [1]; - OS.g_object_get (settings, OS.gtk_cursor_blink, buffer, 0); - if (buffer [0] is 0) return 0; - OS.g_object_get (settings, OS.gtk_cursor_blink_time, buffer, 0); - if (buffer [0] is 0) return 500; + int buffer; + OS.g_object_get1 (settings, OS.gtk_cursor_blink.ptr, &buffer ); + if (buffer is 0) return 0; + OS.g_object_get1 (settings, OS.gtk_cursor_blink_time.ptr, &buffer); + if (buffer is 0) return 500; /* * By experimentation, GTK application don't use the whole * blink cycle time. Instead, they divide up the time, using * an effective blink rate of about 1/2 the total time. */ - return buffer [0] / 2; + return buffer / 2; } /** @@ -1436,17 +1393,16 @@ */ public Control getCursorControl () { checkDevice(); - int[] x = new int[1], y = new int[1]; - int /*long*/ window = OS.gdk_window_at_pointer (x,y); + int x, y; + auto window = OS.gdk_window_at_pointer (&x, &y); if (window is null) return null; - int /*long*/ [] user_data = new int /*long*/ [1]; - OS.gdk_window_get_user_data (window, user_data); - int /*long*/ handle = user_data [0]; + GtkWidget* handle; + OS.gdk_window_get_user_data (window, cast(void**)&handle); if (handle is null) return null; do { Widget widget = getWidget (handle); if (widget !is null && (null !is cast(Control)widget)) { - Control control = (Control) widget; + Control control = cast(Control) widget; if (control.isEnabled ()) return control; } } while ((handle = OS.gtk_widget_get_parent (handle)) !is null); @@ -1463,1551 +1419,1562 @@ return filterTable.hooks (eventType); } -int /*long*/ filterProc (int /*long*/ xEvent, int /*long*/ gdkEvent, int /*long*/ data) { - if (data is null) { - /* - * Feature in GTK. When button 4, 5, 6, or 7 is released, GTK - * does not deliver a corresponding GTK event. Button 6 and 7 - * are mapped to buttons 4 and 5 in SWT. The fix is to change - * the button number of the event to a negative number so that - * it gets dispatched by GTK. SWT has been modified to look - * for negative button numbers. - */ - XButtonEvent mouseEvent = new XButtonEvent (); - OS.memmove (mouseEvent, xEvent, 4); - if (mouseEvent.type is OS.ButtonRelease) { - OS.memmove (mouseEvent, xEvent, XButtonEvent.sizeof); - switch (mouseEvent.button) { - case 6: - case 7: - mouseEvent.button = -mouseEvent.button; - OS.memmove (xEvent, mouseEvent, XButtonEvent.sizeof); - break; - } - } - } - Widget widget = getWidget (data); - if (widget is null) return 0; - return widget.filterProc (xEvent, gdkEvent, data); -} - -/** - * Returns the location of the on-screen pointer relative - * to the top left corner of the screen. - * - * @return the cursor location - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - */ -public Point getCursorLocation () { - checkDevice (); - int [] x = new int [1], y = new int [1]; - OS.gdk_window_get_pointer (0, x, y, null); - return new Point (x [0], y [0]); -} - -/** - * Returns an array containing the recommended cursor sizes. - * - * @return the array of cursor sizes - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @since 3.0 - */ -public Point [] getCursorSizes () { - checkDevice (); - return new Point [] {new Point (16, 16), new Point (32, 32)}; +private static extern(C) GdkFilterReturn filterProcFunc (GdkXEvent* xEvent, GdkEvent* gdkEvent, void* data) { + auto disp = cast(Display)data; + return disp.filterProcMeth(xEvent,gdkEvent); } -/** - * Returns the application defined property of the receiver - * with the specified name, or null if it has not been set. - * <p> - * Applications may have associated arbitrary objects with the - * receiver in this fashion. If the objects stored in the - * properties need to be notified when the display is disposed - * of, it is the application's responsibility to provide a - * <code>disposeExec()</code> handler which does so. - * </p> - * - * @param key the name of the property - * @return the value of the property or null if it has not been set - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the key is null</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see #setData(String, Object) - * @see #disposeExec(Runnable) - */ -public Object getData (char[] key) { - checkDevice (); - if (key is null) error (SWT.ERROR_NULL_ARGUMENT); - if (key ==/*eq*/ DISPATCH_EVENT_KEY) { - return dispatchEvents; - } - if (keys is null) return null; - for (int i=0; i<keys.length; i++) { - if (keys [i] ==/*eq*/ key) return values [i]; - } - return null; +GdkFilterReturn filterProcMeth (GdkXEvent* xEvent, GdkEvent* gdkEvent) { +// /* +// * Feature in GTK. When button 4, 5, 6, or 7 is released, GTK +// * does not deliver a corresponding GTK event. Button 6 and 7 +// * are mapped to buttons 4 and 5 in SWT. The fix is to change +// * the button number of the event to a negative number so that +// * it gets dispatched by GTK. SWT has been modified to look +// * for negative button numbers. +// */ +// XButtonEvent* mouseEvent = cast(XButtonEvent*) xEvent; +// if (mouseEvent.type is OS.ButtonRelease) { +// switch (mouseEvent.button) { +// case 6: +// case 7: +// mouseEvent.button = -mouseEvent.button; +// break; +// } +// } +// Widget widget = getWidget (data); +// if (widget is null) return 0; +// return widget.filterProc (xEvent, gdkEvent, data); +return GdkFilterReturn.init; } - -/** - * Returns the application defined, display specific data - * associated with the receiver, or null if it has not been - * set. The <em>display specific data</em> is a single, - * unnamed field that is stored with every display. - * <p> - * Applications may put arbitrary objects in this field. If - * the object stored in the display specific data needs to - * be notified when the display is disposed of, it is the - * application's responsibility to provide a - * <code>disposeExec()</code> handler which does so. - * </p> - * - * @return the display specific data - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see #setData(Object) - * @see #disposeExec(Runnable) - */ -public Object getData () { - checkDevice (); - return data; -} - -/** - * Returns a point whose x coordinate is the horizontal - * dots per inch of the display, and whose y coordinate - * is the vertical dots per inch of the display. - * - * @return the horizontal and vertical DPI - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public Point getDPI () { - checkDevice (); - int widthMM = OS.gdk_screen_width_mm (); - int width = OS.gdk_screen_width (); - int dpi = Compatibility.round (254 * width, widthMM * 10); - return new Point (dpi, dpi); -} - -int /*long*/ gtk_fixed_get_type () { - return fixed_type; -} - -int /*long*/ gtk_cell_renderer_text_get_type () { - return text_renderer_type; -} - -int /*long*/ gtk_cell_renderer_pixbuf_get_type () { - return pixbuf_renderer_type; -} - -int /*long*/ gtk_cell_renderer_toggle_get_type () { - return toggle_renderer_type; -} - -/** - * Returns the default display. One is created (making the - * thread that invokes this method its user-interface thread) - * if it did not already exist. - * - * @return the default display - */ +// +// /** +// * Returns the location of the on-screen pointer relative +// * to the top left corner of the screen. +// * +// * @return the cursor location +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// */ +// public Point getCursorLocation () { +// checkDevice (); +// int [] x = new int [1], y = new int [1]; +// OS.gdk_window_get_pointer (0, x, y, null); +// return new Point (x [0], y [0]); +// } +// +// /** +// * Returns an array containing the recommended cursor sizes. +// * +// * @return the array of cursor sizes +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @since 3.0 +// */ +// public Point [] getCursorSizes () { +// checkDevice (); +// return [new Point (16, 16), new Point (32, 32)]; +// } +// +// /** +// * Returns the application defined property of the receiver +// * with the specified name, or null if it has not been set. +// * <p> +// * Applications may have associated arbitrary objects with the +// * receiver in this fashion. If the objects stored in the +// * properties need to be notified when the display is disposed +// * of, it is the application's responsibility to provide a +// * <code>disposeExec()</code> handler which does so. +// * </p> +// * +// * @param key the name of the property +// * @return the value of the property or null if it has not been set +// * +// * @exception IllegalArgumentException <ul> +// * <li>ERROR_NULL_ARGUMENT - if the key is null</li> +// * </ul> +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see #setData(String, Object) +// * @see #disposeExec(Runnable) +// */ +// public Object getData (char[] key) { +// checkDevice (); +// if (key is null) error (SWT.ERROR_NULL_ARGUMENT); +// if (key ==/*eq*/ DISPATCH_EVENT_KEY) { +// return dispatchEvents; +// } +// if (keys is null) return null; +// for (int i=0; i<keys.length; i++) { +// if (keys [i] ==/*eq*/ key) return values [i]; +// } +// return null; +// } +// +// /** +// * Returns the application defined, display specific data +// * associated with the receiver, or null if it has not been +// * set. The <em>display specific data</em> is a single, +// * unnamed field that is stored with every display. +// * <p> +// * Applications may put arbitrary objects in this field. If +// * the object stored in the display specific data needs to +// * be notified when the display is disposed of, it is the +// * application's responsibility to provide a +// * <code>disposeExec()</code> handler which does so. +// * </p> +// * +// * @return the display specific data +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see #setData(Object) +// * @see #disposeExec(Runnable) +// */ +// public Object getData () { +// checkDevice (); +// return data; +// } +// +// /** +// * Returns a point whose x coordinate is the horizontal +// * dots per inch of the display, and whose y coordinate +// * is the vertical dots per inch of the display. +// * +// * @return the horizontal and vertical DPI +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * </ul> +// */ +// public Point getDPI () { +// checkDevice (); +// int widthMM = OS.gdk_screen_width_mm (); +// int width = OS.gdk_screen_width (); +// int dpi = Compatibility.round (254 * width, widthMM * 10); +// return new Point (dpi, dpi); +// } +// +// int /*long*/ gtk_fixed_get_type () { +// return fixed_type; +// } +// +// int /*long*/ gtk_cell_renderer_text_get_type () { +// return text_renderer_type; +// } +// +// int /*long*/ gtk_cell_renderer_pixbuf_get_type () { +// return pixbuf_renderer_type; +// } +// +// int /*long*/ gtk_cell_renderer_toggle_get_type () { +// return toggle_renderer_type; +// } +// +// /** +// * Returns the default display. One is created (making the +// * thread that invokes this method its user-interface thread) +// * if it did not already exist. +// * +// * @return the default display +// */ public static synchronized Display getDefault () { if (Default is null) Default = new Display (); return Default; } - -static bool isValidClass (Class clazz) { - char[] name = clazz.getName (); - int index = name.lastIndexOf ('.'); - return name.substring (0, index + 1)==/*eq*/ PACKAGE_PREFIX; -} - -/** - * Returns the button dismissal alignment, one of <code>LEFT</code> or <code>RIGHT</code>. - * The button dismissal alignment is the ordering that should be used when positioning the - * default dismissal button for a dialog. For example, in a dialog that contains an OK and - * CANCEL button, on platforms where the button dismissal alignment is <code>LEFT</code>, the - * button ordering should be OK/CANCEL. When button dismissal alignment is <code>RIGHT</code>, - * the button ordering should be CANCEL/OK. - * - * @return the button dismissal order - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @since 2.1 - */ -public int getDismissalAlignment () { - checkDevice (); - return SWT.RIGHT; -} - -/** - * Returns the longest duration, in milliseconds, between - * two mouse button clicks that will be considered a - * <em>double click</em> by the underlying operating system. - * - * @return the double click time - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - */ -public int getDoubleClickTime () { - checkDevice (); - int /*long*/ settings = OS.gtk_settings_get_default (); - int [] buffer = new int [1]; - OS.g_object_get (settings, OS.gtk_double_click_time, buffer, 0); - return buffer [0]; -} - -/** - * Returns the control which currently has keyboard focus, - * or null if keyboard events are not currently going to - * any of the controls built by the currently running - * application. - * - * @return the control under the cursor - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - */ -public Control getFocusControl () { - checkDevice (); - if (focusControl !is null && !focusControl.isDisposed ()) { - return focusControl; - } - if (activeShell is null) return null; - int /*long*/ shellHandle = activeShell.shellHandle; - int /*long*/ handle = OS.gtk_window_get_focus (shellHandle); - if (handle is null) return null; - do { - Widget widget = getWidget (handle); - if (widget !is null && (null !is cast(Control)widget)) { - Control control = (Control) widget; - return control.isEnabled () ? control : null; - } - } while ((handle = OS.gtk_widget_get_parent (handle)) !is null); - return null; -} - -/** - * Returns true when the high contrast mode is enabled. - * Otherwise, false is returned. - * <p> - * Note: This operation is a hint and is not supported on - * platforms that do not have this concept. - * </p> - * - * @return the high contrast mode - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @since 3.0 - */ -public bool getHighContrast () { - checkDevice (); - return false; -} - -public int getDepth () { - checkDevice (); - GdkVisual visual = new GdkVisual (); - OS.memmove (visual, OS.gdk_visual_get_system()); - return visual.depth; -} - -/** - * Returns the maximum allowed depth of icons on this display, in bits per pixel. - * On some platforms, this may be different than the actual depth of the display. - * - * @return the maximum icon depth - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see Device#getDepth - */ -public int getIconDepth () { - checkDevice (); - return getDepth (); -} - -/** - * Returns an array containing the recommended icon sizes. - * - * @return the array of icon sizes - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see Decorations#setImages(Image[]) - * - * @since 3.0 - */ -public Point [] getIconSizes () { - checkDevice (); - return new Point [] {new Point (16, 16), new Point (32, 32)}; -} - -int getLastEventTime () { - return lastEventTime; -} - -int getMessageCount () { - return synchronizer.getMessageCount (); -} - -/** - * Returns the work area, an EWMH property to store the size - * and position of the screen not covered by dock and panel - * windows. See http://freedesktop.org/Standards/wm-spec. - */ -Rectangle getWorkArea() { - byte[] name = Converter.wcsToMbcs (null, "_NET_WORKAREA", true); - int /*long*/ atom = OS.gdk_atom_intern (name, true); - if (atom is OS.GDK_NONE) return null; - int /*long*/[] actualType = new int /*long*/[1]; - int[] actualFormat = new int[1]; - int[] actualLength = new int[1]; - int /*long*/[] data = new int /*long*/[1]; - if (!OS.gdk_property_get (OS.GDK_ROOT_PARENT (), atom, OS.GDK_NONE, 0, 16, 0, actualType, actualFormat, actualLength, data)) { - return null; - } - Rectangle result = null; - if (data [0] !is 0) { - if (actualLength [0] is 16) { - int values [] = new int [4]; - OS.memmove (values, data[0], 16); - result = new Rectangle (values [0],values [1],values [2],values [3]); - } else if (actualLength [0] is 32) { - long values [] = new long [4]; - OS.memmove (values, data[0], 32); - result = new Rectangle (cast(int)values [0],cast(int)values [1],cast(int)values [2],cast(int)values [3]); - } - OS.g_free (data [0]); - } - return result; -} - -/** - * Returns an array of monitors attached to the device. - * - * @return the array of monitors - * - * @since 3.0 - */ -public Monitor [] getMonitors () { - checkDevice (); - Monitor [] monitors = null; - Rectangle workArea = getWorkArea(); - int /*long*/ screen = OS.gdk_screen_get_default (); - if (screen !is null) { - int monitorCount = OS.gdk_screen_get_n_monitors (screen); - if (monitorCount > 0) { - monitors = new Monitor [monitorCount]; - GdkRectangle dest = new GdkRectangle (); - for (int i = 0; i < monitorCount; i++) { - OS.gdk_screen_get_monitor_geometry (screen, i, dest); - Monitor monitor = new Monitor (); - monitor.handle = i; - monitor.x = dest.x; - monitor.y = dest.y; - monitor.width = dest.width; - monitor.height = dest.height; - if (i is 0 && workArea !is null) { - monitor.clientX = workArea.x; - monitor.clientY = workArea.y; - monitor.clientWidth = workArea.width; - monitor.clientHeight = workArea.height; - } else { - monitor.clientX = monitor.x; - monitor.clientY = monitor.y; - monitor.clientWidth = monitor.width; - monitor.clientHeight = monitor.height; - } - monitors [i] = monitor; - } - } - } - if (monitors is null) { - /* No multimonitor support detected, default to one monitor */ - Monitor monitor = new Monitor (); - Rectangle bounds = getBounds (); - monitor.x = bounds.x; - monitor.y = bounds.y; - monitor.width = bounds.width; - monitor.height = bounds.height; - if (workArea !is null) { - monitor.clientX = workArea.x; - monitor.clientY = workArea.y; - monitor.clientWidth = workArea.width; - monitor.clientHeight = workArea.height; - } else { - monitor.clientX = monitor.x; - monitor.clientY = monitor.y; - monitor.clientWidth = monitor.width; - monitor.clientHeight = monitor.height; - } - monitors = new Monitor [] { monitor }; - } - return monitors; -} - -/** - * Returns the primary monitor for that device. - * - * @return the primary monitor - * - * @since 3.0 - */ -public Monitor getPrimaryMonitor () { - checkDevice (); - Monitor [] monitors = getMonitors (); - return monitors [0]; -} - -/** - * Returns a (possibly empty) array containing all shells which have - * not been disposed and have the receiver as their display. - * - * @return the receiver's shells - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - */ -public Shell [] getShells () { - checkDevice (); - int index = 0; - Shell [] result = new Shell [16]; - for (int i = 0; i < widgetTable.length; i++) { - Widget widget = widgetTable [i]; - if (widget !is null && (null !is cast(Shell)widget)) { - int j = 0; - while (j < index) { - if (result [j] is widget) break; - j++; - } - if (j is index) { - if (index is result.length) { - Shell [] newResult = new Shell [index + 16]; - System.arraycopy (result, 0, newResult, 0, index); - result = newResult; - } - result [index++] = (Shell) widget; - } - } - } - if (index is result.length) return result; - Shell [] newResult = new Shell [index]; - System.arraycopy (result, 0, newResult, 0, index); - return newResult; -} - -/** - * Returns the thread that has invoked <code>syncExec</code> - * or null if no such runnable is currently being invoked by - * the user-interface thread. - * <p> - * Note: If a runnable invoked by asyncExec is currently - * running, this method will return null. - * </p> - * - * @return the receiver's sync-interface thread - * - * @exception SWTException <ul> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - */ -public Thread getSyncThread () { - if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED); - return synchronizer.syncThread; -} - -/** - * Returns the matching standard color for the given - * constant, which should be one of the color constants - * specified in class <code>SWT</code>. Any value other - * than one of the SWT color constants which is passed - * in will result in the color black. This color should - * not be free'd because it was allocated by the system, - * not the application. - * - * @param id the color constant - * @return the matching color - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see SWT - */ -public Color getSystemColor (int id) { - checkDevice (); - GdkColor gdkColor = null; - switch (id) { - case SWT.COLOR_INFO_FOREGROUND: gdkColor = COLOR_INFO_FOREGROUND; break; - case SWT.COLOR_INFO_BACKGROUND: gdkColor = COLOR_INFO_BACKGROUND; break; - case SWT.COLOR_TITLE_FOREGROUND: gdkColor = COLOR_TITLE_FOREGROUND; break; - case SWT.COLOR_TITLE_BACKGROUND: gdkColor = COLOR_TITLE_BACKGROUND; break; - case SWT.COLOR_TITLE_BACKGROUND_GRADIENT: gdkColor = COLOR_TITLE_BACKGROUND_GRADIENT; break; - case SWT.COLOR_TITLE_INACTIVE_FOREGROUND: gdkColor = COLOR_TITLE_INACTIVE_FOREGROUND; break; - case SWT.COLOR_TITLE_INACTIVE_BACKGROUND: gdkColor = COLOR_TITLE_INACTIVE_BACKGROUND; break; - case SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT: gdkColor = COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT; break; - case SWT.COLOR_WIDGET_DARK_SHADOW: gdkColor = COLOR_WIDGET_DARK_SHADOW; break; - case SWT.COLOR_WIDGET_NORMAL_SHADOW: gdkColor = COLOR_WIDGET_NORMAL_SHADOW; break; - case SWT.COLOR_WIDGET_LIGHT_SHADOW: gdkColor = COLOR_WIDGET_LIGHT_SHADOW; break; - case SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW: gdkColor = COLOR_WIDGET_HIGHLIGHT_SHADOW; break; - case SWT.COLOR_WIDGET_BACKGROUND: gdkColor = COLOR_WIDGET_BACKGROUND; break; - case SWT.COLOR_WIDGET_FOREGROUND: gdkColor = COLOR_WIDGET_FOREGROUND; break; - case SWT.COLOR_WIDGET_BORDER: gdkColor = COLOR_WIDGET_BORDER; break; - case SWT.COLOR_LIST_FOREGROUND: gdkColor = COLOR_LIST_FOREGROUND; break; - case SWT.COLOR_LIST_BACKGROUND: gdkColor = COLOR_LIST_BACKGROUND; break; - case SWT.COLOR_LIST_SELECTION: gdkColor = COLOR_LIST_SELECTION; break; - case SWT.COLOR_LIST_SELECTION_TEXT: gdkColor = COLOR_LIST_SELECTION_TEXT; break; - default: - return super.getSystemColor (id); - } - if (gdkColor is null) return super.getSystemColor (SWT.COLOR_BLACK); - return Color.gtk_new (this, gdkColor); -} - -/** - * Returns the matching standard platform cursor for the given - * constant, which should be one of the cursor constants - * specified in class <code>SWT</code>. This cursor should - * not be free'd because it was allocated by the system, - * not the application. A value of <code>null</code> will - * be returned if the supplied constant is not an SWT cursor - * constant. - * - * @param id the SWT cursor constant - * @return the corresponding cursor or <code>null</code> - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see SWT#CURSOR_ARROW - * @see SWT#CURSOR_WAIT - * @see SWT#CURSOR_CROSS - * @see SWT#CURSOR_APPSTARTING - * @see SWT#CURSOR_HELP - * @see SWT#CURSOR_SIZEALL - * @see SWT#CURSOR_SIZENESW - * @see SWT#CURSOR_SIZENS - * @see SWT#CURSOR_SIZENWSE - * @see SWT#CURSOR_SIZEWE - * @see SWT#CURSOR_SIZEN - * @see SWT#CURSOR_SIZES - * @see SWT#CURSOR_SIZEE - * @see SWT#CURSOR_SIZEW - * @see SWT#CURSOR_SIZENE - * @see SWT#CURSOR_SIZESE - * @see SWT#CURSOR_SIZESW - * @see SWT#CURSOR_SIZENW - * @see SWT#CURSOR_UPARROW - * @see SWT#CURSOR_IBEAM - * @see SWT#CURSOR_NO - * @see SWT#CURSOR_HAND - * - * @since 3.0 - */ -public Cursor getSystemCursor (int id) { - checkDevice (); - if (!(0 <= id && id < cursors.length)) return null; - if (cursors [id] is null) { - cursors [id] = new Cursor (this, id); - } - return cursors [id]; -} - -/** - * Returns the matching standard platform image for the given - * constant, which should be one of the icon constants - * specified in class <code>SWT</code>. This image should - * not be free'd because it was allocated by the system, - * not the application. A value of <code>null</code> will - * be returned either if the supplied constant is not an - * SWT icon constant or if the platform does not define an - * image that corresponds to the constant. - * - * @param id the SWT icon constant - * @return the corresponding image or <code>null</code> - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see SWT#ICON_ERROR - * @see SWT#ICON_INFORMATION - * @see SWT#ICON_QUESTION - * @see SWT#ICON_WARNING - * @see SWT#ICON_WORKING - * - * @since 3.0 - */ -public Image getSystemImage (int id) { - checkDevice (); - switch (id) { - case SWT.ICON_ERROR: - if (errorImage is null) { - errorImage = createImage ("gtk-dialog-error"); - } - return errorImage; - case SWT.ICON_INFORMATION: - case SWT.ICON_WORKING: - if (infoImage is null) { - infoImage = createImage ("gtk-dialog-info"); - } - return infoImage; - case SWT.ICON_QUESTION: - if (questionImage is null) { - questionImage = createImage ("gtk-dialog-question"); - } - return questionImage; - case SWT.ICON_WARNING: - if (warningImage is null) { - warningImage = createImage ("gtk-dialog-warning"); - } - return warningImage; - } - return null; -} - -void initializeSystemColors () { - GdkColor gdkColor; - - /* Get Tooltip resources */ - int /*long*/ tooltipShellHandle = OS.gtk_window_new (OS.GTK_WINDOW_POPUP); - if (tooltipShellHandle is null) SWT.error (SWT.ERROR_NO_HANDLES); - byte[] gtk_tooltips = Converter.wcsToMbcs (null, "gtk-tooltips", true); - OS.gtk_widget_set_name (tooltipShellHandle, gtk_tooltips); - OS.gtk_widget_realize (tooltipShellHandle); - int /*long*/ tooltipStyle = OS.gtk_widget_get_style (tooltipShellHandle); - gdkColor = new GdkColor(); - OS.gtk_style_get_fg (tooltipStyle, OS.GTK_STATE_NORMAL, gdkColor); - COLOR_INFO_FOREGROUND = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_bg (tooltipStyle, OS.GTK_STATE_NORMAL, gdkColor); - COLOR_INFO_BACKGROUND = gdkColor; - OS.gtk_widget_destroy (tooltipShellHandle); - - /* Get Shell resources */ - int /*long*/ style = OS.gtk_widget_get_style (shellHandle); - gdkColor = new GdkColor(); - OS.gtk_style_get_black (style, gdkColor); - COLOR_WIDGET_DARK_SHADOW = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_dark (style, OS.GTK_STATE_NORMAL, gdkColor); - COLOR_WIDGET_NORMAL_SHADOW = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_bg (style, OS.GTK_STATE_NORMAL, gdkColor); - COLOR_WIDGET_LIGHT_SHADOW = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_light (style, OS.GTK_STATE_NORMAL, gdkColor); - COLOR_WIDGET_HIGHLIGHT_SHADOW = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_fg (style, OS.GTK_STATE_NORMAL, gdkColor); - COLOR_WIDGET_FOREGROUND = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_bg (style, OS.GTK_STATE_NORMAL, gdkColor); - COLOR_WIDGET_BACKGROUND = gdkColor; - //gdkColor = new GdkColor(); - //OS.gtk_style_get_text (style, OS.GTK_STATE_NORMAL, gdkColor); - //COLOR_TEXT_FOREGROUND = gdkColor; - //gdkColor = new GdkColor(); - //OS.gtk_style_get_base (style, OS.GTK_STATE_NORMAL, gdkColor); - //COLOR_TEXT_BACKGROUND = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_text (style, OS.GTK_STATE_NORMAL, gdkColor); - COLOR_LIST_FOREGROUND = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_base (style, OS.GTK_STATE_NORMAL, gdkColor); - COLOR_LIST_BACKGROUND = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_text (style, OS.GTK_STATE_SELECTED, gdkColor); - COLOR_LIST_SELECTION_TEXT = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_base (style, OS.GTK_STATE_SELECTED, gdkColor); - COLOR_LIST_SELECTION = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_bg (style, OS.GTK_STATE_SELECTED, gdkColor); - COLOR_TITLE_BACKGROUND = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_fg (style, OS.GTK_STATE_SELECTED, gdkColor); - COLOR_TITLE_FOREGROUND = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_light (style, OS.GTK_STATE_SELECTED, gdkColor); - COLOR_TITLE_BACKGROUND_GRADIENT = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_bg (style, OS.GTK_STATE_INSENSITIVE, gdkColor); - COLOR_TITLE_INACTIVE_BACKGROUND = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_fg (style, OS.GTK_STATE_INSENSITIVE, gdkColor); - COLOR_TITLE_INACTIVE_FOREGROUND = gdkColor; - gdkColor = new GdkColor(); - OS.gtk_style_get_light (style, OS.GTK_STATE_INSENSITIVE, gdkColor); - COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT = gdkColor; -} - -/** - * Returns a reasonable font for applications to use. - * On some platforms, this will match the "default font" - * or "system font" if such can be found. This font - * should not be free'd because it was allocated by the - * system, not the application. - * <p> - * Typically, applications which want the default look - * should simply not set the font on the widgets they - * create. Widgets are always created with the correct - * default font for the class of user-interface component - * they represent. - * </p> - * - * @return a font - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - */ -public Font getSystemFont () { - checkDevice (); - if (systemFont !is null) return systemFont; - int /*long*/ style = OS.gtk_widget_get_style (shellHandle); - int /*long*/ defaultFont = OS.pango_font_description_copy (OS.gtk_style_get_font_desc (style)); - return systemFont = Font.gtk_new (this, defaultFont); -} - -/** - * Returns the single instance of the system tray or null - * when there is no system tray available for the platform. - * - * @return the system tray or <code>null</code> - * - * @exception SWTException <ul> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @since 3.0 - */ -public Tray getSystemTray () { - checkDevice (); - if (tray !is null) return tray; - return tray = new Tray (this, SWT.NONE); -} - -/** - * Returns the user-interface thread for the receiver. - * - * @return the receiver's user-interface thread - * - * @exception SWTException <ul> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - */ -public Thread getThread () { - if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED); - return thread; -} - -Widget getWidget (int /*long*/ handle) { - if (handle is null) return null; - if (lastWidget !is null && lastHandle is handle) return lastWidget; - int /*long*/ index = OS.g_object_get_qdata (handle, SWT_OBJECT_INDEX) - 1; - if (0 <= index && index < widgetTable.length) { - lastHandle = handle; - return lastWidget = widgetTable [cast(int)/*64*/index]; - } +// +// /+static bool isValidClass (Class clazz) { +// //PROTING_TODO char[] name = clazz.getName (); +// //PROTING_TODO int index = name.lastIndexOf ('.'); +// //PROTING_TODO return name.substring (0, index + 1)==/*eq*/ PACKAGE_PREFIX; +// return true; +// }+/ +// +// /** +// * Returns the button dismissal alignment, one of <code>LEFT</code> or <code>RIGHT</code>. +// * The button dismissal alignment is the ordering that should be used when positioning the +// * default dismissal button for a dialog. For example, in a dialog that contains an OK and +// * CANCEL button, on platforms where the button dismissal alignment is <code>LEFT</code>, the +// * button ordering should be OK/CANCEL. When button dismissal alignment is <code>RIGHT</code>, +// * the button ordering should be CANCEL/OK. +// * +// * @return the button dismissal order +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @since 2.1 +// */ +// public int getDismissalAlignment () { +// checkDevice (); +// return SWT.RIGHT; +// } +// +// /** +// * Returns the longest duration, in milliseconds, between +// * two mouse button clicks that will be considered a +// * <em>double click</em> by the underlying operating system. +// * +// * @return the double click time +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// */ +// public int getDoubleClickTime () { +// checkDevice (); +// auto settings = OS.gtk_settings_get_default (); +// int [] buffer = new int [1]; +// OS.g_object_get (settings, OS.gtk_double_click_time, buffer, 0); +// return buffer [0]; +// } +// +// /** +// * Returns the control which currently has keyboard focus, +// * or null if keyboard events are not currently going to +// * any of the controls built by the currently running +// * application. +// * +// * @return the control under the cursor +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// */ +// public Control getFocusControl () { +// checkDevice (); +// if (focusControl !is null && !focusControl.isDisposed ()) { +// return focusControl; +// } +// if (activeShell is null) return null; +// auto shellHandle = activeShell.shellHandle; +// auto handle = OS.gtk_window_get_focus (shellHandle); +// if (handle is null) return null; +// do { +// Widget widget = getWidget (handle); +// if (widget !is null && (null !is cast(Control)widget)) { +// Control control = cast(Control) widget; +// return control.isEnabled () ? control : null; +// } +// } while ((handle = OS.gtk_widget_get_parent (handle)) !is null); +// return null; +// } +// +// /** +// * Returns true when the high contrast mode is enabled. +// * Otherwise, false is returned. +// * <p> +// * Note: This operation is a hint and is not supported on +// * platforms that do not have this concept. +// * </p> +// * +// * @return the high contrast mode +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @since 3.0 +// */ +// public bool getHighContrast () { +// checkDevice (); +// return false; +// } +// +// public int getDepth () { +// checkDevice (); +// GdkVisual* visual = new GdkVisual (); +// memmove (visual, OS.gdk_visual_get_system()); +// return visual.depth; +// } +// +// /** +// * Returns the maximum allowed depth of icons on this display, in bits per pixel. +// * On some platforms, this may be different than the actual depth of the display. +// * +// * @return the maximum icon depth +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see Device#getDepth +// */ +// public int getIconDepth () { +// checkDevice (); +// return getDepth (); +// } +// +// /** +// * Returns an array containing the recommended icon sizes. +// * +// * @return the array of icon sizes +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see Decorations#setImages(Image[]) +// * +// * @since 3.0 +// */ +// public Point [] getIconSizes () { +// checkDevice (); +// return [new Point (16, 16), new Point (32, 32)]; +// } +// +// int getLastEventTime () { +// return lastEventTime; +// } +// +// int getMessageCount () { +// return synchronizer.getMessageCount (); +// } +// +// /** +// * Returns the work area, an EWMH property to store the size +// * and position of the screen not covered by dock and panel +// * windows. See http://freedesktop.org/Standards/wm-spec. +// */ +// Rectangle getWorkArea() { +// byte[] name = Converter.wcsToMbcs (null, "_NET_WORKAREA", true); +// auto atom = OS.gdk_atom_intern (name, true); +// if (atom is OS.GDK_NONE) return null; +// int /*long*/[] actualType = new int /*long*/[1]; +// int[] actualFormat = new int[1]; +// int[] actualLength = new int[1]; +// int /*long*/[] data = new int /*long*/[1]; +// if (!OS.gdk_property_get (OS.GDK_ROOT_PARENT (), atom, OS.GDK_NONE, 0, 16, 0, actualType, actualFormat, actualLength, data)) { +// return null; +// } +// Rectangle result = null; +// if (data [0] !is 0) { +// if (actualLength [0] is 16) { +// int values [] = new int [4]; +// memmove (values, data[0], 16); +// result = new Rectangle (values [0],values [1],values [2],values [3]); +// } else if (actualLength [0] is 32) { +// long values [] = new long [4]; +// memmove (values, data[0], 32); +// result = new Rectangle (cast(int)values [0],cast(int)values [1],cast(int)values [2],cast(int)values [3]); +// } +// OS.g_free (data [0]); +// } +// return result; +// } +// +// /** +// * Returns an array of monitors attached to the device. +// * +// * @return the array of monitors +// * +// * @since 3.0 +// */ +// public Monitor [] getMonitors () { +// checkDevice (); +// Monitor [] monitors = null; +// Rectangle workArea = getWorkArea(); +// auto screen = OS.gdk_screen_get_default (); +// if (screen !is null) { +// int monitorCount = OS.gdk_screen_get_n_monitors (screen); +// if (monitorCount > 0) { +// monitors = new Monitor [monitorCount]; +// GdkRectangle* dest = new GdkRectangle (); +// for (int i = 0; i < monitorCount; i++) { +// OS.gdk_screen_get_monitor_geometry (screen, i, dest); +// Monitor monitor = new Monitor (); +// monitor.handle = i; +// monitor.x = dest.x; +// monitor.y = dest.y; +// monitor.width = dest.width; +// monitor.height = dest.height; +// if (i is 0 && workArea !is null) { +// monitor.clientX = workArea.x; +// monitor.clientY = workArea.y; +// monitor.clientWidth = workArea.width; +// monitor.clientHeight = workArea.height; +// } else { +// monitor.clientX = monitor.x; +// monitor.clientY = monitor.y; +// monitor.clientWidth = monitor.width; +// monitor.clientHeight = monitor.height; +// } +// monitors [i] = monitor; +// } +// } +// } +// if (monitors is null) { +// /* No multimonitor support detected, default to one monitor */ +// Monitor monitor = new Monitor (); +// Rectangle bounds = getBounds (); +// monitor.x = bounds.x; +// monitor.y = bounds.y; +// monitor.width = bounds.width; +// monitor.height = bounds.height; +// if (workArea !is null) { +// monitor.clientX = workArea.x; +// monitor.clientY = workArea.y; +// monitor.clientWidth = workArea.width; +// monitor.clientHeight = workArea.height; +// } else { +// monitor.clientX = monitor.x; +// monitor.clientY = monitor.y; +// monitor.clientWidth = monitor.width; +// monitor.clientHeight = monitor.height; +// } +// monitors = [ monitor ]; +// } +// return monitors; +// } +// +// /** +// * Returns the primary monitor for that device. +// * +// * @return the primary monitor +// * +// * @since 3.0 +// */ +// public Monitor getPrimaryMonitor () { +// checkDevice (); +// Monitor [] monitors = getMonitors (); +// return monitors [0]; +// } +// +// /** +// * Returns a (possibly empty) array containing all shells which have +// * not been disposed and have the receiver as their display. +// * +// * @return the receiver's shells +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// */ +// public Shell [] getShells () { +// checkDevice (); +// int index = 0; +// Shell [] result = new Shell [16]; +// for (int i = 0; i < widgetTable.length; i++) { +// Widget widget = widgetTable [i]; +// if (widget !is null && (null !is cast(Shell)widget)) { +// int j = 0; +// while (j < index) { +// if (result [j] is widget) break; +// j++; +// } +// if (j is index) { +// if (index is result.length) { +// Shell [] newResult = new Shell [index + 16]; +// System.arraycopy (result, 0, newResult, 0, index); +// result = newResult; +// } +// result [index++] = cast(Shell) widget; +// } +// } +// } +// if (index is result.length) return result; +// Shell [] newResult = new Shell [index]; +// System.arraycopy (result, 0, newResult, 0, index); +// return newResult; +// } +// +// /** +// * Returns the thread that has invoked <code>syncExec</code> +// * or null if no such runnable is currently being invoked by +// * the user-interface thread. +// * <p> +// * Note: If a runnable invoked by asyncExec is currently +// * running, this method will return null. +// * </p> +// * +// * @return the receiver's sync-interface thread +// * +// * @exception SWTException <ul> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// */ +// public Thread getSyncThread () { +// if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED); +// return synchronizer.syncThread; +// } +// +// /** +// * Returns the matching standard color for the given +// * constant, which should be one of the color constants +// * specified in class <code>SWT</code>. Any value other +// * than one of the SWT color constants which is passed +// * in will result in the color black. This color should +// * not be free'd because it was allocated by the system, +// * not the application. +// * +// * @param id the color constant +// * @return the matching color +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see SWT +// */ +// public Color getSystemColor (int id) { +// checkDevice (); +// GdkColor gdkColor = null; +// switch (id) { +// case SWT.COLOR_INFO_FOREGROUND: gdkColor = COLOR_INFO_FOREGROUND; break; +// case SWT.COLOR_INFO_BACKGROUND: gdkColor = COLOR_INFO_BACKGROUND; break; +// case SWT.COLOR_TITLE_FOREGROUND: gdkColor = COLOR_TITLE_FOREGROUND; break; +// case SWT.COLOR_TITLE_BACKGROUND: gdkColor = COLOR_TITLE_BACKGROUND; break; +// case SWT.COLOR_TITLE_BACKGROUND_GRADIENT: gdkColor = COLOR_TITLE_BACKGROUND_GRADIENT; break; +// case SWT.COLOR_TITLE_INACTIVE_FOREGROUND: gdkColor = COLOR_TITLE_INACTIVE_FOREGROUND; break; +// case SWT.COLOR_TITLE_INACTIVE_BACKGROUND: gdkColor = COLOR_TITLE_INACTIVE_BACKGROUND; break; +// case SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT: gdkColor = COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT; break; +// case SWT.COLOR_WIDGET_DARK_SHADOW: gdkColor = COLOR_WIDGET_DARK_SHADOW; break; +// case SWT.COLOR_WIDGET_NORMAL_SHADOW: gdkColor = COLOR_WIDGET_NORMAL_SHADOW; break; +// case SWT.COLOR_WIDGET_LIGHT_SHADOW: gdkColor = COLOR_WIDGET_LIGHT_SHADOW; break; +// case SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW: gdkColor = COLOR_WIDGET_HIGHLIGHT_SHADOW; break; +// case SWT.COLOR_WIDGET_BACKGROUND: gdkColor = COLOR_WIDGET_BACKGROUND; break; +// case SWT.COLOR_WIDGET_FOREGROUND: gdkColor = COLOR_WIDGET_FOREGROUND; break; +// case SWT.COLOR_WIDGET_BORDER: gdkColor = COLOR_WIDGET_BORDER; break; +// case SWT.COLOR_LIST_FOREGROUND: gdkColor = COLOR_LIST_FOREGROUND; break; +// case SWT.COLOR_LIST_BACKGROUND: gdkColor = COLOR_LIST_BACKGROUND; break; +// case SWT.COLOR_LIST_SELECTION: gdkColor = COLOR_LIST_SELECTION; break; +// case SWT.COLOR_LIST_SELECTION_TEXT: gdkColor = COLOR_LIST_SELECTION_TEXT; break; +// default: +// return super.getSystemColor (id); +// } +// if (gdkColor is null) return super.getSystemColor (SWT.COLOR_BLACK); +// return Color.gtk_new (this, gdkColor); +// } +// +// /** +// * Returns the matching standard platform cursor for the given +// * constant, which should be one of the cursor constants +// * specified in class <code>SWT</code>. This cursor should +// * not be free'd because it was allocated by the system, +// * not the application. A value of <code>null</code> will +// * be returned if the supplied constant is not an SWT cursor +// * constant. +// * +// * @param id the SWT cursor constant +// * @return the corresponding cursor or <code>null</code> +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see SWT#CURSOR_ARROW +// * @see SWT#CURSOR_WAIT +// * @see SWT#CURSOR_CROSS +// * @see SWT#CURSOR_APPSTARTING +// * @see SWT#CURSOR_HELP +// * @see SWT#CURSOR_SIZEALL +// * @see SWT#CURSOR_SIZENESW +// * @see SWT#CURSOR_SIZENS +// * @see SWT#CURSOR_SIZENWSE +// * @see SWT#CURSOR_SIZEWE +// * @see SWT#CURSOR_SIZEN +// * @see SWT#CURSOR_SIZES +// * @see SWT#CURSOR_SIZEE +// * @see SWT#CURSOR_SIZEW +// * @see SWT#CURSOR_SIZENE +// * @see SWT#CURSOR_SIZESE +// * @see SWT#CURSOR_SIZESW +// * @see SWT#CURSOR_SIZENW +// * @see SWT#CURSOR_UPARROW +// * @see SWT#CURSOR_IBEAM +// * @see SWT#CURSOR_NO +// * @see SWT#CURSOR_HAND +// * +// * @since 3.0 +// */ +// public Cursor getSystemCursor (int id) { +// checkDevice (); +// if (!(0 <= id && id < cursors.length)) return null; +// if (cursors [id] is null) { +// cursors [id] = new Cursor (this, id); +// } +// return cursors [id]; +// } +// +// /** +// * Returns the matching standard platform image for the given +// * constant, which should be one of the icon constants +// * specified in class <code>SWT</code>. This image should +// * not be free'd because it was allocated by the system, +// * not the application. A value of <code>null</code> will +// * be returned either if the supplied constant is not an +// * SWT icon constant or if the platform does not define an +// * image that corresponds to the constant. +// * +// * @param id the SWT icon constant +// * @return the corresponding image or <code>null</code> +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see SWT#ICON_ERROR +// * @see SWT#ICON_INFORMATION +// * @see SWT#ICON_QUESTION +// * @see SWT#ICON_WARNING +// * @see SWT#ICON_WORKING +// * +// * @since 3.0 +// */ +// public Image getSystemImage (int id) { +// checkDevice (); +// switch (id) { +// case SWT.ICON_ERROR: +// if (errorImage is null) { +// errorImage = createImage ("gtk-dialog-error"); +// } +// return errorImage; +// case SWT.ICON_INFORMATION: +// case SWT.ICON_WORKING: +// if (infoImage is null) { +// infoImage = createImage ("gtk-dialog-info"); +// } +// return infoImage; +// case SWT.ICON_QUESTION: +// if (questionImage is null) { +// questionImage = createImage ("gtk-dialog-question"); +// } +// return questionImage; +// case SWT.ICON_WARNING: +// if (warningImage is null) { +// warningImage = createImage ("gtk-dialog-warning"); +// } +// return warningImage; +// } +// return null; +// } +// +// void initializeSystemColors () { +// GdkColor gdkColor; +// +// /* Get Tooltip resources */ +// auto tooltipShellHandle = OS.gtk_window_new (OS.GTK_WINDOW_POPUP); +// if (tooltipShellHandle is null) SWT.error (SWT.ERROR_NO_HANDLES); +// byte[] gtk_tooltips = Converter.wcsToMbcs (null, "gtk-tooltips", true); +// OS.gtk_widget_set_name (tooltipShellHandle, gtk_tooltips); +// OS.gtk_widget_realize (tooltipShellHandle); +// auto tooltipStyle = OS.gtk_widget_get_style (tooltipShellHandle); +// gdkColor = new GdkColor(); +// OS.gtk_style_get_fg (tooltipStyle, OS.GTK_STATE_NORMAL, gdkColor); +// COLOR_INFO_FOREGROUND = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_bg (tooltipStyle, OS.GTK_STATE_NORMAL, gdkColor); +// COLOR_INFO_BACKGROUND = gdkColor; +// OS.gtk_widget_destroy (tooltipShellHandle); +// +// /* Get Shell resources */ +// auto style = OS.gtk_widget_get_style (shellHandle); +// gdkColor = new GdkColor(); +// OS.gtk_style_get_black (style, gdkColor); +// COLOR_WIDGET_DARK_SHADOW = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_dark (style, OS.GTK_STATE_NORMAL, gdkColor); +// COLOR_WIDGET_NORMAL_SHADOW = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_bg (style, OS.GTK_STATE_NORMAL, gdkColor); +// COLOR_WIDGET_LIGHT_SHADOW = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_light (style, OS.GTK_STATE_NORMAL, gdkColor); +// COLOR_WIDGET_HIGHLIGHT_SHADOW = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_fg (style, OS.GTK_STATE_NORMAL, gdkColor); +// COLOR_WIDGET_FOREGROUND = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_bg (style, OS.GTK_STATE_NORMAL, gdkColor); +// COLOR_WIDGET_BACKGROUND = gdkColor; +// //gdkColor = new GdkColor(); +// //OS.gtk_style_get_text (style, OS.GTK_STATE_NORMAL, gdkColor); +// //COLOR_TEXT_FOREGROUND = gdkColor; +// //gdkColor = new GdkColor(); +// //OS.gtk_style_get_base (style, OS.GTK_STATE_NORMAL, gdkColor); +// //COLOR_TEXT_BACKGROUND = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_text (style, OS.GTK_STATE_NORMAL, gdkColor); +// COLOR_LIST_FOREGROUND = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_base (style, OS.GTK_STATE_NORMAL, gdkColor); +// COLOR_LIST_BACKGROUND = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_text (style, OS.GTK_STATE_SELECTED, gdkColor); +// COLOR_LIST_SELECTION_TEXT = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_base (style, OS.GTK_STATE_SELECTED, gdkColor); +// COLOR_LIST_SELECTION = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_bg (style, OS.GTK_STATE_SELECTED, gdkColor); +// COLOR_TITLE_BACKGROUND = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_fg (style, OS.GTK_STATE_SELECTED, gdkColor); +// COLOR_TITLE_FOREGROUND = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_light (style, OS.GTK_STATE_SELECTED, gdkColor); +// COLOR_TITLE_BACKGROUND_GRADIENT = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_bg (style, OS.GTK_STATE_INSENSITIVE, gdkColor); +// COLOR_TITLE_INACTIVE_BACKGROUND = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_fg (style, OS.GTK_STATE_INSENSITIVE, gdkColor); +// COLOR_TITLE_INACTIVE_FOREGROUND = gdkColor; +// gdkColor = new GdkColor(); +// OS.gtk_style_get_light (style, OS.GTK_STATE_INSENSITIVE, gdkColor); +// COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT = gdkColor; +// } +// +// /** +// * Returns a reasonable font for applications to use. +// * On some platforms, this will match the "default font" +// * or "system font" if such can be found. This font +// * should not be free'd because it was allocated by the +// * system, not the application. +// * <p> +// * Typically, applications which want the default look +// * should simply not set the font on the widgets they +// * create. Widgets are always created with the correct +// * default font for the class of user-interface component +// * they represent. +// * </p> +// * +// * @return a font +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// */ +// public Font getSystemFont () { +// checkDevice (); +// if (systemFont !is null) return systemFont; +// auto style = OS.gtk_widget_get_style (shellHandle); +// auto defaultFont = OS.pango_font_description_copy (OS.gtk_style_get_font_desc (style)); +// return systemFont = Font.gtk_new (this, defaultFont); +// } +// +// /** +// * Returns the single instance of the system tray or null +// * when there is no system tray available for the platform. +// * +// * @return the system tray or <code>null</code> +// * +// * @exception SWTException <ul> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @since 3.0 +// */ +// public Tray getSystemTray () { +// checkDevice (); +// if (tray !is null) return tray; +// return tray = new Tray (this, SWT.NONE); +// } +// +// /** +// * Returns the user-interface thread for the receiver. +// * +// * @return the receiver's user-interface thread +// * +// * @exception SWTException <ul> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// */ +// public Thread getThread () { +// if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED); +// return thread; +// } +// +Widget getWidget (GtkWidget* handle) { +// if (handle is null) return null; +// if (lastWidget !is null && lastHandle is handle) return lastWidget; +// auto index = OS.g_object_get_qdata (handle, SWT_OBJECT_INDEX) - 1; +// if (0 <= index && index < widgetTable.length) { +// lastHandle = handle; +// return lastWidget = widgetTable [cast(int)/*64*/index]; +// } return null; } -int /*long*/ idleProc (int /*long*/ data) { - bool result = runAsyncMessages (false); - if (!result) { - synchronized (idleLock) { - idleHandle = 0; - } - } - return result ? 1 : 0; +private static extern(C) int idleProcFunc (void* data) { + Display display = cast(Display)data; + return display.idleProcMeth(); +} +private int idleProcMeth () { +// bool result = runAsyncMessages (false); +// if (!result) { +// synchronized (idleLock) { +// idleHandle = 0; +// } +// } +// return result ? 1 : 0; + return 0; } - -/** - * Initializes any internal resources needed by the - * device. - * <p> - * This method is called after <code>create</code>. - * </p> - * - * @see #create - */ -protected void init () { - super.init (); - initializeCallbacks (); - initializeSystemColors (); - initializeSystemSettings (); - initializeWidgetTable (); - initializeWindowManager (); +// +// /** +// * Initializes any internal resources needed by the +// * device. +// * <p> +// * This method is called after <code>create</code>. +// * </p> +// * +// * @see #create +// */ +// protected void init () { +// super.init (); +// initializeCallbacks (); +// initializeSystemColors (); +// initializeSystemSettings (); +// initializeWidgetTable (); +// initializeWindowManager (); +// } +// +// void initializeCallbacks () { +// closures = new int /*long*/ [Widget.LAST_SIGNAL]; +// signalIds = new int [Widget.LAST_SIGNAL]; +// +// /* Cache signals for GtkWidget */ +// signalIds [Widget.BUTTON_PRESS_EVENT] = OS.g_signal_lookup (OS.button_press_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.BUTTON_RELEASE_EVENT] = OS.g_signal_lookup (OS.button_release_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.CONFIGURE_EVENT] = OS.g_signal_lookup (OS.configure_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.DELETE_EVENT] = OS.g_signal_lookup (OS.delete_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.ENTER_NOTIFY_EVENT] = OS.g_signal_lookup (OS.enter_notify_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.EVENT] = OS.g_signal_lookup (OS.event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.EVENT_AFTER] = OS.g_signal_lookup (OS.event_after, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.EXPOSE_EVENT] = OS.g_signal_lookup (OS.expose_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.FOCUS] = OS.g_signal_lookup (OS.focus, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.FOCUS_IN_EVENT] = OS.g_signal_lookup (OS.focus_in_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.FOCUS_OUT_EVENT] = OS.g_signal_lookup (OS.focus_out_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.GRAB_FOCUS] = OS.g_signal_lookup (OS.grab_focus, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.HIDE] = OS.g_signal_lookup (OS.hide, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.KEY_PRESS_EVENT] = OS.g_signal_lookup (OS.key_press_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.KEY_RELEASE_EVENT] = OS.g_signal_lookup (OS.key_release_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.LEAVE_NOTIFY_EVENT] = OS.g_signal_lookup (OS.leave_notify_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.MAP] = OS.g_signal_lookup (OS.map, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.MAP_EVENT] = OS.g_signal_lookup (OS.map_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.MNEMONIC_ACTIVATE] = OS.g_signal_lookup (OS.mnemonic_activate, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.MOTION_NOTIFY_EVENT] = OS.g_signal_lookup (OS.motion_notify_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.POPUP_MENU] = OS.g_signal_lookup (OS.popup_menu, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.REALIZE] = OS.g_signal_lookup (OS.realize, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.SCROLL_EVENT] = OS.g_signal_lookup (OS.scroll_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.SHOW] = OS.g_signal_lookup (OS.show, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.SHOW_HELP] = OS.g_signal_lookup (OS.show_help, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.SIZE_ALLOCATE] = OS.g_signal_lookup (OS.size_allocate, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.STYLE_SET] = OS.g_signal_lookup (OS.style_set, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.UNMAP] = OS.g_signal_lookup (OS.unmap, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.UNMAP_EVENT] = OS.g_signal_lookup (OS.unmap_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.UNREALIZE] = OS.g_signal_lookup (OS.realize, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.VISIBILITY_NOTIFY_EVENT] = OS.g_signal_lookup (OS.visibility_notify_event, OS.GTK_TYPE_WIDGET ()); +// signalIds [Widget.WINDOW_STATE_EVENT] = OS.g_signal_lookup (OS.window_state_event, OS.GTK_TYPE_WIDGET ()); +// +// windowCallback2 = new void*/*Callback*/ (this, "windowProc", 2); +// windowProc2 = windowCallback2.getAddress (); +// if (windowProc2 is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// closures [Widget.ACTIVATE] = OS.g_cclosure_new (windowProc2, Widget.ACTIVATE, 0); +// closures [Widget.ACTIVATE_INVERSE] = OS.g_cclosure_new (windowProc2, Widget.ACTIVATE_INVERSE, 0); +// closures [Widget.CHANGED] = OS.g_cclosure_new (windowProc2, Widget.CHANGED, 0); +// closures [Widget.CLICKED] = OS.g_cclosure_new (windowProc2, Widget.CLICKED, 0); +// closures [Widget.DAY_SELECTED] = OS.g_cclosure_new (windowProc2, Widget.DAY_SELECTED, 0); +// closures [Widget.HIDE] = OS.g_cclosure_new (windowProc2, Widget.HIDE, 0); +// closures [Widget.GRAB_FOCUS] = OS.g_cclosure_new (windowProc2, Widget.GRAB_FOCUS, 0); +// closures [Widget.MAP] = OS.g_cclosure_new (windowProc2, Widget.MAP, 0); +// closures [Widget.MONTH_CHANGED] = OS.g_cclosure_new (windowProc2, Widget.MONTH_CHANGED, 0); +// closures [Widget.OUTPUT] = OS.g_cclosure_new (windowProc2, Widget.OUTPUT, 0); +// closures [Widget.POPUP_MENU] = OS.g_cclosure_new (windowProc2, Widget.POPUP_MENU, 0); +// closures [Widget.PREEDIT_CHANGED] = OS.g_cclosure_new (windowProc2, Widget.PREEDIT_CHANGED, 0); +// closures [Widget.REALIZE] = OS.g_cclosure_new (windowProc2, Widget.REALIZE, 0); +// closures [Widget.SELECT] = OS.g_cclosure_new (windowProc2, Widget.SELECT, 0); +// closures [Widget.SHOW] = OS.g_cclosure_new (windowProc2, Widget.SHOW, 0); +// closures [Widget.VALUE_CHANGED] = OS.g_cclosure_new (windowProc2, Widget.VALUE_CHANGED, 0); +// closures [Widget.UNMAP] = OS.g_cclosure_new (windowProc2, Widget.UNMAP, 0); +// closures [Widget.UNREALIZE] = OS.g_cclosure_new (windowProc2, Widget.UNREALIZE, 0); +// +// windowCallback3 = new void*/*Callback*/ (this, "windowProc", 3); +// windowProc3 = windowCallback3.getAddress (); +// if (windowProc3 is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// closures [Widget.BUTTON_PRESS_EVENT] = OS.g_cclosure_new (windowProc3, Widget.BUTTON_PRESS_EVENT, 0); +// closures [Widget.BUTTON_PRESS_EVENT_INVERSE] = OS.g_cclosure_new (windowProc3, Widget.BUTTON_PRESS_EVENT_INVERSE, 0); +// closures [Widget.BUTTON_RELEASE_EVENT] = OS.g_cclosure_new (windowProc3, Widget.BUTTON_RELEASE_EVENT, 0); +// closures [Widget.BUTTON_RELEASE_EVENT_INVERSE] = OS.g_cclosure_new (windowProc3, Widget.BUTTON_RELEASE_EVENT_INVERSE, 0); +// closures [Widget.COMMIT] = OS.g_cclosure_new (windowProc3, Widget.COMMIT, 0); +// closures [Widget.CONFIGURE_EVENT] = OS.g_cclosure_new (windowProc3, Widget.CONFIGURE_EVENT, 0); +// closures [Widget.DELETE_EVENT] = OS.g_cclosure_new (windowProc3, Widget.DELETE_EVENT, 0); +// closures [Widget.ENTER_NOTIFY_EVENT] = OS.g_cclosure_new (windowProc3, Widget.ENTER_NOTIFY_EVENT, 0); +// closures [Widget.EVENT] = OS.g_cclosure_new (windowProc3, Widget.EVENT, 0); +// closures [Widget.EVENT_AFTER] = OS.g_cclosure_new (windowProc3, Widget.EVENT_AFTER, 0); +// closures [Widget.EXPOSE_EVENT] = OS.g_cclosure_new (windowProc3, Widget.EXPOSE_EVENT, 0); +// closures [Widget.EXPOSE_EVENT_INVERSE] = OS.g_cclosure_new (windowProc3, Widget.EXPOSE_EVENT_INVERSE, 0); +// closures [Widget.FOCUS] = OS.g_cclosure_new (windowProc3, Widget.FOCUS, 0); +// closures [Widget.FOCUS_IN_EVENT] = OS.g_cclosure_new (windowProc3, Widget.FOCUS_IN_EVENT, 0); +// closures [Widget.FOCUS_OUT_EVENT] = OS.g_cclosure_new (windowProc3, Widget.FOCUS_OUT_EVENT, 0); +// closures [Widget.KEY_PRESS_EVENT] = OS.g_cclosure_new (windowProc3, Widget.KEY_PRESS_EVENT, 0); +// closures [Widget.KEY_RELEASE_EVENT] = OS.g_cclosure_new (windowProc3, Widget.KEY_RELEASE_EVENT, 0); +// closures [Widget.INPUT] = OS.g_cclosure_new (windowProc3, Widget.INPUT, 0); +// closures [Widget.LEAVE_NOTIFY_EVENT] = OS.g_cclosure_new (windowProc3, Widget.LEAVE_NOTIFY_EVENT, 0); +// closures [Widget.MAP_EVENT] = OS.g_cclosure_new (windowProc3, Widget.MAP_EVENT, 0); +// closures [Widget.MNEMONIC_ACTIVATE] = OS.g_cclosure_new (windowProc3, Widget.MNEMONIC_ACTIVATE, 0); +// closures [Widget.MOTION_NOTIFY_EVENT] = OS.g_cclosure_new (windowProc3, Widget.MOTION_NOTIFY_EVENT, 0); +// closures [Widget.MOTION_NOTIFY_EVENT_INVERSE] = OS.g_cclosure_new (windowProc3, Widget.MOTION_NOTIFY_EVENT_INVERSE, 0); +// closures [Widget.MOVE_FOCUS] = OS.g_cclosure_new (windowProc3, Widget.MOVE_FOCUS, 0); +// closures [Widget.SCROLL_EVENT] = OS.g_cclosure_new (windowProc3, Widget.SCROLL_EVENT, 0); +// closures [Widget.SHOW_HELP] = OS.g_cclosure_new (windowProc3, Widget.SHOW_HELP, 0); +// closures [Widget.SIZE_ALLOCATE] = OS.g_cclosure_new (windowProc3, Widget.SIZE_ALLOCATE, 0); +// closures [Widget.STYLE_SET] = OS.g_cclosure_new (windowProc3, Widget.STYLE_SET, 0); +// closures [Widget.TOGGLED] = OS.g_cclosure_new (windowProc3, Widget.TOGGLED, 0); +// closures [Widget.UNMAP_EVENT] = OS.g_cclosure_new (windowProc3, Widget.UNMAP_EVENT, 0); +// closures [Widget.VISIBILITY_NOTIFY_EVENT] = OS.g_cclosure_new (windowProc3, Widget.VISIBILITY_NOTIFY_EVENT, 0); +// closures [Widget.WINDOW_STATE_EVENT] = OS.g_cclosure_new (windowProc3, Widget.WINDOW_STATE_EVENT, 0); +// +// windowCallback4 = new void*/*Callback*/ (this, "windowProc", 4); +// windowProc4 = windowCallback4.getAddress (); +// if (windowProc4 is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// closures [Widget.DELETE_RANGE] = OS.g_cclosure_new (windowProc4, Widget.DELETE_RANGE, 0); +// closures [Widget.DELETE_TEXT] = OS.g_cclosure_new (windowProc4, Widget.DELETE_TEXT, 0); +// closures [Widget.ROW_ACTIVATED] = OS.g_cclosure_new (windowProc4, Widget.ROW_ACTIVATED, 0); +// closures [Widget.SCROLL_CHILD] = OS.g_cclosure_new (windowProc4, Widget.SCROLL_CHILD, 0); +// closures [Widget.SWITCH_PAGE] = OS.g_cclosure_new (windowProc4, Widget.SWITCH_PAGE, 0); +// closures [Widget.TEST_COLLAPSE_ROW] = OS.g_cclosure_new (windowProc4, Widget.TEST_COLLAPSE_ROW, 0); +// closures [Widget.TEST_EXPAND_ROW] = OS.g_cclosure_new (windowProc4, Widget.TEST_EXPAND_ROW, 0); +// +// windowCallback5 = new void*/*Callback*/ (this, "windowProc", 5); +// windowProc5 = windowCallback5.getAddress (); +// if (windowProc5 is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// closures [Widget.CHANGE_VALUE] = OS.g_cclosure_new (windowProc5, Widget.CHANGE_VALUE, 0); +// closures [Widget.EXPAND_COLLAPSE_CURSOR_ROW] = OS.g_cclosure_new (windowProc5, Widget.EXPAND_COLLAPSE_CURSOR_ROW, 0); +// closures [Widget.INSERT_TEXT] = OS.g_cclosure_new (windowProc5, Widget.INSERT_TEXT, 0); +// closures [Widget.TEXT_BUFFER_INSERT_TEXT] = OS.g_cclosure_new (windowProc5, Widget.TEXT_BUFFER_INSERT_TEXT, 0); +// +// for (int i = 0; i < Widget.LAST_SIGNAL; i++) { +// if (closures [i] !is null) OS.g_closure_ref (closures [i]); +// } +// +// timerCallback = new void*/*Callback*/ (this, "timerProc", 1); +// timerProc = timerCallback.getAddress (); +// if (timerProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// windowTimerCallback = new void*/*Callback*/ (this, "windowTimerProc", 1); +// windowTimerProc = windowTimerCallback.getAddress (); +// if (windowTimerProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// mouseHoverCallback = new void*/*Callback*/ (this, "mouseHoverProc", 1); +// mouseHoverProc = mouseHoverCallback.getAddress (); +// if (mouseHoverProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// caretCallback = new void*/*Callback*/(this, "caretProc", 1); +// caretProc = caretCallback.getAddress(); +// if (caretProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// menuPositionCallback = new void*/*Callback*/(this, "menuPositionProc", 5); +// menuPositionProc = menuPositionCallback.getAddress(); +// if (menuPositionProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// sizeAllocateCallback = new void*/*Callback*/(this, "sizeAllocateProc", 3); +// sizeAllocateProc = sizeAllocateCallback.getAddress(); +// if (sizeAllocateProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// sizeRequestCallback = new void*/*Callback*/(this, "sizeRequestProc", 3); +// sizeRequestProc = sizeRequestCallback.getAddress(); +// if (sizeRequestProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// shellMapCallback = new void*/*Callback*/(this, "shellMapProc", 3); +// shellMapProc = shellMapCallback.getAddress(); +// if (shellMapProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// shellMapProcClosure = OS.g_cclosure_new (shellMapProc, 0, 0); +// OS.g_closure_ref (shellMapProcClosure); +// +// treeSelectionCallback = new void*/*Callback*/(this, "treeSelectionProc", 4); +// treeSelectionProc = treeSelectionCallback.getAddress(); +// if (treeSelectionProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// cellDataCallback = new void*/*Callback*/ (this, "cellDataProc", 5); +// cellDataProcFld = cellDataCallback.getAddress (); +// if (cellDataProcFld is null) error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// setDirectionCallback = new void*/*Callback*/ (this, "setDirectionProc", 2); +// setDirectionProc = setDirectionCallback.getAddress (); +// if (setDirectionProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// allChildrenCallback = new void*/*Callback*/ (this, "allChildrenProc", 2); +// allChildrenProc = allChildrenCallback.getAddress (); +// if (allChildrenProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// checkIfEventCallback = new void*/*Callback*/ (this, "checkIfEventProc", 3); +// checkIfEventProc = checkIfEventCallback.getAddress (); +// if (checkIfEventProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); +// +// idleCallback = new void*/*Callback*/ (this, "idleProc", 1); +// idleProc = idleCallback.getAddress (); +// if (idleProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); +// } +// +// void initializeSystemSettings () { +// styleSetCallback = new void*/*Callback*/ (this, "styleSetProc", 3); +// styleSetProc = styleSetCallback.getAddress (); +// if (styleSetProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); +// OS.g_signal_connect (shellHandle, OS.style_set, styleSetProc, 0); +// +// /* +// * Feature in GTK. Despite the fact that the +// * gtk-entry-select-on-focus property is a global +// * setting, it is initialized when the GtkEntry +// * is initialized. This means that it cannot be +// * accessed before a GtkEntry is created. The +// * fix is to for the initializaion by creating +// * a temporary GtkEntry. +// */ +// auto entry = OS.gtk_entry_new (); +// OS.gtk_widget_destroy (entry); +// int [] buffer2 = new int [1]; +// auto settings = OS.gtk_settings_get_default (); +// OS.g_object_get (settings, OS.gtk_entry_select_on_focus, buffer2, 0); +// entrySelectOnFocus = buffer2 [0] !is 0; +// } +// +// void initializeWidgetTable () { +// indexTable = new int [GROW_SIZE]; +// widgetTable = new Widget [GROW_SIZE]; +// for (int i=0; i<GROW_SIZE-1; i++) indexTable [i] = i + 1; +// indexTable [GROW_SIZE - 1] = -1; +// } +// +// void initializeWindowManager () { +// /* Get the window manager name */ +// windowManager = ""; +// if (OS.GTK_VERSION >= OS.VERSION (2, 2, 0)) { +// auto screen = OS.gdk_screen_get_default (); +// if (screen !is null) { +// auto ptr2 = OS.gdk_x11_screen_get_window_manager_name (screen); +// if (ptr2 !is null) { +// int length = OS.strlen (ptr2); +// if (length > 0) { +// byte [] buffer2 = new byte [length]; +// memmove (buffer2, ptr2, length); +// windowManager = new char[] (Converter.mbcsToWcs (null, buffer2)); +// } +// } +// } +// } +// } +// +// /** +// * Invokes platform specific functionality to dispose a GC handle. +// * <p> +// * <b>IMPORTANT:</b> This method is <em>not</em> part of the public +// * API for <code>Display</code>. It is marked public only so that it +// * can be shared within the packages provided by SWT. It is not +// * available on all platforms, and should never be called from +// * application code. +// * </p> +// * +// * @param hDC the platform specific GC handle +// * @param data the platform specific GC data +// */ +public void internal_dispose_GC (GdkGC* gdkGC, GCData data) { +// OS.g_object_unref (gdkGC); +} +// +// /** +// * Invokes platform specific functionality to allocate a new GC handle. +// * <p> +// * <b>IMPORTANT:</b> This method is <em>not</em> part of the public +// * API for <code>Display</code>. It is marked public only so that it +// * can be shared within the packages provided by SWT. It is not +// * available on all platforms, and should never be called from +// * application code. +// * </p> +// * +// * @param data the platform specific GC data +// * @return the platform specific GC handle +// * +// * @exception SWTException <ul> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * @exception SWTError <ul> +// * <li>ERROR_NO_HANDLES if a handle could not be obtained for gc creation</li> +// * </ul> +// */ +public GdkGC* internal_new_GC (GCData data) { +// if (isDisposed()) SWT.error(SWT.ERROR_DEVICE_DISPOSED); +// auto root = OS.GDK_ROOT_PARENT (); +// auto gdkGC = OS.gdk_gc_new (root); +// if (gdkGC is null) SWT.error (SWT.ERROR_NO_HANDLES); +// OS.gdk_gc_set_subwindow (gdkGC, OS.GDK_INCLUDE_INFERIORS); +// if (data !is null) { +// int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; +// if ((data.style & mask) is 0) { +// data.style |= SWT.LEFT_TO_RIGHT; +// } +// data.device = this; +// data.drawable = root; +// data.background = getSystemColor (SWT.COLOR_WHITE).handle; +// data.foreground = getSystemColor (SWT.COLOR_BLACK).handle; +// data.font = getSystemFont ().handle; +// } +// return gdkGC; + return null; +} +// +bool isValidThread () { + return thread is Thread.getThis (); } - -void initializeCallbacks () { - closures = new int /*long*/ [Widget.LAST_SIGNAL]; - signalIds = new int [Widget.LAST_SIGNAL]; - - /* Cache signals for GtkWidget */ - signalIds [Widget.BUTTON_PRESS_EVENT] = OS.g_signal_lookup (OS.button_press_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.BUTTON_RELEASE_EVENT] = OS.g_signal_lookup (OS.button_release_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.CONFIGURE_EVENT] = OS.g_signal_lookup (OS.configure_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.DELETE_EVENT] = OS.g_signal_lookup (OS.delete_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.ENTER_NOTIFY_EVENT] = OS.g_signal_lookup (OS.enter_notify_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.EVENT] = OS.g_signal_lookup (OS.event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.EVENT_AFTER] = OS.g_signal_lookup (OS.event_after, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.EXPOSE_EVENT] = OS.g_signal_lookup (OS.expose_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.FOCUS] = OS.g_signal_lookup (OS.focus, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.FOCUS_IN_EVENT] = OS.g_signal_lookup (OS.focus_in_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.FOCUS_OUT_EVENT] = OS.g_signal_lookup (OS.focus_out_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.GRAB_FOCUS] = OS.g_signal_lookup (OS.grab_focus, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.HIDE] = OS.g_signal_lookup (OS.hide, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.KEY_PRESS_EVENT] = OS.g_signal_lookup (OS.key_press_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.KEY_RELEASE_EVENT] = OS.g_signal_lookup (OS.key_release_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.LEAVE_NOTIFY_EVENT] = OS.g_signal_lookup (OS.leave_notify_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.MAP] = OS.g_signal_lookup (OS.map, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.MAP_EVENT] = OS.g_signal_lookup (OS.map_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.MNEMONIC_ACTIVATE] = OS.g_signal_lookup (OS.mnemonic_activate, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.MOTION_NOTIFY_EVENT] = OS.g_signal_lookup (OS.motion_notify_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.POPUP_MENU] = OS.g_signal_lookup (OS.popup_menu, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.REALIZE] = OS.g_signal_lookup (OS.realize, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.SCROLL_EVENT] = OS.g_signal_lookup (OS.scroll_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.SHOW] = OS.g_signal_lookup (OS.show, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.SHOW_HELP] = OS.g_signal_lookup (OS.show_help, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.SIZE_ALLOCATE] = OS.g_signal_lookup (OS.size_allocate, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.STYLE_SET] = OS.g_signal_lookup (OS.style_set, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.UNMAP] = OS.g_signal_lookup (OS.unmap, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.UNMAP_EVENT] = OS.g_signal_lookup (OS.unmap_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.UNREALIZE] = OS.g_signal_lookup (OS.realize, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.VISIBILITY_NOTIFY_EVENT] = OS.g_signal_lookup (OS.visibility_notify_event, OS.GTK_TYPE_WIDGET ()); - signalIds [Widget.WINDOW_STATE_EVENT] = OS.g_signal_lookup (OS.window_state_event, OS.GTK_TYPE_WIDGET ()); - - windowCallback2 = new void*/*Callback*/ (this, "windowProc", 2); - windowProc2 = windowCallback2.getAddress (); - if (windowProc2 is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - - closures [Widget.ACTIVATE] = OS.g_cclosure_new (windowProc2, Widget.ACTIVATE, 0); - closures [Widget.ACTIVATE_INVERSE] = OS.g_cclosure_new (windowProc2, Widget.ACTIVATE_INVERSE, 0); - closures [Widget.CHANGED] = OS.g_cclosure_new (windowProc2, Widget.CHANGED, 0); - closures [Widget.CLICKED] = OS.g_cclosure_new (windowProc2, Widget.CLICKED, 0); - closures [Widget.DAY_SELECTED] = OS.g_cclosure_new (windowProc2, Widget.DAY_SELECTED, 0); - closures [Widget.HIDE] = OS.g_cclosure_new (windowProc2, Widget.HIDE, 0); - closures [Widget.GRAB_FOCUS] = OS.g_cclosure_new (windowProc2, Widget.GRAB_FOCUS, 0); - closures [Widget.MAP] = OS.g_cclosure_new (windowProc2, Widget.MAP, 0); - closures [Widget.MONTH_CHANGED] = OS.g_cclosure_new (windowProc2, Widget.MONTH_CHANGED, 0); - closures [Widget.OUTPUT] = OS.g_cclosure_new (windowProc2, Widget.OUTPUT, 0); - closures [Widget.POPUP_MENU] = OS.g_cclosure_new (windowProc2, Widget.POPUP_MENU, 0); - closures [Widget.PREEDIT_CHANGED] = OS.g_cclosure_new (windowProc2, Widget.PREEDIT_CHANGED, 0); - closures [Widget.REALIZE] = OS.g_cclosure_new (windowProc2, Widget.REALIZE, 0); - closures [Widget.SELECT] = OS.g_cclosure_new (windowProc2, Widget.SELECT, 0); - closures [Widget.SHOW] = OS.g_cclosure_new (windowProc2, Widget.SHOW, 0); - closures [Widget.VALUE_CHANGED] = OS.g_cclosure_new (windowProc2, Widget.VALUE_CHANGED, 0); - closures [Widget.UNMAP] = OS.g_cclosure_new (windowProc2, Widget.UNMAP, 0); - closures [Widget.UNREALIZE] = OS.g_cclosure_new (windowProc2, Widget.UNREALIZE, 0); - - windowCallback3 = new void*/*Callback*/ (this, "windowProc", 3); - windowProc3 = windowCallback3.getAddress (); - if (windowProc3 is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - - closures [Widget.BUTTON_PRESS_EVENT] = OS.g_cclosure_new (windowProc3, Widget.BUTTON_PRESS_EVENT, 0); - closures [Widget.BUTTON_PRESS_EVENT_INVERSE] = OS.g_cclosure_new (windowProc3, Widget.BUTTON_PRESS_EVENT_INVERSE, 0); - closures [Widget.BUTTON_RELEASE_EVENT] = OS.g_cclosure_new (windowProc3, Widget.BUTTON_RELEASE_EVENT, 0); - closures [Widget.BUTTON_RELEASE_EVENT_INVERSE] = OS.g_cclosure_new (windowProc3, Widget.BUTTON_RELEASE_EVENT_INVERSE, 0); - closures [Widget.COMMIT] = OS.g_cclosure_new (windowProc3, Widget.COMMIT, 0); - closures [Widget.CONFIGURE_EVENT] = OS.g_cclosure_new (windowProc3, Widget.CONFIGURE_EVENT, 0); - closures [Widget.DELETE_EVENT] = OS.g_cclosure_new (windowProc3, Widget.DELETE_EVENT, 0); - closures [Widget.ENTER_NOTIFY_EVENT] = OS.g_cclosure_new (windowProc3, Widget.ENTER_NOTIFY_EVENT, 0); - closures [Widget.EVENT] = OS.g_cclosure_new (windowProc3, Widget.EVENT, 0); - closures [Widget.EVENT_AFTER] = OS.g_cclosure_new (windowProc3, Widget.EVENT_AFTER, 0); - closures [Widget.EXPOSE_EVENT] = OS.g_cclosure_new (windowProc3, Widget.EXPOSE_EVENT, 0); - closures [Widget.EXPOSE_EVENT_INVERSE] = OS.g_cclosure_new (windowProc3, Widget.EXPOSE_EVENT_INVERSE, 0); - closures [Widget.FOCUS] = OS.g_cclosure_new (windowProc3, Widget.FOCUS, 0); - closures [Widget.FOCUS_IN_EVENT] = OS.g_cclosure_new (windowProc3, Widget.FOCUS_IN_EVENT, 0); - closures [Widget.FOCUS_OUT_EVENT] = OS.g_cclosure_new (windowProc3, Widget.FOCUS_OUT_EVENT, 0); - closures [Widget.KEY_PRESS_EVENT] = OS.g_cclosure_new (windowProc3, Widget.KEY_PRESS_EVENT, 0); - closures [Widget.KEY_RELEASE_EVENT] = OS.g_cclosure_new (windowProc3, Widget.KEY_RELEASE_EVENT, 0); - closures [Widget.INPUT] = OS.g_cclosure_new (windowProc3, Widget.INPUT, 0); - closures [Widget.LEAVE_NOTIFY_EVENT] = OS.g_cclosure_new (windowProc3, Widget.LEAVE_NOTIFY_EVENT, 0); - closures [Widget.MAP_EVENT] = OS.g_cclosure_new (windowProc3, Widget.MAP_EVENT, 0); - closures [Widget.MNEMONIC_ACTIVATE] = OS.g_cclosure_new (windowProc3, Widget.MNEMONIC_ACTIVATE, 0); - closures [Widget.MOTION_NOTIFY_EVENT] = OS.g_cclosure_new (windowProc3, Widget.MOTION_NOTIFY_EVENT, 0); - closures [Widget.MOTION_NOTIFY_EVENT_INVERSE] = OS.g_cclosure_new (windowProc3, Widget.MOTION_NOTIFY_EVENT_INVERSE, 0); - closures [Widget.MOVE_FOCUS] = OS.g_cclosure_new (windowProc3, Widget.MOVE_FOCUS, 0); - closures [Widget.SCROLL_EVENT] = OS.g_cclosure_new (windowProc3, Widget.SCROLL_EVENT, 0); - closures [Widget.SHOW_HELP] = OS.g_cclosure_new (windowProc3, Widget.SHOW_HELP, 0); - closures [Widget.SIZE_ALLOCATE] = OS.g_cclosure_new (windowProc3, Widget.SIZE_ALLOCATE, 0); - closures [Widget.STYLE_SET] = OS.g_cclosure_new (windowProc3, Widget.STYLE_SET, 0); - closures [Widget.TOGGLED] = OS.g_cclosure_new (windowProc3, Widget.TOGGLED, 0); - closures [Widget.UNMAP_EVENT] = OS.g_cclosure_new (windowProc3, Widget.UNMAP_EVENT, 0); - closures [Widget.VISIBILITY_NOTIFY_EVENT] = OS.g_cclosure_new (windowProc3, Widget.VISIBILITY_NOTIFY_EVENT, 0); - closures [Widget.WINDOW_STATE_EVENT] = OS.g_cclosure_new (windowProc3, Widget.WINDOW_STATE_EVENT, 0); - - windowCallback4 = new void*/*Callback*/ (this, "windowProc", 4); - windowProc4 = windowCallback4.getAddress (); - if (windowProc4 is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - - closures [Widget.DELETE_RANGE] = OS.g_cclosure_new (windowProc4, Widget.DELETE_RANGE, 0); - closures [Widget.DELETE_TEXT] = OS.g_cclosure_new (windowProc4, Widget.DELETE_TEXT, 0); - closures [Widget.ROW_ACTIVATED] = OS.g_cclosure_new (windowProc4, Widget.ROW_ACTIVATED, 0); - closures [Widget.SCROLL_CHILD] = OS.g_cclosure_new (windowProc4, Widget.SCROLL_CHILD, 0); - closures [Widget.SWITCH_PAGE] = OS.g_cclosure_new (windowProc4, Widget.SWITCH_PAGE, 0); - closures [Widget.TEST_COLLAPSE_ROW] = OS.g_cclosure_new (windowProc4, Widget.TEST_COLLAPSE_ROW, 0); - closures [Widget.TEST_EXPAND_ROW] = OS.g_cclosure_new (windowProc4, Widget.TEST_EXPAND_ROW, 0); - - windowCallback5 = new void*/*Callback*/ (this, "windowProc", 5); - windowProc5 = windowCallback5.getAddress (); - if (windowProc5 is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - - closures [Widget.CHANGE_VALUE] = OS.g_cclosure_new (windowProc5, Widget.CHANGE_VALUE, 0); - closures [Widget.EXPAND_COLLAPSE_CURSOR_ROW] = OS.g_cclosure_new (windowProc5, Widget.EXPAND_COLLAPSE_CURSOR_ROW, 0); - closures [Widget.INSERT_TEXT] = OS.g_cclosure_new (windowProc5, Widget.INSERT_TEXT, 0); - closures [Widget.TEXT_BUFFER_INSERT_TEXT] = OS.g_cclosure_new (windowProc5, Widget.TEXT_BUFFER_INSERT_TEXT, 0); - - for (int i = 0; i < Widget.LAST_SIGNAL; i++) { - if (closures [i] !is null) OS.g_closure_ref (closures [i]); - } - - timerCallback = new void*/*Callback*/ (this, "timerProc", 1); - timerProc = timerCallback.getAddress (); - if (timerProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); - - windowTimerCallback = new void*/*Callback*/ (this, "windowTimerProc", 1); - windowTimerProc = windowTimerCallback.getAddress (); - if (windowTimerProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); - - mouseHoverCallback = new void*/*Callback*/ (this, "mouseHoverProc", 1); - mouseHoverProc = mouseHoverCallback.getAddress (); - if (mouseHoverProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); - - caretCallback = new void*/*Callback*/(this, "caretProc", 1); - caretProc = caretCallback.getAddress(); - if (caretProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); - - menuPositionCallback = new void*/*Callback*/(this, "menuPositionProc", 5); - menuPositionProc = menuPositionCallback.getAddress(); - if (menuPositionProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); - - sizeAllocateCallback = new void*/*Callback*/(this, "sizeAllocateProc", 3); - sizeAllocateProc = sizeAllocateCallback.getAddress(); - if (sizeAllocateProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); - - sizeRequestCallback = new void*/*Callback*/(this, "sizeRequestProc", 3); - sizeRequestProc = sizeRequestCallback.getAddress(); - if (sizeRequestProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); - - shellMapCallback = new void*/*Callback*/(this, "shellMapProc", 3); - shellMapProc = shellMapCallback.getAddress(); - if (shellMapProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); - - shellMapProcClosure = OS.g_cclosure_new (shellMapProc, 0, 0); - OS.g_closure_ref (shellMapProcClosure); - - treeSelectionCallback = new void*/*Callback*/(this, "treeSelectionProc", 4); - treeSelectionProc = treeSelectionCallback.getAddress(); - if (treeSelectionProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); - - cellDataCallback = new void*/*Callback*/ (this, "cellDataProc", 5); - cellDataProc = cellDataCallback.getAddress (); - if (cellDataProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); - - setDirectionCallback = new void*/*Callback*/ (this, "setDirectionProc", 2); - setDirectionProc = setDirectionCallback.getAddress (); - if (setDirectionProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); - - allChildrenCallback = new void*/*Callback*/ (this, "allChildrenProc", 2); - allChildrenProc = allChildrenCallback.getAddress (); - if (allChildrenProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); - - checkIfEventCallback = new void*/*Callback*/ (this, "checkIfEventProc", 3); - checkIfEventProc = checkIfEventCallback.getAddress (); - if (checkIfEventProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); - - idleCallback = new void*/*Callback*/ (this, "idleProc", 1); - idleProc = idleCallback.getAddress (); - if (idleProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS); -} - -void initializeSystemSettings () { - styleSetCallback = new void*/*Callback*/ (this, "styleSetProc", 3); - styleSetProc = styleSetCallback.getAddress (); - if (styleSetProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - OS.g_signal_connect (shellHandle, OS.style_set, styleSetProc, 0); - - /* - * Feature in GTK. Despite the fact that the - * gtk-entry-select-on-focus property is a global - * setting, it is initialized when the GtkEntry - * is initialized. This means that it cannot be - * accessed before a GtkEntry is created. The - * fix is to for the initializaion by creating - * a temporary GtkEntry. - */ - int /*long*/ entry = OS.gtk_entry_new (); - OS.gtk_widget_destroy (entry); - int [] buffer2 = new int [1]; - int /*long*/ settings = OS.gtk_settings_get_default (); - OS.g_object_get (settings, OS.gtk_entry_select_on_focus, buffer2, 0); - entrySelectOnFocus = buffer2 [0] !is 0; -} - -void initializeWidgetTable () { - indexTable = new int [GROW_SIZE]; - widgetTable = new Widget [GROW_SIZE]; - for (int i=0; i<GROW_SIZE-1; i++) indexTable [i] = i + 1; - indexTable [GROW_SIZE - 1] = -1; -} - -void initializeWindowManager () { - /* Get the window manager name */ - windowManager = ""; - if (OS.GTK_VERSION >= OS.VERSION (2, 2, 0)) { - int /*long*/ screen = OS.gdk_screen_get_default (); - if (screen !is null) { - int /*long*/ ptr2 = OS.gdk_x11_screen_get_window_manager_name (screen); - if (ptr2 !is null) { - int length = OS.strlen (ptr2); - if (length > 0) { - byte [] buffer2 = new byte [length]; - OS.memmove (buffer2, ptr2, length); - windowManager = new char[] (Converter.mbcsToWcs (null, buffer2)); - } - } - } - } -} - -/** - * Invokes platform specific functionality to dispose a GC handle. - * <p> - * <b>IMPORTANT:</b> This method is <em>not</em> part of the public - * API for <code>Display</code>. It is marked public only so that it - * can be shared within the packages provided by SWT. It is not - * available on all platforms, and should never be called from - * application code. - * </p> - * - * @param hDC the platform specific GC handle - * @param data the platform specific GC data - */ -public void internal_dispose_GC (int /*long*/ gdkGC, GCData data) { - OS.g_object_unref (gdkGC); -} - -/** - * Invokes platform specific functionality to allocate a new GC handle. - * <p> - * <b>IMPORTANT:</b> This method is <em>not</em> part of the public - * API for <code>Display</code>. It is marked public only so that it - * can be shared within the packages provided by SWT. It is not - * available on all platforms, and should never be called from - * application code. - * </p> - * - * @param data the platform specific GC data - * @return the platform specific GC handle - * - * @exception SWTException <ul> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * @exception SWTError <ul> - * <li>ERROR_NO_HANDLES if a handle could not be obtained for gc creation</li> - * </ul> - */ -public int /*long*/ internal_new_GC (GCData data) { - if (isDisposed()) SWT.error(SWT.ERROR_DEVICE_DISPOSED); - int /*long*/ root = OS.GDK_ROOT_PARENT (); - int /*long*/ gdkGC = OS.gdk_gc_new (root); - if (gdkGC is null) SWT.error (SWT.ERROR_NO_HANDLES); - OS.gdk_gc_set_subwindow (gdkGC, OS.GDK_INCLUDE_INFERIORS); - if (data !is null) { - int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; - if ((data.style & mask) is 0) { - data.style |= SWT.LEFT_TO_RIGHT; - } - data.device = this; - data.drawable = root; - data.background = getSystemColor (SWT.COLOR_WHITE).handle; - data.foreground = getSystemColor (SWT.COLOR_BLACK).handle; - data.font = getSystemFont ().handle; - } - return gdkGC; -} - -bool isValidThread () { - return thread is Thread.currentThread (); -} - -/** - * Maps a point from one coordinate system to another. - * When the control is null, coordinates are mapped to - * the display. - * <p> - * NOTE: On right-to-left platforms where the coordinate - * systems are mirrored, special care needs to be taken - * when mapping coordinates from one control to another - * to ensure the result is correctly mirrored. - * - * Mapping a point that is the origin of a rectangle and - * then adding the width and height is not equivalent to - * mapping the rectangle. When one control is mirrored - * and the other is not, adding the width and height to a - * point that was mapped causes the rectangle to extend - * in the wrong direction. Mapping the entire rectangle - * instead of just one point causes both the origin and - * the corner of the rectangle to be mapped. - * </p> - * - * @param from the source <code>Control</code> or <code>null</code> - * @param to the destination <code>Control</code> or <code>null</code> - * @param point to be mapped - * @return point with mapped coordinates - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the point is null</li> - * <li>ERROR_INVALID_ARGUMENT - if the Control from or the Control to have been disposed</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @since 2.1.2 - */ -public Point map (Control from, Control to, Point point) { - checkDevice (); - if (point is null) error (SWT.ERROR_NULL_ARGUMENT); - return map (from, to, point.x, point.y); +// +// /** +// * Maps a point from one coordinate system to another. +// * When the control is null, coordinates are mapped to +// * the display. +// * <p> +// * NOTE: On right-to-left platforms where the coordinate +// * systems are mirrored, special care needs to be taken +// * when mapping coordinates from one control to another +// * to ensure the result is correctly mirrored. +// * +// * Mapping a point that is the origin of a rectangle and +// * then adding the width and height is not equivalent to +// * mapping the rectangle. When one control is mirrored +// * and the other is not, adding the width and height to a +// * point that was mapped causes the rectangle to extend +// * in the wrong direction. Mapping the entire rectangle +// * instead of just one point causes both the origin and +// * the corner of the rectangle to be mapped. +// * </p> +// * +// * @param from the source <code>Control</code> or <code>null</code> +// * @param to the destination <code>Control</code> or <code>null</code> +// * @param point to be mapped +// * @return point with mapped coordinates +// * +// * @exception IllegalArgumentException <ul> +// * <li>ERROR_NULL_ARGUMENT - if the point is null</li> +// * <li>ERROR_INVALID_ARGUMENT - if the Control from or the Control to have been disposed</li> +// * </ul> +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @since 2.1.2 +// */ +// public Point map (Control from, Control to, Point point) { +// checkDevice (); +// if (point is null) error (SWT.ERROR_NULL_ARGUMENT); +// return map (from, to, point.x, point.y); +// } +// +// /** +// * Maps a point from one coordinate system to another. +// * When the control is null, coordinates are mapped to +// * the display. +// * <p> +// * NOTE: On right-to-left platforms where the coordinate +// * systems are mirrored, special care needs to be taken +// * when mapping coordinates from one control to another +// * to ensure the result is correctly mirrored. +// * +// * Mapping a point that is the origin of a rectangle and +// * then adding the width and height is not equivalent to +// * mapping the rectangle. When one control is mirrored +// * and the other is not, adding the width and height to a +// * point that was mapped causes the rectangle to extend +// * in the wrong direction. Mapping the entire rectangle +// * instead of just one point causes both the origin and +// * the corner of the rectangle to be mapped. +// * </p> +// * +// * @param from the source <code>Control</code> or <code>null</code> +// * @param to the destination <code>Control</code> or <code>null</code> +// * @param x coordinates to be mapped +// * @param y coordinates to be mapped +// * @return point with mapped coordinates +// * +// * @exception IllegalArgumentException <ul> +// * <li>ERROR_INVALID_ARGUMENT - if the Control from or the Control to have been disposed</li> +// * </ul> +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @since 2.1.2 +// */ +// public Point map (Control from, Control to, int x, int y) { +// checkDevice (); +// if (from !is null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); +// if (to !is null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); +// Point point = new Point (x, y); +// if (from is to) return point; +// if (from !is null) { +// auto window = from.eventWindow (); +// int [] origin_x = new int [1], origin_y = new int [1]; +// OS.gdk_window_get_origin (window, origin_x, origin_y); +// point.x += origin_x [0]; +// point.y += origin_y [0]; +// } +// if (to !is null) { +// auto window = to.eventWindow (); +// int [] origin_x = new int [1], origin_y = new int [1]; +// OS.gdk_window_get_origin (window, origin_x, origin_y); +// point.x -= origin_x [0]; +// point.y -= origin_y [0]; +// } +// return point; +// } +// +// /** +// * Maps a point from one coordinate system to another. +// * When the control is null, coordinates are mapped to +// * the display. +// * <p> +// * NOTE: On right-to-left platforms where the coordinate +// * systems are mirrored, special care needs to be taken +// * when mapping coordinates from one control to another +// * to ensure the result is correctly mirrored. +// * +// * Mapping a point that is the origin of a rectangle and +// * then adding the width and height is not equivalent to +// * mapping the rectangle. When one control is mirrored +// * and the other is not, adding the width and height to a +// * point that was mapped causes the rectangle to extend +// * in the wrong direction. Mapping the entire rectangle +// * instead of just one point causes both the origin and +// * the corner of the rectangle to be mapped. +// * </p> +// * +// * @param from the source <code>Control</code> or <code>null</code> +// * @param to the destination <code>Control</code> or <code>null</code> +// * @param rectangle to be mapped +// * @return rectangle with mapped coordinates +// * +// * @exception IllegalArgumentException <ul> +// * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li> +// * <li>ERROR_INVALID_ARGUMENT - if the Control from or the Control to have been disposed</li> +// * </ul> +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @since 2.1.2 +// */ +// public Rectangle map (Control from, Control to, Rectangle rectangle) { +// checkDevice(); +// if (rectangle is null) error (SWT.ERROR_NULL_ARGUMENT); +// return map (from, to, rectangle.x, rectangle.y, rectangle.width, rectangle.height); +// } +// +// static char mbcsToWcs (char ch) { +// int key = ch & 0xFFFF; +// if (key <= 0x7F) return ch; +// byte [] buffer; +// if (key <= 0xFF) { +// buffer = new byte [1]; +// buffer [0] = cast(byte) key; +// } else { +// buffer = new byte [2]; +// buffer [0] = cast(byte) ((key >> 8) & 0xFF); +// buffer [1] = cast(byte) (key & 0xFF); +// } +// char [] result = Converter.mbcsToWcs (null, buffer); +// if (result.length is 0) return 0; +// return result [0]; +// } +// +// int /*long*/ menuPositionProcMeth (int /*long*/ menu, int /*long*/ x, int /*long*/ y, int /*long*/ push_in, int /*long*/ user_data) { +// Widget widget = getWidget (menu); +// if (widget is null) return 0; +// return widget.menuPositionProc (menu, x, y, push_in, user_data); +// } +// +// /** +// * Maps a point from one coordinate system to another. +// * When the control is null, coordinates are mapped to +// * the display. +// * <p> +// * NOTE: On right-to-left platforms where the coordinate +// * systems are mirrored, special care needs to be taken +// * when mapping coordinates from one control to another +// * to ensure the result is correctly mirrored. +// * +// * Mapping a point that is the origin of a rectangle and +// * then adding the width and height is not equivalent to +// * mapping the rectangle. When one control is mirrored +// * and the other is not, adding the width and height to a +// * point that was mapped causes the rectangle to extend +// * in the wrong direction. Mapping the entire rectangle +// * instead of just one point causes both the origin and +// * the corner of the rectangle to be mapped. +// * </p> +// * +// * @param from the source <code>Control</code> or <code>null</code> +// * @param to the destination <code>Control</code> or <code>null</code> +// * @param x coordinates to be mapped +// * @param y coordinates to be mapped +// * @param width coordinates to be mapped +// * @param height coordinates to be mapped +// * @return rectangle with mapped coordinates +// * +// * @exception IllegalArgumentException <ul> +// * <li>ERROR_INVALID_ARGUMENT - if the Control from or the Control to have been disposed</li> +// * </ul> +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @since 2.1.2 +// */ +// public Rectangle map (Control from, Control to, int x, int y, int width, int height) { +// checkDevice(); +// if (from !is null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); +// if (to !is null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); +// Rectangle rect = new Rectangle (x, y, width, height); +// if (from is to) return rect; +// if (from !is null) { +// auto window = from.eventWindow (); +// int [] origin_x = new int [1], origin_y = new int [1]; +// OS.gdk_window_get_origin (window, origin_x, origin_y); +// rect.x += origin_x [0]; +// rect.y += origin_y [0]; +// } +// if (to !is null) { +// auto window = to.eventWindow (); +// int [] origin_x = new int [1], origin_y = new int [1]; +// OS.gdk_window_get_origin (window, origin_x, origin_y); +// rect.x -= origin_x [0]; +// rect.y -= origin_y [0]; +// } +// return rect; +// } +// +// private extern(C) int mouseHoverProcMeth (void* handle) { +// } +// +// int /*long*/ mouseHoverProcMeth (int /*long*/ handle) { +// Widget widget = getWidget (handle); +// if (widget is null) return 0; +// return widget.hoverProc (handle); +// } +// +// /** +// * Generate a low level system event. +// * +// * <code>post</code> is used to generate low level keyboard +// * and mouse events. The intent is to enable automated UI +// * testing by simulating the input from the user. Most +// * SWT applications should never need to call this method. +// * <p> +// * Note that this operation can fail when the operating system +// * fails to generate the event for any reason. For example, +// * this can happen when there is no such key or mouse button +// * or when the system event queue is full. +// * </p> +// * <p> +// * <b>Event Types:</b> +// * <p>KeyDown, KeyUp +// * <p>The following fields in the <code>Event</code> apply: +// * <ul> +// * <li>(in) type KeyDown or KeyUp</li> +// * <p> Either one of: +// * <li>(in) character a character that corresponds to a keyboard key</li> +// * <li>(in) keyCode the key code of the key that was typed, +// * as defined by the key code constants in class <code>SWT</code></li> +// * </ul> +// * <p>MouseDown, MouseUp</p> +// * <p>The following fields in the <code>Event</code> apply: +// * <ul> +// * <li>(in) type MouseDown or MouseUp +// * <li>(in) button the button that is pressed or released +// * </ul> +// * <p>MouseMove</p> +// * <p>The following fields in the <code>Event</code> apply: +// * <ul> +// * <li>(in) type MouseMove +// * <li>(in) x the x coordinate to move the mouse pointer to in screen coordinates +// * <li>(in) y the y coordinate to move the mouse pointer to in screen coordinates +// * </ul> +// * </dl> +// * +// * @param event the event to be generated +// * +// * @return true if the event was generated or false otherwise +// * +// * @exception IllegalArgumentException <ul> +// * <li>ERROR_NULL_ARGUMENT - if the event is null</li> +// * </ul> +// * @exception SWTException <ul> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @since 3.0 +// * +// */ +// public bool post (Event event) { +// if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED); +// if (event is null) error (SWT.ERROR_NULL_ARGUMENT); +// if (!OS.GDK_WINDOWING_X11()) return false; +// auto xDisplay = OS.GDK_DISPLAY (); +// int type = event.type; +// switch (type) { +// case SWT.KeyDown: +// case SWT.KeyUp: { +// int keyCode = 0; +// auto keysym = untranslateKey (event.keyCode); +// if (keysym !is 0) keyCode = OS.XKeysymToKeycode (xDisplay, keysym); +// if (keyCode is 0) { +// char key = event.character; +// switch (key) { +// case SWT.BS: keysym = OS.GDK_BackSpace; break; +// case SWT.CR: keysym = OS.GDK_Return; break; +// case SWT.DEL: keysym = OS.GDK_Delete; break; +// case SWT.ESC: keysym = OS.GDK_Escape; break; +// case SWT.TAB: keysym = OS.GDK_Tab; break; +// case SWT.LF: keysym = OS.GDK_Linefeed; break; +// default: +// keysym = wcsToMbcs (key); +// } +// keyCode = OS.XKeysymToKeycode (xDisplay, keysym); +// if (keyCode is 0) return false; +// } +// OS.XTestFakeKeyEvent (xDisplay, keyCode, type is SWT.KeyDown, 0); +// return true; +// } +// case SWT.MouseDown: +// case SWT.MouseMove: +// case SWT.MouseUp: { +// if (type is SWT.MouseMove) { +// OS.XTestFakeMotionEvent (xDisplay, -1, event.x, event.y, 0); +// } else { +// int button = event.button; +// switch (button) { +// case 1: +// case 2: +// case 3: break; +// case 4: button = 6; break; +// case 5: button = 7; break; +// default: return false; +// } +// OS.XTestFakeButtonEvent (xDisplay, button, type is SWT.MouseDown, 0); +// } +// return true; +// } +// /* +// * This code is intentionally commented. After posting a +// * mouse wheel event the system may respond unpredictably +// * to subsequent mouse actions. +// */ +// // case SWT.MouseWheel: { +// // if (event.count is 0) return false; +// // int button = event.count < 0 ? 5 : 4; +// // OS.XTestFakeButtonEvent (xDisplay, button, type is SWT.MouseWheel, 0); +// // } +// } +// return false; +// } +// +// void postEvent (Event event) { +// /* +// * Place the event at the end of the event queue. +// * This code is always called in the Display's +// * thread so it must be re-enterant but does not +// * need to be synchronized. +// */ +// if (eventQueue is null) eventQueue = new Event [4]; +// int index = 0; +// int length = eventQueue.length; +// while (index < length) { +// if (eventQueue [index] is null) break; +// index++; +// } +// if (index is length) { +// Event [] newQueue = new Event [length + 4]; +// System.arraycopy (eventQueue, 0, newQueue, 0, length); +// eventQueue = newQueue; +// } +// eventQueue [index] = event; +// } +// +void putGdkEvents () { +// if (gdkEventCount !is 0) { +// for (int i = 0; i < gdkEventCount; i++) { +// auto event = gdkEvents [i]; +// Widget widget = gdkEventWidgets [i]; +// if (widget is null || !widget.isDisposed ()) { +// OS.gdk_event_put (event); +// } +// OS.gdk_event_free (event); +// gdkEvents [i] = 0; +// gdkEventWidgets [i] = null; +// } +// gdkEventCount = 0; +// } } -/** - * Maps a point from one coordinate system to another. - * When the control is null, coordinates are mapped to - * the display. - * <p> - * NOTE: On right-to-left platforms where the coordinate - * systems are mirrored, special care needs to be taken - * when mapping coordinates from one control to another - * to ensure the result is correctly mirrored. - * - * Mapping a point that is the origin of a rectangle and - * then adding the width and height is not equivalent to - * mapping the rectangle. When one control is mirrored - * and the other is not, adding the width and height to a - * point that was mapped causes the rectangle to extend - * in the wrong direction. Mapping the entire rectangle - * instead of just one point causes both the origin and - * the corner of the rectangle to be mapped. - * </p> - * - * @param from the source <code>Control</code> or <code>null</code> - * @param to the destination <code>Control</code> or <code>null</code> - * @param x coordinates to be mapped - * @param y coordinates to be mapped - * @return point with mapped coordinates - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the Control from or the Control to have been disposed</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @since 2.1.2 - */ -public Point map (Control from, Control to, int x, int y) { - checkDevice (); - if (from !is null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); - if (to !is null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); - Point point = new Point (x, y); - if (from is to) return point; - if (from !is null) { - int /*long*/ window = from.eventWindow (); - int [] origin_x = new int [1], origin_y = new int [1]; - OS.gdk_window_get_origin (window, origin_x, origin_y); - point.x += origin_x [0]; - point.y += origin_y [0]; - } - if (to !is null) { - int /*long*/ window = to.eventWindow (); - int [] origin_x = new int [1], origin_y = new int [1]; - OS.gdk_window_get_origin (window, origin_x, origin_y); - point.x -= origin_x [0]; - point.y -= origin_y [0]; - } - return point; -} - -/** - * Maps a point from one coordinate system to another. - * When the control is null, coordinates are mapped to - * the display. - * <p> - * NOTE: On right-to-left platforms where the coordinate - * systems are mirrored, special care needs to be taken - * when mapping coordinates from one control to another - * to ensure the result is correctly mirrored. - * - * Mapping a point that is the origin of a rectangle and - * then adding the width and height is not equivalent to - * mapping the rectangle. When one control is mirrored - * and the other is not, adding the width and height to a - * point that was mapped causes the rectangle to extend - * in the wrong direction. Mapping the entire rectangle - * instead of just one point causes both the origin and - * the corner of the rectangle to be mapped. - * </p> - * - * @param from the source <code>Control</code> or <code>null</code> - * @param to the destination <code>Control</code> or <code>null</code> - * @param rectangle to be mapped - * @return rectangle with mapped coordinates - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li> - * <li>ERROR_INVALID_ARGUMENT - if the Control from or the Control to have been disposed</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @since 2.1.2 - */ -public Rectangle map (Control from, Control to, Rectangle rectangle) { - checkDevice(); - if (rectangle is null) error (SWT.ERROR_NULL_ARGUMENT); - return map (from, to, rectangle.x, rectangle.y, rectangle.width, rectangle.height); -} - -static char mbcsToWcs (char ch) { - int key = ch & 0xFFFF; - if (key <= 0x7F) return ch; - byte [] buffer; - if (key <= 0xFF) { - buffer = new byte [1]; - buffer [0] = cast(byte) key; - } else { - buffer = new byte [2]; - buffer [0] = cast(byte) ((key >> 8) & 0xFF); - buffer [1] = cast(byte) (key & 0xFF); - } - char [] result = Converter.mbcsToWcs (null, buffer); - if (result.length is 0) return 0; - return result [0]; -} - -int /*long*/ menuPositionProc (int /*long*/ menu, int /*long*/ x, int /*long*/ y, int /*long*/ push_in, int /*long*/ user_data) { - Widget widget = getWidget (menu); - if (widget is null) return 0; - return widget.menuPositionProc (menu, x, y, push_in, user_data); -} - -/** - * Maps a point from one coordinate system to another. - * When the control is null, coordinates are mapped to - * the display. - * <p> - * NOTE: On right-to-left platforms where the coordinate - * systems are mirrored, special care needs to be taken - * when mapping coordinates from one control to another - * to ensure the result is correctly mirrored. - * - * Mapping a point that is the origin of a rectangle and - * then adding the width and height is not equivalent to - * mapping the rectangle. When one control is mirrored - * and the other is not, adding the width and height to a - * point that was mapped causes the rectangle to extend - * in the wrong direction. Mapping the entire rectangle - * instead of just one point causes both the origin and - * the corner of the rectangle to be mapped. - * </p> - * - * @param from the source <code>Control</code> or <code>null</code> - * @param to the destination <code>Control</code> or <code>null</code> - * @param x coordinates to be mapped - * @param y coordinates to be mapped - * @param width coordinates to be mapped - * @param height coordinates to be mapped - * @return rectangle with mapped coordinates - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the Control from or the Control to have been disposed</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @since 2.1.2 - */ -public Rectangle map (Control from, Control to, int x, int y, int width, int height) { - checkDevice(); - if (from !is null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); - if (to !is null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); - Rectangle rect = new Rectangle (x, y, width, height); - if (from is to) return rect; - if (from !is null) { - int /*long*/ window = from.eventWindow (); - int [] origin_x = new int [1], origin_y = new int [1]; - OS.gdk_window_get_origin (window, origin_x, origin_y); - rect.x += origin_x [0]; - rect.y += origin_y [0]; - } - if (to !is null) { - int /*long*/ window = to.eventWindow (); - int [] origin_x = new int [1], origin_y = new int [1]; - OS.gdk_window_get_origin (window, origin_x, origin_y); - rect.x -= origin_x [0]; - rect.y -= origin_y [0]; - } - return rect; -} - -int /*long*/ mouseHoverProc (int /*long*/ handle) { - Widget widget = getWidget (handle); - if (widget is null) return 0; - return widget.hoverProc (handle); -} - -/** - * Generate a low level system event. - * - * <code>post</code> is used to generate low level keyboard - * and mouse events. The intent is to enable automated UI - * testing by simulating the input from the user. Most - * SWT applications should never need to call this method. - * <p> - * Note that this operation can fail when the operating system - * fails to generate the event for any reason. For example, - * this can happen when there is no such key or mouse button - * or when the system event queue is full. - * </p> - * <p> - * <b>Event Types:</b> - * <p>KeyDown, KeyUp - * <p>The following fields in the <code>Event</code> apply: - * <ul> - * <li>(in) type KeyDown or KeyUp</li> - * <p> Either one of: - * <li>(in) character a character that corresponds to a keyboard key</li> - * <li>(in) keyCode the key code of the key that was typed, - * as defined by the key code constants in class <code>SWT</code></li> - * </ul> - * <p>MouseDown, MouseUp</p> - * <p>The following fields in the <code>Event</code> apply: - * <ul> - * <li>(in) type MouseDown or MouseUp - * <li>(in) button the button that is pressed or released - * </ul> - * <p>MouseMove</p> - * <p>The following fields in the <code>Event</code> apply: - * <ul> - * <li>(in) type MouseMove - * <li>(in) x the x coordinate to move the mouse pointer to in screen coordinates - * <li>(in) y the y coordinate to move the mouse pointer to in screen coordinates - * </ul> - * </dl> - * - * @param event the event to be generated - * - * @return true if the event was generated or false otherwise - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the event is null</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @since 3.0 - * - */ -public bool post (Event event) { - if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED); - if (event is null) error (SWT.ERROR_NULL_ARGUMENT); - if (!OS.GDK_WINDOWING_X11()) return false; - int /*long*/ xDisplay = OS.GDK_DISPLAY (); - int type = event.type; - switch (type) { - case SWT.KeyDown: - case SWT.KeyUp: { - int keyCode = 0; - int /*long*/ keysym = untranslateKey (event.keyCode); - if (keysym !is 0) keyCode = OS.XKeysymToKeycode (xDisplay, keysym); - if (keyCode is 0) { - char key = event.character; - switch (key) { - case SWT.BS: keysym = OS.GDK_BackSpace; break; - case SWT.CR: keysym = OS.GDK_Return; break; - case SWT.DEL: keysym = OS.GDK_Delete; break; - case SWT.ESC: keysym = OS.GDK_Escape; break; - case SWT.TAB: keysym = OS.GDK_Tab; break; - case SWT.LF: keysym = OS.GDK_Linefeed; break; - default: - keysym = wcsToMbcs (key); - } - keyCode = OS.XKeysymToKeycode (xDisplay, keysym); - if (keyCode is 0) return false; - } - OS.XTestFakeKeyEvent (xDisplay, keyCode, type is SWT.KeyDown, 0); - return true; - } - case SWT.MouseDown: - case SWT.MouseMove: - case SWT.MouseUp: { - if (type is SWT.MouseMove) { - OS.XTestFakeMotionEvent (xDisplay, -1, event.x, event.y, 0); - } else { - int button = event.button; - switch (button) { - case 1: - case 2: - case 3: break; - case 4: button = 6; break; - case 5: button = 7; break; - default: return false; - } - OS.XTestFakeButtonEvent (xDisplay, button, type is SWT.MouseDown, 0); - } - return true; - } - /* - * This code is intentionally commented. After posting a - * mouse wheel event the system may respond unpredictably - * to subsequent mouse actions. - */ -// case SWT.MouseWheel: { -// if (event.count is 0) return false; -// int button = event.count < 0 ? 5 : 4; -// OS.XTestFakeButtonEvent (xDisplay, button, type is SWT.MouseWheel, 0); -// } - } - return false; -} - -void postEvent (Event event) { - /* - * Place the event at the end of the event queue. - * This code is always called in the Display's - * thread so it must be re-enterant but does not - * need to be synchronized. - */ - if (eventQueue is null) eventQueue = new Event [4]; - int index = 0; - int length = eventQueue.length; - while (index < length) { - if (eventQueue [index] is null) break; - index++; - } - if (index is length) { - Event [] newQueue = new Event [length + 4]; - System.arraycopy (eventQueue, 0, newQueue, 0, length); - eventQueue = newQueue; - } - eventQueue [index] = event; -} - -void putGdkEvents () { - if (gdkEventCount !is 0) { - for (int i = 0; i < gdkEventCount; i++) { - int /*long*/ event = gdkEvents [i]; - Widget widget = gdkEventWidgets [i]; - if (widget is null || !widget.isDisposed ()) { - OS.gdk_event_put (event); - } - OS.gdk_event_free (event); - gdkEvents [i] = 0; - gdkEventWidgets [i] = null; - } - gdkEventCount = 0; - } -} - -/** - * Reads an event from the operating system's event queue, - * dispatches it appropriately, and returns <code>true</code> - * if there is potentially more work to do, or <code>false</code> - * if the caller can sleep until another event is placed on - * the event queue. - * <p> - * In addition to checking the system event queue, this method also - * checks if any inter-thread messages (created by <code>syncExec()</code> - * or <code>asyncExec()</code>) are waiting to be processed, and if - * so handles them before returning. - * </p> - * - * @return <code>false</code> if the caller can sleep upon return from this method - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_FAILED_EXEC - if an exception occurred while running an inter-thread message</li> - * </ul> - * - * @see #sleep - * @see #wake - */ -public bool readAndDispatch () { - checkDevice (); - bool events = false; - events |= runSettings (); - events |= runPopups (); - events |= OS.g_main_context_iteration (0, false); - if (events) { - runDeferredEvents (); - return true; - } - return runAsyncMessages (false); -} - +// /** +// * Reads an event from the operating system's event queue, +// * dispatches it appropriately, and returns <code>true</code> +// * if there is potentially more work to do, or <code>false</code> +// * if the caller can sleep until another event is placed on +// * the event queue. +// * <p> +// * In addition to checking the system event queue, this method also +// * checks if any inter-thread messages (created by <code>syncExec()</code> +// * or <code>asyncExec()</code>) are waiting to be processed, and if +// * so handles them before returning. +// * </p> +// * +// * @return <code>false</code> if the caller can sleep upon return from this method +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * <li>ERROR_FAILED_EXEC - if an exception occurred while running an inter-thread message</li> +// * </ul> +// * +// * @see #sleep +// * @see #wake +// */ +// public bool readAndDispatch () { +// checkDevice (); +// bool events = false; +// events |= runSettings (); +// events |= runPopups (); +// events |= OS.g_main_context_iteration (0, false); +// if (events) { +// runDeferredEvents (); +// return true; +// } +// return runAsyncMessages (false); +// } +// synchronized void register () { for (int i=0; i<Displays.length; i++) { if (Displays [i] is null) { @@ -3021,1009 +2988,1010 @@ Displays = newDisplays; } -/** - * Releases any internal resources back to the operating - * system and clears all fields except the device handle. - * <p> - * Disposes all shells which are currently open on the display. - * After this method has been invoked, all related related shells - * will answer <code>true</code> when sent the message - * <code>isDisposed()</code>. - * </p><p> - * When a device is destroyed, resources that were acquired - * on behalf of the programmer need to be returned to the - * operating system. For example, if the device allocated a - * font to be used as the system font, this font would be - * freed in <code>release</code>. Also,to assist the garbage - * collector and minimize the amount of memory that is not - * reclaimed when the programmer keeps a reference to a - * disposed device, all fields except the handle are zero'd. - * The handle is needed by <code>destroy</code>. - * </p> - * This method is called before <code>destroy</code>. - * - * @see Device#dispose - * @see #destroy - */ -protected void release () { - sendEvent (SWT.Dispose, new Event ()); - Shell [] shells = getShells (); - for (int i=0; i<shells.length; i++) { - Shell shell = shells [i]; - if (!shell.isDisposed ()) shell.dispose (); - } - if (tray !is null) tray.dispose (); - tray = null; - while (readAndDispatch ()) {} - if (disposeList !is null) { - for (int i=0; i<disposeList.length; i++) { - if (disposeList [i] !is null) disposeList [i].run (); - } - } - disposeList = null; - synchronizer.releaseSynchronizer (); - synchronizer = null; - releaseDisplay (); - super.release (); -} - -void releaseDisplay () { - windowCallback2.dispose (); windowCallback2 = null; - windowCallback3.dispose (); windowCallback3 = null; - windowCallback4.dispose (); windowCallback4 = null; - windowCallback5.dispose (); windowCallback5 = null; - windowProc2 = windowProc3 = windowProc4 = windowProc5 = 0; - - /* Dispose xfilter callback */ - filterCallback.dispose(); filterCallback = null; - filterProc = 0; - - /* Dispose checkIfEvent callback */ - checkIfEventCallback.dispose(); checkIfEventCallback = null; - checkIfEventProc = 0; - - /* Dispose preedit window */ - if (preeditWindow !is null) OS.gtk_widget_destroy (preeditWindow); - imControl = null; - - /* Dispose the menu callback */ - menuPositionCallback.dispose (); menuPositionCallback = null; - menuPositionProc = 0; - - /* Dispose the tooltip map callback */ - sizeAllocateCallback.dispose (); sizeAllocateCallback = null; - sizeAllocateProc = 0; - sizeRequestCallback.dispose (); sizeRequestCallback = null; - sizeRequestProc = 0; - - /* Dispose the shell map callback */ - shellMapCallback.dispose (); shellMapCallback = null; - shellMapProc = 0; - - /* Dispose the run async messages callback */ - idleCallback.dispose (); idleCallback = null; - idleProc = 0; - if (idleHandle !is null) OS.g_source_remove (idleHandle); - idleHandle = 0; - - /* Dispose GtkTreeView callbacks */ - treeSelectionCallback.dispose (); treeSelectionCallback = null; - treeSelectionProc = 0; - cellDataCallback.dispose (); cellDataCallback = null; - cellDataProc = 0; - - /* Dispose the set direction callback */ - setDirectionCallback.dispose (); setDirectionCallback = null; - setDirectionProc = 0; - - /* Dispose the set direction callback */ - allChildrenCallback.dispose (); allChildrenCallback = null; - allChildrenProc = 0; - - /* Dispose the caret callback */ - if (caretId !is null) OS.gtk_timeout_remove (caretId); - caretId = 0; - caretProc = 0; - caretCallback.dispose (); - caretCallback = null; - - /* Release closures */ - for (int i = 0; i < Widget.LAST_SIGNAL; i++) { - if (closures [i] !is null) OS.g_closure_unref (closures [i]); - } - if (shellMapProcClosure !is null) OS.g_closure_unref (shellMapProcClosure); - - /* Dispose the timer callback */ - if (timerIds !is null) { - for (int i=0; i<timerIds.length; i++) { - if (timerIds [i] !is null) OS.gtk_timeout_remove (timerIds [i]); - } - } - timerIds = null; - timerList = null; - timerProc = 0; - timerCallback.dispose (); - timerCallback = null; - windowTimerProc = 0; - windowTimerCallback.dispose (); - windowTimerCallback = null; - - /* Dispose mouse hover callback */ - if (mouseHoverId !is null) OS.gtk_timeout_remove (mouseHoverId); - mouseHoverId = 0; - mouseHoverHandle = mouseHoverProc = 0; - mouseHoverCallback.dispose (); - mouseHoverCallback = null; - - /* Dispose the default font */ - if (systemFont !is null) systemFont.dispose (); - systemFont = null; - - /* Dispose the System Images */ - if (errorImage !is null) errorImage.dispose(); - if (infoImage !is null) infoImage.dispose(); - if (questionImage !is null) questionImage.dispose(); - if (warningImage !is null) warningImage.dispose(); - errorImage = infoImage = questionImage = warningImage = null; - - /* Release the System Cursors */ - for (int i = 0; i < cursors.length; i++) { - if (cursors [i] !is null) cursors [i].dispose (); - } - cursors = null; - - /* Release Acquired Resources */ - if (resources !is null) { - for (int i=0; i<resources.length; i++) { - if (resources [i] !is null) resources [i].dispose (); - } - resources = null; - } - - /* Release the System Colors */ - COLOR_WIDGET_DARK_SHADOW = COLOR_WIDGET_NORMAL_SHADOW = COLOR_WIDGET_LIGHT_SHADOW = - COLOR_WIDGET_HIGHLIGHT_SHADOW = COLOR_WIDGET_BACKGROUND = COLOR_WIDGET_BORDER = - COLOR_LIST_FOREGROUND = COLOR_LIST_BACKGROUND = COLOR_LIST_SELECTION = COLOR_LIST_SELECTION_TEXT = - COLOR_INFO_BACKGROUND = COLOR_INFO_FOREGROUND = null; - - /* Dispose the event callback */ - OS.gdk_event_handler_set (0, 0, 0); - eventCallback.dispose (); eventCallback = null; - - /* Dispose the hidden shell */ - if (shellHandle !is null) OS.gtk_widget_destroy (shellHandle); - shellHandle = 0; - - /* Dispose the settings callback */ - styleSetCallback.dispose(); styleSetCallback = null; - styleSetProc = 0; - - /* Release the sleep resources */ - max_priority = timeout = null; - if (fds !is null) OS.g_free (fds); - fds = 0; - - /* Release references */ - popups = null; - thread = null; - activeShell = null; - lastWidget = null; - indexTable = null; - widgetTable = null; -} - -/** - * Removes the listener from the collection of listeners who will - * be notified when an event of the given type occurs anywhere in - * a widget. The event type is one of the event constants defined - * in class <code>SWT</code>. - * - * @param eventType the type of event to listen for - * @param listener the listener which should no longer be notified when the event occurs - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * - * @see Listener - * @see SWT - * @see #addFilter - * @see #addListener - * - * @since 3.0 - */ -public void removeFilter (int eventType, Listener listener) { - checkDevice (); - if (listener is null) error (SWT.ERROR_NULL_ARGUMENT); - if (filterTable is null) return; - filterTable.unhook (eventType, listener); - if (filterTable.size () is 0) filterTable = null; -} - -int /*long*/ removeGdkEvent () { - if (gdkEventCount is 0) return 0; - int /*long*/ event = gdkEvents [0]; - --gdkEventCount; - System.arraycopy (gdkEvents, 1, gdkEvents, 0, gdkEventCount); - System.arraycopy (gdkEventWidgets, 1, gdkEventWidgets, 0, gdkEventCount); - gdkEvents [gdkEventCount] = 0; - gdkEventWidgets [gdkEventCount] = null; - if (gdkEventCount is 0) { - gdkEvents = null; - gdkEventWidgets = null; - } - return event; -} - -void removeIdleProc () { - synchronized(idleLock) { - if (idleHandle !is null) OS.g_source_remove (idleHandle); - idleNeeded = false; - idleHandle = 0; - } +// /** +// * Releases any internal resources back to the operating +// * system and clears all fields except the device handle. +// * <p> +// * Disposes all shells which are currently open on the display. +// * After this method has been invoked, all related related shells +// * will answer <code>true</code> when sent the message +// * <code>isDisposed()</code>. +// * </p><p> +// * When a device is destroyed, resources that were acquired +// * on behalf of the programmer need to be returned to the +// * operating system. For example, if the device allocated a +// * font to be used as the system font, this font would be +// * freed in <code>release</code>. Also,to assist the garbage +// * collector and minimize the amount of memory that is not +// * reclaimed when the programmer keeps a reference to a +// * disposed device, all fields except the handle are zero'd. +// * The handle is needed by <code>destroy</code>. +// * </p> +// * This method is called before <code>destroy</code>. +// * +// * @see Device#dispose +// * @see #destroy +// */ +// protected void release () { +// sendEvent (SWT.Dispose, new Event ()); +// Shell [] shells = getShells (); +// for (int i=0; i<shells.length; i++) { +// Shell shell = shells [i]; +// if (!shell.isDisposed ()) shell.dispose (); +// } +// if (tray !is null) tray.dispose (); +// tray = null; +// while (readAndDispatch ()) {} +// if (disposeList !is null) { +// for (int i=0; i<disposeList.length; i++) { +// if (disposeList [i] !is null) disposeList [i].run (); +// } +// } +// disposeList = null; +// synchronizer.releaseSynchronizer (); +// synchronizer = null; +// releaseDisplay (); +// super.release (); +// } +// +// void releaseDisplay () { +// windowCallback2.dispose (); windowCallback2 = null; +// windowCallback3.dispose (); windowCallback3 = null; +// windowCallback4.dispose (); windowCallback4 = null; +// windowCallback5.dispose (); windowCallback5 = null; +// windowProc2 = windowProc3 = windowProc4 = windowProc5 = 0; +// +// /* Dispose xfilter callback */ +// filterCallback.dispose(); filterCallback = null; +// filterProc = 0; +// +// /* Dispose checkIfEvent callback */ +// checkIfEventCallback.dispose(); checkIfEventCallback = null; +// checkIfEventProc = 0; +// +// /* Dispose preedit window */ +// if (preeditWindow !is null) OS.gtk_widget_destroy (preeditWindow); +// imControl = null; +// +// /* Dispose the menu callback */ +// menuPositionCallback.dispose (); menuPositionCallback = null; +// menuPositionProc = 0; +// +// /* Dispose the tooltip map callback */ +// sizeAllocateCallback.dispose (); sizeAllocateCallback = null; +// sizeAllocateProc = 0; +// sizeRequestCallback.dispose (); sizeRequestCallback = null; +// sizeRequestProc = 0; +// +// /* Dispose the shell map callback */ +// shellMapCallback.dispose (); shellMapCallback = null; +// shellMapProc = 0; +// +// /* Dispose the run async messages callback */ +// idleCallback.dispose (); idleCallback = null; +// idleProc = 0; +// if (idleHandle !is null) OS.g_source_remove (idleHandle); +// idleHandle = 0; +// +// /* Dispose GtkTreeView callbacks */ +// treeSelectionCallback.dispose (); treeSelectionCallback = null; +// treeSelectionProc = 0; +// cellDataCallback.dispose (); cellDataCallback = null; +// cellDataProcFld = 0; +// +// /* Dispose the set direction callback */ +// setDirectionCallback.dispose (); setDirectionCallback = null; +// setDirectionProc = 0; +// +// /* Dispose the set direction callback */ +// allChildrenCallback.dispose (); allChildrenCallback = null; +// allChildrenProc = 0; +// +// /* Dispose the caret callback */ +// if (caretId !is null) OS.gtk_timeout_remove (caretId); +// caretId = 0; +// caretProc = 0; +// caretCallback.dispose (); +// caretCallback = null; +// +// /* Release closures */ +// for (int i = 0; i < Widget.LAST_SIGNAL; i++) { +// if (closures [i] !is null) OS.g_closure_unref (closures [i]); +// } +// if (shellMapProcClosure !is null) OS.g_closure_unref (shellMapProcClosure); +// +// /* Dispose the timer callback */ +// if (timerIds !is null) { +// for (int i=0; i<timerIds.length; i++) { +// if (timerIds [i] !is null) OS.gtk_timeout_remove (timerIds [i]); +// } +// } +// timerIds = null; +// timerList = null; +// timerProc = 0; +// timerCallback.dispose (); +// timerCallback = null; +// windowTimerProc = 0; +// windowTimerCallback.dispose (); +// windowTimerCallback = null; +// +// /* Dispose mouse hover callback */ +// if (mouseHoverId !is null) OS.gtk_timeout_remove (mouseHoverId); +// mouseHoverId = 0; +// mouseHoverHandle = mouseHoverProc = 0; +// mouseHoverCallback.dispose (); +// mouseHoverCallback = null; +// +// /* Dispose the default font */ +// if (systemFont !is null) systemFont.dispose (); +// systemFont = null; +// +// /* Dispose the System Images */ +// if (errorImage !is null) errorImage.dispose(); +// if (infoImage !is null) infoImage.dispose(); +// if (questionImage !is null) questionImage.dispose(); +// if (warningImage !is null) warningImage.dispose(); +// errorImage = infoImage = questionImage = warningImage = null; +// +// /* Release the System Cursors */ +// for (int i = 0; i < cursors.length; i++) { +// if (cursors [i] !is null) cursors [i].dispose (); +// } +// cursors = null; +// +// /* Release Acquired Resources */ +// if (resources !is null) { +// for (int i=0; i<resources.length; i++) { +// if (resources [i] !is null) resources [i].dispose (); +// } +// resources = null; +// } +// +// /* Release the System Colors */ +// COLOR_WIDGET_DARK_SHADOW = COLOR_WIDGET_NORMAL_SHADOW = COLOR_WIDGET_LIGHT_SHADOW = +// COLOR_WIDGET_HIGHLIGHT_SHADOW = COLOR_WIDGET_BACKGROUND = COLOR_WIDGET_BORDER = +// COLOR_LIST_FOREGROUND = COLOR_LIST_BACKGROUND = COLOR_LIST_SELECTION = COLOR_LIST_SELECTION_TEXT = +// COLOR_INFO_BACKGROUND = COLOR_INFO_FOREGROUND = null; +// +// /* Dispose the event callback */ +// OS.gdk_event_handler_set (0, 0, 0); +// eventCallback.dispose (); eventCallback = null; +// +// /* Dispose the hidden shell */ +// if (shellHandle !is null) OS.gtk_widget_destroy (shellHandle); +// shellHandle = 0; +// +// /* Dispose the settings callback */ +// styleSetCallback.dispose(); styleSetCallback = null; +// styleSetProc = 0; +// +// /* Release the sleep resources */ +// max_priority = timeout = null; +// if (fds !is null) OS.g_free (fds); +// fds = 0; +// +// /* Release references */ +// popups = null; +// thread = null; +// activeShell = null; +// lastWidget = null; +// indexTable = null; +// widgetTable = null; +// } +// +// /** +// * Removes the listener from the collection of listeners who will +// * be notified when an event of the given type occurs anywhere in +// * a widget. The event type is one of the event constants defined +// * in class <code>SWT</code>. +// * +// * @param eventType the type of event to listen for +// * @param listener the listener which should no longer be notified when the event occurs +// * +// * @exception IllegalArgumentException <ul> +// * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> +// * </ul> +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * </ul> +// * +// * @see Listener +// * @see SWT +// * @see #addFilter +// * @see #addListener +// * +// * @since 3.0 +// */ +// public void removeFilter (int eventType, Listener listener) { +// checkDevice (); +// if (listener is null) error (SWT.ERROR_NULL_ARGUMENT); +// if (filterTable is null) return; +// filterTable.unhook (eventType, listener); +// if (filterTable.size () is 0) filterTable = null; +// } +// +// int /*long*/ removeGdkEvent () { +// if (gdkEventCount is 0) return 0; +// auto event = gdkEvents [0]; +// --gdkEventCount; +// System.arraycopy (gdkEvents, 1, gdkEvents, 0, gdkEventCount); +// System.arraycopy (gdkEventWidgets, 1, gdkEventWidgets, 0, gdkEventCount); +// gdkEvents [gdkEventCount] = 0; +// gdkEventWidgets [gdkEventCount] = null; +// if (gdkEventCount is 0) { +// gdkEvents = null; +// gdkEventWidgets = null; +// } +// return event; +// } +// +// void removeIdleProc () { +// synchronized(idleLock) { +// if (idleHandle !is null) OS.g_source_remove (idleHandle); +// idleNeeded = false; +// idleHandle = 0; +// } +// } +// /** +// * Removes the listener from the collection of listeners who will +// * be notified when an event of the given type occurs. The event type +// * is one of the event constants defined in class <code>SWT</code>. +// * +// * @param eventType the type of event to listen for +// * @param listener the listener which should no longer be notified when the event occurs +// * +// * @exception IllegalArgumentException <ul> +// * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> +// * </ul> +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see Listener +// * @see SWT +// * @see #addListener +// * +// * @since 2.0 +// */ +// public void removeListener (int eventType, Listener listener) { +// checkDevice (); +// if (listener is null) error (SWT.ERROR_NULL_ARGUMENT); +// if (eventTable is null) return; +// eventTable.unhook (eventType, listener); +// } +// +// void removeMouseHoverTimeout (int /*long*/ handle) { +// if (handle !is mouseHoverHandle) return; +// if (mouseHoverId !is null) OS.gtk_timeout_remove (mouseHoverId); +// mouseHoverId = 0; +// mouseHoverHandle = 0; +// } +// +// void removePopup (Menu menu) { +// if (popups is null) return; +// for (int i=0; i<popups.length; i++) { +// if (popups [i] is menu) { +// popups [i] = null; +// return; +// } +// } +// } +// +// Widget removeWidget (int /*long*/ handle) { +// if (handle is null) return null; +// lastWidget = null; +// Widget widget = null; +// int index = cast(int)/*64*/ OS.g_object_get_qdata (handle, SWT_OBJECT_INDEX) - 1; +// if (0 <= index && index < widgetTable.length) { +// widget = widgetTable [index]; +// widgetTable [index] = null; +// indexTable [index] = freeSlot; +// freeSlot = index; +// OS.g_object_set_qdata (handle, SWT_OBJECT_INDEX, 0); +// } +// return widget; +// } +// +// bool runAsyncMessages (bool all) { +// return synchronizer.runAsyncMessages (all); +// } +// +// bool runDeferredEvents () { +// /* +// * Run deferred events. This code is always +// * called in the Display's thread so it must +// * be re-enterant but need not be synchronized. +// */ +// while (eventQueue !is null) { +// +// /* Take an event off the queue */ +// Event event = eventQueue [0]; +// if (event is null) break; +// int length = eventQueue.length; +// System.arraycopy (eventQueue, 1, eventQueue, 0, --length); +// eventQueue [length] = null; +// +// /* Run the event */ +// Widget widget = event.widget; +// if (widget !is null && !widget.isDisposed ()) { +// Widget item = event.item; +// if (item is null || !item.isDisposed ()) { +// widget.sendEvent (event); +// } +// } +// +// /* +// * At this point, the event queue could +// * be null due to a recursive invokation +// * when running the event. +// */ +// } +// +// /* Clear the queue */ +// eventQueue = null; +// return true; +// } +// +// bool runPopups () { +// if (popups is null) return false; +// bool result = false; +// while (popups !is null) { +// Menu menu = popups [0]; +// if (menu is null) break; +// int length = popups.length; +// System.arraycopy (popups, 1, popups, 0, --length); +// popups [length] = null; +// runDeferredEvents (); +// if (!menu.isDisposed ()) menu._setVisible (true); +// result = true; +// } +// popups = null; +// return result; +// } +// +// bool runSettingsMeth () { +// if (!runSettings) return false; +// runSettings = false; +// saveResources (); +// initializeSystemColors (); +// sendEvent (SWT.Settings, null); +// Shell [] shells = getShells (); +// for (int i=0; i<shells.length; i++) { +// Shell shell = shells [i]; +// if (!shell.isDisposed ()) { +// shell.fixStyle (); +// shell.redraw (true); +// shell.layout (true, true); +// } +// } +// return true; +// } +// +// /** +// * On platforms which support it, sets the application name +// * to be the argument. On Motif, for example, this can be used +// * to set the name used for resource lookup. Specifying +// * <code>null</code> for the name clears it. +// * +// * @param name the new app name or <code>null</code> +// */ +// public static void setAppName (char[] name) { +// APP_NAME = name; +// } +// +// /** +// * Sets the location of the on-screen pointer relative to the top left corner +// * of the screen. <b>Note: It is typically considered bad practice for a +// * program to move the on-screen pointer location.</b> +// * +// * @param x the new x coordinate for the cursor +// * @param y the new y coordinate for the cursor +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @since 2.1 +// */ +// public void setCursorLocation (int x, int y) { +// checkDevice (); +// if (OS.GDK_WINDOWING_X11 ()) { +// auto xDisplay = OS.GDK_DISPLAY (); +// auto xWindow = OS.XDefaultRootWindow (xDisplay); +// OS.XWarpPointer (xDisplay, OS.None, xWindow, 0, 0, 0, 0, x, y); +// } +// } +// +// /** +// * Sets the location of the on-screen pointer relative to the top left corner +// * of the screen. <b>Note: It is typically considered bad practice for a +// * program to move the on-screen pointer location.</b> +// * +// * @param point new position +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_NULL_ARGUMENT - if the point is null +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @since 2.0 +// */ +// public void setCursorLocation (Point point) { +// checkDevice (); +// if (point is null) error (SWT.ERROR_NULL_ARGUMENT); +// setCursorLocation (point.x, point.y); +// } +// +// /** +// * Sets the application defined property of the receiver +// * with the specified name to the given argument. +// * <p> +// * Applications may have associated arbitrary objects with the +// * receiver in this fashion. If the objects stored in the +// * properties need to be notified when the display is disposed +// * of, it is the application's responsibility provide a +// * <code>disposeExec()</code> handler which does so. +// * </p> +// * +// * @param key the name of the property +// * @param value the new value for the property +// * +// * @exception IllegalArgumentException <ul> +// * <li>ERROR_NULL_ARGUMENT - if the key is null</li> +// * </ul> +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see #getData(String) +// * @see #disposeExec(Runnable) +// */ +// public void setData (char[] key, Object value) { +// checkDevice (); +// if (key is null) error (SWT.ERROR_NULL_ARGUMENT); +// +// if (key==/*eq*/ DISPATCH_EVENT_KEY) { +// if (value is null || (null !is cast(ArrayWrapperInt)value)) { +// dispatchEvents = value.array; +// if (value is null) putGdkEvents (); +// return; +// } +// } +// +// if (key==/*eq*/ ADD_WIDGET_KEY) { +// auto wrap = cast(ArrayWrapperObject) value; +// if( wrap is null ) SWT.error(SWT.ERROR_INVALID_ARGUMENT, null, " []"); +// Object [] data = wrap.array; +// auto handle = (cast(LONG) data [0]).value; +// Widget widget = cast(Widget) data [1]; +// if (widget !is null) { +// addWidget (handle, widget); +// } else { +// removeWidget (handle); +// } +// } +// +// if (key==/*eq*/ ADD_IDLE_PROC_KEY) { +// addIdleProc (); +// return; +// } +// if (key==/*eq*/ REMOVE_IDLE_PROC_KEY) { +// removeIdleProc (); +// return; +// } +// +// /* Remove the key/value pair */ +// if (value is null) { +// if (keys is null) return; +// int index = 0; +// while (index < keys.length && !keys [index]==/*eq*/ key) index++; +// if (index is keys.length) return; +// if (keys.length is 1) { +// keys = null; +// values = null; +// } else { +// char[] [] newKeys = new char[] [keys.length - 1]; +// Object [] newValues = new Object [values.length - 1]; +// System.arraycopy (keys, 0, newKeys, 0, index); +// System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index); +// System.arraycopy (values, 0, newValues, 0, index); +// System.arraycopy (values, index + 1, newValues, index, newValues.length - index); +// keys = newKeys; +// values = newValues; +// } +// return; +// } +// +// /* Add the key/value pair */ +// if (keys is null) { +// keys = [key]; +// values = [value]; +// return; +// } +// for (int i=0; i<keys.length; i++) { +// if (keys [i]==/*eq*/ key) { +// values [i] = value; +// return; +// } +// } +// char[] [] newKeys = new char[] [keys.length + 1]; +// Object [] newValues = new Object [values.length + 1]; +// System.arraycopy (keys, 0, newKeys, 0, keys.length); +// System.arraycopy (values, 0, newValues, 0, values.length); +// newKeys [keys.length] = key; +// newValues [values.length] = value; +// keys = newKeys; +// values = newValues; +// } +// +// /** +// * Sets the application defined, display specific data +// * associated with the receiver, to the argument. +// * The <em>display specific data</em> is a single, +// * unnamed field that is stored with every display. +// * <p> +// * Applications may put arbitrary objects in this field. If +// * the object stored in the display specific data needs to +// * be notified when the display is disposed of, it is the +// * application's responsibility provide a +// * <code>disposeExec()</code> handler which does so. +// * </p> +// * +// * @param data the new display specific data +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see #getData() +// * @see #disposeExec(Runnable) +// */ +// public void setData (Object data) { +// checkDevice (); +// this.data = data; +// } +// +// int /*long*/ setDirectionProcMeth (int /*long*/ widget, int /*long*/ direction) { +// OS.gtk_widget_set_direction (widget, cast(int)/*64*/ direction); +// if (OS.GTK_IS_CONTAINER (widget)) { +// OS.gtk_container_forall (widget, setDirectionProc, direction); +// } +// return 0; +// } +// +// /** +// * Sets the synchronizer used by the display to be +// * the argument, which can not be null. +// * +// * @param synchronizer the new synchronizer for the display (must not be null) +// * +// * @exception IllegalArgumentException <ul> +// * <li>ERROR_NULL_ARGUMENT - if the synchronizer is null</li> +// * </ul> +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * <li>ERROR_FAILED_EXEC - if an exception occurred while running an inter-thread message</li> +// * </ul> +// */ +// public void setSynchronizer (Synchronizer synchronizer) { +// checkDevice (); +// if (synchronizer is null) error (SWT.ERROR_NULL_ARGUMENT); +// if (this.synchronizer !is null) { +// this.synchronizer.runAsyncMessages(true); +// } +// this.synchronizer = synchronizer; +// } +// +// void showIMWindow (Control control) { +// imControl = control; +// if (preeditWindow is null) { +// preeditWindow = OS.gtk_window_new (OS.GTK_WINDOW_POPUP); +// if (preeditWindow is null) error (SWT.ERROR_NO_HANDLES); +// preeditLabel = OS.gtk_label_new (null); +// if (preeditLabel is null) error (SWT.ERROR_NO_HANDLES); +// OS.gtk_container_add (preeditWindow, preeditLabel); +// OS.gtk_widget_show (preeditLabel); +// } +// int /*long*/ [] preeditString = new int /*long*/ [1]; +// int /*long*/ [] pangoAttrs = new int /*long*/ [1]; +// auto imHandle = control.imHandle (); +// OS.gtk_im_context_get_preedit_string (imHandle, preeditString, pangoAttrs, null); +// if (preeditString [0] !is null && OS.strlen (preeditString [0]) > 0) { +// Control widget = control.findBackgroundControl (); +// if (widget is null) widget = control; +// OS.gtk_widget_modify_bg (preeditWindow, OS.GTK_STATE_NORMAL, widget.getBackgroundColor ()); +// widget.setForegroundColor (preeditLabel, control.getForegroundColor()); +// OS.gtk_widget_modify_font (preeditLabel, control.getFontDescription ()); +// if (pangoAttrs [0] !is null) OS.gtk_label_set_attributes (preeditLabel, pangoAttrs[0]); +// OS.gtk_label_set_text (preeditLabel, preeditString [0]); +// Point point = control.toDisplay (control.getIMCaretPos ()); +// OS.gtk_window_move (preeditWindow, point.x, point.y); +// GtkRequisition* requisition = new GtkRequisition (); +// OS.gtk_widget_size_request (preeditLabel, requisition); +// OS.gtk_window_resize (preeditWindow, requisition.width, requisition.height); +// OS.gtk_widget_show (preeditWindow); +// } else { +// OS.gtk_widget_hide (preeditWindow); +// } +// if (preeditString [0] !is null) OS.g_free (preeditString [0]); +// if (pangoAttrs [0] !is null) OS.pango_attr_list_unref (pangoAttrs [0]); +// } +// +// /** +// * Causes the user-interface thread to <em>sleep</em> (that is, +// * to be put in a state where it does not consume CPU cycles) +// * until an event is received or it is otherwise awakened. +// * +// * @return <code>true</code> if an event requiring dispatching was placed on the queue. +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see #wake +// */ +// public bool sleep () { +// checkDevice (); +// if (gdkEventCount is 0) { +// gdkEvents = null; +// gdkEventWidgets = null; +// } +// if (settingsChanged) { +// settingsChanged = false; +// runSettings = true; +// return false; +// } +// if (getMessageCount () !is 0) return true; +// if (fds is null) { +// allocated_nfds = 2; +// fds = OS.g_malloc (OS.GPollFD_sizeof () * allocated_nfds); +// } +// max_priority [0] = timeout [0] = 0; +// auto context = OS.g_main_context_default (); +// bool result = false; +// do { +// if (OS.g_main_context_acquire (context)) { +// result = OS.g_main_context_prepare (context, max_priority); +// int nfds; +// while ((nfds = OS.g_main_context_query (context, max_priority [0], timeout, fds, allocated_nfds)) > allocated_nfds) { +// OS.g_free (fds); +// allocated_nfds = nfds; +// fds = OS.g_malloc (OS.GPollFD_sizeof() * allocated_nfds); +// } +// auto poll = OS.g_main_context_get_poll_func (context); +// if (poll !is null) { +// if (nfds > 0 || timeout [0] !is 0) { +// /* +// * Bug in GTK. For some reason, g_main_context_wakeup() may +// * fail to wake up the UI thread from the polling function. +// * The fix is to sleep for a maximum of 50 milliseconds. +// */ +// if (timeout [0] < 0) timeout [0] = 50; +// +// /* Exit the OS lock to allow other threads to enter GTK */ +// Lock lock = OS.lock; +// int count = lock.lock (); +// for (int i = 0; i < count; i++) lock.unlock (); +// try { +// wake_state = false; +// OS.Call (poll, fds, nfds, timeout [0]); +// } finally { +// for (int i = 0; i < count; i++) lock.lock (); +// lock.unlock (); +// } +// } +// } +// OS.g_main_context_check (context, max_priority [0], fds, nfds); +// OS.g_main_context_release (context); +// } +// } while (!result && getMessageCount () is null && !wake_state); +// wake_state = false; +// return true; +// } +// +// /** +// * Causes the <code>run()</code> method of the runnable to +// * be invoked by the user-interface thread after the specified +// * number of milliseconds have elapsed. If milliseconds is less +// * than zero, the runnable is not executed. +// * <p> +// * Note that at the time the runnable is invoked, widgets +// * that have the receiver as their display may have been +// * disposed. Therefore, it is necessary to check for this +// * case inside the runnable before accessing the widget. +// * </p> +// * +// * @param milliseconds the delay before running the runnable +// * @param runnable code to run on the user-interface thread +// * +// * @exception IllegalArgumentException <ul> +// * <li>ERROR_NULL_ARGUMENT - if the runnable is null</li> +// * </ul> +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see #asyncExec +// */ +// public void timerExec (int milliseconds, Runnable runnable) { +// checkDevice (); +// if (runnable is null) error (SWT.ERROR_NULL_ARGUMENT); +// if (timerList is null) timerList = new Runnable [4]; +// if (timerIds is null) timerIds = new int [4]; +// int index = 0; +// while (index < timerList.length) { +// if (timerList [index] is runnable) break; +// index++; +// } +// if (index !is timerList.length) { +// OS.gtk_timeout_remove (timerIds [index]); +// timerList [index] = null; +// timerIds [index] = 0; +// if (milliseconds < 0) return; +// } else { +// if (milliseconds < 0) return; +// index = 0; +// while (index < timerList.length) { +// if (timerList [index] is null) break; +// index++; +// } +// if (index is timerList.length) { +// Runnable [] newTimerList = new Runnable [timerList.length + 4]; +// System.arraycopy (timerList, 0, newTimerList, 0, timerList.length); +// timerList = newTimerList; +// int [] newTimerIds = new int [timerIds.length + 4]; +// System.arraycopy (timerIds, 0, newTimerIds, 0, timerIds.length); +// timerIds = newTimerIds; +// } +// } +// int timerId = OS.gtk_timeout_add (milliseconds, timerProc, index); +// if (timerId !is null) { +// timerIds [index] = timerId; +// timerList [index] = runnable; +// } +// } +// +// int /*long*/ timerProcMeth (int /*long*/ i) { +// if (timerList is null) return 0; +// int index = cast(int)/*64*/i; +// if (0 <= index && index < timerList.length) { +// Runnable runnable = timerList [index]; +// timerList [index] = null; +// timerIds [index] = 0; +// if (runnable !is null) runnable.run (); +// } +// return 0; +// } +// +// int /*long*/ caretProcMeth (int /*long*/ clientData) { +// caretId = 0; +// if (currentCaret is null) { +// return 0; +// } +// if (currentCaret.blinkCaret()) { +// int blinkRate = currentCaret.blinkRate; +// if (blinkRate is 0) return 0; +// caretId = OS.gtk_timeout_add (blinkRate, caretProc, 0); +// } else { +// currentCaret = null; +// } +// return 0; +// } +// +// int /*long*/ sizeAllocateProcMeth (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { +// Widget widget = getWidget (user_data); +// if (widget is null) return 0; +// return widget.sizeAllocateProc (handle, arg0, user_data); +// } +// +// int /*long*/ sizeRequestProcMeth (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { +// Widget widget = getWidget (user_data); +// if (widget is null) return 0; +// return widget.sizeRequestProc (handle, arg0, user_data); +// } +// +// int /*long*/ treeSelectionProcMeth (int /*long*/ model, int /*long*/ path, int /*long*/ iter, int /*long*/ data) { +// Widget widget = getWidget (data); +// if (widget is null) return 0; +// return widget.treeSelectionProc (model, path, iter, treeSelection, treeSelectionLength++); +// } +// +// void saveResources () { +// int resourceCount = 0; +// if (resources is null) { +// resources = new Resource [RESOURCE_SIZE]; +// } else { +// resourceCount = resources.length; +// Resource [] newResources = new Resource [resourceCount + RESOURCE_SIZE]; +// System.arraycopy (resources, 0, newResources, 0, resourceCount); +// resources = newResources; +// } +// if (systemFont !is null) { +// resources [resourceCount++] = systemFont; +// systemFont = null; +// } +// if (errorImage !is null) resources [resourceCount++] = errorImage; +// if (infoImage !is null) resources [resourceCount++] = infoImage; +// if (questionImage !is null) resources [resourceCount++] = questionImage; +// if (warningImage !is null) resources [resourceCount++] = warningImage; +// errorImage = infoImage = questionImage = warningImage = null; +// for (int i=0; i<cursors.length; i++) { +// if (cursors [i] !is null) resources [resourceCount++] = cursors [i]; +// cursors [i] = null; +// } +// if (resourceCount < RESOURCE_SIZE) { +// Resource [] newResources = new Resource [resourceCount]; +// System.arraycopy (resources, 0, newResources, 0, resourceCount); +// resources = newResources; +// } +// } +// +void sendEvent (int eventType, Event event) { +// if (eventTable is null && filterTable is null) { +// return; +// } +// if (event is null) event = new Event (); +// event.display = this; +// event.type = eventType; +// if (event.time is 0) event.time = getLastEventTime (); +// if (!filterEvent (event)) { +// if (eventTable !is null) eventTable.sendEvent (event); +// } } -/** - * Removes the listener from the collection of listeners who will - * be notified when an event of the given type occurs. The event type - * is one of the event constants defined in class <code>SWT</code>. - * - * @param eventType the type of event to listen for - * @param listener the listener which should no longer be notified when the event occurs - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see Listener - * @see SWT - * @see #addListener - * - * @since 2.0 - */ -public void removeListener (int eventType, Listener listener) { - checkDevice (); - if (listener is null) error (SWT.ERROR_NULL_ARGUMENT); - if (eventTable is null) return; - eventTable.unhook (eventType, listener); -} - -void removeMouseHoverTimeout (int /*long*/ handle) { - if (handle !is mouseHoverHandle) return; - if (mouseHoverId !is null) OS.gtk_timeout_remove (mouseHoverId); - mouseHoverId = 0; - mouseHoverHandle = 0; -} - -void removePopup (Menu menu) { - if (popups is null) return; - for (int i=0; i<popups.length; i++) { - if (popups [i] is menu) { - popups [i] = null; - return; - } - } -} - -Widget removeWidget (int /*long*/ handle) { - if (handle is null) return null; - lastWidget = null; - Widget widget = null; - int index = cast(int)/*64*/ OS.g_object_get_qdata (handle, SWT_OBJECT_INDEX) - 1; - if (0 <= index && index < widgetTable.length) { - widget = widgetTable [index]; - widgetTable [index] = null; - indexTable [index] = freeSlot; - freeSlot = index; - OS.g_object_set_qdata (handle, SWT_OBJECT_INDEX, 0); - } - return widget; -} - -bool runAsyncMessages (bool all) { - return synchronizer.runAsyncMessages (all); -} - -bool runDeferredEvents () { - /* - * Run deferred events. This code is always - * called in the Display's thread so it must - * be re-enterant but need not be synchronized. - */ - while (eventQueue !is null) { - - /* Take an event off the queue */ - Event event = eventQueue [0]; - if (event is null) break; - int length = eventQueue.length; - System.arraycopy (eventQueue, 1, eventQueue, 0, --length); - eventQueue [length] = null; - - /* Run the event */ - Widget widget = event.widget; - if (widget !is null && !widget.isDisposed ()) { - Widget item = event.item; - if (item is null || !item.isDisposed ()) { - widget.sendEvent (event); - } - } - - /* - * At this point, the event queue could - * be null due to a recursive invokation - * when running the event. - */ - } - - /* Clear the queue */ - eventQueue = null; - return true; -} - -bool runPopups () { - if (popups is null) return false; - bool result = false; - while (popups !is null) { - Menu menu = popups [0]; - if (menu is null) break; - int length = popups.length; - System.arraycopy (popups, 1, popups, 0, --length); - popups [length] = null; - runDeferredEvents (); - if (!menu.isDisposed ()) menu._setVisible (true); - result = true; - } - popups = null; - return result; -} - -bool runSettings () { - if (!runSettings) return false; - runSettings = false; - saveResources (); - initializeSystemColors (); - sendEvent (SWT.Settings, null); - Shell [] shells = getShells (); - for (int i=0; i<shells.length; i++) { - Shell shell = shells [i]; - if (!shell.isDisposed ()) { - shell.fixStyle (); - shell.redraw (true); - shell.layout (true, true); - } - } - return true; -} - -/** - * On platforms which support it, sets the application name - * to be the argument. On Motif, for example, this can be used - * to set the name used for resource lookup. Specifying - * <code>null</code> for the name clears it. - * - * @param name the new app name or <code>null</code> - */ -public static void setAppName (char[] name) { - APP_NAME = name; -} - -/** - * Sets the location of the on-screen pointer relative to the top left corner - * of the screen. <b>Note: It is typically considered bad practice for a - * program to move the on-screen pointer location.</b> - * - * @param x the new x coordinate for the cursor - * @param y the new y coordinate for the cursor - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @since 2.1 - */ -public void setCursorLocation (int x, int y) { - checkDevice (); - if (OS.GDK_WINDOWING_X11 ()) { - int /*long*/ xDisplay = OS.GDK_DISPLAY (); - int /*long*/ xWindow = OS.XDefaultRootWindow (xDisplay); - OS.XWarpPointer (xDisplay, OS.None, xWindow, 0, 0, 0, 0, x, y); - } -} - -/** - * Sets the location of the on-screen pointer relative to the top left corner - * of the screen. <b>Note: It is typically considered bad practice for a - * program to move the on-screen pointer location.</b> - * - * @param point new position - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_NULL_ARGUMENT - if the point is null - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @since 2.0 - */ -public void setCursorLocation (Point point) { - checkDevice (); - if (point is null) error (SWT.ERROR_NULL_ARGUMENT); - setCursorLocation (point.x, point.y); -} - -/** - * Sets the application defined property of the receiver - * with the specified name to the given argument. - * <p> - * Applications may have associated arbitrary objects with the - * receiver in this fashion. If the objects stored in the - * properties need to be notified when the display is disposed - * of, it is the application's responsibility provide a - * <code>disposeExec()</code> handler which does so. - * </p> - * - * @param key the name of the property - * @param value the new value for the property - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the key is null</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see #getData(String) - * @see #disposeExec(Runnable) - */ -public void setData (char[] key, Object value) { - checkDevice (); - if (key is null) error (SWT.ERROR_NULL_ARGUMENT); - - if (key==/*eq*/ DISPATCH_EVENT_KEY) { - if (value is null || value instanceof int []) { - dispatchEvents = (int []) value; - if (value is null) putGdkEvents (); - return; - } - } - - if (key==/*eq*/ ADD_WIDGET_KEY) { - Object [] data = (Object []) value; - int /*long*/ handle = ((LONG) data [0]).value; - Widget widget = (Widget) data [1]; - if (widget !is null) { - addWidget (handle, widget); - } else { - removeWidget (handle); - } - } - - if (key==/*eq*/ ADD_IDLE_PROC_KEY) { - addIdleProc (); - return; - } - if (key==/*eq*/ REMOVE_IDLE_PROC_KEY) { - removeIdleProc (); - return; - } +// +// void setCurrentCaret (Caret caret) { +// if (caretId !is null) OS.gtk_timeout_remove(caretId); +// caretId = 0; +// currentCaret = caret; +// if (caret is null) return; +// int blinkRate = currentCaret.blinkRate; +// caretId = OS.gtk_timeout_add (blinkRate, caretProc, 0); +// } +// +// int /*long*/ shellMapProcMeth (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { +// Widget widget = getWidget (handle); +// if (widget is null) return 0; +// return widget.shellMapProc (handle, arg0, user_data); +// } +// +// int /*long*/ styleSetProcMeth (int /*long*/ gobject, int /*long*/ arg1, int /*long*/ user_data) { +// settingsChanged = true; +// return 0; +// } +// +// /** +// * Causes the <code>run()</code> method of the runnable to +// * be invoked by the user-interface thread at the next +// * reasonable opportunity. The thread which calls this method +// * is suspended until the runnable completes. Specifying <code>null</code> +// * as the runnable simply wakes the user-interface thread. +// * <p> +// * Note that at the time the runnable is invoked, widgets +// * that have the receiver as their display may have been +// * disposed. Therefore, it is necessary to check for this +// * case inside the runnable before accessing the widget. +// * </p> +// * +// * @param runnable code to run on the user-interface thread or <code>null</code> +// * +// * @exception SWTException <ul> +// * <li>ERROR_FAILED_EXEC - if an exception occurred when executing the runnable</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see #asyncExec +// */ +// public void syncExec (Runnable runnable) { +// if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED); +// synchronized (idleLock) { +// if (idleNeeded && idleHandle is null) { +// //NOTE: calling unlocked function in OS +// idleHandle = OS._g_idle_add (idleProc, 0); +// } +// } +// synchronizer.syncExec (runnable); +// } +// +// static int translateKey (int key) { +// for (int i=0; i<KeyTable.length; i++) { +// if (KeyTable [i] [0] is key) return KeyTable [i] [1]; +// } +// return 0; +// } +// +// static int untranslateKey (int key) { +// for (int i=0; i<KeyTable.length; i++) { +// if (KeyTable [i] [1] is key) return KeyTable [i] [0]; +// } +// return 0; +// } +// +// /** +// * Forces all outstanding paint requests for the display +// * to be processed before this method returns. +// * +// * @exception SWTException <ul> +// * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see Control#update() +// */ +// public void update () { +// checkDevice (); +// flushExposes (0, true); +// OS.gdk_window_process_all_updates (); +// } +// +// /** +// * If the receiver's user-interface thread was <code>sleep</code>ing, +// * causes it to be awakened and start running again. Note that this +// * method may be called from any thread. +// * +// * @exception SWTException <ul> +// * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> +// * </ul> +// * +// * @see #sleep +// */ +// public void wake () { +// if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED); +// if (thread is Thread.currentThread ()) return; +// wakeThread (); +// } +// +// void wakeThread () { +// OS.g_main_context_wakeup (0); +// wake_state = true; +// } +// +// static char wcsToMbcs (char ch) { +// int key = ch & 0xFFFF; +// if (key <= 0x7F) return ch; +// byte [] buffer = Converter.wcsToMbcs (null,[ch], false); +// if (buffer.length is 1) return cast(char) buffer [0]; +// if (buffer.length is 2) { +// return cast(char) (((buffer [0] & 0xFF) << 8) | (buffer [1] & 0xFF)); +// } +// return 0; +// } - /* Remove the key/value pair */ - if (value is null) { - if (keys is null) return; - int index = 0; - while (index < keys.length && !keys [index]==/*eq*/ key) index++; - if (index is keys.length) return; - if (keys.length is 1) { - keys = null; - values = null; - } else { - char[] [] newKeys = new char[] [keys.length - 1]; - Object [] newValues = new Object [values.length - 1]; - System.arraycopy (keys, 0, newKeys, 0, index); - System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index); - System.arraycopy (values, 0, newValues, 0, index); - System.arraycopy (values, index + 1, newValues, index, newValues.length - index); - keys = newKeys; - values = newValues; - } - return; - } - - /* Add the key/value pair */ - if (keys is null) { - keys = new char[] [] {key}; - values = new Object [] {value}; - return; - } - for (int i=0; i<keys.length; i++) { - if (keys [i]==/*eq*/ key) { - values [i] = value; - return; - } - } - char[] [] newKeys = new char[] [keys.length + 1]; - Object [] newValues = new Object [values.length + 1]; - System.arraycopy (keys, 0, newKeys, 0, keys.length); - System.arraycopy (values, 0, newValues, 0, values.length); - newKeys [keys.length] = key; - newValues [values.length] = value; - keys = newKeys; - values = newValues; -} - -/** - * Sets the application defined, display specific data - * associated with the receiver, to the argument. - * The <em>display specific data</em> is a single, - * unnamed field that is stored with every display. - * <p> - * Applications may put arbitrary objects in this field. If - * the object stored in the display specific data needs to - * be notified when the display is disposed of, it is the - * application's responsibility provide a - * <code>disposeExec()</code> handler which does so. - * </p> - * - * @param data the new display specific data - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see #getData() - * @see #disposeExec(Runnable) - */ -public void setData (Object data) { - checkDevice (); - this.data = data; -} - -int /*long*/ setDirectionProc (int /*long*/ widget, int /*long*/ direction) { - OS.gtk_widget_set_direction (widget, cast(int)/*64*/ direction); - if (OS.GTK_IS_CONTAINER (widget)) { - OS.gtk_container_forall (widget, setDirectionProc, direction); - } - return 0; -} - -/** - * Sets the synchronizer used by the display to be - * the argument, which can not be null. - * - * @param synchronizer the new synchronizer for the display (must not be null) - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the synchronizer is null</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_FAILED_EXEC - if an exception occurred while running an inter-thread message</li> - * </ul> - */ -public void setSynchronizer (Synchronizer synchronizer) { - checkDevice (); - if (synchronizer is null) error (SWT.ERROR_NULL_ARGUMENT); - if (this.synchronizer !is null) { - this.synchronizer.runAsyncMessages(true); - } - this.synchronizer = synchronizer; -} - -void showIMWindow (Control control) { - imControl = control; - if (preeditWindow is null) { - preeditWindow = OS.gtk_window_new (OS.GTK_WINDOW_POPUP); - if (preeditWindow is null) error (SWT.ERROR_NO_HANDLES); - preeditLabel = OS.gtk_label_new (null); - if (preeditLabel is null) error (SWT.ERROR_NO_HANDLES); - OS.gtk_container_add (preeditWindow, preeditLabel); - OS.gtk_widget_show (preeditLabel); - } - int /*long*/ [] preeditString = new int /*long*/ [1]; - int /*long*/ [] pangoAttrs = new int /*long*/ [1]; - int /*long*/ imHandle = control.imHandle (); - OS.gtk_im_context_get_preedit_string (imHandle, preeditString, pangoAttrs, null); - if (preeditString [0] !is null && OS.strlen (preeditString [0]) > 0) { - Control widget = control.findBackgroundControl (); - if (widget is null) widget = control; - OS.gtk_widget_modify_bg (preeditWindow, OS.GTK_STATE_NORMAL, widget.getBackgroundColor ()); - widget.setForegroundColor (preeditLabel, control.getForegroundColor()); - OS.gtk_widget_modify_font (preeditLabel, control.getFontDescription ()); - if (pangoAttrs [0] !is null) OS.gtk_label_set_attributes (preeditLabel, pangoAttrs[0]); - OS.gtk_label_set_text (preeditLabel, preeditString [0]); - Point point = control.toDisplay (control.getIMCaretPos ()); - OS.gtk_window_move (preeditWindow, point.x, point.y); - GtkRequisition requisition = new GtkRequisition (); - OS.gtk_widget_size_request (preeditLabel, requisition); - OS.gtk_window_resize (preeditWindow, requisition.width, requisition.height); - OS.gtk_widget_show (preeditWindow); - } else { - OS.gtk_widget_hide (preeditWindow); - } - if (preeditString [0] !is null) OS.g_free (preeditString [0]); - if (pangoAttrs [0] !is null) OS.pango_attr_list_unref (pangoAttrs [0]); -} - -/** - * Causes the user-interface thread to <em>sleep</em> (that is, - * to be put in a state where it does not consume CPU cycles) - * until an event is received or it is otherwise awakened. - * - * @return <code>true</code> if an event requiring dispatching was placed on the queue. - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see #wake - */ -public bool sleep () { - checkDevice (); - if (gdkEventCount is 0) { - gdkEvents = null; - gdkEventWidgets = null; - } - if (settingsChanged) { - settingsChanged = false; - runSettings = true; - return false; - } - if (getMessageCount () !is 0) return true; - if (fds is null) { - allocated_nfds = 2; - fds = OS.g_malloc (OS.GPollFD_sizeof () * allocated_nfds); - } - max_priority [0] = timeout [0] = 0; - int /*long*/ context = OS.g_main_context_default (); - bool result = false; - do { - if (OS.g_main_context_acquire (context)) { - result = OS.g_main_context_prepare (context, max_priority); - int nfds; - while ((nfds = OS.g_main_context_query (context, max_priority [0], timeout, fds, allocated_nfds)) > allocated_nfds) { - OS.g_free (fds); - allocated_nfds = nfds; - fds = OS.g_malloc (OS.GPollFD_sizeof() * allocated_nfds); - } - int /*long*/ poll = OS.g_main_context_get_poll_func (context); - if (poll !is null) { - if (nfds > 0 || timeout [0] !is 0) { - /* - * Bug in GTK. For some reason, g_main_context_wakeup() may - * fail to wake up the UI thread from the polling function. - * The fix is to sleep for a maximum of 50 milliseconds. - */ - if (timeout [0] < 0) timeout [0] = 50; - - /* Exit the OS lock to allow other threads to enter GTK */ - Lock lock = OS.lock; - int count = lock.lock (); - for (int i = 0; i < count; i++) lock.unlock (); - try { - wake = false; - OS.Call (poll, fds, nfds, timeout [0]); - } finally { - for (int i = 0; i < count; i++) lock.lock (); - lock.unlock (); - } - } - } - OS.g_main_context_check (context, max_priority [0], fds, nfds); - OS.g_main_context_release (context); - } - } while (!result && getMessageCount () is null && !wake); - wake = false; - return true; -} - -/** - * Causes the <code>run()</code> method of the runnable to - * be invoked by the user-interface thread after the specified - * number of milliseconds have elapsed. If milliseconds is less - * than zero, the runnable is not executed. - * <p> - * Note that at the time the runnable is invoked, widgets - * that have the receiver as their display may have been - * disposed. Therefore, it is necessary to check for this - * case inside the runnable before accessing the widget. - * </p> - * - * @param milliseconds the delay before running the runnable - * @param runnable code to run on the user-interface thread - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the runnable is null</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see #asyncExec - */ -public void timerExec (int milliseconds, Runnable runnable) { - checkDevice (); - if (runnable is null) error (SWT.ERROR_NULL_ARGUMENT); - if (timerList is null) timerList = new Runnable [4]; - if (timerIds is null) timerIds = new int [4]; - int index = 0; - while (index < timerList.length) { - if (timerList [index] is runnable) break; - index++; - } - if (index !is timerList.length) { - OS.gtk_timeout_remove (timerIds [index]); - timerList [index] = null; - timerIds [index] = 0; - if (milliseconds < 0) return; - } else { - if (milliseconds < 0) return; - index = 0; - while (index < timerList.length) { - if (timerList [index] is null) break; - index++; - } - if (index is timerList.length) { - Runnable [] newTimerList = new Runnable [timerList.length + 4]; - System.arraycopy (timerList, 0, newTimerList, 0, timerList.length); - timerList = newTimerList; - int [] newTimerIds = new int [timerIds.length + 4]; - System.arraycopy (timerIds, 0, newTimerIds, 0, timerIds.length); - timerIds = newTimerIds; - } - } - int timerId = OS.gtk_timeout_add (milliseconds, timerProc, index); - if (timerId !is null) { - timerIds [index] = timerId; - timerList [index] = runnable; - } -} - -int /*long*/ timerProc (int /*long*/ i) { - if (timerList is null) return 0; - int index = cast(int)/*64*/i; - if (0 <= index && index < timerList.length) { - Runnable runnable = timerList [index]; - timerList [index] = null; - timerIds [index] = 0; - if (runnable !is null) runnable.run (); - } - return 0; -} - -int /*long*/ caretProc (int /*long*/ clientData) { - caretId = 0; - if (currentCaret is null) { - return 0; - } - if (currentCaret.blinkCaret()) { - int blinkRate = currentCaret.blinkRate; - if (blinkRate is 0) return 0; - caretId = OS.gtk_timeout_add (blinkRate, caretProc, 0); - } else { - currentCaret = null; - } - return 0; -} - -int /*long*/ sizeAllocateProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { - Widget widget = getWidget (user_data); - if (widget is null) return 0; - return widget.sizeAllocateProc (handle, arg0, user_data); -} - -int /*long*/ sizeRequestProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { - Widget widget = getWidget (user_data); - if (widget is null) return 0; - return widget.sizeRequestProc (handle, arg0, user_data); -} - -int /*long*/ treeSelectionProc (int /*long*/ model, int /*long*/ path, int /*long*/ iter, int /*long*/ data) { - Widget widget = getWidget (data); - if (widget is null) return 0; - return widget.treeSelectionProc (model, path, iter, treeSelection, treeSelectionLength++); -} - -void saveResources () { - int resourceCount = 0; - if (resources is null) { - resources = new Resource [RESOURCE_SIZE]; - } else { - resourceCount = resources.length; - Resource [] newResources = new Resource [resourceCount + RESOURCE_SIZE]; - System.arraycopy (resources, 0, newResources, 0, resourceCount); - resources = newResources; - } - if (systemFont !is null) { - resources [resourceCount++] = systemFont; - systemFont = null; - } - if (errorImage !is null) resources [resourceCount++] = errorImage; - if (infoImage !is null) resources [resourceCount++] = infoImage; - if (questionImage !is null) resources [resourceCount++] = questionImage; - if (warningImage !is null) resources [resourceCount++] = warningImage; - errorImage = infoImage = questionImage = warningImage = null; - for (int i=0; i<cursors.length; i++) { - if (cursors [i] !is null) resources [resourceCount++] = cursors [i]; - cursors [i] = null; - } - if (resourceCount < RESOURCE_SIZE) { - Resource [] newResources = new Resource [resourceCount]; - System.arraycopy (resources, 0, newResources, 0, resourceCount); - resources = newResources; - } -} - -void sendEvent (int eventType, Event event) { - if (eventTable is null && filterTable is null) { - return; - } - if (event is null) event = new Event (); - event.display = this; - event.type = eventType; - if (event.time is 0) event.time = getLastEventTime (); - if (!filterEvent (event)) { - if (eventTable !is null) eventTable.sendEvent (event); - } -} - -void setCurrentCaret (Caret caret) { - if (caretId !is null) OS.gtk_timeout_remove(caretId); - caretId = 0; - currentCaret = caret; - if (caret is null) return; - int blinkRate = currentCaret.blinkRate; - caretId = OS.gtk_timeout_add (blinkRate, caretProc, 0); -} - -int /*long*/ shellMapProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { - Widget widget = getWidget (handle); - if (widget is null) return 0; - return widget.shellMapProc (handle, arg0, user_data); -} - -int /*long*/ styleSetProc (int /*long*/ gobject, int /*long*/ arg1, int /*long*/ user_data) { - settingsChanged = true; - return 0; -} - -/** - * Causes the <code>run()</code> method of the runnable to - * be invoked by the user-interface thread at the next - * reasonable opportunity. The thread which calls this method - * is suspended until the runnable completes. Specifying <code>null</code> - * as the runnable simply wakes the user-interface thread. - * <p> - * Note that at the time the runnable is invoked, widgets - * that have the receiver as their display may have been - * disposed. Therefore, it is necessary to check for this - * case inside the runnable before accessing the widget. - * </p> - * - * @param runnable code to run on the user-interface thread or <code>null</code> - * - * @exception SWTException <ul> - * <li>ERROR_FAILED_EXEC - if an exception occurred when executing the runnable</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see #asyncExec - */ -public void syncExec (Runnable runnable) { - if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED); - synchronized (idleLock) { - if (idleNeeded && idleHandle is null) { - //NOTE: calling unlocked function in OS - idleHandle = OS._g_idle_add (idleProc, 0); - } - } - synchronizer.syncExec (runnable); -} - -static int translateKey (int key) { - for (int i=0; i<KeyTable.length; i++) { - if (KeyTable [i] [0] is key) return KeyTable [i] [1]; - } - return 0; -} - -static int untranslateKey (int key) { - for (int i=0; i<KeyTable.length; i++) { - if (KeyTable [i] [1] is key) return KeyTable [i] [0]; - } - return 0; -} - -/** - * Forces all outstanding paint requests for the display - * to be processed before this method returns. - * - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see Control#update() - */ -public void update () { - checkDevice (); - flushExposes (0, true); - OS.gdk_window_process_all_updates (); -} - -/** - * If the receiver's user-interface thread was <code>sleep</code>ing, - * causes it to be awakened and start running again. Note that this - * method may be called from any thread. - * - * @exception SWTException <ul> - * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> - * </ul> - * - * @see #sleep - */ -public void wake () { - if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED); - if (thread is Thread.currentThread ()) return; - wakeThread (); -} - -void wakeThread () { - OS.g_main_context_wakeup (0); - wake = true; -} - -static char wcsToMbcs (char ch) { - int key = ch & 0xFFFF; - if (key <= 0x7F) return ch; - byte [] buffer = Converter.wcsToMbcs (null, new char [] {ch}, false); - if (buffer.length is 1) return (char) buffer [0]; - if (buffer.length is 2) { - return (char) (((buffer [0] & 0xFF) << 8) | (buffer [1] & 0xFF)); - } - return 0; -} - -int /*long*/ windowProc (int /*long*/ handle, int /*long*/ user_data) { - Widget widget = getWidget (handle); - if (widget is null) return 0; - return widget.windowProc (handle, user_data); -} - -int /*long*/ windowProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { - Widget widget = getWidget (handle); - if (widget is null) return 0; - return widget.windowProc (handle, arg0, user_data); -} - -int /*long*/ windowProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ user_data) { - Widget widget = getWidget (handle); - if (widget is null) return 0; - return widget.windowProc (handle, arg0, arg1, user_data); -} - -int /*long*/ windowProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ user_data) { - Widget widget = getWidget (handle); - if (widget is null) return 0; - return widget.windowProc (handle, arg0, arg1, arg2, user_data); -} - -int /*long*/ windowTimerProc (int /*long*/ handle) { - Widget widget = getWidget (handle); - if (widget is null) return 0; - return widget.timerProc (handle); -} +// int /*long*/ windowProcMeth (GtkWidget* handle, int /*long*/ user_data) { +// Widget widget = getWidget (handle); +// if (widget is null) return 0; +// return widget.windowProc (handle, user_data); +// } +// +// int /*long*/ windowProcMeth (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { +// Widget widget = getWidget (handle); +// if (widget is null) return 0; +// return widget.windowProc (handle, arg0, user_data); +// } +// +// int /*long*/ windowProcMeth (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ user_data) { +// Widget widget = getWidget (handle); +// if (widget is null) return 0; +// return widget.windowProc (handle, arg0, arg1, user_data); +// } +// +// int /*long*/ windowProcMeth (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ user_data) { +// Widget widget = getWidget (handle); +// if (widget is null) return 0; +// return widget.windowProc (handle, arg0, arg1, arg2, user_data); +// } +// +// int /*long*/ windowTimerProcMeth (int /*long*/ handle) { +// Widget widget = getWidget (handle); +// if (widget is null) return 0; +// return widget.timerProc (handle); +// } } -++/ \ No newline at end of file
--- a/dwt/widgets/Event.d Tue Jan 08 01:23:25 2008 +0100 +++ b/dwt/widgets/Event.d Tue Jan 08 08:07:04 2008 +0100 @@ -13,11 +13,10 @@ import dwt.graphics.GC; import dwt.graphics.Rectangle; -import tango.text.convert.Format; +import dwt.widgets.Widget; +import dwt.widgets.Display; -/// PORTING_TYPE -class Display{} -class Widget{} +import tango.text.convert.Format; /**
--- a/dwt/widgets/EventTable.d Tue Jan 08 01:23:25 2008 +0100 +++ b/dwt/widgets/EventTable.d Tue Jan 08 08:07:04 2008 +0100 @@ -10,7 +10,15 @@ *******************************************************************************/ module dwt.widgets.EventTable; -class EventTable{} +import dwt.widgets.Listener; +import dwt.widgets.Event; + +class EventTable{ + public void hook (int eventType, Listener listener) {} + public void sendEvent (Event event) ; + public bool hooks (int eventType) ; +} + /+++ import dwt.*; import dwt.internal.SWTEventListener;
--- a/dwt/widgets/Shell.d Tue Jan 08 01:23:25 2008 +0100 +++ b/dwt/widgets/Shell.d Tue Jan 08 08:07:04 2008 +0100 @@ -10,7 +10,13 @@ *******************************************************************************/ module dwt.widgets.Shell; -class Shell{} +import dwt.widgets.Widget; +import dwt.internal.gtk.c.gtktypes; + +class Shell : Widget { + GtkWidget* shellHandle; + bool isDisposed(); +} /++ import dwt.*;
--- a/dwt/widgets/Synchronizer.d Tue Jan 08 01:23:25 2008 +0100 +++ b/dwt/widgets/Synchronizer.d Tue Jan 08 08:07:04 2008 +0100 @@ -10,7 +10,14 @@ *******************************************************************************/ module dwt.widgets.Synchronizer; -class Synchronizer{} +import dwt.widgets.Display; +import dwt.dwthelper.Runnable; + +class Synchronizer{ + public this (Display display) { + } + package void asyncExec (Runnable runnable) {} +} /++ import dwt.*; import dwt.internal.Compatibility; @@ -44,7 +51,7 @@ * * @param display the display to create the synchronizer on */ -public Synchronizer (Display display) { +public this (Display display) { this.display = display; }
--- a/dwt/widgets/Widget.d Tue Jan 08 01:23:25 2008 +0100 +++ b/dwt/widgets/Widget.d Tue Jan 08 08:07:04 2008 +0100 @@ -10,8 +10,38 @@ *******************************************************************************/ module dwt.widgets.Widget; +import dwt.internal.gtk.c.gtktypes; +import dwt.internal.gtk.c.gdktypes; + class Widget{ + static const int DISPOSED = 1<<0; + static const int CANVAS = 1<<1; + static const int KEYED_DATA = 1<<2; + static const int HANDLE = 1<<3; + static const int DISABLED = 1<<4; + static const int MENU = 1<<5; + static const int OBSCURED = 1<<6; + static const int MOVED = 1<<7; + static const int RESIZED = 1<<8; + static const int ZERO_WIDTH = 1<<9; + static const int ZERO_HEIGHT = 1<<10; + static const int HIDDEN = 1<<11; + static const int FOREGROUND = 1<<12; + static const int BACKGROUND = 1<<13; + static const int FONT = 1<<14; + static const int PARENT_BACKGROUND = 1<<15; + static const int THEME_BACKGROUND = 1<<16; + int style, state; + int /*long*/ cellDataProc (int /*long*/ tree_column, int /*long*/ cell, int /*long*/ tree_model, int /*long*/ iter, GtkWidget* data) { + return 0; + } + void fixedMapProc (GtkWidget* widget) { + } +void rendererGetSizeProc(GtkCellRenderer *cell, GtkWidget *handle, GdkRectangle *cell_area, int *x_offset, int *y_offset, int *width, int *height); +void rendererRenderProc (GtkCellRenderer * cell, GdkDrawable * window, GtkWidget * handle, GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, int flags); + } + /++ import dwt.SWT; import dwt.internal.*; @@ -62,106 +92,106 @@ Object data; /* Global state flags */ - static final int DISPOSED = 1<<0; - static final int CANVAS = 1<<1; - static final int KEYED_DATA = 1<<2; - static final int HANDLE = 1<<3; - static final int DISABLED = 1<<4; - static final int MENU = 1<<5; - static final int OBSCURED = 1<<6; - static final int MOVED = 1<<7; - static final int RESIZED = 1<<8; - static final int ZERO_WIDTH = 1<<9; - static final int ZERO_HEIGHT = 1<<10; - static final int HIDDEN = 1<<11; - static final int FOREGROUND = 1<<12; - static final int BACKGROUND = 1<<13; - static final int FONT = 1<<14; - static final int PARENT_BACKGROUND = 1<<15; - static final int THEME_BACKGROUND = 1<<16; + static const int DISPOSED = 1<<0; + static const int CANVAS = 1<<1; + static const int KEYED_DATA = 1<<2; + static const int HANDLE = 1<<3; + static const int DISABLED = 1<<4; + static const int MENU = 1<<5; + static const int OBSCURED = 1<<6; + static const int MOVED = 1<<7; + static const int RESIZED = 1<<8; + static const int ZERO_WIDTH = 1<<9; + static const int ZERO_HEIGHT = 1<<10; + static const int HIDDEN = 1<<11; + static const int FOREGROUND = 1<<12; + static const int BACKGROUND = 1<<13; + static const int FONT = 1<<14; + static const int PARENT_BACKGROUND = 1<<15; + static const int THEME_BACKGROUND = 1<<16; /* A layout was requested on this widget */ - static final int LAYOUT_NEEDED = 1<<17; + static const int LAYOUT_NEEDED = 1<<17; /* The preferred size of a child has changed */ - static final int LAYOUT_CHANGED = 1<<18; + static const int LAYOUT_CHANGED = 1<<18; /* A layout was requested in this widget hierachy */ - static final int LAYOUT_CHILD = 1<<19; + static const int LAYOUT_CHILD = 1<<19; /* More global state flags */ - static final int RELEASED = 1<<20; - static final int DISPOSE_SENT = 1<<21; - static final int FOREIGN_HANDLE = 1<<22; - static final int DRAG_DETECT = 1<<23; + static const int RELEASED = 1<<20; + static const int DISPOSE_SENT = 1<<21; + static const int FOREIGN_HANDLE = 1<<22; + static const int DRAG_DETECT = 1<<23; /* Default size for widgets */ - static final int DEFAULT_WIDTH = 64; - static final int DEFAULT_HEIGHT = 64; + static const int DEFAULT_WIDTH = 64; + static const int DEFAULT_HEIGHT = 64; /* GTK signals data */ - static final int ACTIVATE = 1; - static final int BUTTON_PRESS_EVENT = 2; - static final int BUTTON_PRESS_EVENT_INVERSE = 3; - static final int BUTTON_RELEASE_EVENT = 4; - static final int BUTTON_RELEASE_EVENT_INVERSE = 5; - static final int CHANGED = 6; - static final int CHANGE_VALUE = 7; - static final int CLICKED = 8; - static final int COMMIT = 9; - static final int CONFIGURE_EVENT = 10; - static final int DELETE_EVENT = 11; - static final int DELETE_RANGE = 12; - static final int DELETE_TEXT = 13; - static final int ENTER_NOTIFY_EVENT = 14; - static final int EVENT = 15; - static final int EVENT_AFTER = 16; - static final int EXPAND_COLLAPSE_CURSOR_ROW = 17; - static final int EXPOSE_EVENT = 18; - static final int EXPOSE_EVENT_INVERSE = 19; - static final int FOCUS = 20; - static final int FOCUS_IN_EVENT = 21; - static final int FOCUS_OUT_EVENT = 22; - static final int GRAB_FOCUS = 23; - static final int HIDE = 24; - static final int INPUT = 25; - static final int INSERT_TEXT = 26; - static final int KEY_PRESS_EVENT = 27; - static final int KEY_RELEASE_EVENT = 28; - static final int LEAVE_NOTIFY_EVENT = 29; - static final int MAP = 30; - static final int MAP_EVENT = 31; - static final int MNEMONIC_ACTIVATE = 32; - static final int MOTION_NOTIFY_EVENT = 33; - static final int MOTION_NOTIFY_EVENT_INVERSE = 34; - static final int MOVE_FOCUS = 35; - static final int OUTPUT = 36; - static final int POPUP_MENU = 37; - static final int PREEDIT_CHANGED = 38; - static final int REALIZE = 39; - static final int ROW_ACTIVATED = 40; - static final int SCROLL_CHILD = 41; - static final int SCROLL_EVENT = 42; - static final int SELECT = 43; - static final int SHOW = 44; - static final int SHOW_HELP = 45; - static final int SIZE_ALLOCATE = 46; - static final int STYLE_SET = 47; - static final int SWITCH_PAGE = 48; - static final int TEST_COLLAPSE_ROW = 49; - static final int TEST_EXPAND_ROW = 50; - static final int TEXT_BUFFER_INSERT_TEXT = 51; - static final int TOGGLED = 52; - static final int UNMAP = 53; - static final int UNMAP_EVENT = 54; - static final int UNREALIZE = 55; - static final int VALUE_CHANGED = 56; - static final int VISIBILITY_NOTIFY_EVENT = 57; - static final int WINDOW_STATE_EVENT = 58; - static final int ACTIVATE_INVERSE = 59; - static final int DAY_SELECTED = 60; - static final int MONTH_CHANGED = 61; - static final int LAST_SIGNAL = 62; + static const int ACTIVATE = 1; + static const int BUTTON_PRESS_EVENT = 2; + static const int BUTTON_PRESS_EVENT_INVERSE = 3; + static const int BUTTON_RELEASE_EVENT = 4; + static const int BUTTON_RELEASE_EVENT_INVERSE = 5; + static const int CHANGED = 6; + static const int CHANGE_VALUE = 7; + static const int CLICKED = 8; + static const int COMMIT = 9; + static const int CONFIGURE_EVENT = 10; + static const int DELETE_EVENT = 11; + static const int DELETE_RANGE = 12; + static const int DELETE_TEXT = 13; + static const int ENTER_NOTIFY_EVENT = 14; + static const int EVENT = 15; + static const int EVENT_AFTER = 16; + static const int EXPAND_COLLAPSE_CURSOR_ROW = 17; + static const int EXPOSE_EVENT = 18; + static const int EXPOSE_EVENT_INVERSE = 19; + static const int FOCUS = 20; + static const int FOCUS_IN_EVENT = 21; + static const int FOCUS_OUT_EVENT = 22; + static const int GRAB_FOCUS = 23; + static const int HIDE = 24; + static const int INPUT = 25; + static const int INSERT_TEXT = 26; + static const int KEY_PRESS_EVENT = 27; + static const int KEY_RELEASE_EVENT = 28; + static const int LEAVE_NOTIFY_EVENT = 29; + static const int MAP = 30; + static const int MAP_EVENT = 31; + static const int MNEMONIC_ACTIVATE = 32; + static const int MOTION_NOTIFY_EVENT = 33; + static const int MOTION_NOTIFY_EVENT_INVERSE = 34; + static const int MOVE_FOCUS = 35; + static const int OUTPUT = 36; + static const int POPUP_MENU = 37; + static const int PREEDIT_CHANGED = 38; + static const int REALIZE = 39; + static const int ROW_ACTIVATED = 40; + static const int SCROLL_CHILD = 41; + static const int SCROLL_EVENT = 42; + static const int SELECT = 43; + static const int SHOW = 44; + static const int SHOW_HELP = 45; + static const int SIZE_ALLOCATE = 46; + static const int STYLE_SET = 47; + static const int SWITCH_PAGE = 48; + static const int TEST_COLLAPSE_ROW = 49; + static const int TEST_EXPAND_ROW = 50; + static const int TEXT_BUFFER_INSERT_TEXT = 51; + static const int TOGGLED = 52; + static const int UNMAP = 53; + static const int UNMAP_EVENT = 54; + static const int UNREALIZE = 55; + static const int VALUE_CHANGED = 56; + static const int VISIBILITY_NOTIFY_EVENT = 57; + static const int WINDOW_STATE_EVENT = 58; + static const int ACTIVATE_INVERSE = 59; + static const int DAY_SELECTED = 60; + static const int MONTH_CHANGED = 61; + static const int LAST_SIGNAL = 62; /** * Prevents uninitialized instances from being created outside the package.