Top Description Fields Constructors Methods
org.eclipse.swt.custom

public Class CTabFolderRenderer

extends Object
Class Inheritance
Imports
org.eclipse.swt.*, org.eclipse.swt.graphics.*, org.eclipse.swt.widgets.*

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
Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv static final int
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
private static final String
private static final int
private Font
pack-priv static final RGB
pack-priv int[]
pack-priv int
pack-priv int
pack-priv static final String
pack-priv Color
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv Color
pack-priv int
public static final int
protected CTabFolder
public static final int
PART_BACKGROUND

Part constant indicating the background of the tab folder.

public static final int
PART_BODY

Part constant indicating the body of the tab folder.

public static final int
PART_BORDER

Part constant indicating the border of the tab folder.

public static final int
PART_CHEVRON_BUTTON

Part constant indicating the chevron button of the tab folder.

public static final int
PART_CLOSE_BUTTON

Part constant indicating the close button of a tab item.

public static final int
PART_HEADER

Part constant indicating the tab header of the folder (value is -2).

public static final int
PART_MAX_BUTTON

Part constant indicating the maximize button of the tab folder.

public static final int
PART_MIN_BUTTON

Part constant indicating the minimize button of the tab folder.

pack-priv Color
pack-priv Color
pack-priv Color
pack-priv Color[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv Color
pack-priv static final int
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv int[]
pack-priv int[]

Constructor Summary

AccessConstructor and Description
protected
CTabFolderRenderer(CTabFolder
CTabFolder
parent
)

Constructs a new instance of this class given its parent.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
antialias(int[] shape, Color innerColor, Color outerColor, GC gc)

protected Point

Returns:

the preferred size of the part
computeSize
(int
a part constant
part
,
int
current state
state
,
GC
the gc to use for measuring
gc
,
int
the width hint (can be SWT.DEFAULT)
wHint
,
int
the height hint (can be SWT.DEFAULT)
hHint
)

Returns the preferred size of a part.

protected Rectangle

Returns:

the required bounds to produce the given client area
computeTrim
(int
one of the part constants
part
,
int
the state of the part
state
,
int
the desired x coordinate of the client area
x
,
int
the desired y coordinate of the client area
y
,
int
the desired width of the client area
width
,
int
the desired height of the client area
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.

pack-priv void
pack-priv void
protected void
dispose()

Dispose of any operating system resources associated with the renderer.

pack-priv void
pack-priv void
protected void
draw(int
part to draw
part
,
int
state of the part
state
,
Rectangle
the bounds of the part
bounds
,
GC
the gc to draw the part on
gc
)

Draw a specified part of the CTabFolder using the provided bounds and GC.

pack-priv void
drawBackground(GC gc, Rectangle bounds, int state)

pack-priv void
drawBackground(GC gc, int[] shape, boolean selected)

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

pack-priv void
drawBody(GC gc, Rectangle bounds, int state)

pack-priv void
drawBorder(GC gc, int[] shape)

pack-priv void
drawChevron(GC gc, Rectangle chevronRect, int chevronImageState)

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

pack-priv void
drawClose(GC gc, Rectangle closeRect, int closeImageState)

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

pack-priv void
drawHighlight(GC gc, Rectangle bounds, int state, int rightEdge)

pack-priv void
drawLeftUnselectedBorder(GC gc, Rectangle bounds, int state)

pack-priv void
drawMaximize(GC gc, Rectangle maxRect, int maxImageState)

pack-priv void
drawMinimize(GC gc, Rectangle minRect, int minImageState)

pack-priv void
drawRightUnselectedBorder(GC gc, Rectangle bounds, int state)

private void
drawRoundRectangle(GC gc, Rectangle chevronRect)

pack-priv void
drawSelected(int itemIndex, GC gc, Rectangle bounds, int state)

pack-priv void
drawTabArea(GC gc, Rectangle bounds, int state)

pack-priv void
drawUnselected(int index, GC gc, Rectangle bounds, int state)

pack-priv void
fillRegion(GC gc, Region region)

private Font
pack-priv Color
private int
getLargeTextPadding(CTabItem item)

Returns padding for the text of a tab item when showing images is disabled for the tab folder.

private int
pack-priv boolean
pack-priv void
pack-priv void
pack-priv String
shortenText(GC gc, String text, int width)

pack-priv String
shortenText(GC gc, String text, int width, String ellipses)

private boolean
private boolean
pack-priv void
pack-priv boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BORDER1_COLORback to summary
pack-priv static final int BORDER1_COLOR
BOTTOM_LEFT_CORNERback to summary
pack-priv static final int[] BOTTOM_LEFT_CORNER
BOTTOM_LEFT_CORNER_BORDERLESSback to summary
pack-priv static final int[] BOTTOM_LEFT_CORNER_BORDERLESS
BOTTOM_RIGHT_CORNERback to summary
pack-priv static final int[] BOTTOM_RIGHT_CORNER
BOTTOM_RIGHT_CORNER_BORDERLESSback to summary
pack-priv static final int[] BOTTOM_RIGHT_CORNER_BORDERLESS
BUTTON_BORDERback to summary
pack-priv static final int BUTTON_BORDER
BUTTON_FILLback to summary
pack-priv static final int BUTTON_FILL
BUTTON_SIZEback to summary
pack-priv static final int BUTTON_SIZE
BUTTON_TRIMback to summary
pack-priv static final int BUTTON_TRIM
CHEVRON_ELLIPSISback to summary
private static final String CHEVRON_ELLIPSIS
CHEVRON_FONT_HEIGHTback to summary
private static final int CHEVRON_FONT_HEIGHT
chevronFontback to summary
private Font chevronFont
CLOSE_FILLback to summary
pack-priv static final RGB CLOSE_FILL
curveback to summary
pack-priv int[] curve
curveIndentback to summary
pack-priv int curveIndent
curveWidthback to summary
pack-priv int curveWidth
ELLIPSISback to summary
pack-priv static final String ELLIPSIS
fillColorback to summary
pack-priv Color fillColor
FLAGSback to summary
pack-priv static final int FLAGS
INTERNAL_SPACINGback to summary
pack-priv static final int INTERNAL_SPACING
ITEM_BOTTOM_MARGINback to summary
pack-priv static final int ITEM_BOTTOM_MARGIN
ITEM_LEFT_MARGINback to summary
pack-priv static final int ITEM_LEFT_MARGIN
ITEM_RIGHT_MARGINback to summary
pack-priv static final int ITEM_RIGHT_MARGIN
ITEM_TOP_MARGINback to summary
pack-priv static final int ITEM_TOP_MARGIN
lastBorderColorback to summary
pack-priv Color lastBorderColor
lastTabHeightback to summary
pack-priv int lastTabHeight
MINIMUM_SIZEback to summary
public static final int MINIMUM_SIZE
parentback to summary
protected CTabFolder parent
PART_BACKGROUNDback to summary
public static final int PART_BACKGROUND

Part constant indicating the background of the tab folder. (value is -4).

See Also
computeSize(int, int, GC, int, int), computeTrim(int, int, int, int, int, int), draw(int, int, Rectangle, GC)
PART_BODYback to summary
public static final int PART_BODY

Part constant indicating the body of the tab folder. The body is the underlying container for all of the tab folder and all other parts are drawn on top of it. (value is -1).

See Also
computeSize(int, int, GC, int, int), computeTrim(int, int, int, int, int, int), draw(int, int, Rectangle, GC)
PART_BORDERback to summary
public static final int PART_BORDER

Part constant indicating the border of the tab folder. (value is -3). The border is drawn around the body and is part of the body trim.

See Also
computeSize(int, int, GC, int, int), computeTrim(int, int, int, int, int, int), draw(int, int, Rectangle, GC)
PART_CHEVRON_BUTTONback to summary
public static final int PART_CHEVRON_BUTTON

Part constant indicating the chevron button of the tab folder. (value is -7).

See Also
computeSize(int, int, GC, int, int), computeTrim(int, int, int, int, int, int), draw(int, int, Rectangle, GC)
PART_CLOSE_BUTTONback to summary
public static final int PART_CLOSE_BUTTON

Part constant indicating the close button of a tab item. (value is -8).

See Also
computeSize(int, int, GC, int, int), computeTrim(int, int, int, int, int, int), draw(int, int, Rectangle, GC)
PART_HEADERback to summary
public static final int PART_HEADER

Part constant indicating the tab header of the folder (value is -2). The header is drawn on top of the body and provides an area for the tabs and other tab folder buttons to be rendered.

See Also
computeSize(int, int, GC, int, int), computeTrim(int, int, int, int, int, int), draw(int, int, Rectangle, GC)
PART_MAX_BUTTONback to summary
public static final int PART_MAX_BUTTON

Part constant indicating the maximize button of the tab folder. (value is -5).

See Also
computeSize(int, int, GC, int, int), computeTrim(int, int, int, int, int, int), draw(int, int, Rectangle, GC)
PART_MIN_BUTTONback to summary
public static final int PART_MIN_BUTTON

Part constant indicating the minimize button of the tab folder. (value is -6).

See Also
computeSize(int, int, GC, int, int), computeTrim(int, int, int, int, int, int), draw(int, int, Rectangle, GC)
selectedInnerColorback to summary
pack-priv Color selectedInnerColor
selectedOuterColorback to summary
pack-priv Color selectedOuterColor
selectionHighlightGradientBeginback to summary
pack-priv Color selectionHighlightGradientBegin
selectionHighlightGradientColorsCacheback to summary
pack-priv Color[] selectionHighlightGradientColorsCache
SIMPLE_BOTTOM_LEFT_CORNERback to summary
pack-priv static final int[] SIMPLE_BOTTOM_LEFT_CORNER
SIMPLE_BOTTOM_LEFT_CORNER_BORDERLESSback to summary
pack-priv static final int[] SIMPLE_BOTTOM_LEFT_CORNER_BORDERLESS
SIMPLE_BOTTOM_RIGHT_CORNERback to summary
pack-priv static final int[] SIMPLE_BOTTOM_RIGHT_CORNER
SIMPLE_BOTTOM_RIGHT_CORNER_BORDERLESSback to summary
pack-priv static final int[] SIMPLE_BOTTOM_RIGHT_CORNER_BORDERLESS
SIMPLE_TOP_LEFT_CORNERback to summary
pack-priv static final int[] SIMPLE_TOP_LEFT_CORNER
SIMPLE_TOP_LEFT_CORNER_BORDERLESSback to summary
pack-priv static final int[] SIMPLE_TOP_LEFT_CORNER_BORDERLESS
SIMPLE_TOP_RIGHT_CORNERback to summary
pack-priv static final int[] SIMPLE_TOP_RIGHT_CORNER
SIMPLE_TOP_RIGHT_CORNER_BORDERLESSback to summary
pack-priv static final int[] SIMPLE_TOP_RIGHT_CORNER_BORDERLESS
SIMPLE_UNSELECTED_INNER_CORNERback to summary
pack-priv static final int[] SIMPLE_UNSELECTED_INNER_CORNER
tabAreaColorback to summary
pack-priv Color tabAreaColor
TABS_WITHOUT_ICONS_PADDINGback to summary
pack-priv static final int TABS_WITHOUT_ICONS_PADDING
TOP_LEFT_CORNERback to summary
pack-priv static final int[] TOP_LEFT_CORNER
TOP_LEFT_CORNER_BORDERLESSback to summary
pack-priv static final int[] TOP_LEFT_CORNER_BORDERLESS
TOP_LEFT_CORNER_HILITEback to summary
pack-priv static final int[] TOP_LEFT_CORNER_HILITE
TOP_RIGHT_CORNERback to summary
pack-priv static final int[] TOP_RIGHT_CORNER
TOP_RIGHT_CORNER_BORDERLESSback to summary
pack-priv static final int[] TOP_RIGHT_CORNER_BORDERLESS
topCurveHighlightEndback to summary
pack-priv int[] topCurveHighlightEnd
topCurveHighlightStartback to summary
pack-priv int[] topCurveHighlightStart

Constructor Detail

CTabFolderRendererback to summary
protected CTabFolderRenderer(CTabFolder parent)

Constructs a new instance of this class given its parent.

Parameters
parent:CTabFolder

CTabFolder

Exceptions
IllegalArgumentException:
  • ERROR_INVALID_ARGUMENT - if the parent is disposed
See Also
Widget#getStyle

Method Detail

antialiasback to summary
pack-priv void antialias(int[] shape, Color innerColor, Color outerColor, GC gc)
computeSizeback to summary
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:int

a part constant

state:int

current state

gc:GC

the gc to use for measuring

wHint:int

the width hint (can be SWT.DEFAULT)

hHint:int

the height hint (can be SWT.DEFAULT)

Returns:Point

the preferred size of the part

Since
3.6
computeTrimback to summary
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:int

one of the part constants

state:int

the state of the part

x:int

the desired x coordinate of the client area

y:int

the desired y coordinate of the client area

width:int

the desired width of the client area

height:int

the desired height of the client area

Returns:Rectangle

the required bounds to produce the given client area

Since
3.6
See Also
valid part and state values
createAntialiasColorsback to summary
pack-priv void createAntialiasColors()
createSelectionHighlightGradientColorsback to summary
pack-priv void createSelectionHighlightGradientColors(Color start)
disposeback to summary
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
disposeAntialiasColorsback to summary
pack-priv void disposeAntialiasColors()
disposeSelectionHighlightGradientColorsback to summary
pack-priv void disposeSelectionHighlightGradientColors()
drawback to summary
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:int

part to draw

state:int

state of the part

bounds:Rectangle

the bounds of the part

gc:GC

the gc to draw the part on

Since
3.6
drawBackgroundback to summary
pack-priv void drawBackground(GC gc, Rectangle bounds, int state)
drawBackgroundback to summary
pack-priv void drawBackground(GC gc, int[] shape, boolean selected)
drawBackgroundback to summary
pack-priv void drawBackground(GC gc, int[] shape, int x, int y, int width, int height, Color defaultBackground, Image image, Color[] colors, int[] percents, boolean vertical)
drawBodyback to summary
pack-priv void drawBody(GC gc, Rectangle bounds, int state)
drawBorderback to summary
pack-priv void drawBorder(GC gc, int[] shape)
drawChevronback to summary
pack-priv void drawChevron(GC gc, Rectangle chevronRect, int chevronImageState)
drawChevronContentback to summary
private void drawChevronContent(GC gc, int x, int y, String chevronString)
drawCloseback to summary
pack-priv void drawClose(GC gc, Rectangle closeRect, int closeImageState)
drawCloseLinesback to summary
private void drawCloseLines(GC gc, int x, int y, int lineLength, boolean hot)
drawHighlightback to summary
pack-priv void drawHighlight(GC gc, Rectangle bounds, int state, int rightEdge)
drawLeftUnselectedBorderback to summary
pack-priv void drawLeftUnselectedBorder(GC gc, Rectangle bounds, int state)
drawMaximizeback to summary
pack-priv void drawMaximize(GC gc, Rectangle maxRect, int maxImageState)
drawMinimizeback to summary
pack-priv void drawMinimize(GC gc, Rectangle minRect, int minImageState)
drawRightUnselectedBorderback to summary
pack-priv void drawRightUnselectedBorder(GC gc, Rectangle bounds, int state)
drawRoundRectangleback to summary
private void drawRoundRectangle(GC gc, Rectangle chevronRect)
drawSelectedback to summary
pack-priv void drawSelected(int itemIndex, GC gc, Rectangle bounds, int state)
drawTabAreaback to summary
pack-priv void drawTabArea(GC gc, Rectangle bounds, int state)
drawUnselectedback to summary
pack-priv void drawUnselected(int index, GC gc, Rectangle bounds, int state)
fillRegionback to summary
pack-priv void fillRegion(GC gc, Region region)
getChevronFontback to summary
private Font getChevronFont(Display display)
getFillColorback to summary
pack-priv Color getFillColor()
getLargeTextPaddingback to summary
private int getLargeTextPadding(CTabItem item)

Returns padding for the text of a tab item when showing images is disabled for the tab folder.

getLeftTextMarginback to summary
private int getLeftTextMargin(CTabItem item)
isSelectionHighlightColorsCacheHitback to summary
pack-priv boolean isSelectionHighlightColorsCacheHit(Color start)
resetChevronFontback to summary
pack-priv void resetChevronFont()
setSelectionHighlightGradientColorback to summary
pack-priv void setSelectionHighlightGradientColor(Color start)
shortenTextback to summary
pack-priv String shortenText(GC gc, String text, int width)
shortenTextback to summary
pack-priv String shortenText(GC gc, String text, int width, String ellipses)
shouldApplyLargeTextPaddingback to summary
private boolean shouldApplyLargeTextPadding(CTabFolder tabFolder)
shouldDrawCloseIconback to summary
private boolean shouldDrawCloseIcon(CTabItem item)
updateCurvesback to summary
pack-priv void updateCurves()
useEllipsesback to summary
pack-priv boolean useEllipses()