Package org.eclipse.swt.custom

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

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`MINIMUM_SIZE`
`protected CTabFolder`
`parent`
`static final int`
`PART_BACKGROUND`
Part constant indicating the background of the tab folder.
`static final int`
`PART_BODY`
Part constant indicating the body of the tab folder.
`static final int`
`PART_BORDER`
Part constant indicating the border of the tab folder.
`static final int`
`PART_CHEVRON_BUTTON`
Part constant indicating the chevron button of the tab folder.
`static final int`
`PART_CLOSE_BUTTON`
Part constant indicating the close button of a tab item.
`static final int`
`PART_HEADER`
Part constant indicating the tab header of the folder (value is -2).
`static final int`
`PART_MAX_BUTTON`
Part constant indicating the maximize button of the tab folder.
`static final int`
`PART_MIN_BUTTON`
Part constant indicating the minimize button of the tab folder.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`CTabFolderRenderer(CTabFolder parent)`
Constructs a new instance of this class given its parent.

## Method Summary

Modifier and Type
Method
Description
`protected Point`
`computeSize(int part, int state, GC gc, int wHint, int hHint)`
Returns the preferred size of a part.
`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.
`protected void`
`dispose()`
Dispose of any operating system resources associated with the renderer.
`protected void`
`draw(int part, int state, Rectangle bounds, GC gc)`
Draw a specified `part` of the CTabFolder using the provided `bounds` and `GC`.

### Methods inherited from class java.lang.Object

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

## Field Details

### parent

protected CTabFolder parent

### PART_BODY

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)`
  - Constant Field Values

### PART_HEADER

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)`
  - Constant Field Values

### PART_BORDER

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)`
  - Constant Field Values

### PART_BACKGROUND

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)`
  - Constant Field Values

### PART_MAX_BUTTON

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)`
  - Constant Field Values

### PART_MIN_BUTTON

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)`
  - Constant Field Values

### PART_CHEVRON_BUTTON

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)`
  - Constant Field Values

### PART_CLOSE_BUTTON

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)`
  - Constant Field Values

### MINIMUM_SIZE

public static final int MINIMUM_SIZE

See Also:
  - Constant Field Values

## 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:
  - `Widget.getStyle()`

## Method Details

### 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

### 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:
  - `valid part and state values`

### 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

### 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