summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java12
-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.java52
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java8
8 files changed, 46 insertions, 70 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 afe2763bfb..94e9aa3c1d 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
@@ -538,9 +538,9 @@ public void setAlignment (int alignment) {
void setBackgroundColor (GdkColor color) {
super.setBackgroundColor (color);
- OS.gtk_widget_modify_bg (fixedHandle, 0, color);
- if (labelHandle != 0) OS.gtk_widget_modify_bg (labelHandle, 0, color);
- if (imageHandle != 0) OS.gtk_widget_modify_bg (imageHandle, 0, color);
+ setBackgroundColor(fixedHandle, color);
+ if (labelHandle != 0) setBackgroundColor(labelHandle, color);
+ if (imageHandle != 0) setBackgroundColor(imageHandle, color);
}
boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
@@ -588,9 +588,9 @@ boolean setRadioSelection (boolean value) {
void setForegroundColor (GdkColor color) {
super.setForegroundColor (color);
- OS.gtk_widget_modify_fg (fixedHandle, 0, color);
- if (labelHandle != 0) OS.gtk_widget_modify_fg (labelHandle, 0, color);
- if (imageHandle != 0) OS.gtk_widget_modify_fg (imageHandle, 0, 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);
}
/**
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 2a780062e2..7027994b21 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
@@ -400,14 +400,6 @@ public void cut () {
OS.gtk_editable_cut_clipboard (entryHandle);
}
-GdkColor defaultBackground () {
- return display.COLOR_TEXT_BACKGROUND;
-}
-
-GdkColor defaultForeground () {
- return display.COLOR_TEXT_FOREGROUND;
-}
-
void deregister () {
super.deregister ();
if (arrowHandle != 0) display.removeWidget (arrowHandle);
@@ -1107,7 +1099,7 @@ void setForegroundColor (GdkColor color) {
int count = OS.g_list_length (itemsList);
for (int i=count - 1; i>=0; i--) {
int widget = OS.gtk_bin_get_child (OS.g_list_nth_data (itemsList, i));
- OS.gtk_widget_modify_fg (widget, 0, color);
+ OS.gtk_widget_modify_fg (widget, OS.GTK_STATE_NORMAL, color);
}
OS.g_list_free (itemsList);
}
@@ -1205,7 +1197,7 @@ void setItems (String [] items, boolean keepText, boolean keepSelection) {
int count = OS.g_list_length (itemsList);
for (int i=count - 1; i>=0; i--) {
int widget = OS.gtk_bin_get_child (OS.g_list_nth_data (itemsList, i));
- OS.gtk_widget_modify_fg (widget, 0, color);
+ OS.gtk_widget_modify_fg (widget, OS.GTK_STATE_NORMAL, color);
OS.gtk_widget_modify_font (widget, font);
}
OS.g_list_free (itemsList);
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 d64c661866..03906325a6 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
@@ -86,18 +86,10 @@ public Control (Composite parent, int style) {
createWidget (0);
}
-GdkColor defaultBackground () {
- return display.COLOR_WIDGET_BACKGROUND;
-}
-
int defaultFont () {
return display.defaultFont;
}
-GdkColor defaultForeground () {
- return display.COLOR_WIDGET_FOREGROUND;
-}
-
void deregister () {
super.deregister ();
if (fixedHandle != 0) display.removeWidget (fixedHandle);
@@ -1344,15 +1336,17 @@ GdkColor getBackgroundColor () {
GdkColor getBgColor () {
int fontHandle = fontHandle ();
+ OS.gtk_widget_realize (fontHandle);
GdkColor color = new GdkColor ();
- OS.gtk_style_get_bg (OS.gtk_widget_get_style (fontHandle), 0, color);
+ OS.gtk_style_get_bg (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
return color;
}
GdkColor getBaseColor () {
int fontHandle = fontHandle ();
+ OS.gtk_widget_realize (fontHandle);
GdkColor color = new GdkColor ();
- OS.gtk_style_get_base (OS.gtk_widget_get_style (fontHandle), 0, color);
+ OS.gtk_style_get_base (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
return color;
}
@@ -1433,8 +1427,9 @@ GdkColor getForegroundColor () {
GdkColor getFgColor () {
int fontHandle = fontHandle ();
+ OS.gtk_widget_realize (fontHandle);
GdkColor color = new GdkColor ();
- OS.gtk_style_get_fg (OS.gtk_widget_get_style (fontHandle), 0, color);
+ OS.gtk_style_get_fg (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
return color;
}
@@ -1444,8 +1439,9 @@ Point getIMCaretPos () {
GdkColor getTextColor () {
int fontHandle = fontHandle ();
+ OS.gtk_widget_realize (fontHandle);
GdkColor color = new GdkColor ();
- OS.gtk_style_get_text (OS.gtk_widget_get_style (fontHandle), 0, color);
+ OS.gtk_style_get_text (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
return color;
}
@@ -2290,18 +2286,32 @@ void sendMouseEvent (int type, int button, int gdkEvent) {
*/
public void setBackground (Color color) {
checkWidget();
- GdkColor gdkColor;
- if (color == null) {
- gdkColor = defaultBackground ();
- } else {
+ GdkColor gdkColor = null;
+ if (color != null) {
if (color.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
gdkColor = color.handle;
}
setBackgroundColor (gdkColor);
}
+void setBackgroundColor (int handle, GdkColor color) {
+ int index = OS.GTK_STATE_NORMAL;
+ int style = OS.gtk_widget_get_modifier_style (handle);
+ int ptr = OS.gtk_rc_style_get_bg_pixmap_name (style, index);
+ if (ptr != 0) OS.g_free (ptr);
+ String name = color == null ? "<parent>" : "<none>";
+ byte[] buffer = Converter.wcsToMbcs (null, name, true);
+ ptr = OS.g_malloc (buffer.length);
+ OS.memmove (ptr, buffer, buffer.length);
+ OS.gtk_rc_style_set_bg_pixmap_name (style, index, ptr);
+ OS.gtk_rc_style_set_bg (style, index, color);
+ int flag = OS.gtk_rc_style_get_color_flags(style, index);
+ flag = (color == null) ? flag & ~OS.GTK_RC_BG : flag | OS.GTK_RC_BG;
+ OS.gtk_rc_style_set_color_flags(style, index, flag);
+ OS.gtk_widget_modify_style (handle, style);
+}
void setBackgroundColor (GdkColor color) {
- OS.gtk_widget_modify_bg (handle, 0, color);
+ setBackgroundColor(handle, color);
}
/**
@@ -2452,10 +2462,8 @@ void setFontDescription (int font) {
*/
public void setForeground (Color color) {
checkWidget();
- GdkColor gdkColor;
- if (color == null) {
- gdkColor = defaultForeground ();
- } else {
+ GdkColor gdkColor = null;
+ if (color != null) {
if (color.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
gdkColor = color.handle;
}
@@ -2463,7 +2471,7 @@ public void setForeground (Color color) {
}
void setForegroundColor (GdkColor color) {
- OS.gtk_widget_modify_fg (handle, 0, color);
+ OS.gtk_widget_modify_fg (handle, OS.GTK_STATE_NORMAL, color);
}
void setInitialSize () {
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 d4a55a8e90..a4b826fabe 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
@@ -280,7 +280,7 @@ void releaseWidget () {
void setBackgroundColor (GdkColor color) {
super.setBackgroundColor (color);
- OS.gtk_widget_modify_bg (fixedHandle, 0, color);
+ setBackgroundColor(fixedHandle, color);
}
void setFontDescription (int font) {
@@ -290,7 +290,7 @@ void setFontDescription (int font) {
void setForegroundColor (GdkColor color) {
super.setForegroundColor (color);
- OS.gtk_widget_modify_fg (labelHandle, 0, color);
+ OS.gtk_widget_modify_fg (labelHandle, OS.GTK_STATE_NORMAL, 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 264d0e17c7..a6987f8506 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
@@ -385,9 +385,9 @@ public void setAlignment (int alignment) {
void setBackgroundColor (GdkColor color) {
super.setBackgroundColor (color);
- OS.gtk_widget_modify_bg (fixedHandle, 0, color);
- if (labelHandle != 0) OS.gtk_widget_modify_bg (labelHandle, 0, color);
- if (imageHandle != 0) OS.gtk_widget_modify_bg (imageHandle, 0, color);
+ setBackgroundColor(fixedHandle, color);
+ if (labelHandle != 0) setBackgroundColor(labelHandle, color);
+ if (imageHandle != 0) setBackgroundColor(imageHandle, color);
}
boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
@@ -436,9 +436,9 @@ void setFontDescription (int font) {
void setForegroundColor (GdkColor color) {
super.setForegroundColor (color);
- OS.gtk_widget_modify_fg (fixedHandle, 0, color);
- if (labelHandle != 0) OS.gtk_widget_modify_fg (labelHandle, 0, color);
- if (imageHandle != 0) OS.gtk_widget_modify_fg (imageHandle, 0, 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);
}
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 857a1226ae..cd3e2b4193 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
@@ -234,14 +234,6 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
return size;
}
-GdkColor defaultBackground () {
- return display.COLOR_LIST_BACKGROUND;
-}
-
-GdkColor defaultForeground () {
- return display.COLOR_LIST_FOREGROUND;
-}
-
void deregister() {
super.deregister ();
display.removeWidget (OS.gtk_tree_view_get_selection (handle));
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 a46e5604d9..2a03f0331e 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
@@ -404,14 +404,6 @@ void createWidget (int index) {
itemCount = columnCount = 0;
}
-GdkColor defaultBackground () {
- return display.COLOR_LIST_BACKGROUND;
-}
-
-GdkColor defaultForeground () {
- return display.COLOR_LIST_FOREGROUND;
-}
-
void deregister() {
super.deregister ();
display.removeWidget (OS.gtk_tree_view_get_selection (handle));
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 8d53fe6507..b7a66ce28a 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
@@ -375,14 +375,6 @@ public void cut () {
}
}
-GdkColor defaultBackground () {
- return display.COLOR_TEXT_BACKGROUND;
-}
-
-GdkColor defaultForeground () {
- return display.COLOR_TEXT_FOREGROUND;
-}
-
void deregister () {
super.deregister ();
if (bufferHandle != 0) display.removeWidget (bufferHandle);