diff options
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt')
8 files changed, 80 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java index 1768757ada..e8750b9f80 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java @@ -1336,6 +1336,7 @@ public FontMetrics getFontMetrics() { fm.descent = OS.PANGO_PIXELS(OS.pango_font_metrics_get_descent(metrics)); fm.averageCharWidth = OS.PANGO_PIXELS(OS.pango_font_metrics_get_approximate_char_width(metrics)); fm.height = fm.ascent + fm.descent; + OS.pango_font_metrics_unref(metrics); return fm; } 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 1e332cd693..a348aa0958 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 @@ -424,6 +424,7 @@ public void setAlignment (int alignment) { void setBackgroundColor (GdkColor color) { super.setBackgroundColor (color); + OS.gtk_widget_modify_bg (fixedHandle, 0, color); OS.gtk_widget_modify_bg (labelHandle, 0, color); OS.gtk_widget_modify_bg (pixmapHandle, 0, color); } @@ -436,6 +437,7 @@ void setFontDescription (int font) { void setForegroundColor (GdkColor color) { super.setForegroundColor (color); + OS.gtk_widget_modify_fg (fixedHandle, 0, color); OS.gtk_widget_modify_fg (labelHandle, 0, color); OS.gtk_widget_modify_fg (pixmapHandle, 0, 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 f9b741809a..42edfd0d71 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 @@ -307,6 +307,11 @@ void deregister () { WidgetTable.remove (listHandle); } +int fontHandle () { + if (entryHandle != 0) return entryHandle; + return super.fontHandle (); +} + void hookEvents () { // TO DO - expose, enter/exit, focus in/out super.hookEvents (); @@ -385,6 +390,30 @@ public void deselectAll () { setItems (getItems ()); } +GdkColor getBackgroundColor () { + int fontHandle = fontHandle (); + GtkStyle style = new GtkStyle (); + OS.memmove(style, OS.gtk_widget_get_style (fontHandle)); + GdkColor color = new GdkColor (); + color.pixel = style.base0_pixel; + color.red = style.base0_red; + color.green = style.base0_green; + color.blue = style.base0_blue; + return color; +} + +GdkColor getForegroundColor () { + int fontHandle = fontHandle (); + GtkStyle style = new GtkStyle (); + OS.memmove(style, OS.gtk_widget_get_style (fontHandle)); + GdkColor color = new GdkColor (); + color.pixel = style.text0_pixel; + color.red = style.text0_red; + color.green = style.text0_green; + color.blue = style.text0_blue; + return color; +} + /** * Returns the item at the given, zero-relative index in the * receiver's list. Throws an exception if the index is out 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 47b595f2b2..46e1ae26df 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 @@ -1877,7 +1877,6 @@ public void setBackground (Color color) { } void setBackgroundColor (GdkColor color) { - if (fixedHandle != 0) OS.gtk_widget_modify_bg (fixedHandle, 0, color); OS.gtk_widget_modify_bg (handle, 0, color); } @@ -2035,7 +2034,6 @@ public void setForeground (Color color) { } void setForegroundColor (GdkColor color) { - if (fixedHandle != 0) OS.gtk_widget_modify_fg (fixedHandle, 0, color); OS.gtk_widget_modify_fg (handle, 0, color); } 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 603d99153e..e82e010785 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 @@ -324,6 +324,16 @@ public void setAlignment (int alignment) { } } +void setBackgroundColor (GdkColor color) { + super.setBackgroundColor (color); + OS.gtk_widget_modify_bg (fixedHandle, 0, color); +} + +void setForegroundColor (GdkColor color) { + super.setForegroundColor (color); + OS.gtk_widget_modify_fg (fixedHandle, 0, color); +} + /** * Sets the receiver's image to the argument, which may be * null indicating that no image should be displayed. 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 85eb7186a2..cfdaa5fc3c 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 @@ -198,8 +198,8 @@ void createHandle (int index) { if ((style & SWT.BORDER) != 0) { OS.gtk_clist_set_shadow_type(handle, OS.GTK_SHADOW_ETCHED_IN); } - int hsp = (style & SWT.H_SCROLL) == 0 ? OS.GTK_POLICY_NEVER : OS.GTK_POLICY_AUTOMATIC; - int vsp = (style & SWT.V_SCROLL) == 0 ? OS.GTK_POLICY_NEVER : OS.GTK_POLICY_AUTOMATIC; + int hsp = (style & SWT.H_SCROLL) != 0 ? OS.GTK_POLICY_AUTOMATIC : OS.GTK_POLICY_NEVER; + int vsp = (style & SWT.V_SCROLL) != 0 ? OS.GTK_POLICY_AUTOMATIC : OS.GTK_POLICY_NEVER; OS.gtk_scrolled_window_set_policy (scrolledHandle, hsp, vsp); } @@ -312,6 +312,18 @@ public void deselectAll () { OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection); } +GdkColor getBackgroundColor () { + int fontHandle = fontHandle (); + GtkStyle style = new GtkStyle (); + OS.memmove(style, OS.gtk_widget_get_style (fontHandle)); + GdkColor color = new GdkColor (); + color.pixel = style.base0_pixel; + color.red = style.base0_red; + color.green = style.base0_green; + color.blue = style.base0_blue; + return color; +} + /** * Returns the zero-relative index of the item which is currently * has the focus in the receiver, or -1 if no item is has focus. 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 948fa53d6a..d7b856e3ef 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 @@ -376,6 +376,18 @@ void destroyItem (TableItem item) { items [itemCount] = null; } +GdkColor getBackgroundColor () { + int fontHandle = fontHandle (); + GtkStyle style = new GtkStyle (); + OS.memmove(style, OS.gtk_widget_get_style (fontHandle)); + GdkColor color = new GdkColor (); + color.pixel = style.base0_pixel; + color.red = style.base0_red; + color.green = style.base0_green; + color.blue = style.base0_blue; + return color; +} + /** * Returns the column at the given, zero-relative index in the * receiver. Throws an exception if the index is out of range. 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 39f2feb4c7..0c3d1c0cb8 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 @@ -328,6 +328,18 @@ int findSibling (int node, int index) { return Sibling; } +GdkColor getBackgroundColor () { + int fontHandle = fontHandle (); + GtkStyle style = new GtkStyle (); + OS.memmove(style, OS.gtk_widget_get_style (fontHandle)); + GdkColor color = new GdkColor (); + color.pixel = style.base0_pixel; + color.red = style.base0_red; + color.green = style.base0_green; + color.blue = style.base0_blue; + return color; +} + /** * Returns the item at the given point in the receiver * or null if no such item exists. The point is in the |