Class ScalingMouseWheelListener

  • All Implemented Interfaces:
    EventListener, org.eclipse.swt.events.MouseWheelListener, org.eclipse.swt.internal.SWTEventListener

    public class ScalingMouseWheelListener
    extends Object
    implements org.eclipse.swt.events.MouseWheelListener
    A MouseWheelListener that can be added to a NatTable instance to support zoom operations while having the CTRL key pressed and the mousewheel scrolled. Will support 12 dpi min and 288 dpi max.

    To support zooming of images (e.g. checkboxes) the registration of the ImagePainter need to be overriden in updatePainter().

    Since:
    2.0
    • Constructor Detail

      • ScalingMouseWheelListener

        public ScalingMouseWheelListener()
        Creates a new ScalingMouseWheelListener without an updater.

        Note:
        Without an updater manually registered painters will not be updated and therefore won't reflect the updated scaling. This only works in combination with theme styling, as the painter update is implemented in the themes internally.

      • ScalingMouseWheelListener

        public ScalingMouseWheelListener​(Consumer<IConfigRegistry> updater)
        Creates a new ScalingMouseWheelListener with the given updater.
        Parameters:
        updater - The updater that should be called on zoom operations. Needed to reflect the updated scaling. E.g. re-register ImagePainters like the CheckBoxPainter, otherwise the images will not be updated according to the scaling.
    • Method Detail

      • mouseScrolled

        public void mouseScrolled​(org.eclipse.swt.events.MouseEvent e)
        Specified by:
        mouseScrolled in interface org.eclipse.swt.events.MouseWheelListener