Class RedmondShelfRenderer


  • public class RedmondShelfRenderer
    extends AbstractRenderer

    NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS.

    • Field Detail

      • initialColors

        private org.eclipse.swt.graphics.Color[] initialColors
      • textMargin

        private int textMargin
      • margin

        private int margin
      • parent

        private PShelf parent
      • spacing

        private int spacing
      • initialFont

        private org.eclipse.swt.graphics.Font initialFont
      • initialOpenFont

        private org.eclipse.swt.graphics.Font initialOpenFont
      • gradient1

        private org.eclipse.swt.graphics.Color gradient1
      • gradient2

        private org.eclipse.swt.graphics.Color gradient2
      • font

        private org.eclipse.swt.graphics.Font font
      • selectedFont

        private org.eclipse.swt.graphics.Font selectedFont
      • selectedGradient1

        private org.eclipse.swt.graphics.Color selectedGradient1
      • selectedGradient2

        private org.eclipse.swt.graphics.Color selectedGradient2
      • hoverGradient1

        private org.eclipse.swt.graphics.Color hoverGradient1
      • hoverGradient2

        private org.eclipse.swt.graphics.Color hoverGradient2
      • lineColor

        private org.eclipse.swt.graphics.Color lineColor
      • selectedForeground

        private org.eclipse.swt.graphics.Color selectedForeground
      • hoverForeground

        private org.eclipse.swt.graphics.Color hoverForeground
      • foreground

        private org.eclipse.swt.graphics.Color foreground
    • Constructor Detail

      • RedmondShelfRenderer

        public RedmondShelfRenderer()
    • Method Detail

      • computeSize

        public org.eclipse.swt.graphics.Point computeSize​(org.eclipse.swt.graphics.GC gc,
                                                          int wHint,
                                                          int hHint,
                                                          java.lang.Object value)
        Returns the size of the given value's visual representation.
        Specified by:
        computeSize in class AbstractRenderer
        Parameters:
        gc - convenience GC for string and text extents
        wHint - given width (or SWT.DEFAULT)
        hHint - given height (or SWT.DEFAULT)
        value - value to be sized
        Returns:
        the size
      • paint

        public void paint​(org.eclipse.swt.graphics.GC gc,
                          java.lang.Object value)
        Description copied from class: AbstractRenderer
        Paints the visual representation of the given value on the given GC. The actual class of the value object is determined by the use of the implementing class.

        Implementors need to respect the bounds values that may have been specified. The bounds values may affect the x and y values for all drawing operations as well as the width and heights. Implementors may use a Transform to translate the coordinates of all the drawing operations, otherwise they will need to offset each draw.

        Specified by:
        paint in class AbstractRenderer
        Parameters:
        gc - GC to paint with
        value - the value being painted
        See Also:
        AbstractRenderer.paint(org.eclipse.swt.graphics.GC, java.lang.Object)
      • getLineColor

        public org.eclipse.swt.graphics.Color getLineColor()
      • setLineColor

        public void setLineColor​(org.eclipse.swt.graphics.Color lineColor)
      • getFont

        public org.eclipse.swt.graphics.Font getFont()
      • setFont

        public void setFont​(org.eclipse.swt.graphics.Font font)
      • getGradient1

        public org.eclipse.swt.graphics.Color getGradient1()
      • setGradient1

        public void setGradient1​(org.eclipse.swt.graphics.Color gradient1)
      • getGradient2

        public org.eclipse.swt.graphics.Color getGradient2()
      • setGradient2

        public void setGradient2​(org.eclipse.swt.graphics.Color gradient2)
      • getHoverGradient1

        public org.eclipse.swt.graphics.Color getHoverGradient1()
      • setHoverGradient1

        public void setHoverGradient1​(org.eclipse.swt.graphics.Color hoverGradient1)
      • getHoverGradient2

        public org.eclipse.swt.graphics.Color getHoverGradient2()
      • setHoverGradient2

        public void setHoverGradient2​(org.eclipse.swt.graphics.Color hoverGradient2)
      • getSelectedFont

        public org.eclipse.swt.graphics.Font getSelectedFont()
      • setSelectedFont

        public void setSelectedFont​(org.eclipse.swt.graphics.Font selectedFont)
      • getSelectedForeground

        public org.eclipse.swt.graphics.Color getSelectedForeground()
      • setSelectedForeground

        public void setSelectedForeground​(org.eclipse.swt.graphics.Color selectedForeground)
        Sets text color for the selected item.
        Parameters:
        selectedForeground - Can be null, foreground color of the parent is used in that case.
      • getHoverForeground

        public org.eclipse.swt.graphics.Color getHoverForeground()
      • setHoverForeground

        public void setHoverForeground​(org.eclipse.swt.graphics.Color hoverForeground)
        Sets text color for the hovered item.
        Parameters:
        hoverForeground - Can be null, foreground color of the parent is used in that case.
      • getForeground

        public org.eclipse.swt.graphics.Color getForeground()
      • setForeground

        public void setForeground​(org.eclipse.swt.graphics.Color foreground)
        Sets text color for non-selected items.
        Parameters:
        foreground - Can be null, foreground color of the parent is used in that case.
      • getSelectedGradient1

        public org.eclipse.swt.graphics.Color getSelectedGradient1()
      • setSelectedGradient1

        public void setSelectedGradient1​(org.eclipse.swt.graphics.Color selectedGradient1)
      • getSelectedGradient2

        public org.eclipse.swt.graphics.Color getSelectedGradient2()
      • setSelectedGradient2

        public void setSelectedGradient2​(org.eclipse.swt.graphics.Color selectedGradient2)
      • getShortString

        private static java.lang.String getShortString​(org.eclipse.swt.graphics.GC gc,
                                                       java.lang.String t,
                                                       int width)
      • blend

        private static int blend​(int v1,
                                 int v2,
                                 int ratio)
      • blend

        private static org.eclipse.swt.graphics.RGB blend​(org.eclipse.swt.graphics.RGB c1,
                                                          org.eclipse.swt.graphics.RGB c2,
                                                          int ratio)
      • createNewBlendedColor

        private static org.eclipse.swt.graphics.Color createNewBlendedColor​(org.eclipse.swt.graphics.Color c1,
                                                                            org.eclipse.swt.graphics.Color c2,
                                                                            int ratio)
      • createNewReverseColor

        private static org.eclipse.swt.graphics.Color createNewReverseColor​(org.eclipse.swt.graphics.Color c)
      • saturate

        private static org.eclipse.swt.graphics.RGB saturate​(org.eclipse.swt.graphics.RGB rgb,
                                                             float saturation)
      • createNewSaturatedColor

        private static org.eclipse.swt.graphics.Color createNewSaturatedColor​(org.eclipse.swt.graphics.Color c,
                                                                              float saturation)