summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2003-10-03 20:49:02 +0000
committerSilenio Quarti <silenio>2003-10-03 20:49:02 +0000
commit8bdc7452496d997678c005f282bcd2cc736b0512 (patch)
tree1a3ef55ecdb9c4841c6bd3c5884d5040c1b56023 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org
parenta2fb28aada03076e456f5d04cff320b4b64690b6 (diff)
downloadeclipse.platform.swt-8bdc7452496d997678c005f282bcd2cc736b0512.tar.gz
eclipse.platform.swt-8bdc7452496d997678c005f282bcd2cc736b0512.tar.xz
eclipse.platform.swt-8bdc7452496d997678c005f282bcd2cc736b0512.zip
37683
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java7
-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/Control.java48
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java108
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java7
7 files changed, 46 insertions, 155 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 a057bec561..d74b6fbab4 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
@@ -278,14 +278,9 @@ public void drawArc(int x, int y, int width, int height, int startAngle, int arc
*/
public void drawFocus(int x, int y, int width, int height) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- GtkStyle style = new GtkStyle();
//CHECK - default style might not be attached to any window
- OS.memmove(style, OS.gtk_widget_get_default_style());
GdkColor color = new GdkColor();
- color.pixel = style.fg0_pixel;
- color.red = style.fg0_red;
- color.green = style.fg0_green;
- color.blue = style.fg0_blue;
+ OS.gtk_style_get_fg (OS.gtk_widget_get_default_style(), 0, color);
GdkGCValues values = new GdkGCValues();
OS.gdk_gc_get_values(handle, values);
OS.gdk_gc_set_foreground(handle, 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 5450c9c61d..52b16d159b 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
@@ -293,10 +293,9 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
int layout = OS.gtk_entry_get_layout (entryHandle);
OS.pango_layout_get_size (layout, w, h);
int xborder = INNER_BORDER, yborder = INNER_BORDER;
- GtkStyle style = new GtkStyle ();
- OS.memmove (style, OS.gtk_widget_get_style (entryHandle));
- xborder += style.xthickness;
- yborder += style.ythickness;
+ int style = OS.gtk_widget_get_style (entryHandle);
+ xborder += OS.gtk_style_get_xthickness (style);
+ yborder += OS.gtk_style_get_ythickness (style);
int [] property = new int [1];
OS.gtk_widget_style_get (entryHandle, OS.interior_focus, property, 0);
if (property [0] != 0) {
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 5a77053ea2..dd1b70b124 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
@@ -1329,25 +1329,15 @@ GdkColor getBackgroundColor () {
GdkColor getBgColor () {
int fontHandle = fontHandle ();
- GtkStyle style = new GtkStyle ();
- OS.memmove (style, OS.gtk_widget_get_style (fontHandle));
GdkColor color = new GdkColor ();
- color.pixel = style.bg0_pixel;
- color.red = style.bg0_red;
- color.green = style.bg0_green;
- color.blue = style.bg0_blue;
+ OS.gtk_style_get_bg (OS.gtk_widget_get_style (fontHandle), 0, color);
return color;
}
GdkColor getBaseColor () {
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;
+ OS.gtk_style_get_base (OS.gtk_widget_get_style (fontHandle), 0, color);
return color;
}
@@ -1404,9 +1394,7 @@ public Font getFont () {
int getFontDescription () {
int fontHandle = fontHandle ();
- GtkStyle style = new GtkStyle ();
- OS.memmove(style, OS.gtk_widget_get_style (fontHandle));
- return style.font_desc;
+ return OS.gtk_style_get_font_desc (OS.gtk_widget_get_style (fontHandle));
}
/**
@@ -1430,13 +1418,8 @@ GdkColor getForegroundColor () {
GdkColor getFgColor () {
int fontHandle = fontHandle ();
- GtkStyle style = new GtkStyle ();
- OS.memmove(style, OS.gtk_widget_get_style (fontHandle));
GdkColor color = new GdkColor ();
- color.pixel = style.fg0_pixel;
- color.red = style.fg0_red;
- color.green = style.fg0_green;
- color.blue = style.fg0_blue;
+ OS.gtk_style_get_fg (OS.gtk_widget_get_style (fontHandle), 0, color);
return color;
}
@@ -1446,13 +1429,8 @@ Point getIMCaretPos () {
GdkColor getTextColor () {
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;
+ OS.gtk_style_get_text (OS.gtk_widget_get_style (fontHandle), 0, color);
return color;
}
@@ -1882,22 +1860,10 @@ public int internal_new_GC (GCData data) {
data.style |= style & (mask | SWT.MIRRORED);
}
int fontHandle = fontHandle ();
- GtkStyle style = new GtkStyle ();
- OS.memmove(style, OS.gtk_widget_get_style (fontHandle));
- GdkColor foreground = new GdkColor ();
- foreground.pixel = style.fg0_pixel;
- foreground.red = style.fg0_red;
- foreground.green = style.fg0_green;
- foreground.blue = style.fg0_blue;
- GdkColor background = new GdkColor ();
- background.pixel = style.bg0_pixel;
- background.red = style.bg0_red;
- background.green = style.bg0_green;
- background.blue = style.bg0_blue;
data.drawable = window;
data.device = display;
- data.background = background;
- data.foreground = foreground;
+ data.background = getBackgroundColor ();
+ data.foreground = getForegroundColor ();
data.font = font != null ? font.handle : defaultFont ();
}
return gdkGC;
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 bbdff3cfad..666cc60a24 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
@@ -1198,151 +1198,89 @@ void initializeSystemResources () {
OS.gtk_widget_realize (tooltipShellHandle);
GdkColor gdkColor;
- GtkStyle style = new GtkStyle();
- OS.memmove (style, OS.gtk_widget_get_style (shellHandle));
- GtkStyle tooltipStyle = new GtkStyle();
- OS.memmove (tooltipStyle, OS.gtk_widget_get_style (tooltipShellHandle));
+ int style = OS.gtk_widget_get_style (shellHandle);
+ int tooltipStyle = OS.gtk_widget_get_style (tooltipShellHandle);
- defaultFont = OS.pango_font_description_copy (style.font_desc);
+ defaultFont = OS.pango_font_description_copy (OS.gtk_style_get_font_desc (style));
gdkColor = new GdkColor();
- gdkColor.pixel = style.black_pixel;
- gdkColor.red = style.black_red;
- gdkColor.green = style.black_green;
- gdkColor.blue = style.black_blue;
+ OS.gtk_style_get_black (style, gdkColor);
COLOR_WIDGET_DARK_SHADOW = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.dark0_pixel;
- gdkColor.red = style.dark0_red;
- gdkColor.green = style.dark0_green;
- gdkColor.blue = style.dark0_blue;
+ OS.gtk_style_get_dark (style, 0, gdkColor);
COLOR_WIDGET_NORMAL_SHADOW = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.bg0_pixel;
- gdkColor.red = style.bg0_red;
- gdkColor.green = style.bg0_green;
- gdkColor.blue = style.bg0_blue;
+ OS.gtk_style_get_bg (style, 0, gdkColor);
COLOR_WIDGET_LIGHT_SHADOW = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.light0_pixel;
- gdkColor.red = style.light0_red;
- gdkColor.green = style.light0_green;
- gdkColor.blue = style.light0_blue;
+ OS.gtk_style_get_light (style, 0, gdkColor);
COLOR_WIDGET_HIGHLIGHT_SHADOW = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.fg0_pixel;
- gdkColor.red = style.fg0_red;
- gdkColor.green = style.fg0_green;
- gdkColor.blue = style.fg0_blue;
+ OS.gtk_style_get_fg (style, 0, gdkColor);
COLOR_WIDGET_FOREGROUND = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.bg0_pixel;
- gdkColor.red = style.bg0_red;
- gdkColor.green = style.bg0_green;
- gdkColor.blue = style.bg0_blue;
+ OS.gtk_style_get_bg (style, 0, gdkColor);
COLOR_WIDGET_BACKGROUND = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.text0_pixel;
- gdkColor.red = style.text0_red;
- gdkColor.green = style.text0_green;
- gdkColor.blue = style.text0_blue;
+ OS.gtk_style_get_text (style, 0, gdkColor);
COLOR_TEXT_FOREGROUND = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.base0_pixel;
- gdkColor.red = style.base0_red;
- gdkColor.green = style.base0_green;
- gdkColor.blue = style.base0_blue;
+ OS.gtk_style_get_base (style, 0, gdkColor);
COLOR_TEXT_BACKGROUND = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.text0_pixel;
- gdkColor.red = style.text0_red;
- gdkColor.green = style.text0_green;
- gdkColor.blue = style.text0_blue;
+ OS.gtk_style_get_text (style, 0, gdkColor);
COLOR_LIST_FOREGROUND = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.base0_pixel;
- gdkColor.red = style.base0_red;
- gdkColor.green = style.base0_green;
- gdkColor.blue = style.base0_blue;
+ OS.gtk_style_get_base (style, 0, gdkColor);
COLOR_LIST_BACKGROUND = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.text3_pixel;
- gdkColor.red = style.text3_red;
- gdkColor.green = style.text3_green;
- gdkColor.blue = style.text3_blue;
+ OS.gtk_style_get_text (style, 3, gdkColor);
COLOR_LIST_SELECTION_TEXT = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.base3_pixel;
- gdkColor.red = style.base3_red;
- gdkColor.green = style.base3_green;
- gdkColor.blue = style.base3_blue;
+ OS.gtk_style_get_base (style, 3, gdkColor);
COLOR_LIST_SELECTION = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = tooltipStyle.fg0_pixel;
- gdkColor.red = tooltipStyle.fg0_red;
- gdkColor.green = tooltipStyle.fg0_green;
- gdkColor.blue = tooltipStyle.fg0_blue;
+ OS.gtk_style_get_fg (tooltipStyle, 0, gdkColor);
COLOR_INFO_FOREGROUND = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = tooltipStyle.bg0_pixel;
- gdkColor.red = tooltipStyle.bg0_red;
- gdkColor.green = tooltipStyle.bg0_green;
- gdkColor.blue = tooltipStyle.bg0_blue;
+ OS.gtk_style_get_bg (tooltipStyle, 0, gdkColor);
COLOR_INFO_BACKGROUND = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.bg3_pixel;
- gdkColor.red = style.bg3_red;
- gdkColor.green = style.bg3_green;
- gdkColor.blue = style.bg3_blue;
+ OS.gtk_style_get_bg (style, 3, gdkColor);
COLOR_TITLE_BACKGROUND = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.fg3_pixel;
- gdkColor.red = style.fg3_red;
- gdkColor.green = style.fg3_green;
- gdkColor.blue = style.fg3_blue;
+ OS.gtk_style_get_fg (style, 3, gdkColor);
COLOR_TITLE_FOREGROUND = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.light3_pixel;
- gdkColor.red = style.light3_red;
- gdkColor.green = style.light3_green;
- gdkColor.blue = style.light3_blue;
+ OS.gtk_style_get_light (style, 3, gdkColor);
COLOR_TITLE_BACKGROUND_GRADIENT = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.bg4_pixel;
- gdkColor.red = style.bg4_red;
- gdkColor.green = style.bg4_green;
- gdkColor.blue = style.bg4_blue;
+ OS.gtk_style_get_bg (style, 4, gdkColor);
COLOR_TITLE_INACTIVE_BACKGROUND = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.fg4_pixel;
- gdkColor.red = style.fg4_red;
- gdkColor.green = style.fg4_green;
- gdkColor.blue = style.fg4_blue;
+ OS.gtk_style_get_fg (style, 4, gdkColor);
COLOR_TITLE_INACTIVE_FOREGROUND = gdkColor;
gdkColor = new GdkColor();
- gdkColor.pixel = style.light4_pixel;
- gdkColor.red = style.light4_red;
- gdkColor.green = style.light4_green;
- gdkColor.blue = style.light4_blue;
+ OS.gtk_style_get_light (style, 4, gdkColor);
COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT = gdkColor;
OS.gtk_widget_destroy (tooltipShellHandle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
index 39f2e1b7bd..2f9a55c647 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
@@ -109,12 +109,13 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
trimWidth += vScrollBarWidth ();
if (scrolledHandle != 0) {
if (OS.gtk_scrolled_window_get_shadow_type (scrolledHandle) != OS.GTK_SHADOW_NONE) {
- GtkStyle style = new GtkStyle ();
- OS.memmove (style, OS.gtk_widget_get_style (scrolledHandle));
- trimX -= style.xthickness;
- trimY -= style.ythickness;
- trimWidth += style.xthickness * 2;
- trimHeight += style.ythickness * 2;
+ int style = OS.gtk_widget_get_style (scrolledHandle);
+ int xthickness = OS.gtk_style_get_xthickness (style);
+ int ythickness = OS.gtk_style_get_ythickness (style);
+ trimX -= xthickness;
+ trimY -= ythickness;
+ trimWidth += xthickness * 2;
+ trimHeight += ythickness * 2;
}
}
return new Rectangle (trimX, trimY, trimWidth, trimHeight);
@@ -155,9 +156,7 @@ public int getBorderWidth () {
if (scrolledHandle != 0) {
border += OS.gtk_container_get_border_width (scrolledHandle);
if (OS.gtk_scrolled_window_get_shadow_type (scrolledHandle) != OS.GTK_SHADOW_NONE) {
- GtkStyle style = new GtkStyle ();
- OS.memmove (style, OS.gtk_widget_get_style (scrolledHandle));
- border += style.xthickness;
+ border += OS.gtk_style_get_xthickness (OS.gtk_widget_get_style (scrolledHandle));
}
}
return border;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index 921303b761..18a3f47e7a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -486,13 +486,8 @@ void createHandle (int index) {
}
if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.RESIZE)) == 0) {
OS.gtk_container_set_border_width (shellHandle, 1);
- GtkStyle style = new GtkStyle ();
- OS.memmove (style, OS.gtk_widget_get_style (shellHandle));
GdkColor color = new GdkColor ();
- color.red = style.black_red;
- color.green = style.black_green;
- color.blue = style.black_blue;
- color.pixel = style.black_pixel;
+ OS.gtk_style_get_black (OS.gtk_widget_get_style (shellHandle), color);
OS.gtk_widget_modify_bg (shellHandle, 0, color);
}
//TEMPORARY CODE
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 955eb394c4..a60f90f5f9 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
@@ -290,10 +290,9 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
int layout = OS.gtk_entry_get_layout (handle);
OS.pango_layout_get_size (layout, w, h);
if ((style & SWT.BORDER) != 0) {
- GtkStyle style = new GtkStyle ();
- OS.memmove (style, OS.gtk_widget_get_style (handle));
- xborder += style.xthickness;
- yborder += style.ythickness;
+ int style = OS.gtk_widget_get_style (handle);
+ xborder += OS.gtk_style_get_xthickness (style);
+ yborder += OS.gtk_style_get_ythickness (style);
}
xborder += INNER_BORDER;
yborder += INNER_BORDER;