CTabFolder

Instances of this class implement the notebook user interface metaphor. It allows the user to select a notebook page from set of pages. <p> The item children that may be added to instances of this class must be of type <code>CTabItem</code>. <code>Control</code> children are created and then set into a tab item using <code>CTabItem#setControl</code>. </p><p> Note that although this class is a subclass of <code>Composite</code>, it does not make sense to set a layout on it. </p><p> <dl> <dt><b>Styles:</b></dt> <dd>CLOSE, TOP, BOTTOM, FLAT, BORDER, SINGLE, MULTI</dd> <dt><b>Events:</b></dt> <dd>Selection</dd> <dd>"CTabFolder2"</dd> </dl> <p> Note: Only one of the styles TOP and BOTTOM may be specified. </p><p> IMPORTANT: This class is <em>not</em> intended to be subclassed. </p>

@see <a href="http://www.eclipse.org/swt/snippets/#ctabfolder">CTabFolder, CTabItem snippets</a> @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: CustomControlExample</a> @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>

class CTabFolder : Composite {
int xClient;
int yClient;
bool onBottom;
bool single;
bool simple;
int fixedTabHeight;
int tabHeight;
int minChars;
CTabItem[] items;
int firstIndex;
int selectedIndex;
int[] priority;
bool mru;
Listener listener;
CTabFolder2Listener[] folderListeners;
CTabFolderListener[] tabListeners;
Image selectionBgImage;
Color[] selectionGradientColors;
int[] selectionGradientPercents;
bool selectionGradientVertical;
Color selectionForeground;
Color selectionBackground;
Color selectionFadeStart;
Color selectionHighlightGradientBegin;
Color[] selectionHighlightGradientColorsCache;
Image bgImage;
Color[] gradientColors;
int[] gradientPercents;
bool gradientVertical;
bool showUnselectedImage;
Color borderColor;
bool showClose;
bool showUnselectedClose;
Rectangle chevronRect;
int chevronImageState;
bool showChevron;
Menu showMenu;
bool showMin;
Rectangle minRect;
bool minimized;
int minImageState;
bool showMax;
Rectangle maxRect;
bool maximized;
int maxImageState;
Control topRight;
Rectangle topRightRect;
int topRightAlignment;
int borderLeft;
int borderRight;
int borderTop;
int borderBottom;
int highlight_margin;
int highlight_header;
int[] curve;
int[] topCurveHighlightStart;
int[] topCurveHighlightEnd;
int curveWidth;
int curveIndent;
bool inDispose;
Point oldSize;
Font oldFont;
int DEFAULT_WIDTH;
int DEFAULT_HEIGHT;
int BUTTON_SIZE;
int[] TOP_LEFT_CORNER;
int[] TOP_LEFT_CORNER_HILITE;
int[] TOP_RIGHT_CORNER;
int[] BOTTOM_LEFT_CORNER;
int[] BOTTOM_RIGHT_CORNER;
int[] SIMPLE_TOP_LEFT_CORNER;
int[] SIMPLE_TOP_RIGHT_CORNER;
int[] SIMPLE_BOTTOM_LEFT_CORNER;
int[] SIMPLE_BOTTOM_RIGHT_CORNER;
int[] SIMPLE_UNSELECTED_INNER_CORNER;
int[] TOP_LEFT_CORNER_BORDERLESS;
int[] TOP_RIGHT_CORNER_BORDERLESS;
int[] BOTTOM_LEFT_CORNER_BORDERLESS;
int[] BOTTOM_RIGHT_CORNER_BORDERLESS;
int[] SIMPLE_TOP_LEFT_CORNER_BORDERLESS;
int[] SIMPLE_TOP_RIGHT_CORNER_BORDERLESS;
int[] SIMPLE_BOTTOM_LEFT_CORNER_BORDERLESS;
int[] SIMPLE_BOTTOM_RIGHT_CORNER_BORDERLESS;
int SELECTION_FOREGROUND;
int SELECTION_BACKGROUND;
int BORDER1_COLOR;
int FOREGROUND;
int BACKGROUND;
int BUTTON_BORDER;
int BUTTON_FILL;
int NONE;
int NORMAL;
int HOT;
int SELECTED;
RGB CLOSE_FILL;
int CHEVRON_CHILD_ID;
int MINIMIZE_CHILD_ID;
int MAXIMIZE_CHILD_ID;
int EXTRA_CHILD_ID_COUNT;
}

Constructors

this
this(Composite parent, int style)

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. <p> The style value is either one of the style constants defined in class <code>SWT</code> which is applicable to instances of this class, or must be built by <em>bitwise OR</em>'ing together (that is, using the <code>int</code> "|" operator) two or more of those <code>SWT</code> style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses. </p>

Members

Functions

addCTabFolder2Listener
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.

addCTabFolderListener
void addCTabFolderListener(CTabFolderListener listener)

Adds the listener to the collection of listeners who will be notified when a tab item is closed.

addSelectionListener
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 the <code>SelectionListener</code> interface. <p> <code>widgetSelected</code> is called when the user changes the selected tab. <code>widgetDefaultSelected</code> is not called. </p>

getBorderVisible
bool getBorderVisible()

Returns <code>true</code> if the receiver's border is visible.

getItem
CTabItem getItem(int index)

Return the tab that is located at the specified index.

getItem
CTabItem getItem(Point pt)

Gets the item at a point in the widget.

getItemCount
int getItemCount()

Return the number of tabs in the folder.

getItems
CTabItem[] getItems()

Return the tab items.

getMRUVisible
bool getMRUVisible()

Returns <code>true</code> if the receiver displays most recently used tabs and <code>false</code> otherwise. <p> 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. <p> 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).</p>

getMaximizeVisible
bool getMaximizeVisible()

Returns <code>true</code> if the maximize button is visible.

getMaximized
bool getMaximized()

Returns <code>true</code> if the receiver is maximized. <p>

getMinimizeVisible
bool getMinimizeVisible()

Returns <code>true</code> if the minimize button is visible.

getMinimized
bool getMinimized()

Returns <code>true</code> if the receiver is minimized.

getMinimumCharacters
int getMinimumCharacters()

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

getSelection
CTabItem getSelection()

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

getSelectionBackground
Color getSelectionBackground()

Returns the receiver's selection background color.

getSelectionForeground
Color getSelectionForeground()

Returns the receiver's selection foreground color.

getSelectionIndex
int getSelectionIndex()

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

getSimple
bool getSimple()

Returns <code>true</code> if the CTabFolder is rendered with a simple, traditional shape.

getSingle
bool getSingle()

Returns <code>true</code> if the CTabFolder only displays the selected tab and <code>false</code> if the CTabFolder displays multiple tabs.

getTabHeight
int getTabHeight()

Returns the height of the tab

getTabPosition
int getTabPosition()

Returns the position of the tab. Possible values are SWT.TOP or SWT.BOTTOM.

getTopRight
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.

getUnselectedCloseVisible
bool getUnselectedCloseVisible()

Returns <code>true</code> if the close button appears when the user hovers over an unselected tabs.

getUnselectedImageVisible
bool getUnselectedImageVisible()

Returns <code>true</code> if an image appears in unselected tabs.

indexOf
int indexOf(CTabItem item)

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

removeCTabFolder2Listener
void removeCTabFolder2Listener(CTabFolder2Listener listener)

Removes the listener.

removeCTabFolderListener
void removeCTabFolderListener(CTabFolderListener listener)

Removes the listener.

removeSelectionListener
void removeSelectionListener(SelectionListener listener)

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

setBackground
void setBackground(Color[] colors, int[] percents)

Specify a gradient of colours 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: <pre> 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}); </pre>

setBackground
void setBackground(Color[] colors, int[] percents, bool vertical)

Specify a gradient of colours 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: <pre> 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); </pre>

setBackground
void setBackground(Image image)

Set the image to be drawn in the background of the unselected tab. Image is stretched or compressed to cover entire unselected tab area.

setBorderVisible
void setBorderVisible(bool show)

Toggle the visibility of the border

setInsertMark
void setInsertMark(CTabItem item, bool after)

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

setInsertMark
void setInsertMark(int index, bool after)

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

setLayout
void setLayout(Layout layout)

Sets the layout which is associated with the receiver to be the argument which may be null. <p> Note: No Layout can be set on this Control because it already manages the size and position of its children. </p>

setMRUVisible
void setMRUVisible(bool 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. <p> 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).</p>

setMaximizeVisible
void setMaximizeVisible(bool visible)

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

setMaximized
void setMaximized(bool maximize)

Sets the maximized state of the receiver.

setMinimizeVisible
void setMinimizeVisible(bool visible)

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

setMinimized
void setMinimized(bool minimize)

Sets the minimized state of the receiver.

setMinimumCharacters
void setMinimumCharacters(int count)

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

setSelection
void setSelection(CTabItem item)

Set the selection to the tab at the specified item.

setSelection
void setSelection(int index)

Set the selection to the tab at the specified index.

setSelectionBackground
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.

setSelectionBackground
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: <pre> 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}); </pre>

setSelectionBackground
void setSelectionBackground(Color[] colors, int[] percents, bool 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: <pre> 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); </pre>

setSelectionBackground
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.

setSelectionForeground
void setSelectionForeground(Color color)

Set the foreground color of the selected tab.

setSimple
void setSimple(bool simple)

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

setSingle
void setSingle(bool single)

Sets the number of tabs that the CTabFolder should display

setTabHeight
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.

setTabPosition
void setTabPosition(int position)

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

setTopRight
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.

setTopRight
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. <p> The alignment parameter sets the layout of the control in the tab area. <code>SWT.RIGHT</code> will cause the control to be positioned on the far right of the folder and it will have its default size. <code>SWT.FILL</code> 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. </p>

setUnselectedCloseVisible
void setUnselectedCloseVisible(bool visible)

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

setUnselectedImageVisible
void setUnselectedImageVisible(bool visible)

Specify whether the image appears on unselected tabs.

showItem
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.

showSelection
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.

Static variables

borderInsideRGB
RGB borderInsideRGB;

Color of innermost line of drop shadow border.

borderMiddleRGB
RGB borderMiddleRGB;

Color of middle line of drop shadow border.

borderOutsideRGB
RGB borderOutsideRGB;

Color of outermost line of drop shadow border.

Variables

MIN_TAB_WIDTH
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.

marginHeight
int marginHeight;

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

marginWidth
int marginWidth;

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

Inherited Members

From Composite

changed
void changed(Control[] changed)

Clears any data that has been cached by a Layout for all widgets that are in the parent hierarchy of the changed control up to and including the receiver. If an ancestor does not have a layout, it is skipped.

getBackgroundMode
int getBackgroundMode()

Returns the receiver's background drawing mode. This will be one of the following constants defined in class <code>SWT</code>: <code>INHERIT_NONE</code>, <code>INHERIT_DEFAULT</code>, <code>INHERTIT_FORCE</code>.

getChildren
Control[] getChildren()

Returns a (possibly empty) array containing the receiver's children. Children are returned in the order that they are drawn. The topmost control appears at the beginning of the array. Subsequent controls draw beneath this control and appear later in the array. <p> Note: This is not the actual structure used by the receiver to maintain its list of children, so modifying the array will not affect the receiver. </p>

getLayout
Layout getLayout()

Returns layout which is associated with the receiver, or null if one has not been set.

getLayoutDeferred
bool getLayoutDeferred()

Returns <code>true</code> if the receiver has deferred the performing of layout, and <code>false</code> otherwise.

getTabList
Control[] getTabList()

Gets the (possibly empty) tabbing order for the control.

isLayoutDeferred
bool isLayoutDeferred()

Returns <code>true</code> if the receiver or any ancestor up to and including the receiver's nearest ancestor shell has deferred the performing of layouts. Otherwise, <code>false</code> is returned.

layout
void layout()

If the receiver has a layout, asks the layout to <em>lay out</em> (that is, set the size and location of) the receiver's children. If the receiver does not have a layout, do nothing. <p> This is equivalent to calling <code>layout(true)</code>. </p> <p> Note: Layout is different from painting. If a child is moved or resized such that an area in the parent is exposed, then the parent will paint. If no child is affected, the parent will not paint. </p>

layout
void layout(bool changed)

If the receiver has a layout, asks the layout to <em>lay out</em> (that is, set the size and location of) the receiver's children. If the argument is <code>true</code> the layout must not rely on any information it has cached about the immediate children. If it is <code>false</code> the layout may (potentially) optimize the work it is doing by assuming that none of the receiver's children has changed state since the last layout. If the receiver does not have a layout, do nothing. <p> If a child is resized as a result of a call to layout, the resize event will invoke the layout of the child. The layout will cascade down through all child widgets in the receiver's widget tree until a child is encountered that does not resize. Note that a layout due to a resize will not flush any cached information (same as <code>layout(false)</code>). </p> <p> Note: Layout is different from painting. If a child is moved or resized such that an area in the parent is exposed, then the parent will paint. If no child is affected, the parent will not paint. </p>

layout
void layout(bool changed, bool all)

If the receiver has a layout, asks the layout to <em>lay out</em> (that is, set the size and location of) the receiver's children. If the changed argument is <code>true</code> the layout must not rely on any information it has cached about its children. If it is <code>false</code> the layout may (potentially) optimize the work it is doing by assuming that none of the receiver's children has changed state since the last layout. If the all argument is <code>true</code> the layout will cascade down through all child widgets in the receiver's widget tree, regardless of whether the child has changed size. The changed argument is applied to all layouts. If the all argument is <code>false</code>, the layout will <em>not</em> cascade down through all child widgets in the receiver's widget tree. However, if a child is resized as a result of a call to layout, the resize event will invoke the layout of the child. Note that a layout due to a resize will not flush any cached information (same as <code>layout(false)</code>). </p> <p> Note: Layout is different from painting. If a child is moved or resized such that an area in the parent is exposed, then the parent will paint. If no child is affected, the parent will not paint. </p>

layout
void layout(Control[] changed)

Forces a lay out (that is, sets the size and location) of all widgets that are in the parent hierarchy of the changed control up to and including the receiver. The layouts in the hierarchy must not rely on any information cached about the changed control or any of its ancestors. The layout may (potentially) optimize the work it is doing by assuming that none of the peers of the changed control have changed state since the last layout. If an ancestor does not have a layout, skip it. <p> Note: Layout is different from painting. If a child is moved or resized such that an area in the parent is exposed, then the parent will paint. If no child is affected, the parent will not paint. </p>

setBackgroundMode
void setBackgroundMode(int mode)

Sets the background drawing mode to the argument which should be one of the following constants defined in class <code>SWT</code>: <code>INHERIT_NONE</code>, <code>INHERIT_DEFAULT</code>, <code>INHERIT_FORCE</code>.

setLayout
void setLayout(Layout layout)

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

setLayoutDeferred
void setLayoutDeferred(bool defer)

If the argument is <code>true</code>, causes subsequent layout operations in the receiver or any of its children to be ignored. No layout of any kind can occur in the receiver or any of its children until the flag is set to false. Layout operations that occurred while the flag was <code>true</code> are remembered and when the flag is set to <code>false</code>, the layout operations are performed in an optimized manner. Nested calls to this method are stacked.

setTabList
void setTabList(Control[] tabList)

Sets the tabbing order for the specified controls to match the order that they occur in the argument list.

Meta