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

public Class CTabFolder

extends Composite
Class Inheritance
Imports
org.eclipse.swt.*, org.eclipse.swt.accessibility.*, org.eclipse.swt.events.*, org.eclipse.swt.graphics.*, org.eclipse.swt.internal.*, org.eclipse.swt.internal.DPIUtil.*, org.eclipse.swt.widgets.*

Instances of this class implement the notebook user interface metaphor. It allows the user to select a notebook page from set of pages.

The item children that may be added to instances of this class must be of type CTabItem. Control children are created and then set into a tab item using CTabItem#setControl.

Note that although this class is a subclass of Composite, it does not make sense to set a layout on it.

Styles:
CLOSE, TOP, BOTTOM, FLAT, BORDER, SINGLE, MULTI
Events:
Selection
"CTabFolder2"
Note: Only one of the styles TOP and BOTTOM may be specified.

Important Note

This class is not intended to be subclassed.

See Also
CTabFolder, CTabItem snippets, SWT Example: CustomControlExample, Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv static final int
pack-priv Rectangle[]
public static RGB
borderInsideRGB

Color of innermost line of drop shadow border.

public static RGB
borderMiddleRGB

Color of middle line of drop shadow border.

public static RGB
borderOutsideRGB

Color of outermost line of drop shadow border.

pack-priv boolean
pack-priv int
pack-priv Image
pack-priv ToolItem
pack-priv ToolBar
pack-priv boolean
pack-priv int[]
pack-priv Image[]
pack-priv Rectangle[]
pack-priv Control[]
pack-priv static final int
pack-priv static final int
pack-priv int
firstIndex

index of the left most visible tab.

pack-priv int
pack-priv CTabFolder2Listener[]
pack-priv static final int
pack-priv Color[]
pack-priv int[]
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv Rectangle
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv CTabItem[]
pack-priv Listener
public int
marginHeight

marginHeight specifies the number of points of vertical margin that will be placed along the top and bottom edges of the form.

public int
marginWidth

marginWidth specifies the number of points of horizontal margin that will be placed along the left and right edges of the form.

pack-priv Image
pack-priv boolean
pack-priv ToolItem
public int
MIN_TAB_WIDTH

A multiple of the tab height that specifies the minimum width to which a tab will be compressed before scrolling arrows are used to navigate the tabs.

pack-priv int
pack-priv Image
pack-priv boolean
pack-priv ToolItem
pack-priv ToolBar
pack-priv boolean
pack-priv Font
pack-priv Point
pack-priv boolean
pack-priv int[]
priority

Indices of the elements in the items array, used to manage tab visibility and candidates to be hidden/shown next.

pack-priv static final int
pack-priv static final int
pack-priv CTabFolderRenderer
pack-priv int
pack-priv static final int
pack-priv static final int
pack-priv Color
pack-priv Image
pack-priv Color
pack-priv Color[]
pack-priv int[]
pack-priv boolean
pack-priv int
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv Menu
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv static final int
pack-priv int
pack-priv CTabFolderListener[]
pack-priv Control
pack-priv int
pack-priv static final int
pack-priv int
pack-priv Runnable
pack-priv boolean
Inherited from org.eclipse.swt.widgets.Composite:
embeddedHandle

Constructor Summary

AccessConstructor and Description
public
CTabFolder(Composite
a widget which will be the parent of the new instance (cannot be null)
parent
,
int
the style of widget to construct
style
)

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

Method Summary

Modifier and TypeMethod and Description
pack-priv char
pack-priv String
_getToolTip(int x, int y)

pack-priv void
_setToolTipText(int x, int y)

public void
addCTabFolder2Listener(CTabFolder2Listener
the listener which should be notified
listener
)

Adds the listener to the collection of listeners who will be notified when a tab item is closed, minimized, maximized, restored, or to show the list of items that are not currently visible.

public void
addCTabFolderListener(CTabFolderListener
the listener which should be notified
listener
)

Deprecated use addCTabFolder2Listener(CTabFolder2Listener)
Adds the listener to the collection of listeners who will be notified when a tab item is closed.
public void
addSelectionListener(SelectionListener
the listener which should be notified when the user changes the receiver's selection
listener
)

Adds the listener to the collection of listeners who will be notified when the user changes the receiver's selection, by sending it one of the messages defined in the SelectionListener interface.

pack-priv void
addTabControl(Control
the control to be displayed in the top right corner or null
control
,
int
valid combinations are:
  • SWT.LEAD
  • SWT.TRAIL (| SWT.FILL | SWT.WRAP)
flags
)

Set a control that can appear to the left or to the right of the folder tabs.

pack-priv void
addTabControl(Control control, int flags, int index, boolean update)

pack-priv static int
checkStyle(Composite parent, int style)

pack-priv Rectangle[]
computeControlBounds(Point size, boolean[][] position)

public Rectangle
computeTrim(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
)

Overrides org.eclipse.swt.widgets.Scrollable.computeTrim.

Given a desired client area for the receiver (as described by the arguments), returns the bounding rectangle which would be required to produce that client area.
pack-priv Image
createButtonImage(Display display, int button)

pack-priv void
createItem(CTabItem item, int index)

pack-priv void
public boolean

Returns:

the receiver's border visibility state
getBorderVisible
()

Returns true if the receiver's border is visible.

pack-priv ToolBar
pack-priv int

Returns:

the chevron count
getChevronCount
()

Get the number of hidden items or the number which is to be drawn in the chevon item.

pack-priv boolean

Returns:

the visibility of the chevron button
getChevronVisible
()

Returns true if the chevron button is visible when necessary.

public Rectangle
getClientArea()

Overrides org.eclipse.swt.widgets.Scrollable.getClientArea.

Returns a rectangle which describes the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings").
pack-priv int
pack-priv int
getControlY(Point size, Rectangle[] rects, int borderBottom, int borderTop, int i)

public boolean

Returns:

true if the selected tab is rendered as highlighted.
getHighlightEnabled
()

Returns true if the selected tab is rendered as highlighted.

public CTabItem

Returns:

the item at the specified index
getItem
(int
the index of the tab item
index
)

Return the tab that is located at the specified index.

public CTabItem

Returns:

the item at a point or null
getItem
(Point
the point in coordinates relative to the CTabFolder
pt
)

Gets the item at a point in the widget.

public int

Returns:

the number of tabs in the folder
getItemCount
()

Return the number of tabs in the folder.

public CTabItem[]

Returns:

the tab items
getItems
()

Return the tab items.

pack-priv int
getLeftItemEdge(GC gc, int part)

public boolean

Returns:

the receiver's maximized state
getMaximized
()

Returns true if the receiver is maximized.

public boolean

Returns:

the visibility of the maximized button
getMaximizeVisible
()

Returns true if the maximize button is visible.

public boolean

Returns:

the receiver's minimized state
getMinimized
()

Returns true if the receiver is minimized.

public boolean

Returns:

the visibility of the minimized button
getMinimizeVisible
()

Returns true if the minimize button is visible.

public int

Returns:

number of characters that will appear in a fully compressed tab
getMinimumCharacters
()

Returns the number of characters that will appear in a fully compressed tab.

public boolean

Returns:

the receiver's header's visibility state
getMRUVisible
()

Returns true if the receiver displays most recently used tabs and false otherwise.

public CTabFolderRenderer

Returns:

the receiver's renderer
getRenderer
()

Returns the receiver's renderer.

pack-priv int
public boolean

Returns:

true if an image appears in selected tabs
getSelectedImageVisible
()

Returns true if an image appears in selected tabs.

public CTabItem

Returns:

the selected tab item, or null if none has been selected
getSelection
()

Return the selected tab item, or null if there is no selection.

public Color

Returns:

the selection background color of the receiver
getSelectionBackground
()

Returns the receiver's selection background color.

public Color

Returns:

the selection foreground color of the receiver
getSelectionForeground
()

Returns the receiver's selection foreground color.

public int

Returns:

the index of the selected tab item or -1
getSelectionIndex
()

Return the index of the selected tab item, or -1 if there is no selection.

public boolean

Returns:

true if the CTabFolder is rendered with a simple shape
getSimple
()

Returns true if the CTabFolder is rendered with a simple, traditional shape.

public boolean

Returns:

true if the CTabFolder only displays the selected tab and false if the CTabFolder displays multiple tabs
getSingle
()

Returns true if the CTabFolder only displays the selected tab and false if the CTabFolder displays multiple tabs.

public int
getStyle()

Overrides org.eclipse.swt.widgets.Widget.getStyle.

Returns the receiver's style information.
public int

Returns:

the height of the tab
getTabHeight
()

Returns the height of the tab

public int

Returns:

the position of the tab
getTabPosition
()

Returns the position of the tab.

public Control

Returns:

the control in the top right corner of the tab folder or null
getTopRight
()

Returns the control in the top right corner of the tab folder.

public int

Returns:

the alignment of the top right control which is either SWT.RIGHT or SWT.FILL
getTopRightAlignment
()

Returns the alignment of the top right control.

public boolean

Returns:

true if the close button appears on unselected tabs
getUnselectedCloseVisible
()

Returns true if the close button appears when the user hovers over an unselected tabs.

public boolean

Returns:

true if an image appears in unselected tabs
getUnselectedImageVisible
()

Returns true if an image appears in unselected tabs.

pack-priv int
public int

Returns:

the index of the specified tab item or -1
indexOf
(CTabItem
the tab item for which the index is required
item
)

Return the index of the specified tab or -1 if the tab is not in the receiver.

pack-priv void
init(int style)

pack-priv void
pack-priv void
pack-priv void
pack-priv boolean
private void
pack-priv void
pack-priv void
pack-priv void
pack-priv void
pack-priv void
onFocus(Event event)

pack-priv void
pack-priv void
pack-priv boolean
onMnemonic(Event event, boolean doit)

pack-priv void
onMouse(Event event)

pack-priv void
pack-priv void
pack-priv void
onPaint(Event event)

pack-priv void
onResize(Event event)

pack-priv void
pack-priv void
pack-priv void
public void
removeCTabFolder2Listener(CTabFolder2Listener
the listener which should no longer be notified
listener
)

Removes the listener.

public void
removeCTabFolderListener(CTabFolderListener
the listener which should no longer be notified
listener
)

Deprecated see removeCTabFolderCloseListener(CTabFolderListener)
Removes the listener.
public void
removeSelectionListener(SelectionListener
the listener which should no longer be notified
listener
)

Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.

pack-priv void
removeTabControl(Control
the control to be removed
control
)

Removes the control from the list of tab controls.

pack-priv void
removeTabControl(Control control, boolean update)

public void
reskin(int
the flags specifying how to reskin
flags
)

Overrides org.eclipse.swt.widgets.Widget.reskin.

Marks the widget to be skinned.
pack-priv void
public void
setBackground(Color
the new color (or null)
color
)

Overrides org.eclipse.swt.widgets.Control.setBackground.

Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.
public void
setBackground(Color[]
an array of Color that specifies the colors to appear in the gradient in order of appearance left to right. The value null clears the background gradient. The value null can be used inside the array of Color to specify the background color.
colors
,
int[]
an array of integers between 0 and 100 specifying the percent of the width of the widget at which the color should change. The size of the percents array must be one less than the size of the colors array.
percents
)

Specify a gradient of colors to be drawn in the background of the unselected tabs.

public void
setBackground(Color[]
an array of Color that specifies the colors to appear in the gradient in order of appearance left to right. The value null clears the background gradient. The value null can be used inside the array of Color to specify the background color.
colors
,
int[]
an array of integers between 0 and 100 specifying the percent of the width of the widget at which the color should change. The size of the percents array must be one less than the size of the colors array.
percents
,
boolean
indicate the direction of the gradient. True is vertical and false is horizontal.
vertical
)

Specify a gradient of colors to be drawn in the background of the unselected tab.

public void
setBackgroundImage(Image
the new image (or null)
image
)

Overrides org.eclipse.swt.widgets.Control.setBackgroundImage.

Sets the receiver's background image to the image specified by the argument, or to the default system color for the control if the argument is null.
public void
setBorderVisible(boolean
true if the border should be displayed
show
)

Toggle the visibility of the border

pack-priv void
setButtonBounds()

Update button bounds for min/max and update chevron button.

pack-priv void
setChevronVisible(boolean visible)

Sets whether a chevron is shown when there are more items to be displayed.

public boolean
setFocus()

Overrides org.eclipse.swt.widgets.Composite.setFocus.

Causes the receiver to have the keyboard focus, such that all keyboard events will be delivered to it.
public void
setFont(Font
the new font (or null)
font
)

Overrides org.eclipse.swt.widgets.Control.setFont.

Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.
public void
setForeground(Color
the new color (or null)
color
)

Overrides org.eclipse.swt.widgets.Control.setForeground.

Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.
public void
setHighlightEnabled(boolean
true if the selected tab should be highlighted, false otherwise.
enabled
)

Sets whether the selected tab is rendered as highlighted.

public void
setInsertMark(CTabItem
the item with which the mark is associated or null
item
,
boolean
true if the mark should be displayed after the specified item
after
)

Display an insert marker before or after the specified tab item.

public void
setInsertMark(int
the index of the item with which the mark is associated or -1
index
,
boolean
true if the mark should be displayed after the specified item
after
)

Display an insert marker before or after the specified tab item.

pack-priv boolean
pack-priv void
setItemOrder(int[]
an array containing the new indices for all items
indices
)

Reorder the items of the receiver.

pack-priv boolean
public void
setLayout(Layout
the receiver's new layout or null
layout
)

Overrides org.eclipse.swt.widgets.Composite.setLayout.

Sets the layout which is associated with the receiver to be the argument which may be null.
public void
setMaximized(boolean
the new maximized state
maximize
)

Sets the maximized state of the receiver.

public void
setMaximizeVisible(boolean
the new visibility state
visible
)

Marks the receiver's maximize button as visible if the argument is true, and marks it invisible otherwise.

public void
setMinimized(boolean
the new minimized state
minimize
)

Sets the minimized state of the receiver.

public void
setMinimizeVisible(boolean
the new visibility state
visible
)

Marks the receiver's minimize button as visible if the argument is true, and marks it invisible otherwise.

public void
setMinimumCharacters(int
the minimum number of characters that will be displayed in a fully compressed tab
count
)

Sets the minimum number of characters that will be displayed in a fully compressed tab.

public void
setMRUVisible(boolean
the new visibility state
show
)

When there is not enough horizontal space to show all the tabs, by default, tabs are shown sequentially from left to right in order of their index.

public void
setRenderer(CTabFolderRenderer
a new renderer
renderer
)

Sets the renderer which is associated with the receiver to be the argument which may be null.

public void
setSelectedImageVisible(boolean
true makes the image appear
visible
)

Specify whether the image appears on selected tabs.

public void
setSelection(CTabItem
the tab item to be selected
item
)

Set the selection to the tab at the specified item.

public void
setSelection(int
the index of the tab item to be selected
index
)

Set the selection to the tab at the specified index.

pack-priv void
setSelection(int index, boolean notify)

public void
setSelectionBackground(Color
the new color (or null)
color
)

Sets the receiver's selection background color to the color specified by the argument, or to the default system color for the control if the argument is null.

public void
setSelectionBackground(Color[]
an array of Color that specifies the colors to appear in the gradient in order of appearance left to right. The value null clears the background gradient. The value null can be used inside the array of Color to specify the background color.
colors
,
int[]
an array of integers between 0 and 100 specifying the percent of the width of the widget at which the color should change. The size of the percents array must be one less than the size of the colors array.
percents
)

Specify a gradient of colours to be draw in the background of the selected tab.

public void
setSelectionBackground(Color[]
an array of Color that specifies the colors to appear in the gradient in order of appearance left to right. The value null clears the background gradient. The value null can be used inside the array of Color to specify the background color.
colors
,
int[]
an array of integers between 0 and 100 specifying the percent of the width of the widget at which the color should change. The size of the percents array must be one less than the size of the colors array.
percents
,
boolean
indicate the direction of the gradient. True is vertical and false is horizontal.
vertical
)

Specify a gradient of colours to be draw in the background of the selected tab.

public void
setSelectionBackground(Image
the image to be drawn in the background
image
)

Set the image to be drawn in the background of the selected tab.

public void
setSelectionBarThickness(int
the desired thickness. Must be positive and lower than CTabFolderRenderer#ITEM_TOP_MARGIN (that is either 0 1 or 2 at the moment),for correct results. Set to 0 to not draw a highlight bar.
thickness
)

Sets the thickness of the highlight bar on the selected tab.

public void
setSelectionForeground(Color
the color of the text displayed in the selected tab
color
)

Set the foreground color of the selected tab.

pack-priv void
public void
setSimple(boolean
true if the CTabFolder should render itself in a simple, traditional style
simple
)

Sets the shape that the CTabFolder will use to render itself.

public void
setSingle(boolean
true if only the selected tab should be displayed otherwise, multiple tabs will be shown.
single
)

Sets the number of tabs that the CTabFolder should display

public void
setTabHeight(int
the point value of the height or -1
height
)

Specify a fixed height for the tab items.

public void
setTabPosition(int
SWT.TOP for tabs along the top or SWT.BOTTOM for tabs along the bottom
position
)

Specify whether the tabs should appear along the top of the folder or along the bottom of the folder.

public void
setTopRight(Control
the control to be displayed in the top right corner or null
control
)

Set the control that appears in the top right corner of the tab folder.

public void
setTopRight(Control
the control to be displayed in the top right corner or null
control
,
int
SWT.RIGHT or SWT.FILL or SWT.RIGHT | SWT.WRAP
alignment
)

Set the control that appears in the top right corner of the tab folder.

public void
setUnselectedCloseVisible(boolean
true makes the close button appear
visible
)

Specify whether the close button appears when the user hovers over an unselected tabs.

public void
setUnselectedImageVisible(boolean
true makes the image appear
visible
)

Specify whether the image appears on unselected tabs.

pack-priv boolean
public void
showItem(CTabItem
the item to be shown
item
)

Shows the item.

pack-priv void
public void
showSelection()

Shows the selection.

pack-priv String
pack-priv void
updateBkImages(boolean colorChanged)

pack-priv void
updateButtons()

Create or dispose min/max buttons.

private void
updateChevronImage(boolean
true if the update is required for changed appearance of the chevron. In this case the image is not created if it does not already exist and is updated even if the drawn number (chevonCount) has not changed.
styleChange
)

Update the cached chevron image.

pack-priv void
updateFolder(int flags)

pack-priv boolean
pack-priv boolean
updateItems(int showIndex)

private void
updateMaxImage()

Update the cached maximize button image when color is changed.

private void
updateMinImage()

Update the cached minimize button image when color is changed.

pack-priv boolean
updateTabHeight(boolean force)

Inherited from org.eclipse.swt.widgets.Composite:
changedcheckSubclassdrawBackgroundgetBackgroundModegetChildrengetLayoutgetLayoutDeferredgetTabListisLayoutDeferredlayoutlayoutlayoutlayoutlayoutsetBackgroundModesetLayoutDeferredsetTabListtoString