Class ColorWheelWidget.Wheel

  • All Implemented Interfaces:
    org.eclipse.swt.graphics.Drawable
    Enclosing class:
    ColorWheelWidget

    protected class ColorWheelWidget.Wheel
    extends org.eclipse.swt.widgets.Canvas
    This class represents hue and saturation color wheel to pick a color from.
    The color wheel itself is drawn as a background image. The cursor is drawn in the paint event handler.
    • Field Summary

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

        handle
    • Constructor Summary

      Constructors 
      Constructor Description
      Wheel​(org.eclipse.swt.widgets.Composite parent, int style, int radius)
      Constructs a new instance of ColorWheelWidget.Wheel widget with the specified radius.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.eclipse.swt.graphics.Point computeSize​(int wHint, int hHint, boolean changed)  
      protected org.eclipse.swt.graphics.Image constructWheelImage​(int radius, org.eclipse.swt.graphics.Color bgColor)
      Creates the color wheel image with the specified radius.
      protected org.eclipse.swt.graphics.Image getColorWheelImage​(int radius, org.eclipse.swt.graphics.Color bgColor)
      The method looks for color wheel image in the image registry.
      protected int getSize​(int radius)
      The common way to get color wheel size (=width=height)
      • Methods inherited from class org.eclipse.swt.widgets.Canvas

        drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
      • 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, toString
      • 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, 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, 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, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData
      • Methods inherited from interface org.eclipse.swt.graphics.Drawable

        isAutoScalable
    • Constructor Detail

      • Wheel

        public Wheel​(org.eclipse.swt.widgets.Composite parent,
                     int style,
                     int radius)
        Constructs a new instance of ColorWheelWidget.Wheel widget with the specified radius.
    • Method Detail

      • getColorWheelImage

        protected org.eclipse.swt.graphics.Image getColorWheelImage​(int radius,
                                                                    org.eclipse.swt.graphics.Color bgColor)
        The method looks for color wheel image in the image registry. If it finds one with required size, it returns it. Otherwise it turns to its parent to create a new brand one with the specified radius.
        The method also updates the image registry and deals unnecessary image disposal.
        This way we have a kind of color-wheel-image-singleton
      • getSize

        protected int getSize​(int radius)
        The common way to get color wheel size (=width=height)
      • constructWheelImage

        protected org.eclipse.swt.graphics.Image constructWheelImage​(int radius,
                                                                     org.eclipse.swt.graphics.Color bgColor)
        Creates the color wheel image with the specified radius.
        This method is protected to let descendants cache the image.
        Parameters:
        radius - the radius of the color wheel
        bgColor - the background color to fill the outer fields with
      • computeSize

        public org.eclipse.swt.graphics.Point computeSize​(int wHint,
                                                          int hHint,
                                                          boolean changed)
        Overrides:
        computeSize in class org.eclipse.swt.widgets.Control