Class CustomButton

java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.nebula.widgets.collapsiblebuttons.CustomButton
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable

public class CustomButton
extends org.eclipse.swt.widgets.Composite
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static int BUTTON_HEIGHT  

    Fields inherited from class org.eclipse.swt.widgets.Control

    handle
  • Constructor Summary

    Constructors 
    Constructor Description
    CustomButton​(CollapsibleButtons parent, int style, java.lang.String text, org.eclipse.swt.graphics.Image image, org.eclipse.swt.graphics.Image toolBarImage, java.lang.String toolTip, ISettings settings)
    Creates a new CustomButton.
  • Method Summary

    Modifier and Type Method Description
    void dispose()
    Disposes this button and removes it from the control.
    org.eclipse.swt.graphics.Image getImage()
    Returns the big image.
    int getNumber()
    Internal function.
    java.lang.String getText()
    Returns the button label text
    org.eclipse.swt.graphics.Image getToolBarImage()
    Returns the toolbar image
    java.lang.String getToolTip()
    Returns the tooltip text
    void setImage​(org.eclipse.swt.graphics.Image image)
    Sets the big image.
    void setNumber​(int number)
    Internal function.
    void setText​(java.lang.String text)
    Sets the visible text
    void setToolBarImage​(org.eclipse.swt.graphics.Image toolBarImage)
    Sets the toolbar image.
    void setToolTip​(java.lang.String toolTip)
    Sets the tooltip text.
    java.lang.String toString()  
    void updateHover​(boolean hover)
    Updates the hover state.
    void updateSelection​(boolean selected)
    Updates the selection state.

    Methods inherited from class org.eclipse.swt.widgets.Composite

    changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList

    Methods inherited from class org.eclipse.swt.widgets.Scrollable

    computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar

    Methods inherited from class org.eclipse.swt.widgets.Control

    addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update

    Methods inherited from class org.eclipse.swt.widgets.Widget

    addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.swt.graphics.Drawable

    isAutoScalable
  • Field Details

  • Constructor Details

    • CustomButton

      public CustomButton​(CollapsibleButtons parent, int style, java.lang.String text, org.eclipse.swt.graphics.Image image, org.eclipse.swt.graphics.Image toolBarImage, java.lang.String toolTip, ISettings settings)
      Creates a new CustomButton.
      Parameters:
      parent - ButtonComposite parent
      style - Widget style
      text - Label text
      image - Image to show, null if none
      toolBarImage - Tooolbar image, null if none
      toolTip - Tooltip text
      settings - Button painter class that decides look and feel of button
  • Method Details

    • updateHover

      public void updateHover​(boolean hover)
      Updates the hover state.
      Parameters:
      hover - true for hover, false for off
    • updateSelection

      public void updateSelection​(boolean selected)
      Updates the selection state.
      Parameters:
      selected - true for selected, false for not
    • getText

      public java.lang.String getText()
      Returns the button label text
      Returns:
      Button text
    • getToolTip

      public java.lang.String getToolTip()
      Returns the tooltip text
      Returns:
      Tooltip text
    • getToolBarImage

      public org.eclipse.swt.graphics.Image getToolBarImage()
      Returns the toolbar image
      Returns:
      Toolbar image
    • setText

      public void setText​(java.lang.String text)
      Sets the visible text
      Parameters:
      text -
    • setToolBarImage

      public void setToolBarImage​(org.eclipse.swt.graphics.Image toolBarImage)
      Sets the toolbar image.
      Parameters:
      toolBarImage -
    • setToolTip

      public void setToolTip​(java.lang.String toolTip)
      Sets the tooltip text.
      Parameters:
      toolTip -
    • getImage

      public org.eclipse.swt.graphics.Image getImage()
      Returns the big image.
      Returns:
      Image
    • setImage

      public void setImage​(org.eclipse.swt.graphics.Image image)
      Sets the big image.
      Parameters:
      image - to set
    • setNumber

      public void setNumber​(int number)
      Internal function. This is used to keep a list of numbered buttons in memory via an ever-increasing integer value for setting the order of buttons back to their original position when buttons are permanently hidden/shown. Should you wish to use this, for some reason, then make sure that there is no gap in numbers in the buttons and that they start at 0.
      Parameters:
      number -
    • getNumber

      public int getNumber()
      Internal function. Returns the current number for this button. The number reflects what position in the list the button has - visually.
      Returns:
      Number
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class org.eclipse.swt.widgets.Composite
    • dispose

      public void dispose()
      Disposes this button and removes it from the control.
      Overrides:
      dispose in class org.eclipse.swt.widgets.Widget