|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
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.
Note: Only one of the styles TOP and BOTTOM may be specified.
IMPORTANT: This class is not intended to be subclassed.
Field Summary | |
static RGB |
borderInsideRGB
Color of innermost line of drop shadow border. |
static RGB |
borderMiddleRGB
Color of middle line of drop shadow border. |
static RGB |
borderOutsideRGB
Color of outermost line of drop shadow border. |
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. |
int |
MIN_TAB_WIDTH
|
Fields inherited from class org.eclipse.swt.widgets.Control |
handle |
Constructor Summary | |
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 | |
void |
addCTabFolderListener(CTabFolderListener listener)
Adds the listener to the collection of listeners who will be notified when a tab item is closed. |
void |
addSelectionListener(SelectionListener listener)
Adds the listener to receive events. |
Point |
computeSize(int wHint,
int hHint,
boolean changed)
Returns the preferred size of the receiver. |
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. |
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. |
CTabItem |
getSelection()
Return the selected tab item, or an empty array if there is no selection. |
int |
getSelectionIndex()
Return the index of the selected tab item, or -1 if there is no selection. |
int |
getTabHeight()
Returns the height of the tab |
int |
indexOf(CTabItem item)
Return the index of the specified tab or -1 if the tab is not in the receiver. |
void |
removeCTabFolderListener(CTabFolderListener listener)
Removes the listener. |
void |
removeSelectionListener(SelectionListener listener)
Removes the listener. |
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 |
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 |
setInsertMark(CTabItem item,
boolean after)
Display an insert marker before or after the specified tab item. |
void |
setInsertMark(int index,
boolean after)
Display an insert marker before or after the specified tab item. |
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[] colors,
int[] percents)
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 |
setTabHeight(int height)
Specify a fixed height for the tab items. |
void |
showItem(CTabItem item)
Shows the item. |
void |
showSelection()
Shows the selection. |
Methods inherited from class org.eclipse.swt.widgets.Composite |
checkSubclass, getChildren, getLayout, getTabList, layout, layout, setFocus, setLayout, setTabList |
Methods inherited from class org.eclipse.swt.widgets.Scrollable |
getHorizontalBar, getVerticalBar |
Methods inherited from class org.eclipse.swt.widgets.Widget |
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getStyle, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public int marginWidth
public int marginHeight
public static RGB borderInsideRGB
public static RGB borderMiddleRGB
public static RGB borderOutsideRGB
public int MIN_TAB_WIDTH
Constructor Detail |
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 construct
IllegalArgumentException
- SWTException
- SWT.TOP
,
SWT.BOTTOM
,
SWT.FLAT
,
Widget.getStyle()
Method Detail |
public void addSelectionListener(SelectionListener listener)
listener
- the listener
SWTError
- public void addCTabFolderListener(CTabFolderListener listener)
listener
- the listener which should be notified
IllegalArgumentException
- CTabFolderListener
,
removeCTabFolderListener(org.eclipse.swt.custom.CTabFolderListener)
public Point computeSize(int wHint, int hHint, boolean changed)
Control
The preferred size of a control is the size that it would
best be displayed at. The width hint and height hint arguments
allow the caller to ask a control questions such as "Given a particular
width, how high does the control need to be to show all of the contents?"
To indicate that the caller does not wish to constrain a particular
dimension, the constant SWT.DEFAULT
is passed for the hint.
If the changed flag is true
, it indicates that the receiver's
contents have changed, therefore any caches that a layout manager
containing the control may have been keeping need to be flushed. When the
control is resized, the changed flag will be false
, so layout
manager caches can be retained.
computeSize
in class Composite
wHint
- the width hint (can be SWT.DEFAULT
)hHint
- the height hint (can be SWT.DEFAULT
)changed
- true
if the control's contents have changed, and false
otherwise
Layout
,
Control.getBorderWidth()
,
Control.getBounds()
,
Control.getSize()
,
Control.pack()
,
"computeTrim, getClientArea for controls that implement them"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
Scrollable.getClientArea()
public Rectangle getClientArea()
Scrollable
getClientArea
in class Scrollable
Scrollable.computeTrim(int, int, int, int)
public int getTabHeight()
SWTError
- public CTabItem getItem(int index)
public CTabItem getItem(Point pt)
public int getItemCount()
public CTabItem[] getItems()
public CTabItem getSelection()
public int getSelectionIndex()
public int indexOf(CTabItem item)
SWTError
- public void removeSelectionListener(SelectionListener listener)
listener
- the listener
SWTError
- public void removeCTabFolderListener(CTabFolderListener listener)
listener
- the listener
SWTError
- public void setBackground(Color color)
Control
setBackground
in class Control
color
- the new color (or null)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. The value null
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.
SWTError
- public void setSelectionBackground(Image image)
image
- the image to be drawn in the background
SWTException
- public void setBorderVisible(boolean show)
show
- true if the border should be displayed
SWTException
- public void setFont(Font font)
Control
setFont
in class Control
font
- the new font (or null)public void setSelectionForeground(Color color)
color
- the color of the text displayed in the selected tab
SWTException
- public void setInsertMark(CTabItem item, boolean after)
item
- the item with which the mark is associated or nullafter
- true if the mark should be displayed after the specified item
SWTException
- public void setInsertMark(int index, boolean after)
after
- true if the mark should be displayed after the specified item
SWTException
- public void setSelection(int index)
index
- the index of the tab item to be selected
SWTException
- public void showItem(CTabItem item)
item
- the item to be shown
IllegalArgumentException
- SWTException
- showSelection()
public void showSelection()
IllegalArgumentException
- SWTException
- showItem(CTabItem)
public void setSelection(CTabItem item)
SWTException
- public void setTabHeight(int height)
height
- the pixel value of the height or 0
SWTException
-
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |