diff options
Diffstat (limited to 'bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CTabFolderElement.java')
-rw-r--r-- | bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CTabFolderElement.java | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CTabFolderElement.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CTabFolderElement.java index 4c49b7b7bd6..2aefdb8accd 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CTabFolderElement.java +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CTabFolderElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2012 Angelo Zerr and others. + * Copyright (c) 2009, 2014 Angelo Zerr 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 @@ -7,12 +7,15 @@ * * Contributors: * Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation + * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.e4.ui.css.swt.dom; import org.eclipse.e4.ui.css.core.dom.CSSStylableElement; import org.eclipse.e4.ui.css.core.engine.CSSEngine; +import org.eclipse.e4.ui.internal.css.swt.ICTabRendering; import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Widget; import org.w3c.dom.Node; @@ -22,7 +25,7 @@ import org.w3c.dom.Node; * */ public class CTabFolderElement extends CompositeElement { - + public CTabFolderElement(CTabFolder tabFolder, CSSEngine engine) { super(tabFolder, engine); } @@ -31,6 +34,7 @@ public class CTabFolderElement extends CompositeElement { * Compute static pseudo instances. * */ + @Override protected void computeStaticPseudoInstances() { super.computeStaticPseudoInstances(); // it's CTabFolder. Set selected as static pseudo instance. @@ -40,7 +44,8 @@ public class CTabFolderElement extends CompositeElement { super.addStaticPseudoInstance("selected"); } - + + @Override public Node item(int index) { Widget widget = getWidget(); // retrieve the child control or child item depending on the @@ -54,15 +59,16 @@ public class CTabFolderElement extends CompositeElement { Widget w = folder.getChildren()[index]; return getElement(w); } - + } - + + @Override public int getLength() { Widget widget = getWidget(); int childCount = 0; if (widget instanceof Composite) { childCount = ((Composite) widget).getChildren().length; - + if (widget instanceof CTabFolder) { // if it's a CTabFolder, include the child items in the count childCount += ((CTabFolder) widget).getItemCount(); @@ -70,5 +76,27 @@ public class CTabFolderElement extends CompositeElement { } return childCount; } - + + @Override + public void reset() { + super.reset(); + CTabFolder folder = (CTabFolder) getWidget(); + folder.setSelectionBackground((Color) null); + folder.setSelectionForeground((Color) null); + folder.setBackground(null, null); + + if (folder.getRenderer() instanceof ICTabRendering) { + ICTabRendering renderer = (ICTabRendering) folder + .getRenderer(); + folder.setRenderer(null); + renderer.setSelectedTabFill(null); + renderer.setTabOutline(null); + renderer.setInnerKeyline(null); + renderer.setOuterKeyline(null); + renderer.setShadowColor(null); + renderer.setActiveToolbarGradient(null, null); + renderer.setInactiveToolbarGradient(null, null); + } + } } + |