Community
Participate
Working Groups
This is a request, not a bug. For styling eclipse SWT clients with our corporate design, we need an extension of the dynamic Button CSS functionality. Please support these states for Buttons: normal selected (as 'checked' already, but not all attributes) hover pressed disabled (not dynamic yet) And these attributes: color, background-color border-color corner-radius Default buttons (see Shell.setDefaultButton) have to be styled differently from standard buttons. Sounds to me as if they would need a different class, but I'm no CSS expert. ToolItems and TreeItems styling is needed for the same states, but for ToolItems, only color and background-color make sense. (Let me know if I should create separate tickets for ToolItems and TreeItems.)
(In reply to Wiebke Timm from comment #0) > Let me know if I should create separate tickets for ToolItems and TreeItems. Yes, please create a different bug for tool items and tree items.
I just realized that I never created those entries. Here they are: https://bugs.eclipse.org/bugs/show_bug.cgi?id=579468 https://bugs.eclipse.org/bugs/show_bug.cgi?id=579470
CSS can only style what SWT / the native widgets allow to be styled. AFAIK the following attributes cannot be styled in pure SWT. Please correct me if I'm wrong. border-color corner-radius
Hover already works, AFAICS. Button:hover { background-color: yellow; color:blue; }
The CSS spies shows that currently the default button is not selectable via CSS class. You could assign a CSS class or ID to the button and use this in your styling. Depending your your implementation that might a relatively easily to implemented. Lets discuss in person.
Yes, hover works for Buttons! The only documentation I know of for supported CSS styling of SWT widgets is this: https://wiki.eclipse.org/E4/CSS/SWT_Mapping So I did not even try because it was not listed. (Some other widgets like TreeItem or ToolItem are not even mentioned there)
(In reply to Wiebke Timm from comment #6) > Yes, hover works for Buttons! Great to hear. > The only documentation I know of for supported CSS styling of SWT widgets is > this: > https://wiki.eclipse.org/E4/CSS/SWT_Mapping Yes, documentation is very thin in this area, I also have to check the code for what is supported for non trivial cases. A very helpful tool to use is the CSS spy which we migrated to PDE in the latest releases.
(In reply to Lars Vogel from comment #3) > CSS can only style what SWT / the native widgets allow to be styled. AFAIK > the following attributes cannot be styled in pure SWT. Please correct me if > I'm wrong. > > border-color > corner-radius It is true, SWT buttons do not support this at present. Should I create a separate issue to add that support? (here or in bitbucket...?) Maybe we should discuss the implications in person.
(In reply to Wiebke Timm from comment #8) > (In reply to Lars Vogel from comment #3) > > CSS can only style what SWT / the native widgets allow to be styled. AFAIK > > the following attributes cannot be styled in pure SWT. Please correct me if > > I'm wrong. > > > > border-color > > corner-radius > > It is true, SWT buttons do not support this at present. > Should I create a separate issue to add that support? (here or in > bitbucket...?) > Maybe we should discuss the implications in person. Lets discuss tomorrow in our call.
I have now tried to style default buttons by setting button.setData("org.eclipse.e4.ui.css.CssClassName", "DefaultButton"); ...and styling .DefaultButton in the css file. With a wrapper for "setEnabled" we can call the IThemeEngine to get a dynamic update (because unfortunately callbacks are not fired in SWT in that case). However, when using the jface "MessageDialog", it is impossible to style the default button, because the dialog is created when "open" is called, at which point it is too late to do any (programmatic) styling: The buttons do not exist prior to the open() call. So for a consistent styling of default buttons, CSS support for the default button would be needed. Currently, there is NO specific styling for that button other than it is the active button (which is styled differently by the OS), which can be changed by the user (for example by pressing TAB).