diff options
| author | Niraj Modi | 2015-04-16 08:39:06 +0000 |
|---|---|---|
| committer | Niraj Modi | 2015-04-16 08:39:06 +0000 |
| commit | 79d9fccb3fbc773688882f3e7477eaa419d13abb (patch) | |
| tree | d392339454f4ebd2b87713cd7354514bb9e0a8ba | |
| parent | 272a884cbfaf37ca080cb3f80dc6205e135d72be (diff) | |
| download | eclipse.platform.swt-79d9fccb3fbc773688882f3e7477eaa419d13abb.tar.gz eclipse.platform.swt-79d9fccb3fbc773688882f3e7477eaa419d13abb.tar.xz eclipse.platform.swt-79d9fccb3fbc773688882f3e7477eaa419d13abb.zip | |
Bug 463127 - [Win32][GTK] Transparent background not honored on
Composite with Scrollbars
- GTK patch
Change-Id: I9bd2a575c1b799232c89f292ce3179bc00141b27
Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
9 files changed, 77 insertions, 21 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java index c1e0c50788..c812e16e85 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java @@ -285,6 +285,11 @@ void createHandle (int index) { createHandle (index, true, scrolled || (style & SWT.BORDER) != 0); } +@Override +int applyThemeBackground () { + return (backgroundAlpha == 0 || (style & (SWT.H_SCROLL | SWT.V_SCROLL)) == 0) ? 1 : 0; +} + void createHandle (int index, boolean fixed, boolean scrolled) { if (scrolled) { if (fixed) { 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 599b669cea..f0f59cdf1c 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -193,6 +193,11 @@ void createHandle(int index) { } @Override +int applyThemeBackground () { + return 1; +} + +@Override void deregister () { super.deregister (); display.removeWidget (clientHandle); 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 cecc0f09b0..effeb89e1b 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 @@ -239,6 +239,11 @@ void createHandle (int index) { } @Override +int applyThemeBackground () { + return -1; /* No Change */ +} + +@Override public Point computeSize (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; 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 40f2c414f3..2d38a95911 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -156,6 +156,27 @@ void createWidget (int index) { } @Override +void updateBackgroundMode () { + super.updateBackgroundMode (); + switch (applyThemeBackground ()) { + case 0: state &= ~THEME_BACKGROUND; break; + case 1: state |= THEME_BACKGROUND; break; + default: /* No change */ + } + super.updateBackgroundMode (); +} + +/** + * @return + * <li>0 to remove THEME_BACKGROUND</li> + * <li>1 to apply THEME_BACKGROUND</li> + * <li>otherwise don't change THEME_BACKGROUND state</li> + */ +int applyThemeBackground () { + return (backgroundAlpha == 0) ? 1 : 0; +} + +@Override void deregister () { super.deregister (); if (scrolledHandle != 0) display.removeWidget (scrolledHandle); 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 b2c6ce2ac3..a3b223c3e1 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 @@ -832,6 +832,11 @@ void createWidget (int index) { } } +@Override +int applyThemeBackground () { + return -1; /* No Change */ +} + GdkColor defaultBackground () { return display.COLOR_LIST_BACKGROUND; } 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 65ac355d07..3c05eb5d9a 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -189,7 +189,7 @@ static int checkStyle (int style) { void createHandle (int index) { state |= HANDLE | MENU; if ((style & SWT.READ_ONLY) != 0) { - if ((style & (SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL)) == 0) { + if (applyThemeBackground () == 1) { state |= THEME_BACKGROUND; } } @@ -243,6 +243,11 @@ void createHandle (int index) { } @Override +int applyThemeBackground () { + return (backgroundAlpha == 0 || (style & (SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL)) == 0) ? 1 : 0; +} + +@Override void createWidget (int index) { super.createWidget (index); doubleClick = true; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java index edb311bbaf..42a2b5e604 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -168,6 +168,11 @@ void createHandle (int index) { } @Override +int applyThemeBackground () { + return -1; /* No Change */ +} + +@Override public Point computeSize (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; 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 9aee3137b7..f67a33c34e 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 @@ -749,6 +749,11 @@ void createHandle (int index) { } } +@Override +int applyThemeBackground () { + return -1; /* No Change */ +} + void createItem (TreeColumn column, int index) { if (!(0 <= index && index <= columnCount)) error (SWT.ERROR_INVALID_RANGE); if (index == 0) { diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet365.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet365.java index b9be917c52..99ce79590c 100644 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet365.java +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet365.java @@ -28,14 +28,14 @@ public class Snippet365 { static Image newImage;
// Containers
- static Group containerGroup;
+ static Composite containerGroup;
static Canvas canvas;
static Composite composite;
static Group group;
static Sash sash;
// Native
- static Group nativeGroup;
+ static Composite nativeGroup;
static Button buttonCheckBox;
static ToolBar toolBar;
static CoolBar coolBar;
@@ -47,7 +47,7 @@ public class Snippet365 { static Button push;
// Custom
- static Group customGroup;
+ static Composite customGroup;
static CLabel cLabel;
static StyledText styledText;
static SashForm sashForm;
@@ -55,14 +55,14 @@ public class Snippet365 { static CTabFolder gradientCTab;
// Item
- static Group itemGroup;
+ static Composite itemGroup;
static TabFolder tabFolder;
static Table table;
static Tree tree;
static ExpandBar expandBar;
// As Designed
- static Group defaultBackgroundGroup;
+ static Composite defaultBackgroundGroup;
static Text text;
static Combo combo;
static ProgressBar progressBar;
@@ -219,41 +219,41 @@ public class Snippet365 { });
// ContainerGroup
- containerGroup = new Group(shell, SWT.NONE);
+ containerGroup = new Composite(shell, SWT.NONE);
containerGroup.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- containerGroup.setText("CONTAINER");
+ containerGroup.setToolTipText("CONTAINER");
layout = new RowLayout();
layout.spacing = 20;
containerGroup.setLayout(layout);
// Native
- nativeGroup = new Group(shell, SWT.NONE);
+ nativeGroup = new Composite(shell, SWT.NONE);
nativeGroup.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- nativeGroup.setText("NATIVE");
+ nativeGroup.setToolTipText("NATIVE");
layout = new RowLayout();
layout.spacing = 20;
nativeGroup.setLayout(layout);
// Custom
- customGroup = new Group(shell, SWT.NONE);
+ customGroup = new Composite(shell, SWT.NONE);
customGroup.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- customGroup.setText("CUSTOM");
+ customGroup.setToolTipText("CUSTOM");
layout = new RowLayout();
layout.spacing = 20;
customGroup.setLayout(layout);
// AsDesigned
- defaultBackgroundGroup = new Group(shell, SWT.NONE);
+ defaultBackgroundGroup = new Composite(shell, SWT.NONE);
defaultBackgroundGroup.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- defaultBackgroundGroup.setText("Default Background");
+ defaultBackgroundGroup.setToolTipText("Default Background");
layout = new RowLayout();
layout.spacing = 20;
defaultBackgroundGroup.setLayout(layout);
// ItemGroup
- itemGroup = new Group(shell, SWT.NONE);
+ itemGroup = new Composite(shell, SWT.NONE);
itemGroup.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- itemGroup.setText("ITEM");
+ itemGroup.setToolTipText("ITEM");
layout = new RowLayout();
layout.spacing = 20;
itemGroup.setLayout(layout);
@@ -325,7 +325,7 @@ public class Snippet365 { });
// Composite
- composite = new Composite(containerGroup, SWT.BORDER);
+ composite = new Composite(containerGroup, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
composite.setToolTipText("Composite");
// TabFolder
|
