Class CTabFolder
- java.lang.Object
-
- org.eclipse.swt.widgets.Widget
-
- org.eclipse.swt.widgets.Control
-
- org.eclipse.swt.widgets.Scrollable
-
- org.eclipse.swt.widgets.Composite
-
- org.eclipse.swt.custom.CTabFolder
-
- All Implemented Interfaces:
Drawable
public class CTabFolder extends Composite
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 usingCTabItem#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"
IMPORTANT: This class is not intended to be subclassed.
- See Also:
- CTabFolder, CTabItem snippets, SWT Example: CustomControlExample, Sample code and further information
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Field Summary
Fields Modifier and Type Field Description static RGB
borderInsideRGB
Deprecated.drop shadow border is no longer drawn in 3.0static RGB
borderMiddleRGB
Deprecated.drop shadow border is no longer drawn in 3.0static RGB
borderOutsideRGB
Deprecated.drop shadow border is no longer drawn in 3.0int
marginHeight
marginHeight specifies the number of points of vertical margin that will be placed along the top and bottom edges of the form.int
marginWidth
marginWidth specifies the number of points of horizontal margin that will be placed along the left and right edges of the form.int
MIN_TAB_WIDTH
Deprecated.This field is no longer used.
-
Constructor Summary
Constructors Constructor Description CTabFolder(Composite parent, int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addCTabFolder2Listener(CTabFolder2Listener 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.void
addCTabFolderListener(CTabFolderListener listener)
Deprecated.use addCTabFolder2Listener(CTabFolder2Listener)void
addSelectionListener(SelectionListener 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 theSelectionListener
interface.Rectangle
computeTrim(int x, int y, int width, int height)
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.boolean
getBorderVisible()
Returnstrue
if the receiver's border is visible.Rectangle
getClientArea()
Returns a rectangle which describes the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings").boolean
getHighlightEnabled()
Returnstrue
if the selected tab is rendered as highlighted.CTabItem
getItem(int index)
Return the tab that is located at the specified index.CTabItem
getItem(Point pt)
Gets the item at a point in the widget.int
getItemCount()
Return the number of tabs in the folder.CTabItem[]
getItems()
Return the tab items.boolean
getMaximized()
Returnstrue
if the receiver is maximized.boolean
getMaximizeVisible()
Returnstrue
if the maximize button is visible.boolean
getMinimized()
Returnstrue
if the receiver is minimized.boolean
getMinimizeVisible()
Returnstrue
if the minimize button is visible.int
getMinimumCharacters()
Returns the number of characters that will appear in a fully compressed tab.boolean
getMRUVisible()
Returnstrue
if the receiver displays most recently used tabs andfalse
otherwise.CTabFolderRenderer
getRenderer()
Returns the receiver's renderer.CTabItem
getSelection()
Return the selected tab item, or null if there is no selection.Color
getSelectionBackground()
Returns the receiver's selection background color.Color
getSelectionForeground()
Returns the receiver's selection foreground color.int
getSelectionIndex()
Return the index of the selected tab item, or -1 if there is no selection.boolean
getSimple()
Returnstrue
if the CTabFolder is rendered with a simple, traditional shape.boolean
getSingle()
Returnstrue
if the CTabFolder only displays the selected tab andfalse
if the CTabFolder displays multiple tabs.int
getStyle()
Returns the receiver's style information.int
getTabHeight()
Returns the height of the tabint
getTabPosition()
Returns the position of the tab.Control
getTopRight()
Returns the control in the top right corner of the tab folder.int
getTopRightAlignment()
Returns the alignment of the top right control.boolean
getUnselectedCloseVisible()
Returnstrue
if the close button appears when the user hovers over an unselected tabs.boolean
getUnselectedImageVisible()
Returnstrue
if an image appears in unselected tabs.int
indexOf(CTabItem item)
Return the index of the specified tab or -1 if the tab is not in the receiver.void
removeCTabFolder2Listener(CTabFolder2Listener listener)
Removes the listener.void
removeCTabFolderListener(CTabFolderListener listener)
Deprecated.see removeCTabFolderCloseListener(CTabFolderListener)void
removeSelectionListener(SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.void
reskin(int flags)
Marks the widget to be skinned.void
setBackground(Color color)
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.void
setBackground(Color[] colors, int[] percents)
Specify a gradient of colors to be drawn in the background of the unselected tabs.void
setBackground(Color[] colors, int[] percents, boolean vertical)
Specify a gradient of colors to be drawn in the background of the unselected tab.void
setBackgroundImage(Image image)
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.void
setBorderVisible(boolean show)
Toggle the visibility of the borderboolean
setFocus()
Causes the receiver to have the keyboard focus, such that all keyboard events will be delivered to it.void
setFont(Font font)
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.void
setForeground(Color color)
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.void
setHighlightEnabled(boolean enabled)
Sets whether the selected tab is rendered as highlighted.void
setInsertMark(int index, boolean after)
Display an insert marker before or after the specified tab item.void
setInsertMark(CTabItem item, boolean after)
Display an insert marker before or after the specified tab item.void
setLayout(Layout layout)
Sets the layout which is associated with the receiver to be the argument which may be null.void
setMaximized(boolean maximize)
Sets the maximized state of the receiver.void
setMaximizeVisible(boolean visible)
Marks the receiver's maximize button as visible if the argument istrue
, and marks it invisible otherwise.void
setMinimized(boolean minimize)
Sets the minimized state of the receiver.void
setMinimizeVisible(boolean visible)
Marks the receiver's minimize button as visible if the argument istrue
, and marks it invisible otherwise.void
setMinimumCharacters(int count)
Sets the minimum number of characters that will be displayed in a fully compressed tab.void
setMRUVisible(boolean 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.void
setRenderer(CTabFolderRenderer renderer)
Sets the renderer which is associated with the receiver to be the argument which may be null.void
setSelection(int index)
Set the selection to the tab at the specified index.void
setSelection(CTabItem item)
Set the selection to the tab at the specified item.void
setSelectionBackground(Color 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.void
setSelectionBackground(Color[] colors, int[] percents)
Specify a gradient of colours to be draw in the background of the selected tab.void
setSelectionBackground(Color[] colors, int[] percents, boolean vertical)
Specify a gradient of colours to be draw in the background of the selected tab.void
setSelectionBackground(Image image)
Set the image to be drawn in the background of the selected tab.void
setSelectionForeground(Color color)
Set the foreground color of the selected tab.void
setSimple(boolean simple)
Sets the shape that the CTabFolder will use to render itself.void
setSingle(boolean single)
Sets the number of tabs that the CTabFolder should displayvoid
setTabHeight(int height)
Specify a fixed height for the tab items.void
setTabPosition(int position)
Specify whether the tabs should appear along the top of the folder or along the bottom of the folder.void
setTopRight(Control control)
Set the control that appears in the top right corner of the tab folder.void
setTopRight(Control control, int alignment)
Set the control that appears in the top right corner of the tab folder.void
setUnselectedCloseVisible(boolean visible)
Specify whether the close button appears when the user hovers over an unselected tabs.void
setUnselectedImageVisible(boolean visible)
Specify whether the image appears on unselected tabs.void
showItem(CTabItem item)
Shows the item.void
showSelection()
Shows the selection.-
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setLayoutDeferred, setTabList, toString
-
Methods inherited from class org.eclipse.swt.widgets.Scrollable
getHorizontalBar, getScrollbarsMode, getVerticalBar
-
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
-
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
-
-
-
Field Detail
-
marginWidth
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. The default value is 0.
-
marginHeight
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. The default value is 0.
-
MIN_TAB_WIDTH
@Deprecated public int MIN_TAB_WIDTH
Deprecated.This field is no longer used. See setMinimumCharacters(int)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. NOTE This field is badly named and can not be fixed for backwards compatibility. It should not be capitalized.
-
borderInsideRGB
@Deprecated public static RGB borderInsideRGB
Deprecated.drop shadow border is no longer drawn in 3.0Color of innermost line of drop shadow border. NOTE This field is badly named and can not be fixed for backwards compatibility. It should be capitalized.
-
borderMiddleRGB
@Deprecated public static RGB borderMiddleRGB
Deprecated.drop shadow border is no longer drawn in 3.0Color of middle line of drop shadow border. NOTE This field is badly named and can not be fixed for backwards compatibility. It should be capitalized.
-
borderOutsideRGB
@Deprecated public static RGB borderOutsideRGB
Deprecated.drop shadow border is no longer drawn in 3.0Color of outermost line of drop shadow border. NOTE This field is badly named and can not be fixed for backwards compatibility. It should be capitalized.
-
-
Constructor Detail
-
CTabFolder
public CTabFolder(Composite parent, int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.The style value is either one of the style constants defined in class
SWT
which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using theint
"|" operator) two or more of thoseSWT
style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.- Parameters:
parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of widget to construct- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the parent is null
SWTException
-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- See Also:
SWT.TOP
,SWT.BOTTOM
,SWT.FLAT
,SWT.BORDER
,SWT.SINGLE
,SWT.MULTI
,getStyle()
-
-
Method Detail
-
addCTabFolder2Listener
public void addCTabFolder2Listener(CTabFolder2Listener 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.- Parameters:
listener
- the listener which should be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
- See Also:
CTabFolder2Listener
,removeCTabFolder2Listener(CTabFolder2Listener)
-
addCTabFolderListener
@Deprecated public void addCTabFolderListener(CTabFolderListener listener)
Deprecated.use addCTabFolder2Listener(CTabFolder2Listener)Adds the listener to the collection of listeners who will be notified when a tab item is closed.- Parameters:
listener
- the listener which should be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- See Also:
CTabFolderListener
,removeCTabFolderListener(CTabFolderListener)
-
addSelectionListener
public void addSelectionListener(SelectionListener 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 theSelectionListener
interface.widgetSelected
is called when the user changes the selected tab.widgetDefaultSelected
is not called.- Parameters:
listener
- the listener which should be notified when the user changes the receiver's selection- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
SelectionListener
,removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,SelectionEvent
-
computeTrim
public Rectangle computeTrim(int x, int y, int width, int height)
Description copied from class:Scrollable
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.In other words, it returns a rectangle such that, if the receiver's bounds were set to that rectangle, the area of the receiver 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).
- Overrides:
computeTrim
in classScrollable
- Parameters:
x
- the desired x coordinate of the client areay
- the desired y coordinate of the client areawidth
- the desired width of the client areaheight
- the desired height of the client area- Returns:
- the required bounds to produce the given client area
- See Also:
Scrollable.getClientArea()
-
getBorderVisible
public boolean getBorderVisible()
Returnstrue
if the receiver's border is visible.- Returns:
- the receiver's border visibility state
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
getClientArea
public Rectangle getClientArea()
Description copied from class:Scrollable
Returns a rectangle which describes the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings").- Overrides:
getClientArea
in classScrollable
- Returns:
- the client area
- See Also:
Scrollable.computeTrim(int, int, int, int)
-
getItem
public CTabItem getItem(int index)
Return the tab that is located at the specified index.- Parameters:
index
- the index of the tab item- Returns:
- the item at the specified index
- Throws:
IllegalArgumentException
-- ERROR_INVALID_RANGE - if the index is out of range
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
-
getItem
public CTabItem getItem(Point pt)
Gets the item at a point in the widget.- Parameters:
pt
- the point in coordinates relative to the CTabFolder- Returns:
- the item at a point or null
- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
-
getItemCount
public int getItemCount()
Return the number of tabs in the folder.- Returns:
- the number of tabs in the folder
- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
-
getItems
public CTabItem[] getItems()
Return the tab items.- Returns:
- the tab items
- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
-
getMinimized
public boolean getMinimized()
Returnstrue
if the receiver is minimized.- Returns:
- the receiver's minimized state
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
getMinimizeVisible
public boolean getMinimizeVisible()
Returnstrue
if the minimize button is visible.- Returns:
- the visibility of the minimized button
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
getMinimumCharacters
public int getMinimumCharacters()
Returns the number of characters that will appear in a fully compressed tab.- Returns:
- number of characters that will appear in a fully compressed tab
- Since:
- 3.0
-
getMaximized
public boolean getMaximized()
Returnstrue
if the receiver is maximized.- Returns:
- the receiver's maximized state
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
getMaximizeVisible
public boolean getMaximizeVisible()
Returnstrue
if the maximize button is visible.- Returns:
- the visibility of the maximized button
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
getMRUVisible
public boolean getMRUVisible()
Returnstrue
if the receiver displays most recently used tabs andfalse
otherwise.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. When the MRU visibility is turned on, the tabs that are visible will be the tabs most recently selected. Tabs will still maintain their left to right order based on index but only the most recently selected tabs are visible.
For example, consider a CTabFolder that contains "Tab 1", "Tab 2", "Tab 3" and "Tab 4" (in order by index). The user selects "Tab 1" and then "Tab 3". If the CTabFolder is now compressed so that only two tabs are visible, by default, "Tab 2" and "Tab 3" will be shown ("Tab 3" since it is currently selected and "Tab 2" because it is the previous item in index order). If MRU visibility is enabled, the two visible tabs will be "Tab 1" and "Tab 3" (in that order from left to right).
- Returns:
- the receiver's header's visibility state
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
-
getRenderer
public CTabFolderRenderer getRenderer()
Returns the receiver's renderer.- Returns:
- the receiver's renderer
- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.6
- See Also:
setRenderer(CTabFolderRenderer)
,CTabFolderRenderer
-
getSelection
public CTabItem getSelection()
Return the selected tab item, or null if there is no selection.- Returns:
- the selected tab item, or null if none has been selected
- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
-
getSelectionBackground
public Color getSelectionBackground()
Returns the receiver's selection background color.- Returns:
- the selection background color of the receiver
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
getSelectionForeground
public Color getSelectionForeground()
Returns the receiver's selection foreground color.- Returns:
- the selection foreground color of the receiver
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
getSelectionIndex
public int getSelectionIndex()
Return the index of the selected tab item, or -1 if there is no selection.- Returns:
- the index of the selected tab item or -1
- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
-
getSimple
public boolean getSimple()
Returnstrue
if the CTabFolder is rendered with a simple, traditional shape.- Returns:
true
if the CTabFolder is rendered with a simple shape- Since:
- 3.0
-
getSingle
public boolean getSingle()
Returnstrue
if the CTabFolder only displays the selected tab andfalse
if the CTabFolder displays multiple tabs.- Returns:
true
if the CTabFolder only displays the selected tab andfalse
if the CTabFolder displays multiple tabs- Since:
- 3.0
-
getStyle
public int getStyle()
Description copied from class:Widget
Returns the receiver's style information.Note that the value which is returned by this method may not match the value which was provided to the constructor when the receiver was created. This can occur when the underlying operating system does not support a particular combination of requested styles. For example, if the platform widget used to implement a particular SWT widget always has scroll bars, the result of calling this method would always have the
SWT.H_SCROLL
andSWT.V_SCROLL
bits set.
-
getTabHeight
public int getTabHeight()
Returns the height of the tab- Returns:
- the height of the tab
- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
-
getTabPosition
public int getTabPosition()
Returns the position of the tab. Possible values are SWT.TOP or SWT.BOTTOM.- Returns:
- the position of the tab
- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
-
getTopRight
public Control getTopRight()
Returns the control in the top right corner of the tab folder. Typically this is a close button or a composite with a menu and close button.- Returns:
- the control in the top right corner of the tab folder or null
- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 2.1
-
getTopRightAlignment
public int getTopRightAlignment()
Returns the alignment of the top right control.- Returns:
- the alignment of the top right control which is either
SWT.RIGHT
orSWT.FILL
- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.6
-
getUnselectedCloseVisible
public boolean getUnselectedCloseVisible()
Returnstrue
if the close button appears when the user hovers over an unselected tabs.- Returns:
true
if the close button appears on unselected tabs- Since:
- 3.0
-
getUnselectedImageVisible
public boolean getUnselectedImageVisible()
Returnstrue
if an image appears in unselected tabs.- Returns:
true
if an image appears in unselected tabs- Since:
- 3.0
-
indexOf
public int indexOf(CTabItem item)
Return the index of the specified tab or -1 if the tab is not in the receiver.- Parameters:
item
- the tab item for which the index is required- Returns:
- the index of the specified tab item or -1
- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
-
removeCTabFolder2Listener
public void removeCTabFolder2Listener(CTabFolder2Listener listener)
Removes the listener.- Parameters:
listener
- the listener which should no longer be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
- See Also:
addCTabFolder2Listener(CTabFolder2Listener)
-
removeCTabFolderListener
@Deprecated public void removeCTabFolderListener(CTabFolderListener listener)
Deprecated.see removeCTabFolderCloseListener(CTabFolderListener)Removes the listener.- Parameters:
listener
- the listener which should no longer be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
-
removeSelectionListener
public void removeSelectionListener(SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.- Parameters:
listener
- the listener which should no longer be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
SelectionListener
,addSelectionListener(org.eclipse.swt.events.SelectionListener)
-
reskin
public void reskin(int flags)
Description copied from class:Widget
Marks the widget to be skinned.The skin event is sent to the receiver's display when appropriate (usually before the next event is handled). Widgets are automatically marked for skinning upon creation as well as when its skin id or class changes. The skin id and/or class can be changed by calling
Display.setData(String, Object)
with the keysSWT.SKIN_ID
and/orSWT.SKIN_CLASS
. Once the skin event is sent to a widget, it will not be sent again unlessreskin(int)
is called on the widget or on an ancestor while specifying theSWT.ALL
flag.The parameter
flags
may be either:
-
setBackground
public void setBackground(Color color)
Description copied from class:Control
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.Note: This operation is a hint and may be overridden by the platform.
- Overrides:
setBackground
in classControl
- Parameters:
color
- the new color (or null)
-
setBackground
public void setBackground(Color[] colors, int[] percents)
Specify a gradient of colors to be drawn in the background of the unselected tabs. For example to draw a gradient that varies from dark blue to blue and then to white, use the following call to setBackground:cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), display.getSystemColor(SWT.COLOR_BLUE), display.getSystemColor(SWT.COLOR_WHITE), display.getSystemColor(SWT.COLOR_WHITE)}, new int[] {25, 50, 100});
- Parameters:
colors
- an array of Color that specifies the colors to appear in the gradient in order of appearance left to right. The valuenull
clears the background gradient. The valuenull
can be used inside the array of Color to specify the background color.percents
- 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 thepercents
array must be one less than the size of thecolors
array.- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.6
-
setBackground
public void setBackground(Color[] colors, int[] percents, boolean vertical)
Specify a gradient of colors to be drawn in the background of the unselected tab. For example to draw a vertical gradient that varies from dark blue to blue and then to white, use the following call to setBackground:cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), display.getSystemColor(SWT.COLOR_BLUE), display.getSystemColor(SWT.COLOR_WHITE), display.getSystemColor(SWT.COLOR_WHITE)}, new int[] {25, 50, 100}, true);
- Parameters:
colors
- an array of Color that specifies the colors to appear in the gradient in order of appearance left to right. The valuenull
clears the background gradient. The valuenull
can be used inside the array of Color to specify the background color.percents
- 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 thepercents
array must be one less than the size of thecolors
array.vertical
- indicate the direction of the gradient.True
is vertical andfalse
is horizontal.- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.6
-
setBackgroundImage
public void setBackgroundImage(Image image)
Description copied from class:Control
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. The background image is tiled to fill the available space.Note: This operation is a hint and may be overridden by the platform. For example, on Windows the background of a Button cannot be changed.
- Overrides:
setBackgroundImage
in classControl
- Parameters:
image
- the new image (or null)
-
setBorderVisible
public void setBorderVisible(boolean show)
Toggle the visibility of the border- Parameters:
show
- true if the border should be displayed- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setFocus
public boolean setFocus()
Description copied from class:Control
Causes the receiver to have the keyboard focus, such that all keyboard events will be delivered to it. Focus reassignment will respect applicable platform constraints.- Overrides:
setFocus
in classComposite
- Returns:
true
if the control got focus, andfalse
if it was unable to.- See Also:
Control.forceFocus()
-
setFont
public void setFont(Font font)
Description copied from class:Control
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.
-
setForeground
public void setForeground(Color color)
Description copied from class:Control
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.Note: This operation is a hint and may be overridden by the platform.
- Overrides:
setForeground
in classControl
- Parameters:
color
- the new color (or null)
-
setInsertMark
public void setInsertMark(CTabItem item, boolean after)
Display an insert marker before or after the specified tab item. A value of null will clear the mark.- Parameters:
item
- the item with which the mark is associated or nullafter
- true if the mark should be displayed after the specified item- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setInsertMark
public void setInsertMark(int index, boolean after)
Display an insert marker before or after the specified tab item. A value of -1 will clear the mark.- Parameters:
index
- the index of the item with which the mark is associated or -1after
- true if the mark should be displayed after the specified item- Throws:
IllegalArgumentException
-- ERROR_INVALID_ARGUMENT when the index is invalid
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setMaximizeVisible
public void setMaximizeVisible(boolean visible)
Marks the receiver's maximize button as visible if the argument istrue
, and marks it invisible otherwise.- Parameters:
visible
- the new visibility state- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
setLayout
public void setLayout(Layout layout)
Sets the layout which is associated with the receiver to be the argument which may be null.Note: No Layout can be set on this Control because it already manages the size and position of its children.
- Overrides:
setLayout
in classComposite
- Parameters:
layout
- the receiver's new layout or null- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setMaximized
public void setMaximized(boolean maximize)
Sets the maximized state of the receiver.- Parameters:
maximize
- the new maximized state- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
setMinimizeVisible
public void setMinimizeVisible(boolean visible)
Marks the receiver's minimize button as visible if the argument istrue
, and marks it invisible otherwise.- Parameters:
visible
- the new visibility state- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
setMinimized
public void setMinimized(boolean minimize)
Sets the minimized state of the receiver.- Parameters:
minimize
- the new minimized state- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
setMinimumCharacters
public void setMinimumCharacters(int count)
Sets the minimum number of characters that will be displayed in a fully compressed tab.- Parameters:
count
- the minimum number of characters that will be displayed in a fully compressed tab- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_INVALID_RANGE - if the count is less than zero
- Since:
- 3.0
-
setMRUVisible
public void setMRUVisible(boolean 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. When the MRU visibility is turned on, the tabs that are visible will be the tabs most recently selected. Tabs will still maintain their left to right order based on index but only the most recently selected tabs are visible.For example, consider a CTabFolder that contains "Tab 1", "Tab 2", "Tab 3" and "Tab 4" (in order by index). The user selects "Tab 1" and then "Tab 3". If the CTabFolder is now compressed so that only two tabs are visible, by default, "Tab 2" and "Tab 3" will be shown ("Tab 3" since it is currently selected and "Tab 2" because it is the previous item in index order). If MRU visibility is enabled, the two visible tabs will be "Tab 1" and "Tab 3" (in that order from left to right).
- Parameters:
show
- the new visibility state- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
-
setRenderer
public void setRenderer(CTabFolderRenderer renderer)
Sets the renderer which is associated with the receiver to be the argument which may be null. In the case of null, the default renderer is used.- Parameters:
renderer
- a new renderer- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.6
- See Also:
CTabFolderRenderer
-
setSelection
public void setSelection(CTabItem item)
Set the selection to the tab at the specified item.- Parameters:
item
- the tab item to be selected- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the item is null
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
-
setSelection
public void setSelection(int index)
Set the selection to the tab at the specified index.- Parameters:
index
- the index of the tab item to be selected- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setSelectionBackground
public void setSelectionBackground(Color 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.- Parameters:
color
- the new color (or null)- Throws:
IllegalArgumentException
-- ERROR_INVALID_ARGUMENT - if the argument has been disposed
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
setSelectionBackground
public void setSelectionBackground(Color[] colors, int[] percents)
Specify a gradient of colours to be draw in the background of the selected tab. For example to draw a gradient that varies from dark blue to blue and then to white, use the following call to setBackground:cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), display.getSystemColor(SWT.COLOR_BLUE), display.getSystemColor(SWT.COLOR_WHITE), display.getSystemColor(SWT.COLOR_WHITE)}, new int[] {25, 50, 100});
- Parameters:
colors
- an array of Color that specifies the colors to appear in the gradient in order of appearance left to right. The valuenull
clears the background gradient. The valuenull
can be used inside the array of Color to specify the background color.percents
- 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.- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
-
setSelectionBackground
public void setSelectionBackground(Color[] colors, int[] percents, boolean vertical)
Specify a gradient of colours to be draw in the background of the selected tab. For example to draw a vertical gradient that varies from dark blue to blue and then to white, use the following call to setBackground:cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), display.getSystemColor(SWT.COLOR_BLUE), display.getSystemColor(SWT.COLOR_WHITE), display.getSystemColor(SWT.COLOR_WHITE)}, new int[] {25, 50, 100}, true);
- Parameters:
colors
- an array of Color that specifies the colors to appear in the gradient in order of appearance left to right. The valuenull
clears the background gradient. The valuenull
can be used inside the array of Color to specify the background color.percents
- 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.vertical
- indicate the direction of the gradient. True is vertical and false is horizontal.- Throws:
SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
setSelectionBackground
public void setSelectionBackground(Image image)
Set the image to be drawn in the background of the selected tab. Image is stretched or compressed to cover entire selection tab area.- Parameters:
image
- the image to be drawn in the background- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setSelectionForeground
public void setSelectionForeground(Color color)
Set the foreground color of the selected tab.- Parameters:
color
- the color of the text displayed in the selected tab- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setSimple
public void setSimple(boolean simple)
Sets the shape that the CTabFolder will use to render itself.- Parameters:
simple
-true
if the CTabFolder should render itself in a simple, traditional style- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
setSingle
public void setSingle(boolean single)
Sets the number of tabs that the CTabFolder should display- Parameters:
single
-true
if only the selected tab should be displayed otherwise, multiple tabs will be shown.- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
setTabHeight
public void setTabHeight(int height)
Specify a fixed height for the tab items. If no height is specified, the default height is the height of the text or the image, whichever is greater. Specifying a height of -1 will revert to the default height.- Parameters:
height
- the point value of the height or -1- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_INVALID_ARGUMENT - if called with a height of less than 0
-
setTabPosition
public void setTabPosition(int position)
Specify whether the tabs should appear along the top of the folder or along the bottom of the folder.- Parameters:
position
-SWT.TOP
for tabs along the top orSWT.BOTTOM
for tabs along the bottom- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_INVALID_ARGUMENT - if the position value is not either SWT.TOP or SWT.BOTTOM
- Since:
- 3.0
-
setTopRight
public void setTopRight(Control control)
Set the control that appears in the top right corner of the tab folder. Typically this is a close button or a composite with a Menu and close button. The topRight control is optional. Setting the top right control to null will remove it from the tab folder.- Parameters:
control
- the control to be displayed in the top right corner or null- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_INVALID_ARGUMENT - if the control is disposed, or not a child of this CTabFolder
- Since:
- 2.1
-
setTopRight
public void setTopRight(Control control, int alignment)
Set the control that appears in the top right corner of the tab folder. Typically this is a close button or a composite with a Menu and close button. The topRight control is optional. Setting the top right control to null will remove it from the tab folder.The alignment parameter sets the layout of the control in the tab area.
SWT.RIGHT
will cause the control to be positioned on the far right of the folder and it will have its default size.SWT.FILL
will size the control to fill all the available space to the right of the last tab. If there is no available space, the control will not be visible.SWT.RIGHT | SWT.WRAP
will allow the control to wrap below the tabs if there is not enough available space to the right of the last tab.- Parameters:
control
- the control to be displayed in the top right corner or nullalignment
-SWT.RIGHT
orSWT.FILL
orSWT.RIGHT | SWT.WRAP
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_INVALID_ARGUMENT - if the control is disposed, or not a child of this CTabFolder
- Since:
- 3.0
-
setUnselectedCloseVisible
public void setUnselectedCloseVisible(boolean visible)
Specify whether the close button appears when the user hovers over an unselected tabs.- Parameters:
visible
-true
makes the close button appear- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
setUnselectedImageVisible
public void setUnselectedImageVisible(boolean visible)
Specify whether the image appears on unselected tabs.- Parameters:
visible
-true
makes the image appear- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.0
-
showItem
public void showItem(CTabItem item)
Shows the item. If the item is already showing in the receiver, this method simply returns. Otherwise, the items are scrolled until the item is visible.- Parameters:
item
- the item to be shown- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the item is null
- ERROR_INVALID_ARGUMENT - if the item has been disposed
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 2.0
- See Also:
showSelection()
-
showSelection
public void showSelection()
Shows the selection. If the selection is already showing in the receiver, this method simply returns. Otherwise, the items are scrolled until the selection is visible.- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 2.0
- See Also:
showItem(CTabItem)
-
setHighlightEnabled
public void setHighlightEnabled(boolean enabled)
Sets whether the selected tab is rendered as highlighted.- Parameters:
enabled
-true
if the selected tab should be highlighted,false
otherwise.- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.106
-
getHighlightEnabled
public boolean getHighlightEnabled()
Returnstrue
if the selected tab is rendered as highlighted.- Returns:
true
if the selected tab is rendered as highlighted- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.106
-
-