summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2003-07-31 20:50:15 +0000
committerSilenio Quarti <silenio>2003-07-31 20:50:15 +0000
commit01b53f04043d77e5b4a54bcfe36da2df748745a8 (patch)
tree8013dd641c6d926275c49778b78711edc56c5eec
parent5e25a1d6de8e8f0c1e45910e13ae0be069575b8b (diff)
downloadeclipse.platform.swt-01b53f04043d77e5b4a54bcfe36da2df748745a8.tar.gz
eclipse.platform.swt-01b53f04043d77e5b4a54bcfe36da2df748745a8.tar.xz
eclipse.platform.swt-01b53f04043d77e5b4a54bcfe36da2df748745a8.zip
embedding
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java9
3 files changed, 31 insertions, 9 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
index 8f74c91763..f21296f57a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
@@ -422,10 +422,9 @@ int fontHandle () {
return super.fontHandle ();
}
-public boolean forceFocus () {
- checkWidget();
- OS.gtk_widget_grab_focus (entryHandle);
- return OS.gtk_widget_is_focus (entryHandle);
+int focusHandle () {
+ if (entryHandle != 0) return entryHandle;
+ return super.focusHandle ();
}
boolean hasFocus () {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index 6820f6d738..5af18ba865 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -39,7 +39,8 @@ import org.eclipse.swt.graphics.*;
* @see Canvas
*/
public class Composite extends Scrollable {
- int imHandle;
+ public int embeddedHandle;
+ int imHandle, socketHandle;
Layout layout;
Control[] tabList;
@@ -223,6 +224,13 @@ void createScrolledHandle (int parentHandle) {
OS.gtk_container_add (parentHandle, handle);
}
OS.gtk_widget_show (handle);
+ if ((style & SWT.EMBEDDED) != 0) {
+ socketHandle = OS.gtk_socket_new ();
+ if (socketHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+ OS.gtk_container_add (handle, socketHandle);
+ OS.gtk_widget_show (socketHandle);
+ embeddedHandle = OS.gtk_socket_get_id (socketHandle);
+ }
if (imHandle != 0) {
int window = OS.GTK_WIDGET_WINDOW (handle);
if (window != 0) {
@@ -249,6 +257,11 @@ void enableWidget (boolean enabled) {
}
}
+int focusHandle () {
+ if (socketHandle != 0) return socketHandle;
+ return super.focusHandle ();
+}
+
public int getBorderWidth () {
checkWidget();
int topHandle = topHandle ();
@@ -555,6 +568,11 @@ void releaseWidget () {
layout = null;
}
+void resizeHandle (int width, int height) {
+ super.resizeHandle (width, height);
+ if (socketHandle != 0) OS.gtk_widget_set_size_request (socketHandle, width, height);
+}
+
boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
boolean changed = super.setBounds (x, y, width, height, move, resize);
if (changed && resize && layout != null) layout.layout (this, false);
@@ -592,7 +610,7 @@ boolean setTabGroupFocus () {
if ((style & SWT.NO_FOCUS) == 0) {
boolean takeFocus = true;
if ((state & CANVAS) != 0) takeFocus = hooksKeys ();
- if (takeFocus && setTabItemFocus ()) return true;
+ if ((takeFocus || socketHandle != 0) && setTabItemFocus ()) return true;
}
Control [] children = _getChildren ();
for (int i=0; i<children.length; i++) {
@@ -606,7 +624,7 @@ boolean setTabItemFocus () {
if ((style & SWT.NO_FOCUS) == 0) {
boolean takeFocus = true;
if ((state & CANVAS) != 0) takeFocus = hooksKeys ();
- if (takeFocus) {
+ if (takeFocus || socketHandle != 0) {
if (!isShowing ()) return false;
if (forceFocus ()) return true;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index 50c6ae54ce..2fd12f6ae4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -122,6 +122,10 @@ void fixFocus () {
}
}
+int focusHandle () {
+ return handle;
+}
+
int fontHandle () {
return handle;
}
@@ -1290,8 +1294,9 @@ public boolean forceFocus () {
shell.setSavedFocus (this);
if (!isEnabled () || !isVisible ()) return false;
shell.bringToTop (false);
- OS.gtk_widget_grab_focus (handle);
- return OS.gtk_widget_is_focus (handle);
+ int focusHandle = focusHandle ();
+ OS.gtk_widget_grab_focus (focusHandle);
+ return OS.gtk_widget_is_focus (focusHandle);
}
/**