diff options
| author | Daniel Rolka | 2014-04-30 12:26:50 +0000 |
|---|---|---|
| committer | Daniel Rolka | 2014-04-30 16:32:01 +0000 |
| commit | bd6eb85ddf810df4e8491e0bd38dfa1ec29ea1d2 (patch) | |
| tree | 5694a43739ab0da053dee307b9509eff2f5f9195 | |
| parent | 8963e678092712041ab28f96b739ba455b58e3cc (diff) | |
| download | eclipse.platform.ui-bd6eb85ddf810df4e8491e0bd38dfa1ec29ea1d2.tar.gz eclipse.platform.ui-bd6eb85ddf810df4e8491e0bd38dfa1ec29ea1d2.tar.xz eclipse.platform.ui-bd6eb85ddf810df4e8491e0bd38dfa1ec29ea1d2.zip | |
Bug 433830 - Part's background color is wrong
Change-Id: I642d3a12dd1f3a25b43999b63738dddcb33c78bf
Signed-off-by: Daniel Rolka <daniel.rolka@pl.ibm.com>
3 files changed, 73 insertions, 8 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java index 8dd1935352a..e54a4f90c4e 100644 --- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java +++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java @@ -27,8 +27,10 @@ import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Region; +import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.ToolBar; @SuppressWarnings("restriction") public class CTabRendering extends CTabFolderRenderer implements @@ -58,6 +60,8 @@ public class CTabRendering extends CTabFolderRenderer implements static final String E4_TOOLBAR_ACTIVE_IMAGE = "org.eclipse.e4.renderer.toolbar_background_active_image"; //$NON-NLS-1$ static final String E4_TOOLBAR_INACTIVE_IMAGE = "org.eclipse.e4.renderer.toolbar_background_inactive_image"; //$NON-NLS-1$ + private static final String TOOLBAR_CONTAINER = "CTabRendering.toolbarContainer"; //$NON-NLS-1$ + int[] shape; Image shadowImage, toolbarActiveImage, toolbarInactiveImage; @@ -1120,13 +1124,44 @@ public class CTabRendering extends CTabFolderRenderer implements int leftRightBorder = (parent.getBounds().width - selectedItemWidth) / 2; int topBorder = INNER_KEYLINE + OUTER_KEYLINE; + Control toolbarContainer = findToolbarContainer(); + + if (toolbarContainer != null) { + if (toolbarContainer.getBounds().height > 0) { + int unselectedHeightToDraw = Math.max( + toolbarContainer.getBounds().height, + partHeaderBounds.height); + + rendererWrapper.drawBackground(gc, partHeaderBounds.x + + leftRightBorder, partHeaderBounds.height + topBorder, + partHeaderBounds.width - leftRightBorder * 2, + unselectedHeightToDraw, defaultBackground, + getUnselectedTabsColors(state), + getUnselectedTabsPercents(state), vertical); + } + } + } - rendererWrapper.drawBackground(gc, - partHeaderBounds.x + leftRightBorder, partHeaderBounds.height - + topBorder, partHeaderBounds.width - leftRightBorder - * 2, partHeaderBounds.height, - defaultBackground, getUnselectedTabsColors(state), - getUnselectedTabsPercents(state), vertical); + private Control findToolbarContainer() { + Object obj = parent.getData(TOOLBAR_CONTAINER); + if (obj instanceof Control) { + Control control = (Control) obj; + if (!control.isDisposed()) { + return control; + } + } + + for (Control child : parent.getChildren()) { + if (child instanceof Composite) { + for (Control subChild : ((Composite) child).getChildren()) { + if (subChild instanceof ToolBar && subChild.isVisible()) { + parent.setData(TOOLBAR_CONTAINER, child); + return child; + } + } + } + } + return null; } private static class CTabFolderRendererWrapper extends diff --git a/bundles/org.eclipse.ui.themes/css/dark/e4-dark_partstyle.css b/bundles/org.eclipse.ui.themes/css/dark/e4-dark_partstyle.css index 240cdc00b6e..f142c57cb62 100644 --- a/bundles/org.eclipse.ui.themes/css/dark/e4-dark_partstyle.css +++ b/bundles/org.eclipse.ui.themes/css/dark/e4-dark_partstyle.css @@ -315,3 +315,23 @@ background-color: #252525; color: #CCCCCC; } + +/* begin of the hack for the Bug 433276 */ +.MPartStack#left > Composite, +.MPartStack#left ToolBar, +.MPartStack#right > Composite, +.MPartStack#right ToolBar, +.MPartStack#bottom > Composite, +.MPartStack#bottom ToolBar { + background-color: '#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_START' '#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_END' 100% 100%; +} + +.MPartStack#left.active > Composite, +.MPartStack#left.active ToolBar, +.MPartStack#right.active > Composite, +.MPartStack#right.active ToolBar, +.MPartStack#bottom.active > Composite, +.MPartStack#bottom.active ToolBar { + background-color: '#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START' '#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END' 100% 100%; +} +/* end of the hack */ diff --git a/bundles/org.eclipse.ui.themes/css/e4_basestyle.css b/bundles/org.eclipse.ui.themes/css/e4_basestyle.css index 13ad5a3d7c6..14d0a455552 100644 --- a/bundles/org.eclipse.ui.themes/css/e4_basestyle.css +++ b/bundles/org.eclipse.ui.themes/css/e4_basestyle.css @@ -166,13 +166,23 @@ CTabItem:selected { color: '#org-eclipse-ui-workbench-ACTIVE_NOFOCUS_TAB_TEXT_COLOR'; } -.MPartStack Composite { +.MPartStack#left Composite, .MPartStack#right Composite, .MPartStack#bottom Composite { + background-color: '#org-eclipse-ui-workbench-INACTIVE_TAB_BG_END'; +} + +.MPartStack#left.active Composite, .MPartStack#right.active Composite, .MPartStack#bottom.active Composite { + background-color: '#org-eclipse-ui-workbench-ACTIVE_TAB_BG_END'; +} + +/* begin of the hack for the Bug 433276 */ +.MPartStack#left > Composite, .MPartStack#right > Composite, .MPartStack#bottom > Composite { background-color: '#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_START' '#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_END' 100% 100%; } -.MPartStack.active Composite { +.MPartStack#left.active > Composite, .MPartStack#right.active > Composite, .MPartStack#bottom.active > Composite { background-color: '#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START' '#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END' 100% 100%; } +/* end of the hack */ #PerspectiveSwitcher { eclipse-perspective-keyline-color: #AAB0BF #AAB0BF; |
