# HG changeset patch
# User Frank Benoit
# Date 1199855846 -3600
# Node ID 5e5d1c9cffdb0686bb8b9c3c1d9ece64b6043ff0
# Parent ffffd0cd3b5910fdf8ff41f63949ec4b1886a694
ATK, Control
diff -r ffffd0cd3b59 -r 5e5d1c9cffdb dwt/internal/accessibility/gtk/ATK.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/accessibility/gtk/ATK.d Wed Jan 09 06:17:26 2008 +0100
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others. All rights reserved.
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module dwt.internal.accessibility.gtk.ATK;
+
+
+import dwt.internal.Library;
+import dwt.internal.gtk.OS;
+import dwt.internal.gtk.c.atk;
+
+import tango.core.Traits;
+
+template NameOfFunc(alias f) {
+ // Note: highly dependent on the .stringof formatting
+ // the value begins with "& " which is why the first two chars are cut off
+ const char[] NameOfFunc = (&f).stringof[2 .. $];
+}
+
+template ForwardGtkAtkCFunc( alias cFunc ) {
+ alias ParameterTupleOf!(cFunc) P;
+ alias ReturnTypeOf!(cFunc) R;
+ mixin("public static R " ~ NameOfFunc!(cFunc) ~ "( P p ){
+ lock.lock();
+ scope(exit) lock.unlock();
+ return cFunc(p);
+ }");
+}
+/+
+// alternative template implementation, might be more stable
+template ForwardGtkOsCFunc(char[] name) {
+ alias typeof(mixin(name)) func;
+ alias ParameterTupleOf!(func) Params;
+ alias ReturnTypeOf!(func) Ret;
+ mixin("public static Ret "~name~"( Params p ) {
+ return ."~name~"(p);
+ }");
+}
++/
+
+public class ATK : OS {
+
+ /** Constants */
+ public static const int ATK_RELATION_LABELLED_BY = 4;
+ public static const int ATK_ROLE_CHECK_BOX = 7;
+ public static const int ATK_ROLE_COMBO_BOX = 11;
+ public static const int ATK_ROLE_DIALOG = 16;
+ public static const int ATK_ROLE_DRAWING_AREA = 18;
+ public static const int ATK_ROLE_WINDOW = 68;
+ public static const int ATK_ROLE_LABEL = 28;
+ public static const int ATK_ROLE_LIST = 30;
+ public static const int ATK_ROLE_LIST_ITEM = 31;
+ public static const int ATK_ROLE_MENU = 32;
+ public static const int ATK_ROLE_MENU_BAR = 33;
+ public static const int ATK_ROLE_MENU_ITEM = 34;
+ public static const int ATK_ROLE_PAGE_TAB = 36;
+ public static const int ATK_ROLE_PAGE_TAB_LIST = 37;
+ public static const int ATK_ROLE_PROGRESS_BAR = 41;
+ public static const int ATK_ROLE_PUSH_BUTTON = 42;
+ public static const int ATK_ROLE_RADIO_BUTTON = 43;
+ public static const int ATK_ROLE_SCROLL_BAR = 47;
+ public static const int ATK_ROLE_SEPARATOR = 49;
+ public static const int ATK_ROLE_SLIDER = 50;
+ public static const int ATK_ROLE_TABLE = 54;
+ public static const int ATK_ROLE_TABLE_CELL = 55;
+ public static const int ATK_ROLE_TABLE_COLUMN_HEADER = 56;
+ public static const int ATK_ROLE_TABLE_ROW_HEADER = 57;
+ public static const int ATK_ROLE_TEXT = 60;
+ public static const int ATK_ROLE_TOOL_BAR = 62;
+ public static const int ATK_ROLE_TOOL_TIP = 63;
+ public static const int ATK_ROLE_TREE = 64;
+ public static const int ATK_STATE_ARMED = 2;
+ public static const int ATK_STATE_BUSY = 3;
+ public static const int ATK_STATE_CHECKED = 4;
+ public static const int ATK_STATE_DEFUNCT = 5;
+ public static const int ATK_STATE_EDITABLE = 6;
+ public static const int ATK_STATE_ENABLED = 7;
+ public static const int ATK_STATE_EXPANDED = 9;
+ public static const int ATK_STATE_FOCUSABLE = 10;
+ public static const int ATK_STATE_FOCUSED = 11;
+ public static const int ATK_STATE_MULTISELECTABLE = 16;
+ public static const int ATK_STATE_PRESSED = 18;
+ public static const int ATK_STATE_RESIZABLE = 19;
+ public static const int ATK_STATE_SELECTABLE = 20;
+ public static const int ATK_STATE_SELECTED = 21;
+ public static const int ATK_STATE_SHOWING = 23;
+ public static const int ATK_STATE_TRANSIENT = 26;
+ public static const int ATK_STATE_VISIBLE = 28;
+ public static const int ATK_TEXT_BOUNDARY_CHAR = 0;
+ public static const int ATK_TEXT_BOUNDARY_WORD_START = 1;
+ public static const int ATK_TEXT_BOUNDARY_WORD_END = 2;
+ public static const int ATK_TEXT_BOUNDARY_SENTENCE_START = 3;
+ public static const int ATK_TEXT_BOUNDARY_SENTENCE_END = 4;
+ public static const int ATK_TEXT_BOUNDARY_LINE_START = 5;
+ public static const int ATK_TEXT_BOUNDARY_LINE_END = 6;
+ public static const int ATK_XY_WINDOW = 1;
+
+ /** Signals */
+ public static const char[] selection_changed = "selection_changed";
+ public static const char[] text_changed_insert = "text_changed::insert";
+ public static const char[] text_changed_delete = "text_changed::delete";
+ public static const char[] text_caret_moved = "text_caret_moved";
+ public static const char[] text_selection_changed = "text_selection_changed";
+
+ //mixin ForwardGtkAtkCFunc!(.ATK_ACTION_GET_IFACE );
+ //mixin ForwardGtkAtkCFunc!(.ATK_COMPONENT_GET_IFACE);
+ //mixin ForwardGtkAtkCFunc!(.ATK_OBJECT_FACTORY_CLASS );
+ //mixin ForwardGtkAtkCFunc!(.ATK_SELECTION_GET_IFACE );
+ //mixin ForwardGtkAtkCFunc!(.ATK_TEXT_GET_IFACE );
+ //mixin ForwardGtkAtkCFunc!(.GTK_ACCESSIBLE );
+ mixin ForwardGtkAtkCFunc!(.atk_focus_tracker_notify );
+ mixin ForwardGtkAtkCFunc!(.atk_get_default_registry );
+ mixin ForwardGtkAtkCFunc!(.atk_object_factory_create_accessible );
+ mixin ForwardGtkAtkCFunc!(.atk_object_factory_get_accessible_type );
+ mixin ForwardGtkAtkCFunc!(.atk_object_initialize );
+ mixin ForwardGtkAtkCFunc!(.atk_object_ref_relation_set );
+ mixin ForwardGtkAtkCFunc!(.atk_registry_get_factory );
+ mixin ForwardGtkAtkCFunc!(.atk_registry_set_factory_type );
+ mixin ForwardGtkAtkCFunc!(.atk_relation_set_get_n_relations );
+ mixin ForwardGtkAtkCFunc!(.atk_relation_set_get_relation );
+ mixin ForwardGtkAtkCFunc!(.atk_relation_set_remove );
+ mixin ForwardGtkAtkCFunc!(.atk_state_set_add_state );
+ mixin ForwardGtkAtkCFunc!(.atk_state_set_new );
+
+}
diff -r ffffd0cd3b59 -r 5e5d1c9cffdb dwt/internal/gtk/OS.d
--- a/dwt/internal/gtk/OS.d Wed Jan 09 03:05:22 2008 +0100
+++ b/dwt/internal/gtk/OS.d Wed Jan 09 06:17:26 2008 +0100
@@ -120,7 +120,15 @@
uint button;
int same_screen;
}
-
+struct XWindowChanges {
+int x;
+int y;
+int width;
+int height;
+int border_width;
+uint sibling;
+int stack_mode;
+}
private extern (C){
GdkWindow * gdk_window_lookup(uint);
uint XRenderCreatePicture(void *, uint, XRenderPictFormat *, uint, XRenderPictureAttributes *);
@@ -143,6 +151,9 @@
void * gdk_atom_intern(char *, int);
int gdk_property_get(GdkDrawable *, void *, void *, uint, uint, int, void **, int *, int *, char ** );
+ void * gdk_x11_drawable_get_xdisplay(GdkDrawable *);
+ int XDefaultScreen(void *);
+ int XReconfigureWMWindow(void *, uint, int, uint, XWindowChanges *);
}
@@ -211,22 +222,22 @@
private bool GTK_IS_CONTAINER(GtkWidget*);
private GType GTK_TYPE_MENU();
private GType GTK_TYPE_WIDGET();
-private GType GTK_WIDGET_FLAGS();
-private GType GTK_WIDGET_STATE();
-private GType GTK_WIDGET_HAS_DEFAULT();
-private GType GTK_WIDGET_HAS_FOCUS();
-private GType GTK_WIDGET_IS_SENSITIVE();
-private GType GTK_WIDGET_MAPPED();
-private GType GTK_WIDGET_SENSITIVE();
-private GType GTK_WIDGET_SET_FLAGS();
-private GType GTK_WIDGET_UNSET_FLAGS();
-private GType GTK_WIDGET_VISIBLE();
+private GType GTK_WIDGET_FLAGS(GtkWidget*);
+private GType GTK_WIDGET_STATE(GtkWidget*);
+private GType GTK_WIDGET_HAS_DEFAULT(GtkWidget*);
+private GType GTK_WIDGET_HAS_FOCUS(GtkWidget*);
+private GType GTK_WIDGET_IS_SENSITIVE(GtkWidget*);
+private GType GTK_WIDGET_MAPPED(GtkWidget*);
+private GType GTK_WIDGET_SENSITIVE(GtkWidget*);
+private void GTK_WIDGET_SET_FLAGS(GtkWidget*, int);
+private void GTK_WIDGET_UNSET_FLAGS(GtkWidget*, int);
+private bool GTK_WIDGET_VISIBLE(GtkWidget*);
private GType G_OBJECT_CLASS ();
private GType G_OBJECT_GET_CLASS ();
private GType G_OBJECT_TYPE_NAME ();
private GType G_TYPE_BOOLEAN();
private GType G_TYPE_INT();
-private GType G_OBJECT_TYPE( );
+private GType G_OBJECT_TYPE( GObject* );
private GType G_TYPE_STRING();
private char* gdk_x11_screen_get_window_manager_name(GdkScreen*);
private char XKeysymToKeycode(void *, uint);
@@ -901,8 +912,8 @@
// mixin ForwardGtkOsCFunc!(.XCheckMaskEvent);
// mixin ForwardGtkOsCFunc!(.XCheckWindowEvent);
- mixin ForwardGtkOsCFunc!(.XCheckIfEvent);
-// mixin ForwardGtkOsCFunc!(.XDefaultScreen);
+ mixin ForwardGtkOsCFunc!(.XCheckIfEvent);
+ mixin ForwardGtkOsCFunc!(.XDefaultScreen);
mixin ForwardGtkOsCFunc!(.XDefaultRootWindow);
mixin ForwardGtkOsCFunc!(.XFlush);
// mixin ForwardGtkOsCFunc!(.XFree);
@@ -911,7 +922,7 @@
// mixin ForwardGtkOsCFunc!(.XQueryTree);
mixin ForwardGtkOsCFunc!(.XKeysymToKeycode);
// mixin ForwardGtkOsCFunc!(.XListProperties);
-// mixin ForwardGtkOsCFunc!(.XReconfigureWMWindow);
+ mixin ForwardGtkOsCFunc!(.XReconfigureWMWindow);
// mixin ForwardGtkOsCFunc!(.XSendEvent);
mixin ForwardGtkOsCFunc!(.XSetIOErrorHandler);
@@ -926,8 +937,8 @@
mixin ForwardGtkOsCFunc!(.gdk_x11_atom_to_xatom);
mixin ForwardGtkOsCFunc!(.gdk_x11_colormap_get_xcolormap);
+ +/
mixin ForwardGtkOsCFunc!(.gdk_x11_drawable_get_xdisplay);
- +/
mixin ForwardGtkOsCFunc!(.gdk_x11_drawable_get_xid);
//mixin ForwardGtkOsCFunc!(.gdk_x11_screen_lookup_visual);
mixin ForwardGtkOsCFunc!(.gdk_x11_screen_get_window_manager_name);
@@ -1011,12 +1022,12 @@
mixin ForwardGtkOsCFunc!(.g_free);
mixin ForwardGtkOsCFunc!(.g_idle_add);
mixin ForwardGtkOsCFunc!(.g_list_append);
-// mixin ForwardGtkOsCFunc!(.g_list_data);
+ //mixin ForwardGtkOsCFunc!(.g_list_data); // macro impl
mixin ForwardGtkOsCFunc!(.g_list_free);
mixin ForwardGtkOsCFunc!(.g_list_free_1);
mixin ForwardGtkOsCFunc!(.g_list_length);
// mixin ForwardGtkOsCFunc!(.g_list_set_next);
-// mixin ForwardGtkOsCFunc!(.g_list_next);
+ //mixin ForwardGtkOsCFunc!(.g_list_next);
mixin ForwardGtkOsCFunc!(.g_list_nth);
mixin ForwardGtkOsCFunc!(.g_list_nth_data);
mixin ForwardGtkOsCFunc!(.g_list_prepend);
@@ -1992,33 +2003,33 @@
(cast(GtkScrolledWindowClass*) ((cast(GTypeInstance*) arg0).g_class)).scrollbar_spacing : 3) ;
}
- int GTK_WIDGET_HEIGHT( GtkWidget* arg0 )
+ static int GTK_WIDGET_HEIGHT( GtkWidget* arg0 )
{ return arg0.allocation.height; }
- void GTK_WIDGET_SET_HEIGHT( GtkWidget* arg0, int arg1)
+ static void GTK_WIDGET_SET_HEIGHT( GtkWidget* arg0, int arg1)
{ arg0.allocation.height = arg1; }
- int GTK_WIDGET_WIDTH( GtkWidget* arg0)
+ static int GTK_WIDGET_WIDTH( GtkWidget* arg0)
{ return arg0.allocation.width; }
- void GTK_WIDGET_SET_WIDTH( GtkWidget* arg0, int arg1)
+ static void GTK_WIDGET_SET_WIDTH( GtkWidget* arg0, int arg1)
{ arg0.allocation.width = arg1; }
- GdkWindow* GTK_WIDGET_WINDOW( GtkWidget* arg0)
+ static GdkWindow* GTK_WIDGET_WINDOW( GtkWidget* arg0)
{ return arg0.window; }
- int GTK_WIDGET_X( GtkWidget* arg0 )
+ static int GTK_WIDGET_X( GtkWidget* arg0 )
{ return arg0.allocation.x; }
- void GTK_WIDGET_SET_X( GtkWidget* arg0, int arg1)
+ static void GTK_WIDGET_SET_X( GtkWidget* arg0, int arg1)
{ arg0.allocation.x = arg1; }
- int GTK_WIDGET_Y( GtkWidget* arg0 )
+ static int GTK_WIDGET_Y( GtkWidget* arg0 )
{ return arg0.allocation.y; }
- void GTK_WIDGET_SET_Y( GtkWidget* arg0, int arg1)
+ static void GTK_WIDGET_SET_Y( GtkWidget* arg0, int arg1)
{ arg0.allocation.y = arg1; }
- int GTK_WIDGET_REQUISITION_WIDTH( GtkWidget* arg0 )
+ static int GTK_WIDGET_REQUISITION_WIDTH( GtkWidget* arg0 )
{ return arg0.requisition.width; }
- int GTK_WIDGET_REQUISITION_HEIGHT( GtkWidget* arg0 )
+ static int GTK_WIDGET_REQUISITION_HEIGHT( GtkWidget* arg0 )
{ return arg0.requisition.height; }
- GtkIMContext* GTK_ENTRY_IM_CONTEXT( GtkEntry* arg0 )
+ static GtkIMContext* GTK_ENTRY_IM_CONTEXT( GtkEntry* arg0 )
{ return arg0.im_context; }
- GtkIMContext* GTK_TEXTVIEW_IM_CONTEXT( GtkTextView* arg0)
+ static GtkIMContext* GTK_TEXTVIEW_IM_CONTEXT( GtkTextView* arg0)
{ return arg0.im_context; }
static GtkWidget* GTK_TOOLTIPS_TIP_WINDOW( GtkTooltips* arg0)
@@ -2035,12 +2046,28 @@
{ return arg0.type; }
Window X_EVENT_WINDOW( XAnyEvent* arg0 )
{ return arg0.window; }
+ +/
- g_list_data(arg0) (arg0)->data
- g_slist_data(arg0) (arg0)->data
- g_list_set_next(arg0, arg1) (arg0)->next = arg1
- g_list_set_previous(arg0, arg1) (arg0)->prev = arg1
- +/
+ //g_list_data(arg0) (arg0)->data
+ static void* g_list_data( GList* arg0 ) {
+ return arg0.data;
+ }
+ //g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL)
+ static void* g_list_next( GList* list ) {
+ return list ? list.next : null;
+ }
+ //g_slist_data(arg0) (arg0)->data
+ //g_list_set_next(arg0, arg1) (arg0)->next = arg1
+ //g_list_set_previous(arg0, arg1) (arg0)->prev = arg1
+
+
+
+
+
+
+
+
+
//gtk_rc_style_get_bg_pixmap_name(arg0, arg1) (arg0)->bg_pixmap_name[arg1]
static char* gtk_rc_style_get_bg_pixmap_name( GtkRcStyle* arg0, int arg1 ) {
diff -r ffffd0cd3b59 -r 5e5d1c9cffdb dwt/internal/gtk/c/gdktypes.d
--- a/dwt/internal/gtk/c/gdktypes.d Wed Jan 09 03:05:22 2008 +0100
+++ b/dwt/internal/gtk/c/gdktypes.d Wed Jan 09 06:17:26 2008 +0100
@@ -2126,7 +2126,22 @@
* GdkWindowTypeHinttype_hint;
* a hint of the function of the window
*/
-public struct GdkWindowAttr{}
+public struct GdkWindowAttr{
+ char * title;
+ int event_mask;
+ int x;
+ int y;
+ int width;
+ int height;
+ int wclass;
+ GdkVisual * visual;
+ GdkColormap * colormap;
+ int window_type;
+ GdkCursor * cursor;
+ char * wmclass_name;
+ char * wmclass_class;
+ int override_redirect;
+}
// char *title;
// gdk-Windows.html
// int eventMask;
@@ -2315,7 +2330,7 @@
uint state;
uint button;
GdkDevice *device;
- double xRoot, yRoot;
+ double x_root, y_root;
}
@@ -2346,14 +2361,14 @@
{
GdkEventType type;
GdkWindow *window;
- byte sendEvent;
+ byte send_event;
uint time;
double x;
double y;
uint state;
GdkScrollDirection direction;
GdkDevice *device;
- double xRoot, yRoot;
+ double x_root, y_root;
}
@@ -2379,15 +2394,15 @@
{
GdkEventType type;
GdkWindow *window;
- byte sendEvent;
+ byte send_event;
uint time;
double x;
double y;
double *axes;
uint state;
- short isHint;
+ short is_hint;
GdkDevice *device;
- double xRoot, yRoot;
+ double x_root, y_root;
}
@@ -2477,8 +2492,8 @@
uint time;
double x;
double y;
- double xRoot;
- double yRoot;
+ double x_root;
+ double y_root;
GdkCrossingMode mode;
GdkNotifyType detail;
int focus;
@@ -2503,7 +2518,7 @@
GdkEventType type;
GdkWindow *window;
byte sendEvent;
- short inn;
+ short in_;
}
diff -r ffffd0cd3b59 -r 5e5d1c9cffdb dwt/widgets/Composite.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/widgets/Composite.d Wed Jan 09 06:17:26 2008 +0100
@@ -0,0 +1,1361 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module dwt.widgets.Composite;
+import dwt.widgets.Control;
+import dwt.internal.gtk.c.gtktypes;
+
+class Composite : Control {
+ Control [] _getTabList ();
+ int backgroundMode;
+ GtkWidget* parentingHandle ();
+ Control [] _getChildren () ;
+ void removeControl (Control control);
+ void moveAbove (GtkWidget* child, GtkWidget* sibling);
+ void moveBelow (GtkWidget* child, GtkWidget* sibling);
+ void fixZOrder () ;
+}
+
+/+
+import dwt.*;
+import dwt.internal.cairo.*;
+import dwt.internal.gtk.*;
+import dwt.graphics.*;
+
+/**
+ * Instances of this class are controls which are capable
+ * of containing other controls.
+ *
+ * - Styles:
+ * - NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, NO_REDRAW_RESIZE, NO_RADIO_GROUP, EMBEDDED, DOUBLE_BUFFERED
+ * - Events:
+ * - (none)
+ *
+ *
+ * Note: The NO_BACKGROUND
, NO_FOCUS
, NO_MERGE_PAINTS
,
+ * and NO_REDRAW_RESIZE
styles are intended for use with Canvas
.
+ * They can be used with Composite
if you are drawing your own, but their
+ * behavior is undefined if they are used with subclasses of Composite
other
+ * than Canvas
.
+ *
+ * Note: The CENTER
style, although undefined for composites, has the
+ * same value as EMBEDDED
(which is used to embed widgets from other
+ * widget toolkits into SWT). On some operating systems (GTK, Motif), this may cause
+ * the children of this composite to be obscured. The EMBEDDED
style
+ * is for use by other widget toolkits and should normally never be used.
+ *
+ * This class may be subclassed by custom control implementors
+ * who are building controls that are constructed from aggregates
+ * of other controls.
+ *
+ *
+ * @see Canvas
+ */
+public class Composite extends Scrollable {
+ public int /*long*/ embeddedHandle;
+ int /*long*/ imHandle, socketHandle;
+ Layout layout;
+ Control[] tabList;
+ int layoutCount, backgroundMode;
+
+ static final String NO_INPUT_METHOD = "dwt.internal.gtk.noInputMethod"; //$NON-NLS-1$
+
+Composite () {
+ /* Do nothing */
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ *
+ * The style value is either one of the style constants defined in
+ * class SWT
which is applicable to instances of this
+ * class, or must be built by bitwise OR'ing together
+ * (that is, using the int
"|" operator) two or more
+ * of those SWT
style constants. The class description
+ * lists the style constants that are applicable to the class.
+ * Style bits are also inherited from superclasses.
+ *
+ *
+ * @param parent a widget which will be the parent of the new instance (cannot be null)
+ * @param style the style of widget to construct
+ *
+ * @exception IllegalArgumentException
+ * - ERROR_NULL_ARGUMENT - if the parent is null
+ *
+ * @exception SWTException
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
+ *
+ *
+ * @see SWT#NO_BACKGROUND
+ * @see SWT#NO_FOCUS
+ * @see SWT#NO_MERGE_PAINTS
+ * @see SWT#NO_REDRAW_RESIZE
+ * @see SWT#NO_RADIO_GROUP
+ * @see Widget#getStyle
+ */
+public Composite (Composite parent, int style) {
+ super (parent, style);
+}
+
+Control [] _getChildren () {
+ int /*long*/ parentHandle = parentingHandle ();
+ int /*long*/ list = OS.gtk_container_get_children (parentHandle);
+ if (list == 0) return new Control [0];
+ int count = OS.g_list_length (list);
+ Control [] children = new Control [count];
+ int i = 0;
+ int /*long*/ temp = list;
+ while (temp != 0) {
+ int /*long*/ handle = OS.g_list_data (temp);
+ if (handle != 0) {
+ Widget widget = display.getWidget (handle);
+ if (widget != null && widget != this) {
+ if (widget instanceof Control) {
+ children [i++] = (Control) widget;
+ }
+ }
+ }
+ temp = OS.g_list_next (temp);
+ }
+ OS.g_list_free (list);
+ if (i == count) return children;
+ Control [] newChildren = new Control [i];
+ System.arraycopy (children, 0, newChildren, 0, i);
+ return newChildren;
+}
+
+Control [] _getTabList () {
+ if (tabList == null) return tabList;
+ int count = 0;
+ for (int i=0; i
+ * ERROR_INVALID_ARGUMENT - if the changed array is null any of its controls are null or have been disposed
+ * ERROR_INVALID_PARENT - if any control in changed is not in the widget tree of the receiver
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @since 3.1
+ */
+public void changed (Control[] changed) {
+ checkWidget ();
+ if (changed == null) error (SWT.ERROR_INVALID_ARGUMENT);
+ for (int i=0; i 0 ? this : parent.findDeferredControl ();
+}
+
+Menu [] findMenus (Control control) {
+ if (control == this) return new Menu [0];
+ Menu result [] = super.findMenus (control);
+ Control [] children = _getChildren ();
+ for (int i=0; iSWT:
+ * INHERIT_NONE
, INHERIT_DEFAULT
,
+ * INHERTIT_FORCE
.
+ *
+ * @return the background mode
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @see SWT
+ *
+ * @since 3.2
+ */
+public int getBackgroundMode () {
+ checkWidget ();
+ return backgroundMode;
+}
+
+/**
+ * Returns a (possibly empty) array containing the receiver's children.
+ * Children are returned in the order that they are drawn. The topmost
+ * control appears at the beginning of the array. Subsequent controls
+ * draw beneath this control and appear later in the array.
+ *
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of children, so modifying the array will
+ * not affect the receiver.
+ *
+ *
+ * @return an array of children
+ *
+ * @see Control#moveAbove
+ * @see Control#moveBelow
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+public Control [] getChildren () {
+ checkWidget();
+ return _getChildren ();
+}
+
+int getChildrenCount () {
+ /*
+ * NOTE: The current implementation will count
+ * non-registered children.
+ */
+ int /*long*/ list = OS.gtk_container_get_children (handle);
+ if (list == 0) return 0;
+ int count = OS.g_list_length (list);
+ OS.g_list_free (list);
+ return count;
+}
+
+public Rectangle getClientArea () {
+ checkWidget();
+ if ((state & CANVAS) != 0) {
+ if ((state & ZERO_WIDTH) != 0 && (state & ZERO_HEIGHT) != 0) {
+ return new Rectangle (0, 0, 0, 0);
+ }
+ forceResize ();
+ int /*long*/ clientHandle = clientHandle ();
+ int width = (state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (clientHandle);
+ int height = (state & ZERO_HEIGHT) != 0 ? 0 : OS.GTK_WIDGET_HEIGHT (clientHandle);
+ return new Rectangle (0, 0, width, height);
+ }
+ return super.getClientArea();
+}
+
+/**
+ * Returns layout which is associated with the receiver, or
+ * null if one has not been set.
+ *
+ * @return the receiver's layout or null
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+public Layout getLayout () {
+ checkWidget();
+ return layout;
+}
+
+/**
+ * Returns true
if the receiver has deferred
+ * the performing of layout, and false
otherwise.
+ *
+ * @return the receiver's deferred layout state
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @see #setLayoutDeferred(boolean)
+ * @see #isLayoutDeferred()
+ *
+ * @since 3.1
+ */
+public boolean getLayoutDeferred () {
+ checkWidget ();
+ return layoutCount > 0 ;
+}
+
+/**
+ * Gets the (possibly empty) tabbing order for the control.
+ *
+ * @return tabList the ordered list of controls representing the tab order
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @see #setTabList
+ */
+public Control [] getTabList () {
+ checkWidget ();
+ Control [] tabList = _getTabList ();
+ if (tabList == null) {
+ int count = 0;
+ Control [] list =_getChildren ();
+ for (int i=0; itrue if the receiver or any ancestor
+ * up to and including the receiver's nearest ancestor shell
+ * has deferred the performing of layouts. Otherwise, false
+ * is returned.
+ *
+ * @return the receiver's deferred layout state
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @see #setLayoutDeferred(boolean)
+ * @see #getLayoutDeferred()
+ *
+ * @since 3.1
+ */
+public boolean isLayoutDeferred () {
+ checkWidget ();
+ return findDeferredControl () != null;
+}
+
+boolean isTabGroup() {
+ if ((state & CANVAS) != 0) return true;
+ return super.isTabGroup();
+}
+
+/**
+ * If the receiver has a layout, asks the layout to lay out
+ * (that is, set the size and location of) the receiver's children.
+ * If the receiver does not have a layout, do nothing.
+ *
+ * This is equivalent to calling layout(true)
.
+ *
+ *
+ * Note: Layout is different from painting. If a child is
+ * moved or resized such that an area in the parent is
+ * exposed, then the parent will paint. If no child is
+ * affected, the parent will not paint.
+ *
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+public void layout () {
+ checkWidget ();
+ layout (true);
+}
+
+/**
+ * If the receiver has a layout, asks the layout to lay out
+ * (that is, set the size and location of) the receiver's children.
+ * If the argument is true
the layout must not rely
+ * on any information it has cached about the immediate children. If it
+ * is false
the layout may (potentially) optimize the
+ * work it is doing by assuming that none of the receiver's
+ * children has changed state since the last layout.
+ * If the receiver does not have a layout, do nothing.
+ *
+ * If a child is resized as a result of a call to layout, the
+ * resize event will invoke the layout of the child. The layout
+ * will cascade down through all child widgets in the receiver's widget
+ * tree until a child is encountered that does not resize. Note that
+ * a layout due to a resize will not flush any cached information
+ * (same as layout(false)
).
+ *
+ *
+ * Note: Layout is different from painting. If a child is
+ * moved or resized such that an area in the parent is
+ * exposed, then the parent will paint. If no child is
+ * affected, the parent will not paint.
+ *
+ *
+ * @param changed true
if the layout must flush its caches, and false
otherwise
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+public void layout (boolean changed) {
+ checkWidget ();
+ if (layout == null) return;
+ layout (changed, false);
+}
+
+/**
+ * If the receiver has a layout, asks the layout to lay out
+ * (that is, set the size and location of) the receiver's children.
+ * If the changed argument is true
the layout must not rely
+ * on any information it has cached about its children. If it
+ * is false
the layout may (potentially) optimize the
+ * work it is doing by assuming that none of the receiver's
+ * children has changed state since the last layout.
+ * If the all argument is true
the layout will cascade down
+ * through all child widgets in the receiver's widget tree, regardless of
+ * whether the child has changed size. The changed argument is applied to
+ * all layouts. If the all argument is false
, the layout will
+ * not cascade down through all child widgets in the receiver's widget
+ * tree. However, if a child is resized as a result of a call to layout, the
+ * resize event will invoke the layout of the child. Note that
+ * a layout due to a resize will not flush any cached information
+ * (same as layout(false)
).
+ *
+ *
+ * Note: Layout is different from painting. If a child is
+ * moved or resized such that an area in the parent is
+ * exposed, then the parent will paint. If no child is
+ * affected, the parent will not paint.
+ *
+ *
+ * @param changed true
if the layout must flush its caches, and false
otherwise
+ * @param all true
if all children in the receiver's widget tree should be laid out, and false
otherwise
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @since 3.1
+ */
+public void layout (boolean changed, boolean all) {
+ checkWidget ();
+ if (layout == null && !all) return;
+ markLayout (changed, all);
+ updateLayout (all);
+}
+
+/**
+ * Forces a lay out (that is, sets the size and location) of all widgets that
+ * are in the parent hierarchy of the changed control up to and including the
+ * receiver. The layouts in the hierarchy must not rely on any information
+ * cached about the changed control or any of its ancestors. The layout may
+ * (potentially) optimize the work it is doing by assuming that none of the
+ * peers of the changed control have changed state since the last layout.
+ * If an ancestor does not have a layout, skip it.
+ *
+ * Note: Layout is different from painting. If a child is
+ * moved or resized such that an area in the parent is
+ * exposed, then the parent will paint. If no child is
+ * affected, the parent will not paint.
+ *
+ *
+ * @param changed a control that has had a state change which requires a recalculation of its size
+ *
+ * @exception IllegalArgumentException
+ * - ERROR_INVALID_ARGUMENT - if the changed array is null any of its controls are null or have been disposed
+ * - ERROR_INVALID_PARENT - if any control in changed is not in the widget tree of the receiver
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @since 3.1
+ */
+public void layout (Control [] changed) {
+ checkWidget ();
+ if (changed == null) error (SWT.ERROR_INVALID_ARGUMENT);
+ for (int i=0; i=0; i--) {
+ update [i].updateLayout (false);
+ }
+}
+
+void markLayout (boolean changed, boolean all) {
+ if (layout != null) {
+ state |= LAYOUT_NEEDED;
+ if (changed) state |= LAYOUT_CHANGED;
+ }
+ if (all) {
+ Control [] children = _getChildren ();
+ for (int i=0; iSWT:
+ * INHERIT_NONE
, INHERIT_DEFAULT
,
+ * INHERIT_FORCE
.
+ *
+ * @param mode the new background mode
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @see SWT
+ *
+ * @since 3.2
+ */
+public void setBackgroundMode (int mode) {
+ checkWidget ();
+ backgroundMode = mode;
+ Control[] children = _getChildren ();
+ for (int i = 0; i < children.length; i++) {
+ children [i].updateBackgroundMode ();
+ }
+}
+
+int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
+ int result = super.setBounds (x, y, width, height, move, resize);
+ if ((result & RESIZED) != 0 && layout != null) {
+ markLayout (false, false);
+ updateLayout (false);
+ }
+ return result;
+}
+
+public boolean setFocus () {
+ checkWidget();
+ Control [] children = _getChildren ();
+ for (int i=0; i
+ * ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+public void setLayout (Layout layout) {
+ checkWidget();
+ this.layout = layout;
+}
+
+/**
+ * If the argument is true
, causes subsequent layout
+ * operations in the receiver or any of its children to be ignored.
+ * No layout of any kind can occur in the receiver or any of its
+ * children until the flag is set to false.
+ * Layout operations that occurred while the flag was
+ * true
are remembered and when the flag is set to
+ * false
, the layout operations are performed in an
+ * optimized manner. Nested calls to this method are stacked.
+ *
+ * @param defer the new defer state
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @see #layout(boolean)
+ * @see #layout(Control[])
+ *
+ * @since 3.1
+ */
+public void setLayoutDeferred (boolean defer) {
+ if (!defer) {
+ if (--layoutCount == 0) {
+ if ((state & LAYOUT_CHILD) != 0 || (state & LAYOUT_NEEDED) != 0) {
+ updateLayout (true);
+ }
+ }
+ } else {
+ layoutCount++;
+ }
+}
+
+boolean setScrollBarVisible (ScrollBar bar, boolean visible) {
+ boolean changed = super.setScrollBarVisible (bar, visible);
+ if (changed && layout != null) {
+ markLayout (false, false);
+ updateLayout (false);
+ }
+ return changed;
+}
+
+boolean setTabGroupFocus (boolean next) {
+ if (isTabItem ()) return setTabItemFocus (next);
+ boolean takeFocus = (style & SWT.NO_FOCUS) == 0;
+ if ((state & CANVAS) != 0) takeFocus = hooksKeys ();
+ if (socketHandle != 0) takeFocus = true;
+ if (takeFocus && setTabItemFocus (next)) return true;
+ Control [] children = _getChildren ();
+ for (int i=0; i
+ * ERROR_INVALID_ARGUMENT - if a widget in the tabList is null or has been disposed
+ * ERROR_INVALID_PARENT - if widget in the tabList is not in the same widget tree
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+public void setTabList (Control [] tabList) {
+ checkWidget ();
+ if (tabList != null) {
+ for (int i=0; i
*/
-public abstract class Control extends Widget implements Drawable {
- int /*long*/ fixedHandle;
- int /*long*/ redrawWindow, enableWindow;
+public abstract class Control : Widget, Drawable {
+ GtkWidget* fixedHandle;
+ GdkWindow* redrawWindow;
+ GdkWindow* enableWindow;
int drawCount;
Composite parent;
Cursor cursor;
Menu menu;
Image backgroundImage;
Font font;
- String toolTipText;
+ char[] toolTipText;
Object layoutData;
Accessible accessible;
-Control () {
+this () {
}
/**
@@ -100,46 +141,47 @@
* @see Widget#checkSubclass
* @see Widget#getStyle
*/
-public Control (Composite parent, int style) {
+public this (Composite parent, int style) {
super (parent, style);
this.parent = parent;
createWidget (0);
}
-int /*long*/ defaultFont () {
+PangoFontDescription* defaultFont () {
return display.getSystemFont ().handle;
}
void deregister () {
super.deregister ();
- if (fixedHandle != 0) display.removeWidget (fixedHandle);
- int /*long*/ imHandle = imHandle ();
- if (imHandle != 0) display.removeWidget (imHandle);
+ if (fixedHandle !is null) display.removeWidget (fixedHandle);
+ auto imHandle = imHandle ();
+ if (imHandle !is null) display.removeWidget (cast(GtkWidget*)imHandle);
}
-boolean drawGripper (int x, int y, int width, int height, boolean vertical) {
- int /*long*/ paintHandle = paintHandle ();
- int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle);
- if (window == 0) return false;
+bool drawGripper (int x, int y, int width, int height, bool vertical) {
+ auto paintHandle = paintHandle ();
+ auto window = OS.GTK_WIDGET_WINDOW (paintHandle);
+ if (window is null) return false;
int orientation = vertical ? OS.GTK_ORIENTATION_HORIZONTAL : OS.GTK_ORIENTATION_VERTICAL;
- OS.gtk_paint_handle (OS.gtk_widget_get_style (paintHandle), window, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_OUT, null, paintHandle, new byte [1], x, y, width, height, orientation);
+ char dummy;
+ OS.gtk_paint_handle (OS.gtk_widget_get_style (paintHandle), window, cast(GtkStateType)OS.GTK_STATE_NORMAL, cast(GtkShadowType)OS.GTK_SHADOW_OUT, null, paintHandle, &dummy, x, y, width, height, cast(GtkOrientation)orientation);
return true;
}
-void enableWidget (boolean enabled) {
+void enableWidget (bool enabled) {
OS.gtk_widget_set_sensitive (handle, enabled);
}
-int /*long*/ enterExitHandle () {
+GtkWidget* enterExitHandle () {
return eventHandle ();
}
-int /*long*/ eventHandle () {
+GtkWidget* eventHandle () {
return handle;
}
-int /*long*/ eventWindow () {
- int /*long*/ eventHandle = eventHandle ();
+GdkWindow* eventWindow () {
+ auto eventHandle = eventHandle ();
OS.gtk_widget_realize (eventHandle);
return OS.GTK_WIDGET_WINDOW (eventHandle);
}
@@ -147,21 +189,21 @@
void fixFocus (Control focusControl) {
Shell shell = getShell ();
Control control = this;
- while (control != shell && (control = control.parent) != null) {
+ while (control !is shell && (control = control.parent) !is null) {
if (control.setFocus ()) return;
}
shell.setSavedFocus (focusControl);
- int /*long*/ focusHandle = shell.vboxHandle;
+ auto focusHandle = shell.vboxHandle;
OS.GTK_WIDGET_SET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS);
OS.gtk_widget_grab_focus (focusHandle);
OS.GTK_WIDGET_UNSET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS);
}
void fixStyle () {
- if (fixedHandle != 0) fixStyle (fixedHandle);
+ if (fixedHandle !is null) fixStyle (fixedHandle);
}
-void fixStyle (int /*long*/ handle) {
+void fixStyle (GtkWidget* handle) {
/*
* Feature in GTK. Some GTK themes apply a different background to
* the contents of a GtkNotebook. However, in an SWT TabFolder, the
@@ -173,30 +215,30 @@
* Note that this has to be when the theme settings changes and that it
* should not override the application background.
*/
- if ((state & BACKGROUND) != 0) return;
- int /*long*/ childStyle = parent.childStyle ();
- if (childStyle != 0) {
- GdkColor color = new GdkColor();
+ if ((state & BACKGROUND) !is 0) return;
+ auto childStyle = parent.childStyle ();
+ if (childStyle !is null) {
+ GdkColor* color = new GdkColor();
OS.gtk_style_get_bg (childStyle, 0, color);
- OS.gtk_widget_modify_bg (handle, 0, color);
+ OS.gtk_widget_modify_bg (handle, cast(GtkStateType) 0, color);
}
}
-int /*long*/ focusHandle () {
+GtkWidget* focusHandle () {
return handle;
}
-int /*long*/ fontHandle () {
+GtkWidget* fontHandle () {
return handle;
}
-boolean hasFocus () {
- return this == display.getFocusControl();
+bool hasFocus () {
+ return this is display.getFocusControl();
}
void hookEvents () {
/* Connect the keyboard signals */
- int /*long*/ focusHandle = focusHandle ();
+ auto focusHandle = focusHandle ();
int focusMask = OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK | OS.GDK_FOCUS_CHANGE_MASK;
OS.gtk_widget_add_events (focusHandle, focusMask);
OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [POPUP_MENU], 0, display.closures [POPUP_MENU], false);
@@ -208,7 +250,7 @@
OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [FOCUS_OUT_EVENT], 0, display.closures [FOCUS_OUT_EVENT], false);
/* Connect the mouse signals */
- int /*long*/ eventHandle = eventHandle ();
+ auto eventHandle = eventHandle ();
int eventMask = OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_PRESS_MASK |
OS.GDK_BUTTON_RELEASE_MASK;
OS.gtk_widget_add_events (eventHandle, eventMask);
@@ -218,7 +260,7 @@
OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [SCROLL_EVENT], 0, display.closures [SCROLL_EVENT], false);
/* Connect enter/exit signals */
- int /*long*/ enterExitHandle = enterExitHandle ();
+ auto enterExitHandle = enterExitHandle ();
int enterExitMask = OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK;
OS.gtk_widget_add_events (enterExitHandle, enterExitMask);
OS.g_signal_connect_closure_by_id (enterExitHandle, display.signalIds [ENTER_NOTIFY_EVENT], 0, display.closures [ENTER_NOTIFY_EVENT], false);
@@ -234,19 +276,19 @@
* The signal is hooked to the fixedHandle to catch events sent to
* lightweight widgets.
*/
- int /*long*/ blockHandle = fixedHandle != 0 ? fixedHandle : eventHandle;
+ auto blockHandle = fixedHandle !is null ? fixedHandle : eventHandle;
OS.g_signal_connect_closure_by_id (blockHandle, display.signalIds [BUTTON_PRESS_EVENT], 0, display.closures [BUTTON_PRESS_EVENT_INVERSE], true);
OS.g_signal_connect_closure_by_id (blockHandle, display.signalIds [BUTTON_RELEASE_EVENT], 0, display.closures [BUTTON_RELEASE_EVENT_INVERSE], true);
OS.g_signal_connect_closure_by_id (blockHandle, display.signalIds [MOTION_NOTIFY_EVENT], 0, display.closures [MOTION_NOTIFY_EVENT_INVERSE], true);
/* Connect the event_after signal for both key and mouse */
OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [EVENT_AFTER], 0, display.closures [EVENT_AFTER], false);
- if (focusHandle != eventHandle) {
+ if (focusHandle !is eventHandle) {
OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [EVENT_AFTER], 0, display.closures [EVENT_AFTER], false);
}
/* Connect the paint signal */
- int /*long*/ paintHandle = paintHandle ();
+ auto paintHandle = paintHandle ();
int paintMask = OS.GDK_EXPOSURE_MASK | OS.GDK_VISIBILITY_NOTIFY_MASK;
OS.gtk_widget_add_events (paintHandle, paintMask);
OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [EXPOSE_EVENT], 0, display.closures [EXPOSE_EVENT_INVERSE], false);
@@ -256,43 +298,44 @@
/* Connect the Input Method signals */
OS.g_signal_connect_closure_by_id (handle, display.signalIds [REALIZE], 0, display.closures [REALIZE], true);
OS.g_signal_connect_closure_by_id (handle, display.signalIds [UNREALIZE], 0, display.closures [UNREALIZE], false);
- int /*long*/ imHandle = imHandle ();
- if (imHandle != 0) {
- OS.g_signal_connect_closure (imHandle, OS.commit, display.closures [COMMIT], false);
- OS.g_signal_connect_closure (imHandle, OS.preedit_changed, display.closures [PREEDIT_CHANGED], false);
+ auto imHandle = imHandle ();
+ if (imHandle !is null) {
+ OS.g_signal_connect_closure (imHandle, OS.commit.ptr, display.closures [COMMIT], false);
+ OS.g_signal_connect_closure (imHandle, OS.preedit_changed.ptr, display.closures [PREEDIT_CHANGED], false);
}
OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [STYLE_SET], 0, display.closures [STYLE_SET], false);
- int /*long*/ topHandle = topHandle ();
+ auto topHandle = topHandle ();
OS.g_signal_connect_closure_by_id (topHandle, display.signalIds [MAP], 0, display.closures [MAP], true);
}
int /*long*/ hoverProc (int /*long*/ widget) {
- int [] x = new int [1], y = new int [1], mask = new int [1];
- OS.gdk_window_get_pointer (0, x, y, mask);
- sendMouseEvent (SWT.MouseHover, 0, /*time*/0, x [0], y [0], false, mask [0]);
+ int x, y;
+ GdkModifierType mask;
+ OS.gdk_window_get_pointer (null, &x, &y, &mask);
+ sendMouseEvent (SWT.MouseHover, 0, /*time*/0, x , y , false, mask );
/* Always return zero in order to cancel the hover timer */
return 0;
}
-int /*long*/ topHandle() {
- if (fixedHandle != 0) return fixedHandle;
+GtkWidget* topHandle() {
+ if (fixedHandle !is null) return fixedHandle;
return super.topHandle ();
}
-int /*long*/ paintHandle () {
- int /*long*/ topHandle = topHandle ();
- int /*long*/ paintHandle = handle;
- while (paintHandle != topHandle) {
- if ((OS.GTK_WIDGET_FLAGS (paintHandle) & OS.GTK_NO_WINDOW) == 0) break;
+GtkWidget* paintHandle () {
+ auto topHandle = topHandle ();
+ auto paintHandle = handle;
+ while (paintHandle !is topHandle) {
+ if ((OS.GTK_WIDGET_FLAGS (paintHandle) & OS.GTK_NO_WINDOW) is 0) break;
paintHandle = OS.gtk_widget_get_parent (paintHandle);
}
return paintHandle;
}
-int /*long*/ paintWindow () {
- int /*long*/ paintHandle = paintHandle ();
+GdkWindow* paintWindow () {
+ auto paintHandle = paintHandle ();
OS.gtk_widget_realize (paintHandle);
return OS.GTK_WIDGET_WINDOW (paintHandle);
}
@@ -321,7 +364,7 @@
* @see #getBorderWidth
* @see #getBounds
* @see #getSize
- * @see #pack(boolean)
+ * @see #pack(bool)
* @see "computeTrim, getClientArea for controls that implement them"
*/
public Point computeSize (int wHint, int hHint) {
@@ -336,7 +379,7 @@
Control[] computeTabList() {
if (isTabGroup()) {
if (getVisible() && getEnabled()) {
- return new Control[] {this};
+ return [this];
}
}
return new Control[0];
@@ -344,13 +387,13 @@
Control computeTabRoot () {
Control[] tabList = parent._getTabList();
- if (tabList != null) {
+ if (tabList !is null) {
int index = 0;
while (index < tabList.length) {
- if (tabList [index] == this) break;
+ if (tabList [index] is this) break;
index++;
}
- if (index == tabList.length) {
+ if (index is tabList.length) {
if (isTabGroup ()) return this;
}
}
@@ -363,34 +406,34 @@
void checkBackground () {
Shell shell = getShell ();
- if (this == shell) return;
+ if (this is shell) return;
state &= ~PARENT_BACKGROUND;
Composite composite = parent;
do {
int mode = composite.backgroundMode;
- if (mode != SWT.INHERIT_NONE) {
- if (mode == SWT.INHERIT_DEFAULT) {
+ if (mode !is SWT.INHERIT_NONE) {
+ if (mode is SWT.INHERIT_DEFAULT) {
Control control = this;
do {
- if ((control.state & THEME_BACKGROUND) == 0) {
+ if ((control.state & THEME_BACKGROUND) is 0) {
return;
}
control = control.parent;
- } while (control != composite);
+ } while (control !is composite);
}
state |= PARENT_BACKGROUND;
return;
}
- if (composite == shell) break;
+ if (composite is shell) break;
composite = composite.parent;
} while (true);
}
void checkBorder () {
- if (getBorderWidth () == 0) style &= ~SWT.BORDER;
+ if (getBorderWidth () is 0) style &= ~SWT.BORDER;
}
-int /*long*/ childStyle () {
+GtkStyle* childStyle () {
return parent.childStyle ();
}
@@ -399,7 +442,7 @@
checkOrientation (parent);
super.createWidget (index);
checkBackground ();
- if ((state & PARENT_BACKGROUND) != 0) setBackground ();
+ if ((state & PARENT_BACKGROUND) !is 0) setBackground ();
checkBuffered ();
showWidget ();
setInitialBounds ();
@@ -439,32 +482,32 @@
* @see #getBorderWidth
* @see #getBounds
* @see #getSize
- * @see #pack(boolean)
+ * @see #pack(bool)
* @see "computeTrim, getClientArea for controls that implement them"
*/
-public Point computeSize (int wHint, int hHint, boolean changed) {
+public Point computeSize (int wHint, int hHint, bool changed) {
checkWidget();
- if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0;
- if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0;
+ if (wHint !is SWT.DEFAULT && wHint < 0) wHint = 0;
+ if (hHint !is SWT.DEFAULT && hHint < 0) hHint = 0;
return computeNativeSize (handle, wHint, hHint, changed);
}
-Point computeNativeSize (int /*long*/ h, int wHint, int hHint, boolean changed) {
+Point computeNativeSize (GtkWidget* h, int wHint, int hHint, bool changed) {
int width = wHint, height = hHint;
- if (wHint == SWT.DEFAULT && hHint == SWT.DEFAULT) {
- GtkRequisition requisition = new GtkRequisition ();
+ if (wHint is SWT.DEFAULT && hHint is SWT.DEFAULT) {
+ GtkRequisition* requisition = new GtkRequisition ();
gtk_widget_size_request (h, requisition);
width = OS.GTK_WIDGET_REQUISITION_WIDTH (h);
height = OS.GTK_WIDGET_REQUISITION_HEIGHT (h);
- } else if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
- int [] reqWidth = new int [1], reqHeight = new int [1];
- OS.gtk_widget_get_size_request (h, reqWidth, reqHeight);
+ } else if (wHint is SWT.DEFAULT || hHint is SWT.DEFAULT) {
+ int reqWidth, reqHeight;
+ OS.gtk_widget_get_size_request (h, &reqWidth, &reqHeight);
OS.gtk_widget_set_size_request (h, wHint, hHint);
- GtkRequisition requisition = new GtkRequisition ();
+ GtkRequisition* requisition = new GtkRequisition ();
gtk_widget_size_request (h, requisition);
- OS.gtk_widget_set_size_request (h, reqWidth [0], reqHeight [0]);
- width = wHint == SWT.DEFAULT ? requisition.width : wHint;
- height = hHint == SWT.DEFAULT ? requisition.height : hHint;
+ OS.gtk_widget_set_size_request (h, reqWidth, reqHeight);
+ width = wHint is SWT.DEFAULT ? requisition.width : wHint;
+ height = hHint is SWT.DEFAULT ? requisition.height : hHint;
}
return new Point (width, height);
}
@@ -475,10 +518,10 @@
* topHandle. Note that all calls to gtk_widget_size_allocate()
* must be preceded by a call to gtk_widget_size_request().
*/
- int /*long*/ topHandle = topHandle ();
- GtkRequisition requisition = new GtkRequisition ();
+ auto topHandle = topHandle ();
+ GtkRequisition* requisition = new GtkRequisition ();
gtk_widget_size_request (topHandle, requisition);
- GtkAllocation allocation = new GtkAllocation ();
+ GtkAllocation* allocation = new GtkAllocation ();
allocation.x = OS.GTK_WIDGET_X (topHandle);
allocation.y = OS.GTK_WIDGET_Y (topHandle);
allocation.width = OS.GTK_WIDGET_WIDTH (topHandle);
@@ -505,7 +548,7 @@
*/
public Accessible getAccessible () {
checkWidget ();
- if (accessible == null) {
+ if (accessible is null) {
accessible = Accessible.internal_new_Accessible (this);
}
return accessible;
@@ -526,11 +569,11 @@
*/
public Rectangle getBounds () {
checkWidget();
- int /*long*/ topHandle = topHandle ();
+ auto topHandle = topHandle ();
int x = OS.GTK_WIDGET_X (topHandle);
int y = OS.GTK_WIDGET_Y (topHandle);
- int width = (state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle);
- int height = (state & ZERO_HEIGHT) != 0 ? 0 : OS.GTK_WIDGET_HEIGHT (topHandle);
+ int width = (state & ZERO_WIDTH) !is 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle);
+ int height = (state & ZERO_HEIGHT) !is 0 ? 0 : OS.GTK_WIDGET_HEIGHT (topHandle);
return new Rectangle (x, y, width, height);
}
@@ -554,7 +597,7 @@
*/
public void setBounds (Rectangle rect) {
checkWidget ();
- if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (rect is null) error (SWT.ERROR_NULL_ARGUMENT);
setBounds (rect.x, rect.y, Math.max (0, rect.width), Math.max (0, rect.height), true, true);
}
@@ -586,13 +629,13 @@
setBounds (x, y, Math.max (0, width), Math.max (0, height), true, true);
}
-void markLayout (boolean changed, boolean all) {
+void markLayout (bool changed, bool all) {
/* Do nothing */
}
void moveHandle (int x, int y) {
- int /*long*/ topHandle = topHandle ();
- int /*long*/ parentHandle = parent.parentingHandle ();
+ auto topHandle = topHandle ();
+ auto parentHandle = parent.parentingHandle ();
/*
* Feature in GTK. Calling gtk_fixed_move() to move a child causes
* the whole parent to redraw. This is a performance problem. The
@@ -603,43 +646,43 @@
*/
int flags = OS.GTK_WIDGET_FLAGS (parentHandle);
OS.GTK_WIDGET_UNSET_FLAGS (parentHandle, OS.GTK_VISIBLE);
- OS.gtk_fixed_move (parentHandle, topHandle, x, y);
- if ((flags & OS.GTK_VISIBLE) != 0) {
+ OS.gtk_fixed_move (cast(GtkFixed*)parentHandle, topHandle, x, y);
+ if ((flags & OS.GTK_VISIBLE) !is 0) {
OS.GTK_WIDGET_SET_FLAGS (parentHandle, OS.GTK_VISIBLE);
}
}
void resizeHandle (int width, int height) {
- int /*long*/ topHandle = topHandle ();
+ auto topHandle = topHandle ();
OS.gtk_widget_set_size_request (topHandle, width, height);
- if (topHandle != handle) OS.gtk_widget_set_size_request (handle, width, height);
+ if (topHandle !is handle) OS.gtk_widget_set_size_request (handle, width, height);
}
-int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
- int /*long*/ topHandle = topHandle ();
- boolean sameOrigin = true, sameExtent = true;
+int setBounds (int x, int y, int width, int height, bool move, bool resize) {
+ auto topHandle = topHandle ();
+ bool sameOrigin = true, sameExtent = true;
if (move) {
int oldX = OS.GTK_WIDGET_X (topHandle);
int oldY = OS.GTK_WIDGET_Y (topHandle);
- sameOrigin = x == oldX && y == oldY;
+ sameOrigin = x is oldX && y is oldY;
if (!sameOrigin) {
- if (enableWindow != 0) {
+ if (enableWindow !is null) {
OS.gdk_window_move (enableWindow, x, y);
}
moveHandle (x, y);
}
}
if (resize) {
- int oldWidth = (state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle);
- int oldHeight = (state & ZERO_HEIGHT) != 0 ? 0 : OS.GTK_WIDGET_HEIGHT (topHandle);
- sameExtent = width == oldWidth && height == oldHeight;
- if (!sameExtent && !(width == 0 && height == 0)) {
+ int oldWidth = (state & ZERO_WIDTH) !is 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle);
+ int oldHeight = (state & ZERO_HEIGHT) !is 0 ? 0 : OS.GTK_WIDGET_HEIGHT (topHandle);
+ sameExtent = width is oldWidth && height is oldHeight;
+ if (!sameExtent && !(width is 0 && height is 0)) {
int newWidth = Math.max (1, width);
int newHeight = Math.max (1, height);
- if (redrawWindow != 0) {
+ if (redrawWindow !is null) {
OS.gdk_window_resize (redrawWindow, newWidth, newHeight);
}
- if (enableWindow != 0) {
+ if (enableWindow !is null) {
OS.gdk_window_resize (enableWindow, newWidth, newHeight);
}
resizeHandle (newWidth, newHeight);
@@ -651,9 +694,9 @@
* all calls to gtk_widget_size_allocate() must be preceded by
* a call to gtk_widget_size_request().
*/
- GtkRequisition requisition = new GtkRequisition ();
+ GtkRequisition* requisition = new GtkRequisition ();
gtk_widget_size_request (topHandle, requisition);
- GtkAllocation allocation = new GtkAllocation ();
+ GtkAllocation* allocation = new GtkAllocation ();
if (move) {
allocation.x = x;
allocation.y = y;
@@ -676,16 +719,16 @@
* when they are resized larger.
*/
if (!sameExtent) {
- state = (width == 0) ? state | ZERO_WIDTH : state & ~ZERO_WIDTH;
- state = (height == 0) ? state | ZERO_HEIGHT : state & ~ZERO_HEIGHT;
- if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) != 0) {
- if (enableWindow != 0) {
+ state = (width is 0) ? state | ZERO_WIDTH : state & ~ZERO_WIDTH;
+ state = (height is 0) ? state | ZERO_HEIGHT : state & ~ZERO_HEIGHT;
+ if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) !is 0) {
+ if (enableWindow !is null) {
OS.gdk_window_hide (enableWindow);
}
OS.gtk_widget_hide (topHandle);
} else {
- if ((state & HIDDEN) == 0) {
- if (enableWindow != 0) {
+ if ((state & HIDDEN) is 0) {
+ if (enableWindow !is null) {
OS.gdk_window_show_unraised (enableWindow);
}
OS.gtk_widget_show (topHandle);
@@ -695,7 +738,7 @@
int result = 0;
if (move && !sameOrigin) {
Control control = findBackgroundControl ();
- if (control != null && control.backgroundImage != null) {
+ if (control !is null && control.backgroundImage !is null) {
if (isVisible ()) redrawWidget (0, 0, 0, 0, true, true, true);
}
sendEvent (SWT.Move);
@@ -723,7 +766,7 @@
*/
public Point getLocation () {
checkWidget();
- int /*long*/ topHandle = topHandle ();
+ auto topHandle = topHandle ();
int x = OS.GTK_WIDGET_X (topHandle);
int y = OS.GTK_WIDGET_Y (topHandle);
return new Point (x, y);
@@ -745,7 +788,7 @@
*/
public void setLocation (Point location) {
checkWidget ();
- if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (location is null) error (SWT.ERROR_NULL_ARGUMENT);
setBounds (location.x, location.y, 0, 0, true, false);
}
@@ -784,9 +827,9 @@
*/
public Point getSize () {
checkWidget();
- int /*long*/ topHandle = topHandle ();
- int width = (state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle);
- int height = (state & ZERO_HEIGHT) != 0 ? 0 : OS.GTK_WIDGET_HEIGHT (topHandle);
+ auto topHandle = topHandle ();
+ int width = (state & ZERO_WIDTH) !is 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle);
+ int height = (state & ZERO_HEIGHT) !is 0 ? 0 : OS.GTK_WIDGET_HEIGHT (topHandle);
return new Point (width, height);
}
@@ -810,26 +853,25 @@
*/
public void setSize (Point size) {
checkWidget ();
- if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (size is null) error (SWT.ERROR_NULL_ARGUMENT);
setBounds (0, 0, Math.max (0, size.x), Math.max (0, size.y), false, true);
}
void setRelations () {
- int /*long*/ parentHandle = parent.parentingHandle ();
- int /*long*/ list = OS.gtk_container_get_children (parentHandle);
- if (list == 0) return;
+ auto parentHandle = parent.parentingHandle ();
+ auto list = OS.gtk_container_get_children (cast(GtkContainer*)parentHandle);
+ if (list is null) return;
int count = OS.g_list_length (list);
if (count > 1) {
/*
* the receiver is the last item in the list, so its predecessor will
* be the second-last item in the list
*/
- int /*long*/ handle = OS.g_list_nth_data (list, count - 2);
- if (handle != 0) {
+ auto handle = cast(GtkWidget*) OS.g_list_nth_data (list, count - 2);
+ if (handle !is null) {
Widget widget = display.getWidget (handle);
- if (widget != null && widget != this) {
- if (widget instanceof Control) {
- Control sibling = (Control)widget;
+ if (widget !is null && widget !is this) {
+ if (auto sibling = cast(Control)widget ) {
sibling.addRelation (this);
}
}
@@ -860,10 +902,10 @@
}
/*
- * Answers a boolean indicating whether a Label that precedes the receiver in
+ * Answers a bool indicating whether a Label that precedes the receiver in
* a layout should be read by screen readers as the recevier's label.
*/
-boolean isDescribedByLabel () {
+bool isDescribedByLabel () {
return true;
}
@@ -889,9 +931,9 @@
*/
public void moveAbove (Control control) {
checkWidget();
- if (control != null) {
+ if (control !is null) {
if (control.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
- if (parent != control.parent) return;
+ if (parent !is control.parent) return;
}
setZOrder (control, true, true);
}
@@ -918,9 +960,9 @@
*/
public void moveBelow (Control control) {
checkWidget();
- if (control != null) {
+ if (control !is null) {
if (control.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
- if (parent != control.parent) return;
+ if (parent !is control.parent) return;
}
setZOrder (control, false, true);
}
@@ -935,7 +977,7 @@
* ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*
- * @see #computeSize(int, int, boolean)
+ * @see #computeSize(int, int, bool)
*/
public void pack () {
pack (true);
@@ -960,9 +1002,9 @@
* ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*
- * @see #computeSize(int, int, boolean)
+ * @see #computeSize(int, int, bool)
*/
-public void pack (boolean changed) {
+public void pack (bool changed) {
setSize (computeSize (SWT.DEFAULT, SWT.DEFAULT, changed));
}
@@ -999,10 +1041,10 @@
*/
public Point toControl (int x, int y) {
checkWidget ();
- int /*long*/ window = eventWindow ();
- int [] origin_x = new int [1], origin_y = new int [1];
- OS.gdk_window_get_origin (window, origin_x, origin_y);
- return new Point (x - origin_x [0], y - origin_y [0]);
+ auto window = eventWindow ();
+ int origin_x, origin_y;
+ OS.gdk_window_get_origin (window, &origin_x, &origin_y);
+ return new Point (x - origin_x , y - origin_y );
}
/**
@@ -1023,7 +1065,7 @@
*/
public Point toControl (Point point) {
checkWidget ();
- if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (point is null) error (SWT.ERROR_NULL_ARGUMENT);
return toControl (point.x, point.y);
}
@@ -1045,10 +1087,10 @@
*/
public Point toDisplay (int x, int y) {
checkWidget();
- int /*long*/ window = eventWindow ();
- int [] origin_x = new int [1], origin_y = new int [1];
- OS.gdk_window_get_origin (window, origin_x, origin_y);
- return new Point (origin_x [0] + x, origin_y [0] + y);
+ auto window = eventWindow ();
+ int origin_x, origin_y;
+ OS.gdk_window_get_origin (window, &origin_x, &origin_y);
+ return new Point (origin_x + x, origin_y + y);
}
/**
@@ -1069,7 +1111,7 @@
*/
public Point toDisplay (Point point) {
checkWidget();
- if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (point is null) error (SWT.ERROR_NULL_ARGUMENT);
return toDisplay (point.x, point.y);
}
@@ -1094,7 +1136,7 @@
*/
public void addControlListener(ControlListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Resize,typedListener);
addListener (SWT.Move,typedListener);
@@ -1123,7 +1165,7 @@
*/
public void addDragDetectListener (DragDetectListener listener) {
checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.DragDetect,typedListener);
}
@@ -1149,7 +1191,7 @@
*/
public void addFocusListener(FocusListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener(SWT.FocusIn,typedListener);
addListener(SWT.FocusOut,typedListener);
@@ -1176,7 +1218,7 @@
*/
public void addHelpListener (HelpListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Help, typedListener);
}
@@ -1213,7 +1255,7 @@
*/
public void addKeyListener(KeyListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener(SWT.KeyUp,typedListener);
addListener(SWT.KeyDown,typedListener);
@@ -1242,7 +1284,7 @@
*/
public void addMenuDetectListener (MenuDetectListener listener) {
checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.MenuDetect, typedListener);
}
@@ -1268,7 +1310,7 @@
*/
public void addMouseListener(MouseListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener(SWT.MouseDown,typedListener);
addListener(SWT.MouseUp,typedListener);
@@ -1296,7 +1338,7 @@
*/
public void addMouseMoveListener(MouseMoveListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener(SWT.MouseMove,typedListener);
}
@@ -1322,7 +1364,7 @@
*/
public void addMouseTrackListener (MouseTrackListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.MouseEnter,typedListener);
addListener (SWT.MouseExit,typedListener);
@@ -1352,7 +1394,7 @@
*/
public void addMouseWheelListener (MouseWheelListener listener) {
checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.MouseWheel, typedListener);
}
@@ -1378,7 +1420,7 @@
*/
public void addPaintListener(PaintListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener(SWT.Paint,typedListener);
}
@@ -1407,7 +1449,7 @@
*/
public void addTraverseListener (TraverseListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Traverse,typedListener);
}
@@ -1431,8 +1473,8 @@
*/
public void removeControlListener (ControlListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
eventTable.unhook (SWT.Move, listener);
eventTable.unhook (SWT.Resize, listener);
}
@@ -1458,8 +1500,8 @@
*/
public void removeDragDetectListener(DragDetectListener listener) {
checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
eventTable.unhook (SWT.DragDetect, listener);
}
@@ -1482,8 +1524,8 @@
*/
public void removeFocusListener(FocusListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
eventTable.unhook (SWT.FocusIn, listener);
eventTable.unhook (SWT.FocusOut, listener);
}
@@ -1506,8 +1548,8 @@
*/
public void removeHelpListener (HelpListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
eventTable.unhook (SWT.Help, listener);
}
/**
@@ -1529,8 +1571,8 @@
*/
public void removeKeyListener(KeyListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
eventTable.unhook (SWT.KeyUp, listener);
eventTable.unhook (SWT.KeyDown, listener);
}
@@ -1556,8 +1598,8 @@
*/
public void removeMenuDetectListener (MenuDetectListener listener) {
checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
eventTable.unhook (SWT.MenuDetect, listener);
}
/**
@@ -1579,8 +1621,8 @@
*/
public void removeMouseListener (MouseListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
eventTable.unhook (SWT.MouseDown, listener);
eventTable.unhook (SWT.MouseUp, listener);
eventTable.unhook (SWT.MouseDoubleClick, listener);
@@ -1604,8 +1646,8 @@
*/
public void removeMouseMoveListener(MouseMoveListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
eventTable.unhook (SWT.MouseMove, listener);
}
@@ -1628,8 +1670,8 @@
*/
public void removeMouseTrackListener(MouseTrackListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
eventTable.unhook (SWT.MouseEnter, listener);
eventTable.unhook (SWT.MouseExit, listener);
eventTable.unhook (SWT.MouseHover, listener);
@@ -1656,8 +1698,8 @@
*/
public void removeMouseWheelListener (MouseWheelListener listener) {
checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
eventTable.unhook (SWT.MouseWheel, listener);
}
@@ -1680,8 +1722,8 @@
*/
public void removePaintListener(PaintListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
eventTable.unhook(SWT.Paint, listener);
}
@@ -1690,12 +1732,12 @@
*/
void removeRelation () {
if (!isDescribedByLabel ()) return; /* there will not be any */
- int /*long*/ accessible = OS.gtk_widget_get_accessible (handle);
- if (accessible == 0) return;
- int /*long*/ set = ATK.atk_object_ref_relation_set (accessible);
+ auto accessible = OS.gtk_widget_get_accessible (handle);
+ if (accessible is null) return;
+ auto set = ATK.atk_object_ref_relation_set (accessible);
int count = ATK.atk_relation_set_get_n_relations (set);
for (int i = 0; i < count; i++) {
- int /*long*/ relation = ATK.atk_relation_set_get_relation (set, 0);
+ auto relation = ATK.atk_relation_set_get_relation (set, 0);
ATK.atk_relation_set_remove (set, relation);
}
OS.g_object_unref (set);
@@ -1720,8 +1762,8 @@
*/
public void removeTraverseListener(TraverseListener listener) {
checkWidget ();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
eventTable.unhook (SWT.Traverse, listener);
}
@@ -1761,9 +1803,9 @@
*
* @since 3.3
*/
-public boolean dragDetect (Event event) {
+public bool dragDetect (Event event) {
checkWidget ();
- if (event == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (event is null) error (SWT.ERROR_NULL_ARGUMENT);
return dragDetect (event.button, event.count, event.stateMask, event.x, event.y);
}
@@ -1803,51 +1845,51 @@
*
* @since 3.3
*/
-public boolean dragDetect (MouseEvent event) {
+public bool dragDetect (MouseEvent event) {
checkWidget ();
- if (event == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (event is null) error (SWT.ERROR_NULL_ARGUMENT);
return dragDetect (event.button, event.count, event.stateMask, event.x, event.y);
}
-boolean dragDetect (int button, int count, int stateMask, int x, int y) {
- if (button != 1 || count != 1) return false;
+bool dragDetect (int button, int count, int stateMask, int x, int y) {
+ if (button !is 1 || count !is 1) return false;
if (!dragDetect (x, y, false, null)) return false;
return sendDragEvent (button, stateMask, x, y, true);
}
-boolean dragDetect (int x, int y, boolean filter, boolean [] consume) {
- boolean quit = false, dragging = false;
+bool dragDetect (int x, int y, bool filter, bool [] consume) {
+ bool quit = false, dragging = false;
while (!quit) {
- int /*long*/ eventPtr = 0;
+ GdkEvent* eventPtr;
while (true) {
eventPtr = OS.gdk_event_get ();
- if (eventPtr != 0) {
+ if (eventPtr !is null) {
break;
} else {
try {Thread.sleep(50);} catch (Exception ex) {}
}
}
- switch (OS.GDK_EVENT_TYPE (eventPtr)) {
+ switch (cast(int)OS.GDK_EVENT_TYPE (eventPtr)) {
case OS.GDK_MOTION_NOTIFY: {
- GdkEventMotion gdkMotionEvent = new GdkEventMotion ();
- OS.memmove (gdkMotionEvent, eventPtr, GdkEventMotion.sizeof);
- if ((gdkMotionEvent.state & OS.GDK_BUTTON1_MASK) != 0) {
- if (OS.gtk_drag_check_threshold (handle, x, y, (int) gdkMotionEvent.x, (int) gdkMotionEvent.y)) {
+ GdkEventMotion* gdkMotionEvent = new GdkEventMotion ();
+ memmove (gdkMotionEvent, eventPtr, GdkEventMotion.sizeof);
+ if ((gdkMotionEvent.state & OS.GDK_BUTTON1_MASK) !is 0) {
+ if (OS.gtk_drag_check_threshold (handle, x, y, cast(int) gdkMotionEvent.x, cast(int) gdkMotionEvent.y)) {
dragging = true;
quit = true;
}
} else {
quit = true;
}
- int [] newX = new int [1], newY = new int [1];
- OS.gdk_window_get_pointer (gdkMotionEvent.window, newX, newY, null);
+ int newX, newY;
+ OS.gdk_window_get_pointer (gdkMotionEvent.window, &newX, &newY, null);
break;
}
case OS.GDK_KEY_PRESS:
case OS.GDK_KEY_RELEASE: {
- GdkEventKey gdkEvent = new GdkEventKey ();
- OS.memmove (gdkEvent, eventPtr, GdkEventKey.sizeof);
- if (gdkEvent.keyval == OS.GDK_Escape) quit = true;
+ GdkEventKey* gdkEvent = new GdkEventKey ();
+ memmove (gdkEvent, eventPtr, GdkEventKey.sizeof);
+ if (gdkEvent.keyval is OS.GDK_Escape) quit = true;
break;
}
case OS.GDK_BUTTON_RELEASE:
@@ -1866,21 +1908,21 @@
return dragging;
}
-boolean filterKey (int keyval, int /*long*/ event) {
- int /*long*/ imHandle = imHandle ();
- if (imHandle != 0) {
- return OS.gtk_im_context_filter_keypress (imHandle, event);
+bool filterKey (int keyval, GdkEventKey* event) {
+ auto imHandle = imHandle ();
+ if (imHandle !is null) {
+ return cast(bool)OS.gtk_im_context_filter_keypress (imHandle, event);
}
return false;
}
Control findBackgroundControl () {
- if ((state & BACKGROUND) != 0 || backgroundImage != null) return this;
- return (state & PARENT_BACKGROUND) != 0 ? parent.findBackgroundControl () : null;
+ if ((state & BACKGROUND) !is 0 || backgroundImage !is null) return this;
+ return (state & PARENT_BACKGROUND) !is 0 ? parent.findBackgroundControl () : null;
}
Menu [] findMenus (Control control) {
- if (menu != null && this != control) return new Menu [] {menu};
+ if (menu !is null && this !is control) return [menu];
return new Menu [0];
}
@@ -1889,21 +1931,21 @@
oldDecorations.fixDecorations (newDecorations, this, menus);
}
-int /*long*/ fixedMapProc (int /*long*/ widget) {
+int /*long*/ fixedMapProc (GtkWidget* widget) {
OS.GTK_WIDGET_SET_FLAGS (widget, OS.GTK_MAPPED);
- int /*long*/ widgetList = OS.gtk_container_get_children (widget);
- if (widgetList != 0) {
- int /*long*/ widgets = widgetList;
- while (widgets != 0) {
- int /*long*/ child = OS.g_list_data (widgets);
+ auto widgetList = OS.gtk_container_get_children (cast(GtkContainer*)widget);
+ if (widgetList !is null) {
+ auto widgets = widgetList;
+ while (widgets !is null) {
+ auto child = cast(GtkWidget*)OS.g_list_data (widgets);
if (OS.GTK_WIDGET_VISIBLE (child) && OS.gtk_widget_get_child_visible (child) && !OS.GTK_WIDGET_MAPPED (child)) {
OS.gtk_widget_map (child);
}
- widgets = OS.g_list_next (widgets);
+ widgets = cast(GList*)OS.g_list_next (widgets);
}
OS.g_list_free (widgetList);
}
- if ((OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_NO_WINDOW) == 0) {
+ if ((OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_NO_WINDOW) is 0) {
OS.gdk_window_show_unraised (OS.GTK_WIDGET_WINDOW (widget));
}
return 0;
@@ -1922,9 +1964,9 @@
*
* @see #setFocus
*/
-public boolean forceFocus () {
+public bool forceFocus () {
checkWidget();
- if (display.focusEvent == SWT.FocusOut) return false;
+ if (display.focusEvent is SWT.FocusOut) return false;
Shell shell = getShell ();
shell.setSavedFocus (this);
if (!isEnabled () || !isVisible ()) return false;
@@ -1932,18 +1974,18 @@
return forceFocus (focusHandle ());
}
-boolean forceFocus (int /*long*/ focusHandle) {
+bool forceFocus (GtkWidget* focusHandle) {
/* When the control is zero sized it must be realized */
OS.gtk_widget_realize (focusHandle);
OS.gtk_widget_grab_focus (focusHandle);
Shell shell = getShell ();
- int /*long*/ shellHandle = shell.shellHandle;
- int /*long*/ handle = OS.gtk_window_get_focus (shellHandle);
- while (handle != 0) {
- if (handle == focusHandle) return true;
+ auto shellHandle = shell.shellHandle;
+ auto handle = OS.gtk_window_get_focus (cast(GtkWindow*)shellHandle);
+ while (handle !is null) {
+ if (handle is focusHandle) return true;
Widget widget = display.getWidget (handle);
- if (widget != null && widget instanceof Control) {
- return widget == this;
+ if (widget !is null && (null !is cast(Control)widget)) {
+ return widget is this;
}
handle = OS.gtk_widget_get_parent (handle);
}
@@ -1963,11 +2005,11 @@
public Color getBackground () {
checkWidget();
Control control = findBackgroundControl ();
- if (control == null) control = this;
+ if (control is null) control = this;
return Color.gtk_new (display, control.getBackgroundColor ());
}
-GdkColor getBackgroundColor () {
+GdkColor* getBackgroundColor () {
return getBgColor ();
}
@@ -1986,22 +2028,22 @@
public Image getBackgroundImage () {
checkWidget ();
Control control = findBackgroundControl ();
- if (control == null) control = this;
+ if (control is null) control = this;
return control.backgroundImage;
}
-GdkColor getBgColor () {
- int /*long*/ fontHandle = fontHandle ();
+GdkColor* getBgColor () {
+ auto fontHandle = fontHandle ();
OS.gtk_widget_realize (fontHandle);
- GdkColor color = new GdkColor ();
+ GdkColor* color = new GdkColor ();
OS.gtk_style_get_bg (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
return color;
}
-GdkColor getBaseColor () {
- int /*long*/ fontHandle = fontHandle ();
+GdkColor* getBaseColor () {
+ auto fontHandle = fontHandle ();
OS.gtk_widget_realize (fontHandle);
- GdkColor color = new GdkColor ();
+ GdkColor* color = new GdkColor ();
OS.gtk_style_get_base (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
return color;
}
@@ -2053,9 +2095,9 @@
*
* @since 3.3
*/
-public boolean getDragDetect () {
+public bool getDragDetect () {
checkWidget ();
- return (state & DRAG_DETECT) != 0;
+ return (state & DRAG_DETECT) !is 0;
}
/**
@@ -2073,9 +2115,9 @@
*
* @see #isEnabled
*/
-public boolean getEnabled () {
+public bool getEnabled () {
checkWidget ();
- return (state & DISABLED) == 0;
+ return (state & DISABLED) is 0;
}
/**
@@ -2090,12 +2132,12 @@
*/
public Font getFont () {
checkWidget();
- if (font != null) return font;
+ if (font !is null) return font;
return Font.gtk_new (display, defaultFont ());
}
-int /*long*/ getFontDescription () {
- int /*long*/ fontHandle = fontHandle ();
+PangoFontDescription* getFontDescription () {
+ auto fontHandle = fontHandle ();
OS.gtk_widget_realize (fontHandle);
return OS.gtk_style_get_font_desc (OS.gtk_widget_get_style (fontHandle));
}
@@ -2115,14 +2157,14 @@
return Color.gtk_new (display, getForegroundColor ());
}
-GdkColor getForegroundColor () {
+GdkColor* getForegroundColor () {
return getFgColor ();
}
-GdkColor getFgColor () {
- int /*long*/ fontHandle = fontHandle ();
+GdkColor* getFgColor () {
+ auto fontHandle = fontHandle ();
OS.gtk_widget_realize (fontHandle);
- GdkColor color = new GdkColor ();
+ GdkColor* color = new GdkColor ();
OS.gtk_style_get_fg (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
return color;
}
@@ -2131,10 +2173,10 @@
return new Point (0, 0);
}
-GdkColor getTextColor () {
- int /*long*/ fontHandle = fontHandle ();
+GdkColor* getTextColor () {
+ auto fontHandle = fontHandle ();
OS.gtk_widget_realize (fontHandle);
- GdkColor color = new GdkColor ();
+ GdkColor* color = new GdkColor ();
OS.gtk_style_get_text (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
return color;
}
@@ -2181,23 +2223,23 @@
*
* @since 3.0
*/
-public Monitor getMonitor () {
+public dwt.widgets.Monitor.Monitor getMonitor () {
checkWidget();
- Monitor monitor = null;
- int /*long*/ screen = OS.gdk_screen_get_default ();
- if (screen != 0) {
+ dwt.widgets.Monitor.Monitor monitor = null;
+ auto screen = OS.gdk_screen_get_default ();
+ if (screen !is null) {
int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, paintWindow ());
- GdkRectangle dest = new GdkRectangle ();
+ GdkRectangle* dest = new GdkRectangle ();
OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest);
- monitor = new Monitor ();
+ monitor = new dwt.widgets.Monitor.Monitor ();
monitor.handle = monitorNumber;
monitor.x = dest.x;
monitor.y = dest.y;
monitor.width = dest.width;
monitor.height = dest.height;
Rectangle workArea = null;
- if (monitorNumber == 0) workArea = display.getWorkArea ();
- if (workArea != null) {
+ if (monitorNumber is 0) workArea = display.getWorkArea ();
+ if (workArea !is null) {
monitor.clientX = workArea.x;
monitor.clientY = workArea.y;
monitor.clientWidth = workArea.width;
@@ -2235,13 +2277,13 @@
int count = 0;
Shell shell = getShell ();
Control control = this;
- while (control != shell) {
+ while (control !is shell) {
count++;
control = control.parent;
}
control = this;
Control [] result = new Control [count];
- while (control != shell) {
+ while (control !is shell) {
result [--count] = control;
control = control.parent;
}
@@ -2283,7 +2325,7 @@
* ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*/
-public String getToolTipText () {
+public char[] getToolTipText () {
checkWidget();
return toolTipText;
}
@@ -2304,15 +2346,15 @@
* ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*/
-public boolean getVisible () {
+public bool getVisible () {
checkWidget();
- return (state & HIDDEN) == 0;
+ return (state & HIDDEN) is 0;
}
-int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ event) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
- if (gdkEvent.type == OS.GDK_3BUTTON_PRESS) return 0;
+int /*long*/ gtk_button_press_event (GtkWidget* widget, GdkEventButton* event) {
+ GdkEventButton* gdkEvent = new GdkEventButton ();
+ memmove (gdkEvent, event, GdkEventButton.sizeof);
+ if (gdkEvent.type is OS.GDK_3BUTTON_PRESS) return 0;
/*
* When a shell is created with SWT.ON_TOP and SWT.NO_FOCUS,
* do not activate the shell when the user clicks on the
@@ -2320,24 +2362,24 @@
* shell that does not take focus.
*/
Shell shell = _getShell ();
- if (((shell.style & SWT.ON_TOP) != 0) && (((shell.style & SWT.NO_FOCUS) == 0) || ((style & SWT.NO_FOCUS) == 0))) {
+ if (((shell.style & SWT.ON_TOP) !is 0) && (((shell.style & SWT.NO_FOCUS) is 0) || ((style & SWT.NO_FOCUS) is 0))) {
shell.forceActive();
}
int /*long*/ result = 0;
- if (gdkEvent.type == OS.GDK_BUTTON_PRESS) {
+ if (gdkEvent.type is OS.GDK_BUTTON_PRESS) {
display.clickCount = 1;
- int /*long*/ nextEvent = OS.gdk_event_peek ();
- if (nextEvent != 0) {
+ auto nextEvent = OS.gdk_event_peek ();
+ if (nextEvent !is null) {
int eventType = OS.GDK_EVENT_TYPE (nextEvent);
- if (eventType == OS.GDK_2BUTTON_PRESS) display.clickCount = 2;
- if (eventType == OS.GDK_3BUTTON_PRESS) display.clickCount = 3;
+ if (eventType is OS.GDK_2BUTTON_PRESS) display.clickCount = 2;
+ if (eventType is OS.GDK_3BUTTON_PRESS) display.clickCount = 3;
OS.gdk_event_free (nextEvent);
}
- boolean dragging = false;
- if ((state & DRAG_DETECT) != 0 && hooks (SWT.DragDetect)) {
- if (gdkEvent.button == 1) {
- boolean [] consume = new boolean [1];
- if (dragDetect ((int) gdkEvent.x, (int) gdkEvent.y, true, consume)) {
+ bool dragging = false;
+ if ((state & DRAG_DETECT) !is 0 && hooks (SWT.DragDetect)) {
+ if (gdkEvent.button is 1) {
+ bool [] consume = new bool [1];
+ if (dragDetect (cast(int) gdkEvent.x, cast(int) gdkEvent.y, true, consume)) {
dragging = true;
if (consume [0]) result = 1;
}
@@ -2349,7 +2391,7 @@
}
if (isDisposed ()) return 1;
if (dragging) {
- sendDragEvent (gdkEvent.button, gdkEvent.state, (int) gdkEvent.x, (int) gdkEvent.y, false);
+ sendDragEvent (gdkEvent.button, gdkEvent.state, cast(int) gdkEvent.x, cast(int) gdkEvent.y, false);
if (isDisposed ()) return 1;
}
/*
@@ -2357,9 +2399,9 @@
* that have default operating system menus in order to stop the
* operating system from displaying the menu if necessary.
*/
- if ((state & MENU) != 0) {
- if (gdkEvent.button == 3) {
- if (showMenu ((int)gdkEvent.x_root, (int)gdkEvent.y_root)) {
+ if ((state & MENU) !is 0) {
+ if (gdkEvent.button is 3) {
+ if (showMenu (cast(int)gdkEvent.x_root, cast(int)gdkEvent.y_root)) {
result = 1;
}
}
@@ -2373,9 +2415,9 @@
return result;
}
-int /*long*/ gtk_button_release_event (int /*long*/ widget, int /*long*/ event) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
+int /*long*/ gtk_button_release_event (GtkWidget* widget, GdkEventButton* event) {
+ GdkEventButton* gdkEvent = new GdkEventButton ();
+ memmove (gdkEvent, event, GdkEventButton.sizeof);
/*
* Feature in GTK. When button 4, 5, 6, or 7 is released, GTK
* does not deliver a corresponding GTK event. Button 6 and 7
@@ -2392,24 +2434,20 @@
return sendMouseEvent (SWT.MouseUp, button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
}
-int /*long*/ gtk_commit (int /*long*/ imcontext, int /*long*/ text) {
- if (text == 0) return 0;
- int length = OS.strlen (text);
- if (length == 0) return 0;
- byte [] buffer = new byte [length];
- OS.memmove (buffer, text, length);
- char [] chars = Converter.mbcsToWcs (null, buffer);
+int /*long*/ gtk_commit (GtkIMContext* imcontext, char* text) {
+ char [] chars = fromUtf8z( text );
+ if (chars.length is 0) return 0;
sendIMKeyEvent (SWT.KeyDown, null, chars);
return 0;
}
-int /*long*/ gtk_enter_notify_event (int /*long*/ widget, int /*long*/ event) {
- if (display.currentControl == this) return 0;
- GdkEventCrossing gdkEvent = new GdkEventCrossing ();
- OS.memmove (gdkEvent, event, GdkEventCrossing.sizeof);
- if (gdkEvent.mode != OS.GDK_CROSSING_NORMAL && gdkEvent.mode != OS.GDK_CROSSING_UNGRAB) return 0;
- if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) != 0) return 0;
- if (display.currentControl != null && !display.currentControl.isDisposed ()) {
+int /*long*/ gtk_enter_notify_event (GtkWidget* widget, GdkEventCrossing* event) {
+ if (display.currentControl is this) return 0;
+ GdkEventCrossing* gdkEvent = new GdkEventCrossing ();
+ memmove (gdkEvent, event, GdkEventCrossing.sizeof);
+ if (gdkEvent.mode !is OS.GDK_CROSSING_NORMAL && gdkEvent.mode !is OS.GDK_CROSSING_UNGRAB) return 0;
+ if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) !is 0) return 0;
+ if (display.currentControl !is null && !display.currentControl.isDisposed ()) {
display.removeMouseHoverTimeout (display.currentControl.handle);
display.currentControl.sendMouseEvent (SWT.MouseExit, 0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state);
}
@@ -2420,30 +2458,30 @@
return 0;
}
-int /*long*/ gtk_event_after (int /*long*/ widget, int /*long*/ gdkEvent) {
- GdkEvent event = new GdkEvent ();
- OS.memmove (event, gdkEvent, GdkEvent.sizeof);
- switch (event.type) {
+int /*long*/ gtk_event_after (GtkWidget* widget, GdkEvent* gdkEvent) {
+ GdkEvent* event = new GdkEvent ();
+ memmove (event, gdkEvent, GdkEvent.sizeof);
+ switch (cast(int)event.type) {
case OS.GDK_BUTTON_PRESS: {
- if (widget != eventHandle ()) break;
+ if (widget !is eventHandle ()) break;
/*
* Pop up the context menu in the event_after signal to allow
* the widget to process the button press. This allows widgets
* such as GtkTreeView to select items before a menu is shown.
*/
- if ((state & MENU) == 0) {
- GdkEventButton gdkEventButton = new GdkEventButton ();
- OS.memmove (gdkEventButton, gdkEvent, GdkEventButton.sizeof);
- if (gdkEventButton.button == 3) {
- showMenu ((int) gdkEventButton.x_root, (int) gdkEventButton.y_root);
+ if ((state & MENU) is 0) {
+ GdkEventButton* gdkEventButton = new GdkEventButton ();
+ memmove (gdkEventButton, gdkEvent, GdkEventButton.sizeof);
+ if (gdkEventButton.button is 3) {
+ showMenu (cast(int) gdkEventButton.x_root, cast(int) gdkEventButton.y_root);
}
}
break;
}
case OS.GDK_FOCUS_CHANGE: {
- if (widget != focusHandle ()) break;
- GdkEventFocus gdkEventFocus = new GdkEventFocus ();
- OS.memmove (gdkEventFocus, gdkEvent, GdkEventFocus.sizeof);
+ if (widget !is focusHandle ()) break;
+ GdkEventFocus* gdkEventFocus = new GdkEventFocus ();
+ memmove (gdkEventFocus, gdkEvent, GdkEventFocus.sizeof);
/*
* Feature in GTK. The GTK combo box popup under some window managers
@@ -2453,40 +2491,40 @@
* and ignore the focus event when the menu is both shown and hidden.
*/
Display display = this.display;
- if (gdkEventFocus.in != 0) {
+ if (gdkEventFocus.in_ !is 0) {
if (display.ignoreFocus) {
display.ignoreFocus = false;
break;
}
} else {
display.ignoreFocus = false;
- int /*long*/ grabHandle = OS.gtk_grab_get_current ();
- if (grabHandle != 0) {
- if (OS.G_OBJECT_TYPE (grabHandle) == OS.GTK_TYPE_MENU ()) {
+ auto grabHandle = OS.gtk_grab_get_current ();
+ if (grabHandle !is null) {
+ if (OS.G_OBJECT_TYPE ( cast(GObject*)grabHandle) is OS.GTK_TYPE_MENU ()) {
display.ignoreFocus = true;
break;
}
}
}
- sendFocusEvent (gdkEventFocus.in != 0 ? SWT.FocusIn : SWT.FocusOut);
+ sendFocusEvent (gdkEventFocus.in_ !is 0 ? SWT.FocusIn : SWT.FocusOut);
break;
}
}
return 0;
}
-int /*long*/ gtk_expose_event (int /*long*/ widget, int /*long*/ eventPtr) {
- if ((state & OBSCURED) != 0) return 0;
+int /*long*/ gtk_expose_event (GtkWidget* widget, GdkEventExpose* eventPtr) {
+ if ((state & OBSCURED) !is 0) return 0;
if (!hooks (SWT.Paint) && !filters (SWT.Paint)) return 0;
- GdkEventExpose gdkEvent = new GdkEventExpose ();
- OS.memmove(gdkEvent, eventPtr, GdkEventExpose.sizeof);
+ GdkEventExpose* gdkEvent = new GdkEventExpose ();
+ memmove(gdkEvent, eventPtr, GdkEventExpose.sizeof);
Event event = new Event ();
event.count = gdkEvent.count;
- event.x = gdkEvent.area_x;
- event.y = gdkEvent.area_y;
- event.width = gdkEvent.area_width;
- event.height = gdkEvent.area_height;
+ event.x = gdkEvent.area.x;
+ event.y = gdkEvent.area.y;
+ event.width = gdkEvent.area.width;
+ event.height = gdkEvent.area.height;
GCData data = new GCData ();
data.damageRgn = gdkEvent.region;
GC gc = event.gc = GC.gtk_new (this, data);
@@ -2497,35 +2535,35 @@
return 0;
}
-int /*long*/ gtk_focus (int /*long*/ widget, int /*long*/ directionType) {
+int /*long*/ gtk_focus (GtkWidget* widget, int /*long*/ directionType) {
/* Stop GTK traversal for every widget */
return 1;
}
-int /*long*/ gtk_focus_in_event (int /*long*/ widget, int /*long*/ event) {
+int /*long*/ gtk_focus_in_event (GtkWidget* widget, int /*long*/ event) {
// widget could be disposed at this point
- if (handle != 0) {
+ if (handle !is null) {
Control oldControl = display.imControl;
- if (oldControl != this) {
- if (oldControl != null && !oldControl.isDisposed ()) {
- int /*long*/ oldIMHandle = oldControl.imHandle ();
- if (oldIMHandle != 0) OS.gtk_im_context_reset (oldIMHandle);
+ if (oldControl !is this) {
+ if (oldControl !is null && !oldControl.isDisposed ()) {
+ auto oldIMHandle = oldControl.imHandle ();
+ if (oldIMHandle !is null) OS.gtk_im_context_reset (oldIMHandle);
}
}
if (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) {
- int /*long*/ imHandle = imHandle ();
- if (imHandle != 0) OS.gtk_im_context_focus_in (imHandle);
+ auto imHandle = imHandle ();
+ if (imHandle !is null) OS.gtk_im_context_focus_in (imHandle);
}
}
return 0;
}
-int /*long*/ gtk_focus_out_event (int /*long*/ widget, int /*long*/ event) {
+int /*long*/ gtk_focus_out_event (GtkWidget* widget, int /*long*/ event) {
// widget could be disposed at this point
- if (handle != 0) {
+ if (handle !is null) {
if (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) {
- int /*long*/ imHandle = imHandle ();
- if (imHandle != 0) {
+ auto imHandle = imHandle ();
+ if (imHandle !is null) {
OS.gtk_im_context_focus_out (imHandle);
}
}
@@ -2533,10 +2571,10 @@
return 0;
}
-int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ event) {
+int /*long*/ gtk_key_press_event (GtkWidget* widget, GdkEventKey* event) {
if (!hasFocus ()) return 0;
- GdkEventKey gdkEvent = new GdkEventKey ();
- OS.memmove (gdkEvent, event, GdkEventKey.sizeof);
+ GdkEventKey* gdkEvent = new GdkEventKey ();
+ memmove (gdkEvent, event, GdkEventKey.sizeof);
if (translateMnemonic (gdkEvent.keyval, gdkEvent)) return 1;
// widget could be disposed at this point
@@ -2552,40 +2590,40 @@
return super.gtk_key_press_event (widget, event);
}
-int /*long*/ gtk_key_release_event (int /*long*/ widget, int /*long*/ event) {
+int /*long*/ gtk_key_release_event (GtkWidget* widget, GdkEventKey* event) {
if (!hasFocus ()) return 0;
- int /*long*/ imHandle = imHandle ();
- if (imHandle != 0) {
+ auto imHandle = imHandle ();
+ if (imHandle !is null) {
if (OS.gtk_im_context_filter_keypress (imHandle, event)) return 1;
}
return super.gtk_key_release_event (widget, event);
}
-int /*long*/ gtk_leave_notify_event (int /*long*/ widget, int /*long*/ event) {
- if (display.currentControl != this) return 0;
+int /*long*/ gtk_leave_notify_event (GtkWidget* widget, GdkEventCrossing* event) {
+ if (display.currentControl !is this) return 0;
display.removeMouseHoverTimeout (handle);
int result = 0;
- if (sendLeaveNotify () || display.getCursorControl () == null) {
- GdkEventCrossing gdkEvent = new GdkEventCrossing ();
- OS.memmove (gdkEvent, event, GdkEventCrossing.sizeof);
- if (gdkEvent.mode != OS.GDK_CROSSING_NORMAL && gdkEvent.mode != OS.GDK_CROSSING_UNGRAB) return 0;
- if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) != 0) return 0;
+ if (sendLeaveNotify () || display.getCursorControl () is null) {
+ GdkEventCrossing* gdkEvent = new GdkEventCrossing ();
+ memmove (gdkEvent, event, GdkEventCrossing.sizeof);
+ if (gdkEvent.mode !is OS.GDK_CROSSING_NORMAL && gdkEvent.mode !is OS.GDK_CROSSING_UNGRAB) return 0;
+ if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) !is 0) return 0;
result = sendMouseEvent (SWT.MouseExit, 0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
display.currentControl = null;
}
return result;
}
-int /*long*/ gtk_mnemonic_activate (int /*long*/ widget, int /*long*/ arg1) {
+int /*long*/ gtk_mnemonic_activate (GtkWidget* widget, int /*long*/ arg1) {
int result = 0;
- int /*long*/ eventPtr = OS.gtk_get_current_event ();
- if (eventPtr != 0) {
- GdkEventKey keyEvent = new GdkEventKey ();
- OS.memmove (keyEvent, eventPtr, GdkEventKey.sizeof);
- if (keyEvent.type == OS.GDK_KEY_PRESS) {
+ auto eventPtr = OS.gtk_get_current_event ();
+ if (eventPtr !is null) {
+ GdkEventKey* keyEvent = new GdkEventKey ();
+ memmove (keyEvent, eventPtr, GdkEventKey.sizeof);
+ if (keyEvent.type is OS.GDK_KEY_PRESS) {
Control focusControl = display.getFocusControl ();
- int /*long*/ focusHandle = focusControl != null ? focusControl.focusHandle () : 0;
- if (focusHandle != 0) {
+ auto focusHandle = focusControl !is null ? focusControl.focusHandle () : null;
+ if (focusHandle !is null) {
display.mnemonicControl = this;
OS.gtk_widget_event (focusHandle, eventPtr);
display.mnemonicControl = null;
@@ -2597,31 +2635,32 @@
return result;
}
-int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ event) {
- GdkEventMotion gdkEvent = new GdkEventMotion ();
- OS.memmove (gdkEvent, event, GdkEventMotion.sizeof);
- if (this == display.currentControl && (hooks (SWT.MouseHover) || filters (SWT.MouseHover))) {
+int /*long*/ gtk_motion_notify_event (GtkWidget* widget, GdkEventMotion* event) {
+ GdkEventMotion* gdkEvent = new GdkEventMotion ();
+ memmove (gdkEvent, event, GdkEventMotion.sizeof);
+ if (this is display.currentControl && (hooks (SWT.MouseHover) || filters (SWT.MouseHover))) {
display.addMouseHoverTimeout (handle);
}
double x = gdkEvent.x_root, y = gdkEvent.y_root;
int state = gdkEvent.state;
- if (gdkEvent.is_hint != 0) {
- int [] pointer_x = new int [1], pointer_y = new int [1], mask = new int [1];
- int /*long*/ window = eventWindow ();
- OS.gdk_window_get_pointer (window, pointer_x, pointer_y, mask);
- x = pointer_x [0];
- y = pointer_y [0];
- state = mask [0];
+ if (gdkEvent.is_hint !is 0) {
+ int pointer_x, pointer_y;
+ GdkModifierType mask;
+ auto window = eventWindow ();
+ OS.gdk_window_get_pointer (window, &pointer_x, &pointer_y, &mask);
+ x = pointer_x;
+ y = pointer_y;
+ state = mask;
}
- int result = sendMouseEvent (SWT.MouseMove, 0, gdkEvent.time, x, y, gdkEvent.is_hint != 0, state) ? 0 : 1;
+ int result = sendMouseEvent (SWT.MouseMove, 0, gdkEvent.time, x, y, gdkEvent.is_hint !is 0, state) ? 0 : 1;
return result;
}
-int /*long*/ gtk_popup_menu (int /*long*/ widget) {
+int /*long*/ gtk_popup_menu (GtkWidget* widget) {
if (!hasFocus()) return 0;
- int [] x = new int [1], y = new int [1];
- OS.gdk_window_get_pointer (0, x, y, null);
- return showMenu (x [0], y [0]) ? 1 : 0;
+ int x, y ;
+ OS.gdk_window_get_pointer (null, &x, &y, null);
+ return showMenu (x, y) ? 1 : 0;
}
int /*long*/ gtk_preedit_changed (int /*long*/ imcontext) {
@@ -2629,23 +2668,23 @@
return 0;
}
-int /*long*/ gtk_realize (int /*long*/ widget) {
- int /*long*/ imHandle = imHandle ();
- if (imHandle != 0) {
- int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ());
+int /*long*/ gtk_realize (GtkWidget* widget) {
+ auto imHandle = imHandle ();
+ if (imHandle !is null) {
+ auto window = OS.GTK_WIDGET_WINDOW (paintHandle ());
OS.gtk_im_context_set_client_window (imHandle, window);
}
- if (backgroundImage != null) {
- int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ());
- if (window != 0) OS.gdk_window_set_back_pixmap (window, backgroundImage.pixmap, false);
+ if (backgroundImage !is null) {
+ auto window = OS.GTK_WIDGET_WINDOW (paintHandle ());
+ if (window !is null) OS.gdk_window_set_back_pixmap (window, cast(GdkPixmap*)backgroundImage.pixmap, false);
}
return 0;
}
-int /*long*/ gtk_scroll_event (int /*long*/ widget, int /*long*/ eventPtr) {
- GdkEventScroll gdkEvent = new GdkEventScroll ();
- OS.memmove (gdkEvent, eventPtr, GdkEventScroll.sizeof);
- switch (gdkEvent.direction) {
+int /*long*/ gtk_scroll_event (GtkWidget* widget, GdkEventScroll* eventPtr) {
+ GdkEventScroll* gdkEvent = new GdkEventScroll ();
+ memmove (gdkEvent, eventPtr, GdkEventScroll.sizeof);
+ switch (cast(int)gdkEvent.direction) {
case OS.GDK_SCROLL_UP:
return sendMouseEvent (SWT.MouseWheel, 0, 3, SWT.SCROLL_LINE, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
case OS.GDK_SCROLL_DOWN:
@@ -2658,39 +2697,39 @@
return 0;
}
-int /*long*/ gtk_show_help (int /*long*/ widget, int /*long*/ helpType) {
+int /*long*/ gtk_show_help (GtkWidget* widget, int /*long*/ helpType) {
if (!hasFocus ()) return 0;
return sendHelpEvent (helpType) ? 1 : 0;
}
-int /*long*/ gtk_style_set (int /*long*/ widget, int /*long*/ previousStyle) {
- if (backgroundImage != null) {
+int /*long*/ gtk_style_set (GtkWidget* widget, int /*long*/ previousStyle) {
+ if (backgroundImage !is null) {
setBackgroundPixmap (backgroundImage.pixmap);
}
return 0;
}
-int /*long*/ gtk_unrealize (int /*long*/ widget) {
- int /*long*/ imHandle = imHandle ();
- if (imHandle != 0) OS.gtk_im_context_set_client_window (imHandle, 0);
+int /*long*/ gtk_unrealize (GtkWidget* widget) {
+ auto imHandle = imHandle ();
+ if (imHandle !is null) OS.gtk_im_context_set_client_window (imHandle, null);
return 0;
}
-int /*long*/ gtk_visibility_notify_event (int /*long*/ widget, int /*long*/ event) {
- GdkEventVisibility gdkEvent = new GdkEventVisibility ();
- OS.memmove (gdkEvent, event, GdkEventVisibility.sizeof);
- int /*long*/ paintWindow = paintWindow();
- int /*long*/ window = gdkEvent.window;
- if (window == paintWindow) {
- if (gdkEvent.state == OS.GDK_VISIBILITY_FULLY_OBSCURED) {
+int /*long*/ gtk_visibility_notify_event (GtkWidget* widget, GdkEventVisibility* event) {
+ GdkEventVisibility* gdkEvent = new GdkEventVisibility ();
+ memmove (gdkEvent, event, GdkEventVisibility.sizeof);
+ auto paintWindow = paintWindow();
+ auto window = gdkEvent.window;
+ if (window is paintWindow) {
+ if (gdkEvent.state is OS.GDK_VISIBILITY_FULLY_OBSCURED) {
state |= OBSCURED;
} else {
- if ((state & OBSCURED) != 0) {
- int [] width = new int [1], height = new int [1];
- OS.gdk_drawable_get_size (window, width, height);
- GdkRectangle rect = new GdkRectangle ();
- rect.width = width [0];
- rect.height = height [0];
+ if ((state & OBSCURED) !is 0) {
+ int width, height;
+ OS.gdk_drawable_get_size (cast(GdkDrawable*)window, &width, &height);
+ GdkRectangle* rect = new GdkRectangle ();
+ rect.width = width;
+ rect.height = height;
OS.gdk_window_invalidate_rect (window, rect, false);
}
state &= ~OBSCURED;
@@ -2699,7 +2738,7 @@
return 0;
}
-void gtk_widget_size_request (int /*long*/ widget, GtkRequisition requisition) {
+void gtk_widget_size_request (GtkWidget* widget, GtkRequisition* requisition) {
OS.gtk_widget_size_request (widget, requisition);
}
@@ -2716,30 +2755,30 @@
* @param data the platform specific GC data
* @return the platform specific GC handle
*/
-public int /*long*/ internal_new_GC (GCData data) {
+public GdkGC* internal_new_GC (GCData data) {
checkWidget ();
- int /*long*/ window = paintWindow ();
- if (window == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- int /*long*/ gdkGC = OS.gdk_gc_new (window);
- if (gdkGC == 0) error (SWT.ERROR_NO_HANDLES);
- if (data != null) {
+ auto window = paintWindow ();
+ if (window is null) SWT.error (SWT.ERROR_NO_HANDLES);
+ auto gdkGC = OS.gdk_gc_new (cast(GdkDrawable*)window);
+ if (gdkGC is null) error (SWT.ERROR_NO_HANDLES);
+ if (data !is null) {
int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
- if ((data.style & mask) == 0) {
+ if ((data.style & mask) is 0) {
data.style |= style & (mask | SWT.MIRRORED);
}
- data.drawable = window;
+ data.drawable = cast(GdkDrawable*)window;
data.device = display;
data.foreground = getForegroundColor ();
Control control = findBackgroundControl ();
- if (control == null) control = this;
+ if (control is null) control = this;
data.background = control.getBackgroundColor ();
- data.font = font != null ? font.handle : defaultFont ();
+ data.font = font !is null ? font.handle : defaultFont ();
}
return gdkGC;
}
-int /*long*/ imHandle () {
- return 0;
+GtkIMContext* imHandle () {
+ return null;
}
/**
@@ -2755,7 +2794,7 @@
* @param hDC the platform specific GC handle
* @param data the platform specific GC data
*/
-public void internal_dispose_GC (int /*long*/ gdkGC, GCData data) {
+public void internal_dispose_GC (GdkGC* gdkGC, GCData data) {
checkWidget ();
OS.g_object_unref (gdkGC);
}
@@ -2771,46 +2810,46 @@
* ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*/
-public boolean isReparentable () {
+public bool isReparentable () {
checkWidget();
return true;
}
-boolean isShowing () {
+bool isShowing () {
/*
* This is not complete. Need to check if the
* widget is obscurred by a parent or sibling.
*/
if (!isVisible ()) return false;
Control control = this;
- while (control != null) {
+ while (control !is null) {
Point size = control.getSize ();
- if (size.x == 0 || size.y == 0) {
+ if (size.x is 0 || size.y is 0) {
return false;
}
control = control.parent;
}
return true;
}
-boolean isTabGroup () {
+bool isTabGroup () {
Control [] tabList = parent._getTabList ();
- if (tabList != null) {
+ if (tabList !is null) {
for (int i=0; iERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*/
-public boolean isFocusControl () {
+public bool isFocusControl () {
checkWidget();
Control focusControl = display.focusControl;
- if (focusControl != null && !focusControl.isDisposed ()) {
- return this == focusControl;
+ if (focusControl !is null && !focusControl.isDisposed ()) {
+ return this is focusControl;
}
return hasFocus ();
}
@@ -2875,7 +2914,7 @@
*
* @see #getVisible
*/
-public boolean isVisible () {
+public bool isVisible () {
checkWidget();
return getVisible () && parent.isVisible ();
}
@@ -2884,19 +2923,19 @@
return parent.menuShell ();
}
-boolean mnemonicHit (char key) {
+bool mnemonicHit (char key) {
return false;
}
-boolean mnemonicMatch (char key) {
+bool mnemonicMatch (char key) {
return false;
}
void register () {
super.register ();
- if (fixedHandle != 0) display.addWidget (fixedHandle, this);
- int /*long*/ imHandle = imHandle ();
- if (imHandle != 0) display.addWidget (imHandle, this);
+ if (fixedHandle !is null) display.addWidget (fixedHandle, this);
+ auto imHandle = imHandle ();
+ if (imHandle !is null) display.addWidget (cast(GtkWidget*)imHandle, this);
}
/**
@@ -2923,7 +2962,7 @@
redraw (false);
}
-void redraw (boolean all) {
+void redraw (bool all) {
// checkWidget();
if (!OS.GTK_WIDGET_VISIBLE (topHandle ())) return;
redrawWidget (0, 0, 0, 0, true, all, false);
@@ -2959,7 +2998,7 @@
* @see SWT#NO_MERGE_PAINTS
* @see SWT#DOUBLE_BUFFERED
*/
-public void redraw (int x, int y, int width, int height, boolean all) {
+public void redraw (int x, int y, int width, int height, bool all) {
checkWidget();
if (!OS.GTK_WIDGET_VISIBLE (topHandle ())) return;
redrawWidget (x, y, width, height, false, all, false);
@@ -2968,15 +3007,15 @@
void redrawChildren () {
}
-void redrawWidget (int x, int y, int width, int height, boolean redrawAll, boolean all, boolean trim) {
- if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return;
- int /*long*/ window = paintWindow ();
- GdkRectangle rect = new GdkRectangle ();
+void redrawWidget (int x, int y, int width, int height, bool redrawAll, bool all, bool trim) {
+ if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) is 0) return;
+ auto window = paintWindow ();
+ GdkRectangle* rect = new GdkRectangle ();
if (redrawAll) {
- int [] w = new int [1], h = new int [1];
- OS.gdk_drawable_get_size (window, w, h);
- rect.width = w [0];
- rect.height = h [0];
+ int w, h;
+ OS.gdk_drawable_get_size (cast(GdkDrawable*)window, &w, &h);
+ rect.width = w;
+ rect.height = h;
} else {
rect.x = x;
rect.y = y;
@@ -2986,13 +3025,13 @@
OS.gdk_window_invalidate_rect (window, rect, all);
}
-void release (boolean destroy) {
+void release (bool destroy) {
Control next = null, previous = null;
- if (destroy && parent != null) {
+ if (destroy && parent !is null) {
Control[] children = parent._getChildren ();
int index = 0;
while (index < children.length) {
- if (children [index] == this) break;
+ if (children [index] is this) break;
index++;
}
if (0 < index && (index + 1) < children.length) {
@@ -3002,13 +3041,13 @@
}
super.release (destroy);
if (destroy) {
- if (previous != null) previous.addRelation (next);
+ if (previous !is null) previous.addRelation (next);
}
}
void releaseHandle () {
super.releaseHandle ();
- fixedHandle = 0;
+ fixedHandle = null;
parent = null;
}
@@ -3018,20 +3057,20 @@
void releaseWidget () {
super.releaseWidget ();
- if (display.currentControl == this) display.currentControl = null;
+ if (display.currentControl is this) display.currentControl = null;
display.removeMouseHoverTimeout (handle);
- int /*long*/ imHandle = imHandle ();
- if (imHandle != 0) {
+ auto imHandle = imHandle ();
+ if (imHandle !is null) {
OS.gtk_im_context_reset (imHandle);
- OS.gtk_im_context_set_client_window (imHandle, 0);
+ OS.gtk_im_context_set_client_window (imHandle, null);
}
- if (enableWindow != 0) {
- OS.gdk_window_set_user_data (enableWindow, 0);
+ if (enableWindow !is null) {
+ OS.gdk_window_set_user_data (enableWindow, null);
OS.gdk_window_destroy (enableWindow);
- enableWindow = 0;
+ enableWindow = null;
}
- redrawWindow = 0;
- if (menu != null && !menu.isDisposed ()) {
+ redrawWindow = null;
+ if (menu !is null && !menu.isDisposed ()) {
menu.dispose ();
}
menu = null;
@@ -3041,7 +3080,7 @@
accessible = null;
}
-boolean sendDragEvent (int button, int stateMask, int x, int y, boolean isStateMask) {
+bool sendDragEvent (int button, int stateMask, int x, int y, bool isStateMask) {
Event event = new Event ();
event.button = button;
event.x = x;
@@ -3076,7 +3115,7 @@
shell.setActiveControl (this);
break;
case SWT.FocusOut:
- if (shell != display.activeShell) {
+ if (shell !is display.activeShell) {
shell.setActiveControl (null);
}
break;
@@ -3084,9 +3123,9 @@
}
}
-boolean sendHelpEvent (int /*long*/ helpType) {
+bool sendHelpEvent (int /*long*/ helpType) {
Control control = this;
- while (control != null) {
+ while (control !is null) {
if (control.hooks (SWT.Help)) {
control.postEvent (SWT.Help);
return true;
@@ -3096,15 +3135,15 @@
return false;
}
-boolean sendLeaveNotify() {
+bool sendLeaveNotify() {
return false;
}
-boolean sendMouseEvent (int type, int button, int time, double x, double y, boolean is_hint, int state) {
+bool sendMouseEvent (int type, int button, int time, double x, double y, bool is_hint, int state) {
return sendMouseEvent (type, button, 0, 0, false, time, x, y, is_hint, state);
}
-boolean sendMouseEvent (int type, int button, int count, int detail, boolean send, int time, double x, double y, boolean is_hint, int state) {
+bool sendMouseEvent (int type, int button, int count, int detail, bool send, int time, double x, double y, bool is_hint, int state) {
if (!hooks (type) && !filters (type)) return true;
Event event = new Event ();
event.time = time;
@@ -3112,14 +3151,14 @@
event.detail = detail;
event.count = count;
if (is_hint) {
- event.x = (int)x;
- event.y = (int)y;
+ event.x = cast(int)x;
+ event.y = cast(int)y;
} else {
- int /*long*/ window = eventWindow ();
- int [] origin_x = new int [1], origin_y = new int [1];
- OS.gdk_window_get_origin (window, origin_x, origin_y);
- event.x = (int)x - origin_x [0];
- event.y = (int)y - origin_y [0];
+ auto window = eventWindow ();
+ int origin_x, origin_y;
+ OS.gdk_window_get_origin (window, &origin_x, &origin_y);
+ event.x = cast(int)x - origin_x;
+ event.y = cast(int)y - origin_y;
}
setInputState (event, state);
if (send) {
@@ -3132,7 +3171,7 @@
}
void setBackground () {
- if ((state & PARENT_BACKGROUND) != 0 && (state & BACKGROUND) == 0 && backgroundImage == null) {
+ if ((state & PARENT_BACKGROUND) !is 0 && (state & BACKGROUND) is 0 && backgroundImage is null) {
setParentBackground ();
} else {
setWidgetBackground ();
@@ -3160,22 +3199,22 @@
*/
public void setBackground (Color color) {
checkWidget();
- if (((state & BACKGROUND) == 0) && color == null) return;
- GdkColor gdkColor = null;
- if (color != null) {
+ if (((state & BACKGROUND) is 0) && color is null) return;
+ GdkColor* gdkColor = null;
+ if (color !is null) {
if (color.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
gdkColor = color.handle;
}
- boolean set = false;
- if (gdkColor == null) {
- int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
- set = (OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL) & OS.GTK_RC_BG) != 0;
+ bool set = false;
+ if (gdkColor is null) {
+ auto style = OS.gtk_widget_get_modifier_style (handle);
+ set = (OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL) & OS.GTK_RC_BG) !is 0;
} else {
- GdkColor oldColor = getBackgroundColor ();
- set = oldColor.pixel != gdkColor.pixel;
+ GdkColor* oldColor = getBackgroundColor ();
+ set = oldColor.pixel !is gdkColor.pixel;
}
if (set) {
- if (color == null) {
+ if (color is null) {
state &= ~BACKGROUND;
} else {
state |= BACKGROUND;
@@ -3185,24 +3224,24 @@
}
}
-void setBackgroundColor (int /*long*/ handle, GdkColor color) {
+void setBackgroundColor (GtkWidget* handle, GdkColor* color) {
int index = OS.GTK_STATE_NORMAL;
- int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
- int /*long*/ ptr = OS.gtk_rc_style_get_bg_pixmap_name (style, index);
- if (ptr != 0) OS.g_free (ptr);
- String name = color == null ? "" : "";
- byte[] buffer = Converter.wcsToMbcs (null, name, true);
- ptr = OS.g_malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
+ auto style = OS.gtk_widget_get_modifier_style (handle);
+ auto ptr = OS.gtk_rc_style_get_bg_pixmap_name (style, index);
+ if (ptr !is null) OS.g_free (ptr);
+ char[] name = color is null ? "" : "" ;
+ char* pname = toStringz( name );
+ ptr = cast(char*)OS.g_malloc (name.length+1);
+ memmove (ptr, pname, name.length+1);
OS.gtk_rc_style_set_bg_pixmap_name (style, index, ptr);
OS.gtk_rc_style_set_bg (style, index, color);
int flags = OS.gtk_rc_style_get_color_flags (style, index);
- flags = (color == null) ? flags & ~OS.GTK_RC_BG : flags | OS.GTK_RC_BG;
+ flags = (color is null) ? flags & ~OS.GTK_RC_BG : flags | OS.GTK_RC_BG;
OS.gtk_rc_style_set_color_flags (style, index, flags);
OS.gtk_widget_modify_style (handle, style);
}
-void setBackgroundColor (GdkColor color) {
+void setBackgroundColor (GdkColor* color) {
setBackgroundColor (handle, color);
}
@@ -3230,10 +3269,10 @@
*/
public void setBackgroundImage (Image image) {
checkWidget ();
- if (image != null && image.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (image == backgroundImage) return;
+ if (image !is null && image.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (image is backgroundImage) return;
this.backgroundImage = image;
- if (backgroundImage != null) {
+ if (backgroundImage !is null) {
setBackgroundPixmap (backgroundImage.pixmap);
redrawWidget (0, 0, 0, 0, true, false, false);
} else {
@@ -3242,9 +3281,9 @@
redrawChildren ();
}
-void setBackgroundPixmap (int /*long*/ pixmap) {
- int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ());
- if (window != 0) OS.gdk_window_set_back_pixmap (window, backgroundImage.pixmap, false);
+void setBackgroundPixmap (GdkDrawable* pixmap) {
+ auto window = OS.GTK_WIDGET_WINDOW (paintHandle ());
+ if (window !is null) OS.gdk_window_set_back_pixmap (window, cast(GdkPixmap*)backgroundImage.pixmap, false);
}
/**
@@ -3259,7 +3298,7 @@
* ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*/
-public void setCapture (boolean capture) {
+public void setCapture (bool capture) {
checkWidget();
/* FIXME !!!!! */
/*
@@ -3291,19 +3330,19 @@
*/
public void setCursor (Cursor cursor) {
checkWidget();
- if (cursor != null && cursor.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
+ if (cursor !is null && cursor.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
this.cursor = cursor;
- setCursor (cursor != null ? cursor.handle : 0);
+ setCursor (cursor !is null ? cursor.handle : null);
}
-void setCursor (int /*long*/ cursor) {
- int /*long*/ window = eventWindow ();
- if (window != 0) {
+void setCursor (GdkCursor* cursor) {
+ auto window = eventWindow ();
+ if (window !is null) {
OS.gdk_window_set_cursor (window, cursor);
if (!OS.GDK_WINDOWING_X11 ()) {
OS.gdk_flush ();
} else {
- int /*long*/ xDisplay = OS.GDK_DISPLAY ();
+ auto xDisplay = OS.GDK_DISPLAY ();
OS.XFlush (xDisplay);
}
}
@@ -3323,7 +3362,7 @@
*
* @since 3.3
*/
-public void setDragDetect (boolean dragDetect) {
+public void setDragDetect (bool dragDetect) {
checkWidget ();
if (dragDetect) {
state |= DRAG_DETECT;
@@ -3345,15 +3384,15 @@
* ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*/
-public void setEnabled (boolean enabled) {
+public void setEnabled (bool enabled) {
checkWidget();
- if (((state & DISABLED) == 0) == enabled) return;
+ if (((state & DISABLED) is 0) is enabled) return;
Control control = null;
- boolean fixFocus = false;
+ bool fixFocus_ = false;
if (!enabled) {
- if (display.focusEvent != SWT.FocusOut) {
+ if (display.focusEvent !is SWT.FocusOut) {
control = display.getFocusControl ();
- fixFocus = isFocusAncestor (control);
+ fixFocus_ = isFocusAncestor (control);
}
}
if (enabled) {
@@ -3364,17 +3403,17 @@
enableWidget (enabled);
if (isDisposed ()) return;
if (enabled) {
- if (enableWindow != 0) {
- OS.gdk_window_set_user_data (enableWindow, 0);
+ if (enableWindow !is null) {
+ OS.gdk_window_set_user_data (enableWindow, null);
OS.gdk_window_destroy (enableWindow);
- enableWindow = 0;
+ enableWindow = null;
}
} else {
OS.gtk_widget_realize (handle);
- int /*long*/ parentHandle = parent.parentingHandle ();
- int /*long*/ window = OS.GTK_WIDGET_WINDOW (parentHandle);
+ auto parentHandle = parent.parentingHandle ();
+ auto window = OS.GTK_WIDGET_WINDOW (parentHandle);
Rectangle rect = getBounds ();
- GdkWindowAttr attributes = new GdkWindowAttr ();
+ GdkWindowAttr* attributes = new GdkWindowAttr ();
attributes.x = rect.x;
attributes.y = rect.y;
attributes.width = rect.width;
@@ -3383,26 +3422,26 @@
attributes.wclass = OS.GDK_INPUT_ONLY;
attributes.window_type = OS.GDK_WINDOW_CHILD;
enableWindow = OS.gdk_window_new (window, attributes, OS.GDK_WA_X | OS.GDK_WA_Y);
- if (enableWindow != 0) {
- int /*long*/ topHandle = topHandle ();
+ if (enableWindow !is null) {
+ auto topHandle = topHandle ();
OS.gdk_window_set_user_data (enableWindow, parentHandle);
if (!OS.GDK_WINDOWING_X11 ()) {
OS.gdk_window_raise (enableWindow);
} else {
- int /*long*/ topWindow = OS.GTK_WIDGET_WINDOW (topHandle);
- int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (topWindow);
- int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (enableWindow);
+ auto topWindow = OS.GTK_WIDGET_WINDOW (topHandle);
+ auto xDisplay = OS.gdk_x11_drawable_get_xdisplay (cast(GdkDrawable*)topWindow);
+ auto xWindow = OS.gdk_x11_drawable_get_xid (cast(GdkDrawable*)enableWindow);
int xScreen = OS.XDefaultScreen (xDisplay);
int flags = OS.CWStackMode | OS.CWSibling;
- XWindowChanges changes = new XWindowChanges ();
- changes.sibling = OS.gdk_x11_drawable_get_xid (topWindow);
+ XWindowChanges* changes = new XWindowChanges ();
+ changes.sibling = OS.gdk_x11_drawable_get_xid (cast(GdkDrawable*)topWindow);
changes.stack_mode = OS.Above;
OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes);
}
if (OS.GTK_WIDGET_VISIBLE (topHandle)) OS.gdk_window_show_unraised (enableWindow);
}
}
- if (fixFocus) fixFocus (control);
+ if (fixFocus_) fixFocus (control);
}
/**
@@ -3419,9 +3458,9 @@
*
* @see #forceFocus
*/
-public boolean setFocus () {
+public bool setFocus () {
checkWidget();
- if ((style & SWT.NO_FOCUS) != 0) return false;
+ if ((style & SWT.NO_FOCUS) !is 0) return false;
return forceFocus ();
}
@@ -3442,16 +3481,16 @@
*/
public void setFont (Font font) {
checkWidget();
- if (((state & FONT) == 0) && font == null) return;
+ if (((state & FONT) is 0) && font is null) return;
this.font = font;
- int /*long*/ fontDesc;
- if (font == null) {
+ PangoFontDescription* fontDesc;
+ if (font is null) {
fontDesc = defaultFont ();
} else {
if (font.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
fontDesc = font.handle;
}
- if (font == null) {
+ if (font is null) {
state &= ~FONT;
} else {
state |= FONT;
@@ -3459,7 +3498,7 @@
setFontDescription (fontDesc);
}
-void setFontDescription (int /*long*/ font) {
+void setFontDescription (PangoFontDescription* font) {
OS.gtk_widget_modify_font (handle, font);
}
@@ -3482,22 +3521,22 @@
*/
public void setForeground (Color color) {
checkWidget();
- if (((state & FOREGROUND) == 0) && color == null) return;
- GdkColor gdkColor = null;
- if (color != null) {
+ if (((state & FOREGROUND) is 0) && color is null) return;
+ GdkColor* gdkColor = null;
+ if (color !is null) {
if (color.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
gdkColor = color.handle;
}
- boolean set = false;
- if (gdkColor == null) {
- int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
- set = (OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL) & OS.GTK_RC_FG) != 0;
+ bool set = false;
+ if (gdkColor is null) {
+ auto style = OS.gtk_widget_get_modifier_style (handle);
+ set = (OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL) & OS.GTK_RC_FG) !is 0;
} else {
- GdkColor oldColor = getForegroundColor ();
- set = oldColor.pixel != gdkColor.pixel;
+ GdkColor* oldColor = getForegroundColor ();
+ set = oldColor.pixel !is gdkColor.pixel;
}
if (set) {
- if (color == null) {
+ if (color is null) {
state &= ~FOREGROUND;
} else {
state |= FOREGROUND;
@@ -3506,19 +3545,20 @@
}
}
-void setForegroundColor (GdkColor color) {
+alias Widget.setForegroundColor setForegroundColor;
+void setForegroundColor (GdkColor* color) {
setForegroundColor (handle, color);
}
void setInitialBounds () {
- if ((state & ZERO_WIDTH) != 0 && (state & ZERO_HEIGHT) != 0) {
+ if ((state & ZERO_WIDTH) !is 0 && (state & ZERO_HEIGHT) !is 0) {
/*
* Feature in GTK. On creation, each widget's allocation is
* initialized to a position of (-1, -1) until the widget is
* first sized. The fix is to set the value to (0, 0) as
* expected by SWT.
*/
- int /*long*/ topHandle = topHandle ();
+ auto topHandle = topHandle ();
OS.GTK_WIDGET_SET_X (topHandle, 0);
OS.GTK_WIDGET_SET_Y (topHandle, 0);
} else {
@@ -3554,11 +3594,11 @@
*/
public void setMenu (Menu menu) {
checkWidget();
- if (menu != null) {
- if ((menu.style & SWT.POP_UP) == 0) {
+ if (menu !is null) {
+ if ((menu.style & SWT.POP_UP) is 0) {
error (SWT.ERROR_MENU_NOT_POP_UP);
}
- if (menu.parent != menuShell ()) {
+ if (menu.parent !is menuShell ()) {
error (SWT.ERROR_INVALID_PARENT);
}
}
@@ -3566,9 +3606,9 @@
}
void setOrientation () {
- if ((style & SWT.RIGHT_TO_LEFT) != 0) {
- if (handle != 0) OS.gtk_widget_set_direction (handle, OS.GTK_TEXT_DIR_RTL);
- if (fixedHandle != 0) OS.gtk_widget_set_direction (fixedHandle, OS.GTK_TEXT_DIR_RTL);
+ if ((style & SWT.RIGHT_TO_LEFT) !is 0) {
+ if (handle !is null) OS.gtk_widget_set_direction (handle, cast(GtkTextDirection)OS.GTK_TEXT_DIR_RTL);
+ if (fixedHandle !is null) OS.gtk_widget_set_direction (fixedHandle, cast(GtkTextDirection)OS.GTK_TEXT_DIR_RTL);
}
}
@@ -3589,27 +3629,27 @@
* ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*/
-public boolean setParent (Composite parent) {
+public bool setParent (Composite parent) {
checkWidget ();
- if (parent == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ if (parent is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
if (parent.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- if (this.parent == parent) return true;
+ if (this.parent is parent) return true;
if (!isReparentable ()) return false;
releaseParent ();
Shell newShell = parent.getShell (), oldShell = getShell ();
Decorations newDecorations = parent.menuShell (), oldDecorations = menuShell ();
Menu [] menus = oldShell.findMenus (this);
- if (oldShell != newShell || oldDecorations != newDecorations) {
+ if (oldShell !is newShell || oldDecorations !is newDecorations) {
fixChildren (newShell, oldShell, newDecorations, oldDecorations, menus);
newDecorations.fixAccelGroup ();
oldDecorations.fixAccelGroup ();
}
- int /*long*/ topHandle = topHandle ();
- int /*long*/ newParent = parent.parentingHandle();
+ auto topHandle = topHandle ();
+ auto newParent = parent.parentingHandle();
int x = OS.GTK_WIDGET_X (topHandle);
int y = OS.GTK_WIDGET_Y (topHandle);
OS.gtk_widget_reparent (topHandle, newParent);
- OS.gtk_fixed_move (newParent, topHandle, x, y);
+ OS.gtk_fixed_move (cast(GtkFixed*)newParent, topHandle, x, y);
this.parent = parent;
setZOrder (null, false, true);
return true;
@@ -3617,13 +3657,13 @@
void setParentBackground () {
setBackgroundColor (handle, null);
- if (fixedHandle != 0) setBackgroundColor (fixedHandle, null);
+ if (fixedHandle !is null) setBackgroundColor (fixedHandle, null);
}
-void setParentWindow (int /*long*/ widget) {
+void setParentWindow (GtkWidget* widget) {
}
-boolean setRadioSelection (boolean value) {
+bool setRadioSelection (bool value) {
return false;
}
@@ -3647,41 +3687,41 @@
* ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*
- * @see #redraw(int, int, int, int, boolean)
+ * @see #redraw(int, int, int, int, bool)
* @see #update()
*/
-public void setRedraw (boolean redraw) {
+public void setRedraw (bool redraw) {
checkWidget();
if (redraw) {
- if (--drawCount == 0) {
- if (redrawWindow != 0) {
- int /*long*/ window = paintWindow ();
+ if (--drawCount is 0) {
+ if (redrawWindow !is null) {
+ auto window = paintWindow ();
/* Explicitly hiding the window avoids flicker on GTK+ >= 2.6 */
OS.gdk_window_hide (redrawWindow);
OS.gdk_window_destroy (redrawWindow);
- OS.gdk_window_set_events (window, OS.gtk_widget_get_events (paintHandle ()));
- redrawWindow = 0;
+ OS.gdk_window_set_events (window, cast(GdkEventMask)OS.gtk_widget_get_events (paintHandle ()));
+ redrawWindow = null;
}
}
} else {
- if (drawCount++ == 0) {
- if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) != 0) {
- int /*long*/ window = paintWindow ();
+ if (drawCount++ is 0) {
+ if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) !is 0) {
+ auto window = paintWindow ();
Rectangle rect = getBounds ();
- GdkWindowAttr attributes = new GdkWindowAttr ();
+ GdkWindowAttr* attributes = new GdkWindowAttr ();
attributes.width = rect.width;
attributes.height = rect.height;
attributes.event_mask = OS.GDK_EXPOSURE_MASK;
attributes.window_type = OS.GDK_WINDOW_CHILD;
redrawWindow = OS.gdk_window_new (window, attributes, 0);
- if (redrawWindow != 0) {
+ if (redrawWindow !is null) {
int mouseMask = OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK |
OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK |
OS.GDK_POINTER_MOTION_MASK | OS.GDK_POINTER_MOTION_HINT_MASK |
OS.GDK_BUTTON_MOTION_MASK | OS.GDK_BUTTON1_MOTION_MASK |
OS.GDK_BUTTON2_MOTION_MASK | OS.GDK_BUTTON3_MOTION_MASK;
- OS.gdk_window_set_events (window, OS.gdk_window_get_events (window) & ~mouseMask);
- OS.gdk_window_set_back_pixmap (redrawWindow, 0, false);
+ OS.gdk_window_set_events (window, cast(GdkEventMask)(OS.gdk_window_get_events (window) & ~mouseMask));
+ OS.gdk_window_set_back_pixmap (redrawWindow, null, false);
OS.gdk_window_show (redrawWindow);
}
}
@@ -3689,10 +3729,10 @@
}
}
-boolean setTabGroupFocus (boolean next) {
+bool setTabGroupFocus (bool next) {
return setTabItemFocus (next);
}
-boolean setTabItemFocus (boolean next) {
+bool setTabItemFocus (bool next) {
if (!isShowing ()) return false;
return forceFocus ();
}
@@ -3701,20 +3741,20 @@
* Sets the receiver's tool tip text to the argument, which
* may be null indicating that no tool tip text should be shown.
*
- * @param string the new tool tip text (or null)
+ * @param str the new tool tip text (or null)
*
* @exception SWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*/
-public void setToolTipText (String string) {
+public void setToolTipText (char[] str) {
checkWidget();
- setToolTipText (_getShell (), string);
- toolTipText = string;
+ setToolTipText (_getShell (), str);
+ toolTipText = str;
}
-void setToolTipText (Shell shell, String newString) {
+void setToolTipText (Shell shell, char[] newString) {
shell.setToolTipText (eventHandle (), newString);
}
@@ -3734,10 +3774,10 @@
* ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*/
-public void setVisible (boolean visible) {
+public void setVisible (bool visible) {
checkWidget();
- if (((state & HIDDEN) == 0) == visible) return;
- int /*long*/ topHandle = topHandle();
+ if (((state & HIDDEN) is 0) is visible) return;
+ auto topHandle = topHandle();
if (visible) {
/*
* It is possible (but unlikely), that application
@@ -3747,8 +3787,8 @@
sendEvent (SWT.Show);
if (isDisposed ()) return;
state &= ~HIDDEN;
- if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) == 0) {
- if (enableWindow != 0) OS.gdk_window_show_unraised (enableWindow);
+ if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) is 0) {
+ if (enableWindow !is null) OS.gdk_window_show_unraised (enableWindow);
OS.gtk_widget_show (topHandle);
}
} else {
@@ -3762,13 +3802,13 @@
* temporarily clear and set the GTK_VISIBLE flag.
*/
Control control = null;
- boolean fixFocus = false;
- if (display.focusEvent != SWT.FocusOut) {
+ bool fixFocus_ = false;
+ if (display.focusEvent !is SWT.FocusOut) {
control = display.getFocusControl ();
- fixFocus = isFocusAncestor (control);
+ fixFocus_ = isFocusAncestor (control);
}
state |= HIDDEN;
- if (fixFocus) {
+ if (fixFocus_) {
OS.GTK_WIDGET_UNSET_FLAGS (topHandle, OS.GTK_VISIBLE);
fixFocus (control);
if (isDisposed ()) return;
@@ -3776,28 +3816,28 @@
}
OS.gtk_widget_hide (topHandle);
if (isDisposed ()) return;
- if (enableWindow != 0) OS.gdk_window_hide (enableWindow);
+ if (enableWindow !is null) OS.gdk_window_hide (enableWindow);
sendEvent (SWT.Hide);
}
}
-void setZOrder (Control sibling, boolean above, boolean fixRelations) {
+void setZOrder (Control sibling, bool above, bool fixRelations) {
setZOrder (sibling, above, fixRelations, true);
}
-void setZOrder (Control sibling, boolean above, boolean fixRelations, boolean fixChildren) {
+void setZOrder (Control sibling, bool above, bool fixRelations, bool fixChildren) {
int index = 0, siblingIndex = 0, oldNextIndex = -1;
Control[] children = null;
if (fixRelations) {
/* determine the receiver's and sibling's indexes in the parent */
children = parent._getChildren ();
while (index < children.length) {
- if (children [index] == this) break;
+ if (children [index] is this) break;
index++;
}
- if (sibling != null) {
+ if (sibling !is null) {
while (siblingIndex < children.length) {
- if (children [siblingIndex] == sibling) break;
+ if (children [siblingIndex] is sibling) break;
siblingIndex++;
}
}
@@ -3807,7 +3847,7 @@
oldNextIndex = index + 1;
children [oldNextIndex].removeRelation ();
}
- if (sibling != null) {
+ if (sibling !is null) {
if (above) {
sibling.removeRelation ();
} else {
@@ -3818,35 +3858,35 @@
}
}
- int /*long*/ topHandle = topHandle ();
- int /*long*/ siblingHandle = sibling != null ? sibling.topHandle () : 0;
- int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle);
- if (window != 0) {
- int /*long*/ siblingWindow = 0;
- if (sibling != null) {
- if (above && sibling.enableWindow != 0) {
+ auto topHandle = topHandle ();
+ auto siblingHandle = sibling !is null ? sibling.topHandle () : null;
+ auto window = OS.GTK_WIDGET_WINDOW (topHandle);
+ if (window !is null) {
+ GdkWindow* siblingWindow;
+ if (sibling !is null) {
+ if (above && sibling.enableWindow !is null) {
siblingWindow = enableWindow;
} else {
siblingWindow = OS.GTK_WIDGET_WINDOW (siblingHandle);
}
}
- int /*long*/ redrawWindow = fixChildren ? parent.redrawWindow : 0;
- if (!OS.GDK_WINDOWING_X11 () || (siblingWindow == 0 && (!above || redrawWindow == 0))) {
+ auto redrawWindow = fixChildren ? parent.redrawWindow : null;
+ if (!OS.GDK_WINDOWING_X11 () || (siblingWindow is null && (!above || redrawWindow is null))) {
if (above) {
OS.gdk_window_raise (window);
- if (redrawWindow != 0) OS.gdk_window_raise (redrawWindow);
- if (enableWindow != 0) OS.gdk_window_raise (enableWindow);
+ if (redrawWindow !is null) OS.gdk_window_raise (redrawWindow);
+ if (enableWindow !is null) OS.gdk_window_raise (enableWindow);
} else {
- if (enableWindow != 0) OS.gdk_window_lower (enableWindow);
+ if (enableWindow !is null) OS.gdk_window_lower (enableWindow);
OS.gdk_window_lower (window);
}
} else {
- XWindowChanges changes = new XWindowChanges ();
- changes.sibling = OS.gdk_x11_drawable_get_xid (siblingWindow != 0 ? siblingWindow : redrawWindow);
+ XWindowChanges* changes = new XWindowChanges ();
+ changes.sibling = OS.gdk_x11_drawable_get_xid (cast(GdkDrawable*)(siblingWindow !is null ? siblingWindow : redrawWindow));
changes.stack_mode = above ? OS.Above : OS.Below;
- if (redrawWindow != 0 && siblingWindow == 0) changes.stack_mode = OS.Below;
- int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window);
- int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (window);
+ if (redrawWindow !is null && siblingWindow is null) changes.stack_mode = OS.Below;
+ auto xDisplay = OS.gdk_x11_drawable_get_xdisplay (cast(GdkDrawable*)window);
+ auto xWindow = OS.gdk_x11_drawable_get_xid (cast(GdkDrawable*)window);
int xScreen = OS.XDefaultScreen (xDisplay);
int flags = OS.CWStackMode | OS.CWSibling;
/*
@@ -3859,10 +3899,10 @@
* behaves the same as XConfigureWindow ().
*/
OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes);
- if (enableWindow != 0) {
- changes.sibling = OS.gdk_x11_drawable_get_xid (window);
+ if (enableWindow !is null) {
+ changes.sibling = OS.gdk_x11_drawable_get_xid (cast(GdkDrawable*)window);
changes.stack_mode = OS.Above;
- xWindow = OS.gdk_x11_drawable_get_xid (enableWindow);
+ xWindow = OS.gdk_x11_drawable_get_xid (cast(GdkDrawable*)enableWindow);
OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes);
}
}
@@ -3879,7 +3919,7 @@
if (fixRelations) {
/* determine the receiver's new index in the parent */
- if (sibling != null) {
+ if (sibling !is null) {
if (above) {
index = siblingIndex - (index < siblingIndex ? 1 : 0);
} else {
@@ -3901,10 +3941,10 @@
if (index + 1 < children.length) {
addRelation (children [index + 1]);
}
- if (oldNextIndex != -1) {
+ if (oldNextIndex !is -1) {
if (oldNextIndex <= index) oldNextIndex--;
/* the last two conditions below ensure that duplicate relations are not hooked */
- if (0 < oldNextIndex && oldNextIndex != index && oldNextIndex != index + 1) {
+ if (0 < oldNextIndex && oldNextIndex !is index && oldNextIndex !is index + 1) {
children [oldNextIndex - 1].addRelation (children [oldNextIndex]);
}
}
@@ -3912,24 +3952,24 @@
}
void setWidgetBackground () {
- if (fixedHandle != 0) {
- int /*long*/ style = OS.gtk_widget_get_modifier_style (fixedHandle);
+ if (fixedHandle !is null) {
+ auto style = OS.gtk_widget_get_modifier_style (fixedHandle);
OS.gtk_widget_modify_style (fixedHandle, style);
}
- int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
+ auto style = OS.gtk_widget_get_modifier_style (handle);
OS.gtk_widget_modify_style (handle, style);
}
-boolean showMenu (int x, int y) {
+bool showMenu (int x, int y) {
Event event = new Event ();
event.x = x;
event.y = y;
sendEvent (SWT.MenuDetect, event);
if (event.doit) {
- if (menu != null && !menu.isDisposed ()) {
- boolean hooksKeys = hooks (SWT.KeyDown) || hooks (SWT.KeyUp);
- menu.createIMMenu (hooksKeys ? imHandle() : 0);
- if (event.x != x || event.y != y) {
+ if (menu !is null && !menu.isDisposed ()) {
+ bool hooksKeys = hooks (SWT.KeyDown) || hooks (SWT.KeyUp);
+ menu.createIMMenu (hooksKeys ? imHandle() : null);
+ if (event.x !is x || event.y !is y) {
menu.setLocation (event.x, event.y);
}
menu.setVisible (true);
@@ -3942,15 +3982,15 @@
void showWidget () {
// Comment this line to disable zero-sized widgets
state |= ZERO_WIDTH | ZERO_HEIGHT;
- int /*long*/ topHandle = topHandle ();
- int /*long*/ parentHandle = parent.parentingHandle ();
+ auto topHandle = topHandle ();
+ auto parentHandle = parent.parentingHandle ();
parent.setParentWindow (topHandle);
- OS.gtk_container_add (parentHandle, topHandle);
- if (handle != 0 && handle != topHandle) OS.gtk_widget_show (handle);
- if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) == 0) {
- if (fixedHandle != 0) OS.gtk_widget_show (fixedHandle);
+ OS.gtk_container_add (cast(GtkContainer*)parentHandle, topHandle);
+ if (handle !is null && handle !is topHandle) OS.gtk_widget_show (handle);
+ if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) is 0) {
+ if (fixedHandle !is null) OS.gtk_widget_show (fixedHandle);
}
- if (fixedHandle != 0) fixStyle (fixedHandle);
+ if (fixedHandle !is null) fixStyle (fixedHandle);
}
void sort (int [] items) {
@@ -3984,7 +4024,7 @@
* ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*/
-public boolean traverse (int traversal) {
+public bool traverse (int traversal) {
checkWidget ();
Event event = new Event ();
event.doit = true;
@@ -3992,23 +4032,23 @@
return traverse (event);
}
-boolean translateMnemonic (Event event, Control control) {
- if (control == this) return false;
+bool translateMnemonic (Event event, Control control) {
+ if (control is this) return false;
if (!isVisible () || !isEnabled ()) return false;
- event.doit = this == display.mnemonicControl || mnemonicMatch (event.character);
+ event.doit = this is display.mnemonicControl || mnemonicMatch (event.character);
return traverse (event);
}
-boolean translateMnemonic (int keyval, GdkEventKey gdkEvent) {
+bool translateMnemonic (int keyval, GdkEventKey* gdkEvent) {
int key = OS.gdk_keyval_to_unicode (keyval);
if (key < 0x20) return false;
- if (gdkEvent.state == 0) {
+ if (gdkEvent.state is 0) {
int code = traversalCode (keyval, gdkEvent);
- if ((code & SWT.TRAVERSE_MNEMONIC) == 0) return false;
+ if ((code & SWT.TRAVERSE_MNEMONIC) is 0) return false;
} else {
Shell shell = _getShell ();
int mask = OS.GDK_CONTROL_MASK | OS.GDK_SHIFT_MASK | OS.GDK_MOD1_MASK;
- if ((gdkEvent.state & mask) != OS.gtk_window_get_mnemonic_modifier (shell.shellHandle)) return false;
+ if ((gdkEvent.state & mask) !is OS.gtk_window_get_mnemonic_modifier (cast(GtkWindow*)shell.shellHandle)) return false;
}
Decorations shell = menuShell ();
if (shell.isVisible () && shell.isEnabled ()) {
@@ -4021,11 +4061,11 @@
return false;
}
-boolean translateTraversal (GdkEventKey keyEvent) {
+bool translateTraversal (GdkEventKey* keyEvent) {
int detail = SWT.TRAVERSE_NONE;
int key = keyEvent.keyval;
int code = traversalCode (key, keyEvent);
- boolean all = false;
+ bool all = false;
switch (key) {
case OS.GDK_Escape: {
all = true;
@@ -4040,7 +4080,7 @@
}
case OS.GDK_ISO_Left_Tab:
case OS.GDK_Tab: {
- boolean next = (keyEvent.state & OS.GDK_SHIFT_MASK) == 0;
+ bool next = (keyEvent.state & OS.GDK_SHIFT_MASK) is 0;
detail = next ? SWT.TRAVERSE_TAB_NEXT : SWT.TRAVERSE_TAB_PREVIOUS;
break;
}
@@ -4048,22 +4088,22 @@
case OS.GDK_Left:
case OS.GDK_Down:
case OS.GDK_Right: {
- boolean next = key == OS.GDK_Down || key == OS.GDK_Right;
+ bool next = key is OS.GDK_Down || key is OS.GDK_Right;
detail = next ? SWT.TRAVERSE_ARROW_NEXT : SWT.TRAVERSE_ARROW_PREVIOUS;
break;
}
case OS.GDK_Page_Up:
case OS.GDK_Page_Down: {
all = true;
- if ((keyEvent.state & OS.GDK_CONTROL_MASK) == 0) return false;
- detail = key == OS.GDK_Page_Down ? SWT.TRAVERSE_PAGE_NEXT : SWT.TRAVERSE_PAGE_PREVIOUS;
+ if ((keyEvent.state & OS.GDK_CONTROL_MASK) is 0) return false;
+ detail = key is OS.GDK_Page_Down ? SWT.TRAVERSE_PAGE_NEXT : SWT.TRAVERSE_PAGE_PREVIOUS;
break;
}
default:
return false;
}
Event event = new Event ();
- event.doit = (code & detail) != 0;
+ event.doit = (code & detail) !is 0;
event.detail = detail;
event.time = keyEvent.time;
if (!setKeyState (event, keyEvent)) return false;
@@ -4072,20 +4112,20 @@
do {
if (control.traverse (event)) return true;
if (!event.doit && control.hooks (SWT.Traverse)) return false;
- if (control == shell) return false;
+ if (control is shell) return false;
control = control.parent;
- } while (all && control != null);
+ } while (all && control !is null);
return false;
}
-int traversalCode (int key, GdkEventKey event) {
+int traversalCode (int key, GdkEventKey* event) {
int code = SWT.TRAVERSE_RETURN | SWT.TRAVERSE_TAB_NEXT | SWT.TRAVERSE_TAB_PREVIOUS | SWT.TRAVERSE_PAGE_NEXT | SWT.TRAVERSE_PAGE_PREVIOUS;
Shell shell = getShell ();
- if (shell.parent != null) code |= SWT.TRAVERSE_ESCAPE;
+ if (shell.parent !is null) code |= SWT.TRAVERSE_ESCAPE;
return code;
}
-boolean traverse (Event event) {
+bool traverse (Event event) {
/*
* It is possible (but unlikely), that application
* code could have disposed the widget in the traverse
@@ -4110,18 +4150,18 @@
return false;
}
-boolean traverseEscape () {
+bool traverseEscape () {
return false;
}
-boolean traverseGroup (boolean next) {
+bool traverseGroup (bool next) {
Control root = computeTabRoot ();
Control group = computeTabGroup ();
Control [] list = root.computeTabList ();
int length = list.length;
int index = 0;
while (index < length) {
- if (list [index] == group) break;
+ if (list [index] is group) break;
index++;
}
/*
@@ -4130,9 +4170,9 @@
* or out events. Ensure that a disposed widget is
* not accessed.
*/
- if (index == length) return false;
+ if (index is length) return false;
int start = index, offset = (next) ? 1 : -1;
- while ((index = ((index + offset + length) % length)) != start) {
+ while ((index = ((index + offset + length) % length)) !is start) {
Control control = list [index];
if (!control.isDisposed () && control.setTabGroupFocus (next)) {
return true;
@@ -4142,12 +4182,12 @@
return group.setTabGroupFocus (next);
}
-boolean traverseItem (boolean next) {
+bool traverseItem (bool next) {
Control [] children = parent._getChildren ();
int length = children.length;
int index = 0;
while (index < length) {
- if (children [index] == this) break;
+ if (children [index] is this) break;
index++;
}
/*
@@ -4156,9 +4196,9 @@
* or out events. Ensure that a disposed widget is
* not accessed.
*/
- if (index == length) return false;
+ if (index is length) return false;
int start = index, offset = (next) ? 1 : -1;
- while ((index = (index + offset + length) % length) != start) {
+ while ((index = (index + offset + length) % length) !is start) {
Control child = children [index];
if (!child.isDisposed () && child.isTabItem ()) {
if (child.setTabItemFocus (next)) return true;
@@ -4167,15 +4207,15 @@
return false;
}
-boolean traverseReturn () {
+bool traverseReturn () {
return false;
}
-boolean traversePage (boolean next) {
+bool traversePage (bool next) {
return false;
}
-boolean traverseMnemonic (char key) {
+bool traverseMnemonic (char key) {
return mnemonicHit (key);
}
@@ -4194,7 +4234,7 @@
*
*
* @see #redraw()
- * @see #redraw(int, int, int, int, boolean)
+ * @see #redraw(int, int, int, int, bool)
* @see PaintListener
* @see SWT#Paint
*/
@@ -4203,11 +4243,11 @@
update (false, true);
}
-void update (boolean all, boolean flush) {
+void update (bool all, bool flush) {
// checkWidget();
if (!OS.GTK_WIDGET_VISIBLE (topHandle ())) return;
- if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return;
- int /*long*/ window = paintWindow ();
+ if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) is 0) return;
+ auto window = paintWindow ();
if (flush) display.flushExposes (window, all);
OS.gdk_window_process_updates (window, all);
OS.gdk_flush ();
@@ -4216,34 +4256,34 @@
void updateBackgroundMode () {
int oldState = state & PARENT_BACKGROUND;
checkBackground ();
- if (oldState != (state & PARENT_BACKGROUND)) {
+ if (oldState !is (state & PARENT_BACKGROUND)) {
setBackground ();
}
}
-void updateLayout (boolean all) {
+void updateLayout (bool all) {
/* Do nothing */
}
-int /*long*/ windowProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
- switch ((int)/*64*/user_data) {
+int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) {
+ switch (cast(int)/*64*/user_data) {
case EXPOSE_EVENT_INVERSE: {
- if ((OS.GTK_VERSION < OS.VERSION (2, 8, 0)) && ((state & OBSCURED) == 0)) {
+ if ((OS.GTK_VERSION < OS.buildVERSION (2, 8, 0)) && ((state & OBSCURED) is 0)) {
Control control = findBackgroundControl ();
- if (control != null && control.backgroundImage != null) {
- GdkEventExpose gdkEvent = new GdkEventExpose ();
- OS.memmove (gdkEvent, arg0, GdkEventExpose.sizeof);
- int /*long*/ paintWindow = paintWindow();
- int /*long*/ window = gdkEvent.window;
- if (window != paintWindow) break;
- int /*long*/ gdkGC = OS.gdk_gc_new (window);
+ if (control !is null && control.backgroundImage !is null) {
+ GdkEventExpose* gdkEvent = new GdkEventExpose ();
+ memmove (gdkEvent, cast(void*)arg0, GdkEventExpose.sizeof);
+ auto paintWindow = paintWindow();
+ auto window = gdkEvent.window;
+ if (window !is paintWindow) break;
+ auto gdkGC = OS.gdk_gc_new (cast(GdkDrawable*)window);
OS.gdk_gc_set_clip_region (gdkGC, gdkEvent.region);
- int[] dest_x = new int[1], dest_y = new int[1];
- OS.gtk_widget_translate_coordinates (paintHandle (), control.paintHandle (), 0, 0, dest_x, dest_y);
- OS.gdk_gc_set_fill (gdkGC, OS.GDK_TILED);
- OS.gdk_gc_set_ts_origin (gdkGC, -dest_x [0], -dest_y [0]);
- OS.gdk_gc_set_tile (gdkGC, control.backgroundImage.pixmap);
- OS.gdk_draw_rectangle (window, gdkGC, 1, gdkEvent.area_x, gdkEvent.area_y, gdkEvent.area_width, gdkEvent.area_height);
+ int dest_x, dest_y;
+ OS.gtk_widget_translate_coordinates (paintHandle (), control.paintHandle (), 0, 0, &dest_x, &dest_y);
+ OS.gdk_gc_set_fill (gdkGC, cast(GdkFill)OS.GDK_TILED);
+ OS.gdk_gc_set_ts_origin (gdkGC, -dest_x, -dest_y);
+ OS.gdk_gc_set_tile (gdkGC, cast(GdkPixmap*)control.backgroundImage.pixmap);
+ OS.gdk_draw_rectangle (cast(GdkDrawable*)window, gdkGC, 1, gdkEvent.area.x, gdkEvent.area.y, gdkEvent.area.width, gdkEvent.area.height);
OS.g_object_unref (gdkGC);
}
}
@@ -4253,4 +4293,3 @@
return super.windowProc (handle, arg0, user_data);
}
}
-+++/
\ No newline at end of file
diff -r ffffd0cd3b59 -r 5e5d1c9cffdb dwt/widgets/Decorations.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/widgets/Decorations.d Wed Jan 09 06:17:26 2008 +0100
@@ -0,0 +1,760 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module dwt.widgets.Decorations;
+
+import dwt.widgets.Control;
+import dwt.widgets.Menu;
+import dwt.widgets.Composite;
+
+class Decorations : Composite {
+ void fixDecorations (Decorations newDecorations, Control control, Menu [] menus);
+ void fixAccelGroup () ;
+}
+/+
+import dwt.*;
+import dwt.internal.gtk.*;
+import dwt.graphics.*;
+
+/**
+ * Instances of this class provide the appearance and
+ * behavior of Shells
, but are not top
+ * level shells or dialogs. Class Shell
+ * shares a significant amount of code with this class,
+ * and is a subclass.
+ *
+ * IMPORTANT: This class was intended to be abstract and
+ * should never be referenced or instantiated.
+ * Instead, the class Shell
should be used.
+ *
+ *
+ * Instances are always displayed in one of the maximized,
+ * minimized or normal states:
+ *
+ * -
+ * When an instance is marked as maximized, the
+ * window manager will typically resize it to fill the
+ * entire visible area of the display, and the instance
+ * is usually put in a state where it can not be resized
+ * (even if it has style
RESIZE
) until it is
+ * no longer maximized.
+ * -
+ * When an instance is in the normal state (neither
+ * maximized or minimized), its appearance is controlled by
+ * the style constants which were specified when it was created
+ * and the restrictions of the window manager (see below).
+ *
-
+ * When an instance has been marked as minimized,
+ * its contents (client area) will usually not be visible,
+ * and depending on the window manager, it may be
+ * "iconified" (that is, replaced on the desktop by a small
+ * simplified representation of itself), relocated to a
+ * distinguished area of the screen, or hidden. Combinations
+ * of these changes are also possible.
+ *
+ *
+ *
+ * Note: The styles supported by this class must be treated
+ * as HINTs, since the window manager for the
+ * desktop on which the instance is visible has ultimate
+ * control over the appearance and behavior of decorations.
+ * For example, some window managers only support resizable
+ * windows and will always assume the RESIZE style, even if
+ * it is not set.
+ *
+ * - Styles:
+ * - BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE, ON_TOP, TOOL
+ * - Events:
+ * - (none)
+ *
+ * Class SWT
provides two "convenience constants"
+ * for the most commonly required style combinations:
+ *
+ * SHELL_TRIM
+ * -
+ * the result of combining the constants which are required
+ * to produce a typical application top level shell: (that
+ * is,
CLOSE | TITLE | MIN | MAX | RESIZE
)
+ *
+ * DIALOG_TRIM
+ * -
+ * the result of combining the constants which are required
+ * to produce a typical application dialog shell: (that
+ * is,
TITLE | CLOSE | BORDER
)
+ *
+ *
+ *
+ * IMPORTANT: This class is intended to be subclassed only
+ * within the SWT implementation.
+ *
+ *
+ * @see #getMinimized
+ * @see #getMaximized
+ * @see Shell
+ * @see SWT
+ */
+public class Decorations extends Canvas {
+ String text;
+ Image image;
+ Image [] images = new Image [0];
+ boolean minimized, maximized;
+ Menu menuBar;
+ Menu [] menus;
+ Control savedFocus;
+ Button defaultButton, saveDefault;
+ int /*long*/ accelGroup, vboxHandle;
+
+Decorations () {
+ /* Do nothing */
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ *
+ * The style value is either one of the style constants defined in
+ * class SWT
which is applicable to instances of this
+ * class, or must be built by bitwise OR'ing together
+ * (that is, using the int
"|" operator) two or more
+ * of those SWT
style constants. The class description
+ * lists the style constants that are applicable to the class.
+ * Style bits are also inherited from superclasses.
+ *
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException
+ * - ERROR_NULL_ARGUMENT - if the parent is null
+ *
+ * @exception SWTException
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
+ * - ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
+ *
+ *
+ * @see SWT#BORDER
+ * @see SWT#CLOSE
+ * @see SWT#MIN
+ * @see SWT#MAX
+ * @see SWT#RESIZE
+ * @see SWT#TITLE
+ * @see SWT#NO_TRIM
+ * @see SWT#SHELL_TRIM
+ * @see SWT#DIALOG_TRIM
+ * @see SWT#ON_TOP
+ * @see SWT#TOOL
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Decorations (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+static int checkStyle (int style) {
+ if ((style & SWT.NO_TRIM) != 0) {
+ style &= ~(SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.MAX | SWT.RESIZE | SWT.BORDER);
+ }
+ if ((style & (SWT.MENU | SWT.MIN | SWT.MAX | SWT.CLOSE)) != 0) {
+ style |= SWT.TITLE;
+ }
+ return style;
+}
+
+protected void checkSubclass () {
+ if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
+}
+
+void _setImages (Image [] images) {
+ if (images != null && images.length > 1) {
+ Image [] bestImages = new Image [images.length];
+ System.arraycopy (images, 0, bestImages, 0, images.length);
+ sort (bestImages);
+ images = bestImages;
+ }
+ int /*long*/ pixbufs = 0;
+ if (images != null) {
+ for (int i = 0; i < images.length; i++) {
+ Image image = images [i];
+ int /*long*/ pixbuf = Display.createPixbuf (image);
+ pixbufs = OS.g_list_append (pixbufs, pixbuf);
+ }
+ }
+ OS.gtk_window_set_icon_list (topHandle (), pixbufs);
+ int /*long*/ [] data = new int /*long*/ [1];
+ int /*long*/ temp = pixbufs;
+ while (temp != 0) {
+ OS.memmove (data, temp, OS.PTR_SIZEOF);
+ OS.g_object_unref (data [0]);
+ temp = OS.g_list_next (temp);
+ }
+ if (pixbufs != 0) OS.g_list_free (pixbufs);
+}
+
+void addMenu (Menu menu) {
+ if (menus == null) menus = new Menu [4];
+ for (int i=0; i data2.width || data1.height > data2.height ? -1 : 1;
+}
+
+Control computeTabGroup () {
+ return this;
+}
+
+Control computeTabRoot () {
+ return this;
+}
+
+void createAccelGroup () {
+ if (accelGroup != 0) return;
+ accelGroup = OS.gtk_accel_group_new ();
+ if (accelGroup == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+ //FIXME - what should we do for Decorations
+ int /*long*/ shellHandle = topHandle ();
+ OS.gtk_window_add_accel_group (shellHandle, accelGroup);
+}
+
+void createWidget (int index) {
+ super.createWidget (index);
+ text = "";
+}
+
+void destroyAccelGroup () {
+ if (accelGroup == 0) return;
+ int /*long*/ shellHandle = topHandle ();
+ OS.gtk_window_remove_accel_group (shellHandle, accelGroup);
+ //TEMPORARY CODE
+// OS.g_object_unref (accelGroup);
+ accelGroup = 0;
+}
+
+void fixAccelGroup () {
+ if (menuBar == null) return;
+ destroyAccelGroup ();
+ createAccelGroup ();
+ menuBar.addAccelerators (accelGroup);
+}
+
+void fixDecorations (Decorations newDecorations, Control control, Menu [] menus) {
+ if (this == newDecorations) return;
+ if (control == savedFocus) savedFocus = null;
+ if (control == defaultButton) defaultButton = null;
+ if (control == saveDefault) saveDefault = null;
+ if (menus == null) return;
+ Menu menu = control.menu;
+ if (menu != null) {
+ int index = 0;
+ while (index
+ * ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @see #setDefaultButton(Button)
+ */
+public Button getDefaultButton () {
+ checkWidget();
+ return defaultButton != null ? defaultButton : saveDefault;
+}
+
+/**
+ * Returns the receiver's image if it had previously been
+ * set using setImage()
. The image is typically
+ * displayed by the window manager when the instance is
+ * marked as iconified, and may also be displayed somewhere
+ * in the trim when the instance is in normal or maximized
+ * states.
+ *
+ * Note: This method will return null if called before
+ * setImage()
is called. It does not provide
+ * access to a window manager provided, "default" image
+ * even if one exists.
+ *
+ *
+ * @return the image
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+public Image getImage () {
+ checkWidget ();
+ return image;
+}
+
+/**
+ * Returns the receiver's images if they had previously been
+ * set using setImages()
. Images are typically
+ * displayed by the window manager when the instance is
+ * marked as iconified, and may also be displayed somewhere
+ * in the trim when the instance is in normal or maximized
+ * states. Depending where the icon is displayed, the platform
+ * chooses the icon with the "best" attributes. It is expected
+ * that the array will contain the same icon rendered at different
+ * sizes, with different depth and transparency attributes.
+ *
+ *
+ * Note: This method will return an empty array if called before
+ * setImages()
is called. It does not provide
+ * access to a window manager provided, "default" image
+ * even if one exists.
+ *
+ *
+ * @return the images
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @since 3.0
+ */
+public Image [] getImages () {
+ checkWidget ();
+ if (images == null) return new Image [0];
+ Image [] result = new Image [images.length];
+ System.arraycopy (images, 0, result, 0, images.length);
+ return result;
+}
+
+/**
+ * Returns true
if the receiver is currently
+ * maximized, and false otherwise.
+ *
+ *
+ * @return the maximized state
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @see #setMaximized
+ */
+public boolean getMaximized () {
+ checkWidget();
+ return maximized;
+}
+
+/**
+ * Returns the receiver's menu bar if one had previously
+ * been set, otherwise returns null.
+ *
+ * @return the menu bar or null
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+public Menu getMenuBar () {
+ checkWidget();
+ return menuBar;
+}
+
+/**
+ * Returns true
if the receiver is currently
+ * minimized, and false otherwise.
+ *
+ *
+ * @return the minimized state
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @see #setMinimized
+ */
+public boolean getMinimized () {
+ checkWidget();
+ return minimized;
+}
+
+String getNameText () {
+ return getText ();
+}
+
+/**
+ * Returns the receiver's text, which is the string that the
+ * window manager will typically display as the receiver's
+ * title. If the text has not previously been set,
+ * returns an empty string.
+ *
+ * @return the text
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+public String getText () {
+ checkWidget();
+ return text;
+}
+
+public boolean isReparentable () {
+ checkWidget ();
+ return false;
+}
+
+boolean isTabGroup () {
+ return true;
+}
+
+boolean isTabItem () {
+ return false;
+}
+
+Decorations menuShell () {
+ return this;
+}
+
+void removeMenu (Menu menu) {
+ if (menus == null) return;
+ for (int i=0; isaved default button). If no default button had
+ * previously been set, or the saved default button was
+ * disposed, the receiver's default button will be set to
+ * null.
+ *
+ * The default button is the button that is selected when
+ * the receiver is active and the user presses ENTER.
+ *
+ *
+ * @param button the new default button
+ *
+ * @exception IllegalArgumentException
+ * - ERROR_INVALID_ARGUMENT - if the button has been disposed
+ * - ERROR_INVALID_PARENT - if the control is not in the same widget tree
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+public void setDefaultButton (Button button) {
+ checkWidget();
+ int /*long*/ buttonHandle = 0;
+ if (button != null) {
+ if (button.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
+ if (button.menuShell () != this) error (SWT.ERROR_INVALID_PARENT);
+ buttonHandle = button.handle;
+ }
+ saveDefault = defaultButton = button;
+ OS.gtk_window_set_default (topHandle (), buttonHandle);
+}
+
+/**
+ * Sets the receiver's image to the argument, which may
+ * be null. The image is typically displayed by the window
+ * manager when the instance is marked as iconified, and
+ * may also be displayed somewhere in the trim when the
+ * instance is in normal or maximized states.
+ *
+ * @param image the new image (or null)
+ *
+ * @exception IllegalArgumentException
+ * - ERROR_INVALID_ARGUMENT - if the image has been disposed
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+public void setImage (Image image) {
+ checkWidget ();
+ this.image = image;
+ _setImages (image != null ? new Image [] {image} : null);
+}
+
+/**
+ * Sets the receiver's images to the argument, which may
+ * be an empty array. Images are typically displayed by the
+ * window manager when the instance is marked as iconified,
+ * and may also be displayed somewhere in the trim when the
+ * instance is in normal or maximized states. Depending where
+ * the icon is displayed, the platform chooses the icon with
+ * the "best" attributes. It is expected that the array will
+ * contain the same icon rendered at different sizes, with
+ * different depth and transparency attributes.
+ *
+ * @param images the new image array
+ *
+ * @exception IllegalArgumentException
+ * - ERROR_NULL_ARGUMENT - if the array of images is null
+ * - ERROR_INVALID_ARGUMENT - if one of the images is null or has been disposed
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @since 3.0
+ */
+public void setImages (Image [] images) {
+ checkWidget ();
+ if (images == null) error (SWT.ERROR_INVALID_ARGUMENT);
+ for (int i = 0; i < images.length; i++) {
+ if (images [i] == null || images [i].isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
+ }
+ this.images = images;
+ _setImages (images);
+}
+
+/**
+ * Sets the maximized state of the receiver.
+ * If the argument is true
causes the receiver
+ * to switch to the maximized state, and if the argument is
+ * false
and the receiver was previously maximized,
+ * causes the receiver to switch back to either the minimized
+ * or normal states.
+ *
+ * Note: The result of intermixing calls to setMaximized(true)
+ * and setMinimized(true)
will vary by platform. Typically,
+ * the behavior will match the platform user's expectations, but not
+ * always. This should be avoided if possible.
+ *
+ *
+ * @param maximized the new maximized state
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @see #setMinimized
+ */
+public void setMaximized (boolean maximized) {
+ checkWidget();
+ this.maximized = maximized;
+}
+
+/**
+ * Sets the receiver's menu bar to the argument, which
+ * may be null.
+ *
+ * @param menu the new menu bar
+ *
+ * @exception IllegalArgumentException
+ * - ERROR_INVALID_ARGUMENT - if the menu has been disposed
+ * - ERROR_INVALID_PARENT - if the menu is not in the same widget tree
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+public void setMenuBar (Menu menu) {
+ checkWidget();
+ if (menuBar == menu) return;
+ if (menu != null) {
+ if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR);
+ if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT);
+ }
+ menuBar = menu;
+}
+
+/**
+ * Sets the minimized stated of the receiver.
+ * If the argument is true
causes the receiver
+ * to switch to the minimized state, and if the argument is
+ * false
and the receiver was previously minimized,
+ * causes the receiver to switch back to either the maximized
+ * or normal states.
+ *
+ * Note: The result of intermixing calls to setMaximized(true)
+ * and setMinimized(true)
will vary by platform. Typically,
+ * the behavior will match the platform user's expectations, but not
+ * always. This should be avoided if possible.
+ *
+ *
+ * @param minimized the new maximized state
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ *
+ * @see #setMaximized
+ */
+public void setMinimized (boolean minimized) {
+ checkWidget();
+ this.minimized = minimized;
+}
+
+void setSavedFocus (Control control) {
+ if (this == control) return;
+ savedFocus = control;
+}
+
+/**
+ * Sets the receiver's text, which is the string that the
+ * window manager will typically display as the receiver's
+ * title, to the argument, which must not be null.
+ *
+ * @param string the new text
+ *
+ * @exception IllegalArgumentException
+ * - ERROR_NULL_ARGUMENT - if the text is null
+ *
+ * @exception SWTException
+ * - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ * - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *
+ */
+public void setText (String string) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ text = string;
+}
+
+void sort (Image [] images) {
+ /* Shell Sort from K&R, pg 108 */
+ int length = images.length;
+ if (length <= 1) return;
+ ImageData [] datas = new ImageData [length];
+ for (int i = 0; i < length; i++) {
+ datas [i] = images [i].getImageData ();
+ }
+ for (int gap=length/2; gap>0; gap/=2) {
+ for (int i=gap; i=0; j-=gap) {
+ if (compare (datas [j], datas [j + gap]) >= 0) {
+ Image swap = images [j];
+ images [j] = images [j + gap];
+ images [j + gap] = swap;
+ ImageData swapData = datas [j];
+ datas [j] = datas [j + gap];
+ datas [j + gap] = swapData;
+ }
+ }
+ }
+ }
+}
+
+boolean traverseItem (boolean next) {
+ return false;
+}
+
+boolean traverseReturn () {
+ Button button = defaultButton != null ? defaultButton: saveDefault;
+ if (button == null || button.isDisposed ()) return false;
+ /*
+ * Bug in GTK. When a default button that is disabled is
+ * activated using the Enter key, GTK GP's. The fix is to
+ * detect this case and stop GTK from processing the Enter
+ * key.
+ */
+ if (!button.isVisible () || !button.isEnabled ()) return true;
+ int /*long*/ shellHandle = _getShell ().topHandle ();
+ return OS.gtk_window_activate_default (shellHandle);
+}
+
+}
++/
\ No newline at end of file
diff -r ffffd0cd3b59 -r 5e5d1c9cffdb dwt/widgets/Display.d
--- a/dwt/widgets/Display.d Wed Jan 09 03:05:22 2008 +0100
+++ b/dwt/widgets/Display.d Wed Jan 09 06:17:26 2008 +0100
@@ -202,8 +202,10 @@
/* Mouse hover */
int mouseHoverId;
- GObject* mouseHoverHandle;
- /* Menu position callback */
+ GtkWidget* mouseHoverHandle;
+ CallbackData mouseHoverProcCallbackData;
+
+ /* Menu position callback */
/* Tooltip size allocate callback */
@@ -227,7 +229,7 @@
CallbackData setDirectionCallbackData;
/* Get all children callback */
- CallbackData allChildrenCallbackData;
+ CallbackData allChildrenProcCallbackData;
GList* allChildren;
/* Settings callbacks */
@@ -601,20 +603,28 @@
eventTable.hook (eventType, listener);
}
-//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
+private static extern(C) int /*long*/ allChildrenProcFunc (GtkWidget* handle, void* user_data) {
+ CallbackData* cbdata = cast(CallbackData*)user_data;
+ return cbdata.display.allChildrenProc( cast(GtkWidget*)handle, cast(int)cbdata.data );
+}
+int /*long*/ allChildrenProc (GtkWidget* widget, int /*long*/ recurse) {
+ allChildren = OS.g_list_append (allChildren, widget);
+ if (recurse !is 0 && OS.GTK_IS_CONTAINER (widget)) {
+ allChildrenProcCallbackData.display = this;
+ allChildrenProcCallbackData.data = cast(void*)recurse;
+ OS.gtk_container_forall (cast(GtkContainer*)widget, cast(GtkCallback)&allChildrenProcFunc, &allChildrenProcCallbackData);
+ }
+ return 0;
+}
+
+void addMouseHoverTimeout (GtkWidget* handle) {
+ if (mouseHoverId !is 0) OS.gtk_timeout_remove (mouseHoverId);
+ mouseHoverProcCallbackData.display = this;
+ mouseHoverProcCallbackData.data = cast(void*)handle;
+ mouseHoverId = OS.gtk_timeout_add (400, &mouseHoverProcFunc, &mouseHoverProcCallbackData);
+ mouseHoverHandle = handle;
+}
+
void addPopup (Menu menu) {
if (popups is null) popups = new Menu [4];
int length = popups.length;
@@ -2693,12 +2703,11 @@
return rect;
}
-private extern(C) int mouseHoverProcMeth (void* handle) {
-//PORTING_TODO
- return 0;
+private static extern(C) int /*long*/ mouseHoverProcFunc ( void* user_data) {
+ CallbackData* cbdata = cast(CallbackData*)user_data;
+ return cbdata.display.mouseHoverProc( cast(GtkWidget*)cbdata.data );
}
-
-int /*long*/ mouseHoverProcMeth (GtkWidget* handle) {
+int /*long*/ mouseHoverProc (GtkWidget* handle) {
Widget widget = getWidget (handle);
if (widget is null) return 0;
return widget.hoverProc (handle);
diff -r ffffd0cd3b59 -r 5e5d1c9cffdb dwt/widgets/Menu.d
--- a/dwt/widgets/Menu.d Wed Jan 09 03:05:22 2008 +0100
+++ b/dwt/widgets/Menu.d Wed Jan 09 06:17:26 2008 +0100
@@ -10,10 +10,14 @@
*******************************************************************************/
module dwt.widgets.Menu;
-class Menu{
+import dwt.widgets.Control;
+import dwt.internal.gtk.c.gtktypes;
+
+class Menu : Control {
bool isDisposed();
void dispose();
void _setVisible (bool visible);
+void createIMMenu (GtkIMContext* imHandle) ;
}
/+++
diff -r ffffd0cd3b59 -r 5e5d1c9cffdb dwt/widgets/Shell.d
--- a/dwt/widgets/Shell.d Wed Jan 09 03:05:22 2008 +0100
+++ b/dwt/widgets/Shell.d Wed Jan 09 06:17:26 2008 +0100
@@ -10,17 +10,24 @@
*******************************************************************************/
module dwt.widgets.Shell;
-import dwt.widgets.Widget;
+import dwt.widgets.Composite;
+import dwt.widgets.Control;
import dwt.internal.gtk.c.gtktypes;
-class Shell : Widget {
+class Shell : Composite {
GtkWidget* shellHandle;
bool isDisposed();
void dispose();
void fixStyle ();
void redraw (bool);
void layout (bool, bool);
-
+ void setSavedFocus(Control);
+ GtkWidget* vboxHandle;
+ void fixShell (Shell newShell, Control control) ;
+ void bringToTop (bool force);
+ public void forceActive () ;
+ void setActiveControl (Control control) ;
+ void setToolTipText (GtkWidget* widget, char[] str) ;
}
/++
diff -r ffffd0cd3b59 -r 5e5d1c9cffdb todo.txt
--- a/todo.txt Wed Jan 09 03:05:22 2008 +0100
+++ b/todo.txt Wed Jan 09 06:17:26 2008 +0100
@@ -62,7 +62,7 @@
widgets/ColorDialog
widgets/Combo
widgets/Composite
-widgets/Control
+widgets/Control // OK
widgets/CoolBar
widgets/CoolItem
widgets/DateTime
@@ -303,7 +303,7 @@
// not sure what this is
-internal/accessibility/gtk/ATK
+internal/accessibility/gtk/ATK OK
internal/accessibility/gtk/AtkTextIface
internal/accessibility/gtk/AtkObjectFactoryClass
internal/accessibility/gtk/GtkAccessible