Class CTabFolderRenderer

java.lang.Object
org.eclipse.swt.custom.CTabFolderRenderer

public class CTabFolderRenderer extends Object
Instances of this class provide all of the measuring and drawing functionality required by CTabFolder. This class can be subclassed in order to customize the look of a CTabFolder.
Since:
3.6
See Also:
  • Field Details

  • Constructor Details

    • CTabFolderRenderer

      protected CTabFolderRenderer(CTabFolder parent)
      Constructs a new instance of this class given its parent.
      Parameters:
      parent - CTabFolder
      Throws:
      IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the parent is disposed
      See Also:
  • Method Details

    • antialias

      void antialias(int[] shape, Color innerColor, Color outerColor, GC gc)
    • computeSize

      protected Point computeSize(int part, int state, GC gc, int wHint, int hHint)
      Returns the preferred size of a part.

      The preferred size of a part is the size that it would best be displayed at. The width hint and height hint arguments allow the caller to ask a control questions such as "Given a particular width, how high does the part need to be to show all of the contents?" To indicate that the caller does not wish to constrain a particular dimension, the constant SWT.DEFAULT is passed for the hint.

      The part value indicated what component the preferred size is to be calculated for. Valid values are any of the part constants:

      • PART_BODY
      • PART_HEADER
      • PART_BORDER
      • PART_BACKGROUND
      • PART_MAX_BUTTON
      • PART_MIN_BUTTON
      • PART_CHEVRON_BUTTON
      • PART_CLOSE_BUTTON
      • A positive integer which is the index of an item in the CTabFolder.

      The state parameter may be one of the following:

      • SWT.NONE
      • SWT.SELECTED - whether the part is selected
      Parameters:
      part - a part constant
      state - current state
      gc - the gc to use for measuring
      wHint - the width hint (can be SWT.DEFAULT)
      hHint - the height hint (can be SWT.DEFAULT)
      Returns:
      the preferred size of the part
      Since:
      3.6
    • shouldDrawCloseIcon

      private boolean shouldDrawCloseIcon(CTabItem item)
    • getLargeTextPadding

      private int getLargeTextPadding(CTabItem item)
      Returns padding for the text of a tab item when showing images is disabled for the tab folder.
    • shouldApplyLargeTextPadding

      private boolean shouldApplyLargeTextPadding(CTabFolder tabFolder)
    • computeTrim

      protected Rectangle computeTrim(int part, int state, int x, int y, int width, int height)
      Given a desired client area for the part (as described by the arguments), returns the bounding rectangle which would be required to produce that client area.

      In other words, it returns a rectangle such that, if the part's bounds were set to that rectangle, the area of the part which is capable of displaying data (that is, not covered by the "trimmings") would be the rectangle described by the arguments (relative to the receiver's parent).

      Parameters:
      part - one of the part constants
      state - the state of the part
      x - the desired x coordinate of the client area
      y - the desired y coordinate of the client area
      width - the desired width of the client area
      height - the desired height of the client area
      Returns:
      the required bounds to produce the given client area
      Since:
      3.6
      See Also:
    • createAntialiasColors

      void createAntialiasColors()
    • createSelectionHighlightGradientColors

      void createSelectionHighlightGradientColors(Color start)
    • dispose

      protected void dispose()
      Dispose of any operating system resources associated with the renderer. Called by the CTabFolder parent upon receiving the dispose event or when changing the renderer.
      Since:
      3.6
    • disposeAntialiasColors

      void disposeAntialiasColors()
    • disposeSelectionHighlightGradientColors

      void disposeSelectionHighlightGradientColors()
    • draw

      protected void draw(int part, int state, Rectangle bounds, GC gc)
      Draw a specified part of the CTabFolder using the provided bounds and GC.

      The valid CTabFolder part constants are:

      • PART_BODY - the entire body of the CTabFolder
      • PART_HEADER - the upper tab area of the CTabFolder
      • PART_BORDER - the border of the CTabFolder
      • PART_BACKGROUND - the background of the CTabFolder
      • PART_MAX_BUTTON
      • PART_MIN_BUTTON
      • PART_CHEVRON_BUTTON
      • PART_CLOSE_BUTTON
      • A positive integer which is the index of an item in the CTabFolder.

      The state parameter may be a combination of:

      • SWT.BACKGROUND - whether the background should be drawn
      • SWT.FOREGROUND - whether the foreground should be drawn
      • SWT.SELECTED - whether the part is selected
      • SWT.HOT - whether the part is hot (i.e. mouse is over the part)
      Parameters:
      part - part to draw
      state - state of the part
      bounds - the bounds of the part
      gc - the gc to draw the part on
      Since:
      3.6
    • drawBackground

      void drawBackground(GC gc, Rectangle bounds, int state)
    • drawBackground

      void drawBackground(GC gc, int[] shape, boolean selected)
    • drawBackground

      void drawBackground(GC gc, int[] shape, int x, int y, int width, int height, Color defaultBackground, Image image, Color[] colors, int[] percents, boolean vertical)
    • drawBorder

      void drawBorder(GC gc, int[] shape)
    • drawBody

      void drawBody(GC gc, Rectangle bounds, int state)
    • drawClose

      void drawClose(GC gc, Rectangle closeRect, int closeImageState)
    • drawCloseLines

      private void drawCloseLines(GC gc, int x, int y, int lineLength, boolean hot)
    • drawChevron

      void drawChevron(GC gc, Rectangle chevronRect, int chevronImageState)
    • drawRoundRectangle

      private void drawRoundRectangle(GC gc, Rectangle chevronRect)
    • drawChevronContent

      private void drawChevronContent(GC gc, int x, int y, String chevronString)
    • drawHighlight

      void drawHighlight(GC gc, Rectangle bounds, int state, int rightEdge)
    • drawLeftUnselectedBorder

      void drawLeftUnselectedBorder(GC gc, Rectangle bounds, int state)
    • drawMaximize

      void drawMaximize(GC gc, Rectangle maxRect, int maxImageState)
    • drawMinimize

      void drawMinimize(GC gc, Rectangle minRect, int minImageState)
    • drawRightUnselectedBorder

      void drawRightUnselectedBorder(GC gc, Rectangle bounds, int state)
    • drawSelected

      void drawSelected(int itemIndex, GC gc, Rectangle bounds, int state)
    • getLeftTextMargin

      private int getLeftTextMargin(CTabItem item)
    • drawTabArea

      void drawTabArea(GC gc, Rectangle bounds, int state)
    • drawUnselected

      void drawUnselected(int index, GC gc, Rectangle bounds, int state)
    • fillRegion

      void fillRegion(GC gc, Region region)
    • getFillColor

      Color getFillColor()
    • getChevronFont

      private Font getChevronFont(Display display)
    • isSelectionHighlightColorsCacheHit

      boolean isSelectionHighlightColorsCacheHit(Color start)
    • resetChevronFont

      void resetChevronFont()
    • setSelectionHighlightGradientColor

      void setSelectionHighlightGradientColor(Color start)
    • shortenText

      String shortenText(GC gc, String text, int width)
    • shortenText

      String shortenText(GC gc, String text, int width, String ellipses)
    • updateCurves

      void updateCurves()
    • useEllipses

      boolean useEllipses()