Class FlatToolbarButton

All Implemented Interfaces:
Drawable

public class FlatToolbarButton extends IZ_CLabel
A button that behaves like a flat button should do, i.e. also works under e.g. Windows 7, where the SWT.FLAT look doesn't work for SWT.PUSH. The button only has an image, no text.
Author:
Christopher Mindus
  • Constructor Details Link icon

    • FlatToolbarButton Link icon

      public FlatToolbarButton(Composite parent, String workBenchImage, IFlatToolbarButton listener)
      Creates the toolbar button.
      Parameters:
      parent - The parent composite.
      workBenchImage - The workbench image (dual), from org.eclipse.ui.ISharedImages.IMG_* (e.g. ISharedImages.IMG_TOOL_CUT).
      listener - The button listener, can be null.
      Throws:
      NullPointerException - If image is null.
    • FlatToolbarButton Link icon

      public FlatToolbarButton(Composite parent, Image image, IFlatToolbarButton listener)
      Creates the toolbar button.
      Parameters:
      parent - The parent composite.
      image - The normal image, cannot be null, also used as hover image.
      listener - The button listener, can be null.
      Throws:
      NullPointerException - If image is null.
    • FlatToolbarButton Link icon

      public FlatToolbarButton(Composite parent, Image image, Image imageDisabled, IFlatToolbarButton listener)
      Creates the toolbar button.
      Parameters:
      parent - The parent composite.
      image - The normal image, cannot be null, also used as hover image.
      imageDisabled - The disabled image, if null, a grayed normal image is used.
      listener - The button listener, can be null.
      Throws:
      NullPointerException - If image is null.
    • FlatToolbarButton Link icon

      public FlatToolbarButton(Composite parent, Image image, Image imageHover, Image imageDisabled, IFlatToolbarButton listener)
      Creates the toolbar button.
      Parameters:
      parent - The parent composite.
      image - The normal image, cannot be null.
      imageHover - The hover image, if null, the normal image is used.
      imageDisabled - The disabled image, if null, a grayed normal image is used.
      listener - The button listener, can be null.
      Throws:
      NullPointerException - If image is null.
  • Method Details Link icon

    • setSelection Link icon

      public void setSelection(boolean on)
      Sets the selection state in case the button is used as a toggle button.
    • getSelection Link icon

      public boolean getSelection()
      Gets the current selection state when button is a toggle button.
    • setDoubleClickListener Link icon

      public void setDoubleClickListener(Runnable r)
      Sets the double-click listener.
    • setListener Link icon

      public void setListener(IFlatToolbarButton listener)
      Sets the listener.
    • setEnabled Link icon

      public void setEnabled(boolean on)
      Overrides the enabled method.
      Overrides:
      setEnabled in class Control
    • setImage Link icon

      public void setImage(Image image)
      Overrides setImage.
      Overrides:
      setImage in class CLabel
    • setDisabledImage Link icon

      public void setDisabledImage(Image image)
      The disabled image.
    • setHoverImage Link icon

      public void setHoverImage(Image image)
      The hover image.
    • computeSize Link icon

      public Point computeSize(int wHint, int hHint, boolean changed)
      Computes the size. The size is 23x20.
      Overrides:
      computeSize in class CLabel