Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Adding my own pseudo classes to e4 CSS support?
Adding my own pseudo classes to e4 CSS support? [message #1426928] Fri, 19 September 2014 12:43
Marina Knieling is currently offline Marina KnielingFriend
Messages: 83
Registered: February 2013
Member
Hi guys,

I'm implementing my own CSS element providers and property handlers to
add support for other (own) widgets and some special properties.

I'd like to add a hover pseudo class for one of my own widgets. I tried
to simply check for "hover" in the pseudo parameter in the applyCSS*
method of the PropertyHandler but this doesn't seem to work. Is this
possible at all and if yes how would I achieve it?

This is my code so far (the property handler):

public boolean applyCSSProperty (Object element, String property,
CSSValue value, String pseudo, CSSEngine engine) throws Exception {
Widget widget = (Widget) ((WidgetElement) element).getNativeWidget();

if ("background-color".equals(property)) {
if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
Color newColor = (Color) engine.convert(value, Color.class,
widget.getDisplay());
if (widget instanceof MyMenuItem) {
MyMenuItem menuItem = (MyMenuItem) widget;
if ("hover".equals(pseudo)) {
System.out.println("hover background");
menuItem.setHoverBackgroundColor(newColor);
// TODO redraw necessary?
}
else {
menuItem.setBackgroundColor(newColor);
}
}
}
}
return false;
}

And the CSS:

MyMenuItem {
color: white;
background-color: red;
}

MyMenuItem:hover {
color: red;
background-color: white;
}

The normal (= not hovering) colors are set, but the hover colors aren't.

Thanks in advance for any hints or help

Marina Knieling
Previous Topic:Listening for Activation of new childcontext?
Next Topic:Increase launch speed of e4 applicaiton
Goto Forum:
  


Current Time: Sun Jan 24 16:58:44 GMT 2021

Powered by FUDForum. Page generated in 0.02240 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top