public class CTabFolder extends Composite
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.
IMPORTANT: This class is not intended to be subclassed.
Note: Only one of the styles TOP and BOTTOM may be specified.
Implementation Status:
Attributes, found in SWT, that are not supported
true
)Modifier and Type | Field and Description |
---|---|
int |
marginHeight
marginHeight specifies the number of pixels of vertical margin
that will be placed along the top and bottom edges of the form.
|
int |
marginWidth
marginWidth specifies the number of pixels of horizontal margin
that will be placed along the left and right edges of the form.
|
Constructor and 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.
|
Modifier and Type | Method and 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 |
addSelectionListener(SelectionListener listener)
Adds the listener to receive events.
|
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.
|
<T> T |
getAdapter(java.lang.Class<T> adapter)
Implementation of the
Adaptable interface. |
boolean |
getBorderVisible()
Returns
true if the receiver's border is visible. |
int |
getBorderWidth()
Returns the receiver's border width.
|
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").
|
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()
Returns
true if the receiver is maximized. |
boolean |
getMaximizeVisible()
Returns
true if the maximize button
is visible. |
boolean |
getMinimized()
Returns
true if the receiver is minimized. |
boolean |
getMinimizeVisible()
Returns
true if the minimize button
is visible. |
int |
getMinimumCharacters()
Returns the number of characters that will
appear in a fully compressed tab.
|
boolean |
getMRUVisible()
Returns
true if the receiver displays most
recently used tabs and false otherwise. |
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 |
getSingle()
Returns
true if the CTabFolder only displays the selected tab
and false if the CTabFolder displays multiple tabs. |
int |
getStyle()
Returns the receiver's style information.
|
int |
getTabHeight()
Returns the height of the tab
|
int |
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()
Returns
true if the close button appears
when the user hovers over an unselected tabs. |
boolean |
getUnselectedImageVisible()
Returns
true 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 |
removeSelectionListener(SelectionListener listener)
Removes the listener.
|
void |
reskin(int flags)
Marks the widget to be skinned.
|
void |
setBorderVisible(boolean show)
Toggle the visibility of the border
|
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 |
setLayout(Layout layout)
Sets the layout which is associated with the receiver to be
the argument which may be null.
|
void |
setMaximized(boolean maximized)
Sets the maximized state of the receiver.
|
void |
setMaximizeVisible(boolean maximizeVisible)
Marks the receiver's maximize button as visible if the argument is
true ,
and marks it invisible otherwise. |
void |
setMinimized(boolean minimized)
Marks the receiver's minimize button as visible if the argument is
true ,
and marks it invisible otherwise. |
void |
setMinimizeVisible(boolean minimizeVisible)
Marks the receiver's minimize button as visible if the argument is
true ,
and marks it invisible otherwise. |
void |
setMinimumCharacters(int minimumCharacters)
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 |
setSelection(CTabItem item)
Set the selection to the tab at the specified item.
|
void |
setSelection(int index)
Set the selection to the tab at the specified index.
|
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 |
setSingle(boolean single)
Sets the number of tabs that the CTabFolder should display
|
void |
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.
|
changed, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayoutDeferred, setTabList
getHorizontalBar, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addTouchListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getShell, getSize, getToolTipText, getTouchEnabled, getVisible, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCursor, setData, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setSize, setSize, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, update
addDisposeListener, addListener, checkSubclass, checkWidget, dispose, getData, getData, getDisplay, getListeners, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, toString
public int marginWidth
public int marginHeight
public CTabFolder(Composite parent, int style)
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 the int
"|" operator) two or more
of those SWT
style constants. The class description
lists the style constants that are applicable to the class.
Style bits are also inherited from superclasses.
parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of widget to constructjava.lang.IllegalArgumentException
- SWTException
- SWT.TOP
,
SWT.BOTTOM
,
SWT.FLAT
,
SWT.BORDER
,
SWT.SINGLE
,
SWT.MULTI
,
getStyle()
public CTabItem[] getItems()
SWTException
- public CTabItem getItem(int index)
index
- the index of the tab itemjava.lang.IllegalArgumentException
- SWTException
- public CTabItem getItem(Point pt)
pt
- the point in coordinates relative to the CTabFolderSWTException
- public int getItemCount()
SWTException
- public int indexOf(CTabItem item)
item
- the tab item for which the index is requiredjava.lang.IllegalArgumentException
- SWTException
- public void setSelection(int index)
index
- the index of the tab item to be selectedSWTException
- public int getSelectionIndex()
SWTException
- public void setSelection(CTabItem item)
item
- the tab item to be selectedjava.lang.IllegalArgumentException
- SWTException
- public CTabItem getSelection()
SWTException
- public void showSelection()
SWTException
- showItem(CTabItem)
public void showItem(CTabItem item)
item
- the item to be shownjava.lang.IllegalArgumentException
- SWTException
- showSelection()
public void setMRUVisible(boolean show)
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).
show
- the new visibility stateSWTException
- public boolean getMRUVisible()
true
if the receiver displays most
recently used tabs and false
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).
SWTException
- public void setMaximizeVisible(boolean maximizeVisible)
true
,
and marks it invisible otherwise.maximizeVisible
- the new visibility stateSWTException
- public boolean getMaximizeVisible()
true
if the maximize button
is visible.SWTException
- public void setMinimizeVisible(boolean minimizeVisible)
true
,
and marks it invisible otherwise.minimizeVisible
- the new visibility stateSWTException
- public boolean getMinimizeVisible()
true
if the minimize button
is visible.SWTException
- public void setMinimized(boolean minimized)
true
,
and marks it invisible otherwise.minimized
- the new visibility stateSWTException
- public boolean getMinimized()
true
if the receiver is minimized.SWTException
- public void setMaximized(boolean maximized)
maximized
- the new maximized stateSWTException
- public boolean getMaximized()
true
if the receiver is maximized.
SWTException
- public void setLayout(Layout layout)
Note: No Layout can be set on this Control because it already manages the size and position of its children.
setLayout
in class Composite
layout
- the receiver's new layout or nullSWTException
- public void setTabHeight(int height)
height
- the pixel value of the height or -1SWTException
- public int getTabHeight()
SWTException
- public int getMinimumCharacters()
public void setMinimumCharacters(int minimumCharacters)
minimumCharacters
- the minimum number of characters that will be displayed in a fully compressed tabSWTException
- public int getStyle()
Widget
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
and SWT.V_SCROLL
bits set.
public boolean getSingle()
true
if the CTabFolder only displays the selected tab
and false
if the CTabFolder displays multiple tabs.true
if the CTabFolder only displays the selected tab and false
if the CTabFolder displays multiple tabspublic void setSingle(boolean single)
single
- true
if only the selected tab should be displayed otherwise, multiple tabs will be shown.SWTException
- public int getTabPosition()
SWTException
- public void setTabPosition(int position)
position
- SWT.TOP
for tabs along the top or SWT.BOTTOM
for tabs along the bottomSWTException
- public boolean getBorderVisible()
true
if the receiver's border is visible.SWTException
- public void setBorderVisible(boolean show)
show
- true if the border should be displayedSWTException
- public boolean getUnselectedImageVisible()
true
if an image appears
in unselected tabs.true
if an image appears in unselected tabspublic void setUnselectedImageVisible(boolean visible)
visible
- true
makes the image appearSWTException
- public boolean getUnselectedCloseVisible()
true
if the close button appears
when the user hovers over an unselected tabs.true
if the close button appears on unselected tabspublic void setUnselectedCloseVisible(boolean visible)
visible
- true
makes the close button appearSWTException
- public Rectangle computeTrim(int x, int y, int width, int height)
Scrollable
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).
computeTrim
in class Scrollable
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 areaScrollable.getClientArea()
public void setSelectionBackground(Color color)
color
- the new color (or null)java.lang.IllegalArgumentException
- SWTException
- public Color getSelectionBackground()
SWTException
- public void setSelectionBackground(Color[] colors, int[] percents)
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});
colors
- 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.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.SWTException
- public void setSelectionBackground(Color[] colors, int[] percents, boolean vertical)
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);
colors
- an array of Color that specifies the colors to appear in the gradient
in order of appearance top to bottom. The value null
clears the
background gradient.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.java.lang.IllegalArgumentException
- SWTException
- public void setSelectionBackground(Image image)
image
- the image to be drawn in the backgroundSWTException
- public void setSelectionForeground(Color color)
color
- the color of the text displayed in the selected tabSWTException
- public Color getSelectionForeground()
SWTException
- public void setTopRight(Control control)
control
- the control to be displayed in the top right corner or nullSWTException
- public void setTopRight(Control control, int alignment)
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.
control
- the control to be displayed in the top right corner or nullalignment
- SWT.RIGHT
or SWT.FILL
SWTException
- public Control getTopRight()
SWTException
- public int getTopRightAlignment()
SWT.RIGHT
or SWT.FILL
SWTException
- public <T> T getAdapter(java.lang.Class<T> adapter)
Widget
Adaptable
interface.
IMPORTANT: This method is not part of the RWT public API. It is marked public only so that it can be shared within the packages provided by RWT. It should never be accessed from application code.
getAdapter
in interface Adaptable
getAdapter
in class Composite
adapter
- the lookup classnull
if
there is no adapter associated with the given class.public void setFont(Font font)
Control
public int getBorderWidth()
Control
getBorderWidth
in class Control
public Rectangle getClientArea()
Scrollable
getClientArea
in class Scrollable
Scrollable.computeTrim(int, int, int, int)
public void addSelectionListener(SelectionListener listener)
listener
- the listenerjava.lang.IllegalArgumentException
- SWTException
- public void removeSelectionListener(SelectionListener listener)
listener
- the listenerjava.lang.IllegalArgumentException
- SWTException
- public void addCTabFolder2Listener(CTabFolder2Listener listener)
listener
- the listener which should be notifiedjava.lang.IllegalArgumentException
- SWTException
- CTabFolder2Listener
,
removeCTabFolder2Listener(CTabFolder2Listener)
public void removeCTabFolder2Listener(CTabFolder2Listener listener)
listener
- the listenerjava.lang.IllegalArgumentException
- SWTException
- addCTabFolder2Listener(CTabFolder2Listener)
public void reskin(int flags)
Widget
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 keys SWT.SKIN_ID and/or SWT.SKIN_CLASS. Once the skin event is sent to a widget, it
will not be sent again unless reskin(int)
is called on the widget or on an ancestor
while specifying the SWT.ALL
flag.
The parameter flags
may be either:
Copyright (c) EclipseSource and others 2002, 2017.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0