org.eclipse.swt.custom
Class CBanner
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.CBanner
- All Implemented Interfaces:
- Drawable
- public class CBanner
- extends Composite
Instances of this class implement a Composite that lays out its
children and allows programmatic control of the layout. It draws
a separator between the left and right children which can be dragged
to resize the right control.
CBanner is used in the workbench to layout the toolbar area and
perspective switching toolbar at the top of the workbench.
Note that although this class is a subclass of Composite,
it does not make sense to set a layout on it.
- Styles:
- NONE
- Events:
- (None)
IMPORTANT: This class is not intended to be subclassed.
- Since:
- 3.0
Fields inherited from class org.eclipse.swt.widgets.Control
|
handle
|
Constructor Summary
|
CBanner(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
|
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.
|
Control
| getBottom()
Returns the Control that appears on the bottom side of the banner.
|
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").
|
Control
| getLeft()
Returns the Control that appears on the left side of the banner.
|
Control
| getRight()
Returns the Control that appears on the right side of the banner.
|
int
| getRightWidth()
Returns the width of the control that appears on the right of the banner.
|
boolean
| getSimple()
Returns true if the CBanner is rendered
with a simple, traditional shape.
|
void
| layout(boolean changed)
If the receiver has a layout, asks the layout to lay out
(that is, set the size and location of) the receiver's children.
|
void
| setBottom(Control control)
Set the control that appears on the bottom side of the banner.
|
void
| setLayout(Layout layout)
Sets the layout which is associated with the receiver to be
the argument which may be null.
|
void
| setLeft(Control control)
Set the control that appears on the left side of the banner.
|
void
| setRight(Control control)
Set the control that appears on the right side of the banner.
|
void
| setRightWidth(int width)
Set the width of the control control that appears on the right side of the banner.
|
void
| setSimple(boolean simple)
Sets the shape that the CBanner will use to render itself.
|
Methods inherited from class org.eclipse.swt.widgets.Control
|
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setCursor, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
|
Methods inherited from class org.eclipse.swt.widgets.Widget
|
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
|
CBanner
public CBanner(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 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.
- 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
computeSize
public Point computeSize(int wHint,
int hHint,
boolean changed)
- Description copied from class: Control
- Returns the preferred size of the receiver.
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.
- Overrides:
- computeSize in class Composite
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 class Scrollable
- Parameters:
- x - the desired x coordinate of the client area
- y - the desired y coordinate of the client area
- width - the desired width of the client area
- height - the desired height of the client area
- Returns:
- the required bounds to produce the given client area
- See Also:
- Scrollable.getClientArea()
getBottom
public Control getBottom()
- Returns the Control that appears on the bottom side of the banner.
- Returns:
- the control that appears on the bottom side of the banner 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
- 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 class Scrollable
- Returns:
- the client area
- See Also:
- Scrollable.computeTrim(int, int, int, int)
getLeft
public Control getLeft()
- Returns the Control that appears on the left side of the banner.
- Returns:
- the control that appears on the left side of the banner 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
- Since:
- 3.0
getRight
public Control getRight()
- Returns the Control that appears on the right side of the banner.
- Returns:
- the control that appears on the right side of the banner 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
- Since:
- 3.0
getRightWidth
public int getRightWidth()
- Returns the width of the control that appears on the right of the banner.
- Returns:
- the width of the control that appears on the right of the banner
- Since:
- 3.0
getSimple
public boolean getSimple()
- Returns true if the CBanner is rendered
with a simple, traditional shape.
- Returns:
- true if the Cbanner is rendered with a simple shape
- Since:
- 3.0
layout
public void layout(boolean changed)
- Description copied from class: Composite
- If the receiver has a layout, asks the layout to lay out
(that is, set the size and location of) the receiver's children.
If the the argument is true the layout must not rely
on any cached information it is keeping about the children. If it
is false the layout may (potentially) simplify the
work it is doing by assuming that the state of the none of the
receiver's children has changed since the last layout.
If the receiver does not have a layout, do nothing.
- Overrides:
- layout in class Composite
- Parameters:
- changed - true if the layout must flush its caches, and false otherwise
setBottom
public void setBottom(Control control)
- Set the control that appears on the bottom side of the banner.
The bottom control is optional. Setting the bottom control to null will remove it from
the banner - however, the creator of the control must dispose of the control.
- Parameters:
- control - the control to be displayed on the bottom 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 bottom control was not created as a child of 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 : CBanner does not use a layout class to size and position its children.
- Overrides:
- setLayout in class Composite
- 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
setLeft
public void setLeft(Control control)
- Set the control that appears on the left side of the banner.
The left control is optional. Setting the left control to null will remove it from
the banner - however, the creator of the control must dispose of the control.
- Parameters:
- control - the control to be displayed on the left 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 left control was not created as a child of the receiver
- Since:
- 3.0
setRight
public void setRight(Control control)
- Set the control that appears on the right side of the banner.
The right control is optional. Setting the right control to null will remove it from
the banner - however, the creator of the control must dispose of the control.
- Parameters:
- control - the control to be displayed on the right 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 right control was not created as a child of the receiver
- Since:
- 3.0
setRightWidth
public void setRightWidth(int width)
- Set the width of the control control that appears on the right side of the banner.
- Parameters:
- width - the width of the control on the right
- 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
setSimple
public void setSimple(boolean simple)
- Sets the shape that the CBanner will use to render itself.
- Parameters:
- simple - true if the CBanner 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
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.