summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk
diff options
context:
space:
mode:
authorSteve Northover <steve>2006-06-29 17:57:25 +0000
committerSteve Northover <steve>2006-06-29 17:57:25 +0000
commit372ad0fa1cef9d4ccdc2a41048cec7945f3753c1 (patch)
tree89640a5ae596ba9c7f33a8126bc4e435cbb0b279 /bundles/org.eclipse.swt/Eclipse SWT/gtk
parentb2f839080f9751f164e3c854e27a6a67eb7c0cda (diff)
downloadeclipse.platform.swt-372ad0fa1cef9d4ccdc2a41048cec7945f3753c1.tar.gz
eclipse.platform.swt-372ad0fa1cef9d4ccdc2a41048cec7945f3753c1.tar.xz
eclipse.platform.swt-372ad0fa1cef9d4ccdc2a41048cec7945f3753c1.zip
133183 - Button widget with SWT.CHECK style is not showing foreground color when it is in selected/checked state
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java30
15 files changed, 54 insertions, 48 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 bf81ef7933..1aa5265580 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
@@ -620,9 +620,9 @@ boolean setRadioSelection (boolean value) {
void setForegroundColor (GdkColor color) {
super.setForegroundColor (color);
- OS.gtk_widget_modify_fg (fixedHandle, OS.GTK_STATE_NORMAL, color);
- if (labelHandle != 0) OS.gtk_widget_modify_fg (labelHandle, OS.GTK_STATE_NORMAL, color);
- if (imageHandle != 0) OS.gtk_widget_modify_fg (imageHandle, OS.GTK_STATE_NORMAL, color);
+ setForegroundColor (fixedHandle, color);
+ if (labelHandle != 0) setForegroundColor (labelHandle, color);
+ if (imageHandle != 0) setForegroundColor (imageHandle, color);
}
/**
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 44e95d96af..8fd2cf9fa7 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
@@ -179,7 +179,7 @@ public void add (String string, int index) {
ignoreSelect = lockText = true;
int /*long*/ item = OS.gtk_list_item_new_with_label (buffer);
int /*long*/ label = OS.gtk_bin_get_child (item);
- OS.gtk_widget_modify_fg (label, OS.GTK_STATE_NORMAL, getForegroundColor ());
+ setForegroundColor (label, getForegroundColor ());
OS.gtk_widget_modify_font (label, getFontDescription ());
OS.gtk_widget_set_direction (label, OS.gtk_widget_get_direction (handle));
OS.gtk_widget_show (item);
@@ -1531,18 +1531,18 @@ void setFontDescription (int /*long*/ font) {
void setForegroundColor (GdkColor color) {
super.setForegroundColor (color);
if (OS.GTK_VERSION >= OS.VERSION (2, 4, 0)) {
- if (entryHandle != 0) OS.gtk_widget_modify_text (entryHandle, 0, color);
+ if (entryHandle != 0) setForegroundColor (entryHandle, color);
OS.g_object_set (textRenderer, OS.foreground_gdk, color, 0);
} else {
- OS.gtk_widget_modify_text (entryHandle, 0, color);
+ setForegroundColor (entryHandle, color);
if (listHandle != 0) {
- OS.gtk_widget_modify_text (listHandle, 0, color);
+ setForegroundColor (listHandle, color);
int /*long*/ itemsList = OS.gtk_container_get_children (listHandle);
if (itemsList != 0) {
int count = OS.g_list_length (itemsList);
for (int i=count - 1; i>=0; i--) {
int /*long*/ widget = OS.gtk_bin_get_child (OS.g_list_nth_data (itemsList, i));
- OS.gtk_widget_modify_fg (widget, OS.GTK_STATE_NORMAL, color);
+ setForegroundColor (widget, color);
}
OS.g_list_free (itemsList);
}
@@ -1635,7 +1635,7 @@ public void setItems (String [] items) {
byte [] buffer = Converter.wcsToMbcs (null, string, true);
int /*long*/ item = OS.gtk_list_item_new_with_label (buffer);
int /*long*/ label = OS.gtk_bin_get_child (item);
- OS.gtk_widget_modify_fg (label, OS.GTK_STATE_NORMAL, color);
+ setForegroundColor (label, color);
OS.gtk_widget_modify_font (label, font);
OS.gtk_widget_set_direction (label, direction);
OS.gtk_container_add (listHandle, item);
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 5c5bdd85ae..aa9047e7de 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
@@ -3017,7 +3017,7 @@ public void setForeground (Color color) {
}
void setForegroundColor (GdkColor color) {
- OS.gtk_widget_modify_fg (handle, OS.GTK_STATE_NORMAL, color);
+ setForegroundColor (handle, color);
}
void setInitialBounds () {
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 5df2c958af..b3e137010b 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
@@ -3464,7 +3464,7 @@ void showIMWindow (Control control) {
Control widget = control.findBackgroundControl ();
if (widget == null) widget = control;
OS.gtk_widget_modify_bg (preeditWindow, OS.GTK_STATE_NORMAL, widget.getBackgroundColor ());
- OS.gtk_widget_modify_fg (preeditLabel, OS.GTK_STATE_NORMAL, control.getForegroundColor ());
+ widget.setForegroundColor (preeditLabel, control.getForegroundColor());
OS.gtk_widget_modify_font (preeditLabel, control.getFontDescription ());
if (pangoAttrs [0] != 0) OS.gtk_label_set_attributes (preeditLabel, pangoAttrs[0]);
OS.gtk_label_set_text (preeditLabel, preeditString [0]);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
index 4f6221c6e9..d58b4e7d34 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
@@ -503,9 +503,9 @@ void setFontDescription (int /*long*/ font) {
}
void setForegroundColor (GdkColor color) {
- OS.gtk_widget_modify_fg (handle, OS.GTK_STATE_NORMAL, color);
- if (labelHandle != 0) OS.gtk_widget_modify_fg (labelHandle, OS.GTK_STATE_NORMAL, color);
- if (imageHandle != 0) OS.gtk_widget_modify_fg (imageHandle, OS.GTK_STATE_NORMAL, color);
+ setForegroundColor (handle, color);
+ if (labelHandle != 0) setForegroundColor (labelHandle, color);
+ if (imageHandle != 0) setForegroundColor (imageHandle, color);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
index 3c87319357..94d265f0cc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
@@ -230,7 +230,7 @@ void setFontDescription (int /*long*/ font) {
void setForegroundColor (GdkColor color) {
super.setForegroundColor (color);
- OS.gtk_widget_modify_fg (labelHandle, OS.GTK_STATE_NORMAL, color);
+ setForegroundColor (labelHandle, color);
}
void setOrientation () {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
index 625efef1eb..a97f721953 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
@@ -441,9 +441,9 @@ void setFontDescription (int /*long*/ font) {
void setForegroundColor (GdkColor color) {
super.setForegroundColor (color);
- OS.gtk_widget_modify_fg (fixedHandle, OS.GTK_STATE_NORMAL, color);
- if (labelHandle != 0) OS.gtk_widget_modify_fg (labelHandle, OS.GTK_STATE_NORMAL, color);
- if (imageHandle != 0) OS.gtk_widget_modify_fg (imageHandle, OS.GTK_STATE_NORMAL, color);
+ setForegroundColor (fixedHandle, color);
+ if (labelHandle != 0) setForegroundColor (labelHandle, color);
+ if (imageHandle != 0) setForegroundColor (imageHandle, color);
}
void setOrientation () {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
index dad63df7e1..2051e2c1c8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
@@ -1219,11 +1219,6 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
return result;
}
-void setForegroundColor (GdkColor color) {
- super.setForegroundColor (color);
- OS.gtk_widget_modify_text (handle, 0, color);
-}
-
/**
* Sets the text of the item in the receiver's list at the given
* zero-relative index to the string argument. This is equivalent
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
index a973e187d7..460f60b396 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
@@ -782,11 +782,6 @@ void setFontDescription (int /*long*/ font) {
super.setFontDescription (font);
}
-void setForegroundColor (GdkColor color) {
- super.setForegroundColor (color);
- OS.gtk_widget_modify_text (handle, 0, color);
-}
-
/**
* Sets the amount that the receiver's value will be
* modified by when the up/down arrows are pressed to
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 dfc6719389..4d8aa83989 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
@@ -248,8 +248,9 @@ void setFontDescription (int /*long*/ font) {
}
void setForegroundColor (GdkColor color) {
- OS.gtk_widget_modify_fg (labelHandle, OS.GTK_STATE_NORMAL, color);
- OS.gtk_widget_modify_fg (imageHandle, OS.GTK_STATE_NORMAL, color);
+ /* Don't set the color in vbox handle (it doesn't draw) */
+ setForegroundColor (labelHandle, color);
+ setForegroundColor (imageHandle, color);
}
public void setImage (Image image) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index 23e7ec2c81..4c338f2d9d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -2755,11 +2755,6 @@ void setFontDescription (int /*long*/ font) {
}
}
-void setForegroundColor (GdkColor color) {
- super.setForegroundColor (color);
- OS.gtk_widget_modify_text (handle, 0, color);
-}
-
/**
* Marks the receiver's header as visible if the argument is <code>true</code>,
* and marks it invisible otherwise.
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
index 714992a8a3..413e31d1dd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
@@ -1600,11 +1600,6 @@ void setFontDescription (int /*long*/ font) {
setTabStops (tabs);
}
-void setForegroundColor (GdkColor color) {
- super.setForegroundColor (color);
- OS.gtk_widget_modify_text (handle, 0, color);
-}
-
/**
* Sets the orientation of the receiver, which must be one
* of the constants <code>SWT.LEFT_TO_RIGHT</code> or <code>SWT.RIGHT_TO_LEFT</code>.
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 b9ef443197..e1e2c99d7f 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
@@ -838,9 +838,9 @@ void setFontDescription (int /*long*/ font) {
}
void setForegroundColor (GdkColor color) {
- OS.gtk_widget_modify_fg (handle, OS.GTK_STATE_NORMAL, color);
- if (labelHandle != 0) OS.gtk_widget_modify_fg (labelHandle, OS.GTK_STATE_NORMAL, color);
- if (imageHandle != 0) OS.gtk_widget_modify_fg (imageHandle, OS.GTK_STATE_NORMAL, color);
+ setForegroundColor (handle, color);
+ if (labelHandle != 0) setForegroundColor (labelHandle, color);
+ if (imageHandle != 0) setForegroundColor (imageHandle, color);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index b75d122b0d..d14816c9df 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -2642,11 +2642,6 @@ void setFontDescription (int /*long*/ font) {
}
}
-void setForegroundColor (GdkColor color) {
- super.setForegroundColor (color);
- OS.gtk_widget_modify_text (handle, 0, color);
-}
-
/**
* Marks the receiver's header as visible if the argument is <code>true</code>,
* and marks it invisible otherwise.
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
index a7cbbd7366..3c3c126e8c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
@@ -1293,6 +1293,36 @@ public void setData (String key, Object value) {
}
}
+void setForegroundColor (int /*long*/ handle, GdkColor color) {
+ int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
+ OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_NORMAL, color);
+ OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_ACTIVE, color);
+ OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_PRELIGHT, color);
+ int flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL);
+ flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
+ OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_NORMAL, flags);
+ flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE);
+ flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
+ OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags);
+ flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT);
+ flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
+ OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags);
+
+ OS.gtk_rc_style_set_text (style, OS.GTK_STATE_NORMAL, color);
+ OS.gtk_rc_style_set_text (style, OS.GTK_STATE_ACTIVE, color);
+ OS.gtk_rc_style_set_text (style, OS.GTK_STATE_PRELIGHT, color);
+ flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL);
+ flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
+ OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_NORMAL, flags);
+ flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT);
+ flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
+ OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags);
+ flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE);
+ flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
+ OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags);
+ OS.gtk_widget_modify_style (handle, style);
+}
+
boolean setInputState (Event event, int state) {
if ((state & OS.GDK_MOD1_MASK) != 0) event.stateMask |= SWT.ALT;
if ((state & OS.GDK_SHIFT_MASK) != 0) event.stateMask |= SWT.SHIFT;