Hi Michael,

here's how to add a hover effect to an image:

Extend qx.ui.basic.Image, assign a custom appearance id and add 
listeners that add/remove the "hovered" state on mouseover/mouseout:

qx.Class.define("custom.HoverImage", {

   extend : qx.ui.basic.Image,

   construct : function(source) {
     this.base(arguments, source);

     this.setAppearance("hoverimage");

     this.addListener("mouseover", function() {
       this.addState("hovered");
     });

     this.addListener("mouseout", function() {
       this.removeState("hovered");
     });
   }
});

Add a new appearance definition to 
source/class/<application>/theme/Appearance.js:

qx.Theme.define("custom.theme.Appearance",
{
   extend : qx.theme.modern.Appearance,

   appearances :
   {
     "hoverimage" :
     {
       style : function(states)
       {
         return {
           decorator : states.hovered ? "tooltip-error" : undefined
         };
       }
     }
   }
});

As you can see, the "tooltip-error" decorator is assigned/removed 
according to the "hovered" state. I'll leave it up to you to define your 
own decorator.


Regards,
Daniel


On 26.03.2014 11:18, Micha wrote:
> Hi,
>
> even after reading the appearance, theme and decorator docs I just don't
> see how to configure a highlight effect for an basic.Image object (when
> hovered).
>
> ok, I can catch mouseover / mouseout and change the image to show, but I
> thought I can do this with theming ...
>
> How to do this?
>
> cheers,
>   Michael
>
>
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to