summaryrefslogtreecommitdiffstats
path: root/bundles
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2002-05-03 17:47:21 +0000
committerSilenio Quarti <silenio>2002-05-03 17:47:21 +0000
commit6d842225f60e347e4e85dbc880baacea4e19ba29 (patch)
treef7ef5ca2c2bc391633a3f4083ad657cdbdc78c09 /bundles
parentbd8da331f502cdc4f38173c93a07c181211e33d8 (diff)
downloadeclipse.platform.swt-6d842225f60e347e4e85dbc880baacea4e19ba29.tar.gz
eclipse.platform.swt-6d842225f60e347e4e85dbc880baacea4e19ba29.tar.xz
eclipse.platform.swt-6d842225f60e347e4e85dbc880baacea4e19ba29.zip
*** empty log message ***
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java2
5 files changed, 58 insertions, 19 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
index 202e289f16..4b1818dd6c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
@@ -170,15 +170,14 @@ void createHandle (int index) {
if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
labelHandle = OS.gtk_label_new_with_mnemonic (null);
if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
- int pixmap = OS.gdk_pixmap_new(OS.GDK_ROOT_PARENT(), 1, 1, -1);
- if (pixmap == 0) error (SWT.ERROR_NO_HANDLES);
- pixmapHandle = OS.gtk_pixmap_new (pixmap, 0);
- OS.g_object_unref (pixmap);
+ Display display = getDisplay ();
+ pixmapHandle = OS.gtk_pixmap_new (display.nullPixmap, 0);
if (pixmapHandle == 0) error (SWT.ERROR_NO_HANDLES);
OS.gtk_container_add (handle, boxHandle);
OS.gtk_container_add (boxHandle, labelHandle);
OS.gtk_container_add (boxHandle, pixmapHandle);
OS.gtk_widget_show (boxHandle);
+ OS.gtk_widget_show (labelHandle);
}
int parentHandle = parent.parentingHandle ();
OS.gtk_container_add (parentHandle, fixedHandle);
@@ -467,11 +466,8 @@ public void setImage (Image image) {
OS.gtk_pixmap_set (pixmapHandle, image.pixmap, image.mask);
OS.gtk_widget_show (pixmapHandle);
} else {
-// int pixmap = OS.gdk_pixmap_new (OS.GDK_ROOT_PARENT(), 1, 1, -1);
-// if (pixmap == 0) error (SWT.ERROR_NO_HANDLES);
-// OS.gtk_pixmap_set (pixmapHandle, image.pixmap, image.mask);
-// OS.g_object_unref (pixmap);
- //??? REF
+ Display display = getDisplay ();
+ OS.gtk_pixmap_set (pixmapHandle, display.nullPixmap, 0);
OS.gtk_widget_hide (pixmapHandle);
}
}
@@ -531,7 +527,11 @@ public void setText (String string) {
byte [] buffer = Converter.wcsToMbcs (null, text);
OS.gtk_label_set_text_with_mnemonic (labelHandle, buffer);
OS.gtk_widget_hide (pixmapHandle);
- OS.gtk_widget_show (labelHandle);
+ if (string.length () != 0) {
+ OS.gtk_widget_show (labelHandle);
+ } else {
+ OS.gtk_widget_hide (labelHandle);
+ }
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index defdd6763a..4e8d775d4f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -110,6 +110,9 @@ public class Display extends Device {
Callback caretCallback;
int caretID, caretProc;
+ /* Pixmaps */
+ int nullPixmap;
+
/* Fonts */
int defaultFont;
@@ -798,11 +801,14 @@ public Color getSystemColor (int id) {
return Color.gtk_new (this, gdkColor);
}
-final void initializeSystemResources() {
+void initializeSystemResources () {
int shellHandle = OS.gtk_window_new (OS.GTK_WINDOW_TOPLEVEL);
if (shellHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
OS.gtk_widget_realize (shellHandle);
+ nullPixmap = OS.gdk_pixmap_new(OS.GDK_ROOT_PARENT(), 1, 1, -1);
+ if (nullPixmap == 0) error (SWT.ERROR_NO_HANDLES);
+
GdkColor gdkColor;
GtkStyle style = new GtkStyle();
OS.memmove (style, OS.gtk_widget_get_style (shellHandle));
@@ -1202,6 +1208,9 @@ void releaseDisplay () {
messages = null; messageLock = null; thread = null;
messagesSize = windowProc2 = windowProc3 = windowProc4 = windowProc5 = 0;
+ if (nullPixmap != 0) OS.g_object_unref (nullPixmap);
+ nullPixmap = 0;
+
if (defaultFont != 0) OS.pango_font_description_free (defaultFont);
defaultFont = 0;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
index 6d2432b4c2..005b716971 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
@@ -187,17 +187,27 @@ void createItem (TabItem item, int index) {
System.arraycopy (items, 0, newItems, 0, items.length);
items = newItems;
}
- int labelHandle = OS.gtk_label_new (null);
+ int boxHandle = OS.gtk_hbox_new (false, 0);
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ int labelHandle = OS.gtk_label_new_with_mnemonic (null);
if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ Display display = getDisplay ();
+ int pixmapHandle = OS.gtk_pixmap_new (display.nullPixmap, 0);
+ if (pixmapHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ OS.gtk_container_add (boxHandle, pixmapHandle);
+ OS.gtk_container_add (boxHandle, labelHandle);
int pageHandle = OS.gtk_fixed_new ();
if (pageHandle == 0) error (SWT.ERROR_NO_HANDLES);
OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
- OS.gtk_notebook_insert_page (handle, pageHandle, labelHandle, index);
+ OS.gtk_notebook_insert_page (handle, pageHandle, boxHandle, index);
OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ OS.gtk_widget_show (boxHandle);
OS.gtk_widget_show (labelHandle);
OS.gtk_widget_show (pageHandle);
item.state |= HANDLE;
- item.handle = labelHandle;
+ item.handle = boxHandle;
+ item.labelHandle = labelHandle;
+ item.pixmapHandle = pixmapHandle;
item.pageHandle = pageHandle;
System.arraycopy (items, index, items, index + 1, itemCount++ - index);
items [index] = item;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
index 94accf4139..bfa0d20dfa 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
@@ -25,7 +25,7 @@ import org.eclipse.swt.graphics.*;
*/
public class TabItem extends Item {
- int pageHandle;
+ int labelHandle, pixmapHandle, pageHandle;
Control control;
TabFolder parent;
String toolTipText;
@@ -162,6 +162,11 @@ void releaseChild () {
parent.destroyItem (this);
}
+void releaseHandle () {
+ super.releaseHandle ();
+ labelHandle = pixmapHandle = 0;
+}
+
void releaseWidget () {
super.releaseWidget ();
parent = null;
@@ -199,16 +204,26 @@ public void setControl (Control control) {
}
void setFontDescription (int font) {
- OS.gtk_widget_modify_font (handle, font);
+ OS.gtk_widget_modify_font (labelHandle, font);
+ OS.gtk_widget_modify_font (pixmapHandle, font);
}
void setForegroundColor (GdkColor color) {
- OS.gtk_widget_modify_fg (handle, 0, color);
+ OS.gtk_widget_modify_fg (labelHandle, 0, color);
+ OS.gtk_widget_modify_fg (pixmapHandle, 0, color);
}
public void setImage (Image image) {
checkWidget ();
super.setImage (image);
+ if (image != null) {
+ OS.gtk_pixmap_set (pixmapHandle, image.pixmap, image.mask);
+ OS.gtk_widget_show (pixmapHandle);
+ } else {
+ Display display = getDisplay ();
+ OS.gtk_pixmap_set (pixmapHandle, display.nullPixmap, 0);
+ OS.gtk_widget_hide (pixmapHandle);
+ }
}
public void setText (String string) {
@@ -222,7 +237,12 @@ public void setText (String string) {
if (text [i] == '&') text [i] = '_';
}
byte [] buffer = Converter.wcsToMbcs (null, text);
- OS.gtk_label_set_text_with_mnemonic (handle, buffer);
+ OS.gtk_label_set_text_with_mnemonic (labelHandle, buffer);
+ if (string.length () != 0) {
+ OS.gtk_widget_show (labelHandle);
+ } else {
+ OS.gtk_widget_hide (labelHandle);
+ }
parent.fixPage ();
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
index cf41b90581..3f8c76e1b6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
@@ -789,7 +789,7 @@ public void setText (String string) {
public void setToolTipText (String string) {
checkWidget();
toolTipText = string;
- if (tooltipsHandle == 0) tooltipsHandle = OS.gtk_tooltips_new();
+ if (tooltipsHandle == 0) tooltipsHandle = OS.gtk_tooltips_new ();
byte [] buffer = null;
if (string != null) buffer = Converter.wcsToMbcs (null, string, true);
OS.gtk_tooltips_set_tip (tooltipsHandle, handle, buffer, null);