|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ widgets overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.swt.widgets
Class IconBar

java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.swt.widgets.IconBar
- All Implemented Interfaces:
- org.eclipse.swt.events.DisposeListener, org.eclipse.swt.graphics.Drawable, java.util.EventListener, IComposite, IControl, IIconBar, IScrollable, org.eclipse.swt.internal.SWTEventListener
- public class IconBar
- extends Composite
- implements IIconBar, org.eclipse.swt.events.DisposeListener
- extends Composite
An icon bar like a ToolBar but can scroll and have more control of the appearance. The IconBar is actually a viewport on a Canvas where the icons located. And thus most operations (layout,key,mouse ... etc) are forwarded to the Canvas where interactions occurs. Default highlight is changing icon background color on enter instead of simulating a button. Also fix problem that ToolBar icons flash on enter/exit by custom Canvas with NO_BACKGROUND. Subclass can use setMouseEventHandler() and access to the layout parameters to install different highlight behaviour. Subclass can use setRenderer() to install a renderer to customize how icons are painted. For example, to redraw a region in the Canvas: paintBuffer(getBackBuffer(),x,y,w,h); getCanvas().redraw(x,y,w,h); Usage: IconBar iconbar = new IconBar(parent, SWT.NONE); iconbar.setBackground(bg); iconbar.setIconBackground(iconbg); iconbar.setLayout(new IconBarLayout(4, 0, 0, 2, 2, SWT.LEFT));
| Nested Class Summary | |
class |
IconBar.DefaultMouseHandler
|
class |
IconBar.DefaultRenderer
|
| Fields inherited from class org.eclipse.swt.widgets.Composite |
embeddedHandle, imHandle, layout, socketHandle, tabList |
| Fields inherited from class org.eclipse.swt.widgets.Scrollable |
horizontalBar, scrolledHandle, verticalBar |
| Fields inherited from class org.eclipse.swt.widgets.Control |
accessible, cursor, drawCount, enableWindow, fixedHandle, font, layoutData, menu, parent, redrawWindow, toolTipText |
| Fields inherited from class org.eclipse.swt.widgets.Widget |
ACTIVATE, BUTTON_PRESS_EVENT, BUTTON_RELEASE_EVENT, CANVAS, CHANGED, CLICKED, COMMIT, CONFIGURE_EVENT, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DELETE_EVENT, DELETE_RANGE, DELETE_TEXT, DISABLED, display, DISPOSED, ENTER_NOTIFY_EVENT, EVENT, EVENT_AFTER, eventTable, EXPOSE_EVENT, FOCUS, FOCUS_IN_EVENT, FOCUS_OUT_EVENT, handle, HANDLE, HIDE, INSERT_TEXT, KEY_PRESS_EVENT, KEY_RELEASE_EVENT, KEYED_DATA, LEAVE_NOTIFY_EVENT, MAP_EVENT, MENU, MNEMONIC_ACTIVATE, MOTION_NOTIFY_EVENT, OBSCURED, POPUP_MENU, PREEDIT_CHANGED, REALIZE, ROW_ACTIVATED, SCROLL_CHILD, SELECT, SHOW, SHOW_HELP, SIZE_ALLOCATE, state, style, STYLE_SET, SWITCH_PAGE, TEST_COLLAPSE_ROW, TEST_EXPAND_ROW, TOGGLED, UNMAP_EVENT, UNREALIZE, VALUE_CHANGED, VISIBILITY_NOTIFY_EVENT, WINDOW_STATE_EVENT |
| Constructor Summary | |
IconBar(Composite parent,
int style)
|
|
IconBar(Composite parent,
int style,
java.lang.String id)
|
|
| Method Summary | |
void |
add(java.lang.Object action)
|
boolean |
addAll(java.util.List actions)
|
void |
addKeyListener(org.eclipse.swt.events.KeyListener l)
Adds the listener to the collection of listeners who will be notified when keys are pressed and released on the system keyboard, by sending it one of the messages defined in the KeyListener
interface. |
void |
addMouseListener(org.eclipse.swt.events.MouseListener l)
Adds the listener to the collection of listeners who will be notified when mouse buttons are pressed and released, by sending it one of the messages defined in the MouseListener
interface. |
private static int |
checkStyle(int style)
|
boolean |
getAlwaysShowScrollBars()
Returns the Always Show Scrollbars flag. |
org.eclipse.swt.graphics.Image |
getBackBuffer()
|
Canvas |
getCanvas()
|
org.eclipse.swt.graphics.Color[] |
getColorScheme()
|
org.eclipse.swt.graphics.Color |
getIconBackground()
|
java.lang.String |
getId()
|
java.lang.Object |
getItem(int n)
|
java.lang.Object |
getItemAt(int x,
int y)
Get the Action item at the given coordinate inside the IconBar. |
java.util.List |
getItems()
|
Layout |
getLayout()
Returns layout which is associated with the receiver, or null if one has not been set. |
IIconBarMouseHandler |
getMouseHandler()
|
IIconBarRenderer |
getRenderer()
|
int |
getSelectionIndex()
|
org.eclipse.swt.graphics.Point |
getViewOffset()
Return the point in the content that currenly appears in the top left corner of the scrolled composite. |
protected void |
hScroll()
|
(package private) void |
internalSetMouseHandler(IIconBarMouseHandler handler)
|
int |
itemIndexAt(int x,
int y)
Get item index at given pixel coordinates inside the IconBar. |
void |
layout()
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 |
layout(boolean flush)
Relayout icons on the canvas. |
void |
paintBuffer(boolean flush)
|
protected void |
paintCanvas(org.eclipse.swt.events.PaintEvent e)
|
void |
paintCell(int n,
boolean flush)
|
void |
redraw()
Causes the entire bounds of the receiver to be marked as needing to be redrawn. |
void |
redraw(int x,
int y,
int w,
int h,
boolean all)
Causes the rectangular area of the receiver specified by the arguments to be marked as needing to be redrawn. |
boolean |
remove(java.lang.Object action)
|
boolean |
removeAll()
|
void |
removeKeyListener(org.eclipse.swt.events.KeyListener l)
Removes the listener from the collection of listeners who will be notified when keys are pressed and released on the system keyboard. |
void |
removeMouseListener(org.eclipse.swt.events.MouseListener l)
Removes the listener from the collection of listeners who will be notified when mouse buttons are pressed and released. |
protected void |
resize()
|
void |
select(int index)
|
void |
setAlwaysShowScrollBars(boolean show)
Set the Always Show Scrollbars flag. |
void |
setColorScheme(org.eclipse.swt.graphics.Color[] colors)
Configure colors scheme: [ IconBackground, IconHighLightBackground, CanvasBackground, IconBarBackground, ShadowDark, ShadowLight ] Use null to skip color not required to change. |
void |
setEnabled(int i,
boolean enabled)
Enable/disable specified item. |
void |
setExpandHorizontal(boolean expand)
Configure the ScrolledComposite to resize the content object to be as wide as the ScrolledComposite when the width of the ScrolledComposite is greater than the minimum width specified in setMinWidth. |
void |
setExpandVertical(boolean expand)
Configure the ScrolledComposite to resize the content object to be as tall as the ScrolledComposite when the height of the ScrolledComposite is greater than the minimum height specified in setMinHeight. |
void |
setId(java.lang.String id)
|
void |
setLayout(Layout layout)
Note that IconBarLayout.align is overriden by alignment specified for IconBar constructor. |
void |
setMouseHandler(IIconBarMouseHandler handler)
|
void |
setRenderer(IIconBarRenderer renderer)
|
void |
setViewOffset(int x,
int y)
|
void |
setViewportHeight(int height)
Specify the minimum height at which the ScrolledComposite will begin scrolling the content with the vertical scroll bar. |
void |
setViewportSize(int width,
int height)
Specify the minimum width and height at which the ScrolledComposite will begin scrolling the content with the horizontal scroll bar. |
void |
setViewportSize(org.eclipse.swt.graphics.Point size)
Specify the minimum width and height at which the ScrolledComposite will begin scrolling the content with the horizontal scroll bar. |
void |
setViewportWidth(int width)
Specify the minimum width at which the ScrolledComposite will begin scrolling the content with the horizontal scroll bar. |
java.lang.String |
toString()
Returns a string containing a concise, human-readable description of the receiver. |
void |
update()
Forces all outstanding paint requests for the widget to be processed before this method returns. |
protected void |
vScroll()
|
void |
widgetDisposed(org.eclipse.swt.events.DisposeEvent e)
Sent when the widget is disposed. |
| Methods inherited from class org.eclipse.swt.widgets.Scrollable |
clientHandle, computeTrim, createScrollBar, createWidget, getBorderWidth, getClientArea, getHorizontalBar, getVerticalBar, hScrollBarWidth, releaseHandle, setOrientation, topHandle, vScrollBarWidth |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.eclipse.swt.widgets.IScrollable |
getClientArea, getHorizontalBar, getVerticalBar |
| Methods inherited from interface org.eclipse.swt.widgets.IControl |
addDisposeListener, getBorderWidth, getBounds, getDisplay, removeDisposeListener, setCursor, setFocus, setLayoutData, setVisible |
| Field Detail |
NAME
private static final java.lang.String NAME
- See Also:
- Constant Field Values
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
VERBOSE
static boolean VERBOSE
HIGHLIGHT
protected static int HIGHLIGHT
SHADOWDARK
protected static int SHADOWDARK
SHADOWLIGHT
protected static int SHADOWLIGHT
fBackBuffer
protected org.eclipse.swt.graphics.Image fBackBuffer
fBounds
protected org.eclipse.swt.graphics.Rectangle fBounds
fDirty
protected org.eclipse.swt.graphics.custom.DirtyRectangle fDirty
fIconBG
protected org.eclipse.swt.graphics.Color fIconBG
fIconLight
protected org.eclipse.swt.graphics.Color fIconLight
fShadowDark
protected org.eclipse.swt.graphics.Color fShadowDark
fShadowLight
protected org.eclipse.swt.graphics.Color fShadowLight
fLayout
protected IconBarLayout fLayout
fId
private java.lang.String fId
- List of items to be shown in the IconBar.
fItems
private java.util.List fItems
fCanvas
private Canvas fCanvas
fRenderer
private IIconBarRenderer fRenderer
fMouseHandler
private IIconBarMouseHandler fMouseHandler
fViewOffset
private org.eclipse.swt.graphics.Point fViewOffset
fViewportHeight
private int fViewportHeight
fViewportWidth
private int fViewportWidth
fExpandHorizontal
private boolean fExpandHorizontal
fExpandVertical
private boolean fExpandVertical
isAlwaysShowScroll
private boolean isAlwaysShowScroll
isInResize
private boolean isInResize
| Constructor Detail |
IconBar
public IconBar(Composite parent, int style)
IconBar
public IconBar(Composite parent, int style, java.lang.String id)
| Method Detail |
checkStyle
private static int checkStyle(int style)
widgetDisposed
public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e)
- Description copied from interface:
org.eclipse.swt.events.DisposeListener - Sent when the widget is disposed.
- Specified by:
widgetDisposedin interfaceorg.eclipse.swt.events.DisposeListener
redraw
public void redraw()
- Description copied from class:
Control - Causes the entire bounds of the receiver to be marked
as needing to be redrawn. The next time a paint request
is processed, the control will be completely painted,
including the background.
redraw
public void redraw(int x,
int y,
int w,
int h,
boolean all)
- Description copied from class:
Control - Causes the rectangular area of the receiver specified by
the arguments to be marked as needing to be redrawn.
The next time a paint request is processed, that area of
the receiver will be painted, including the background.
If the
allflag istrue, any children of the receiver which intersect with the specified area will also paint their intersecting areas. If theallflag isfalse, the children will not be painted.
update
public void update()
- Description copied from class:
Control - Forces all outstanding paint requests for the widget
to be processed before this method returns.
add
public void add(java.lang.Object action)
remove
public boolean remove(java.lang.Object action)
addAll
public boolean addAll(java.util.List actions)
removeAll
public boolean removeAll()
getRenderer
public IIconBarRenderer getRenderer()
getMouseHandler
public IIconBarMouseHandler getMouseHandler()
setRenderer
public void setRenderer(IIconBarRenderer renderer)
setMouseHandler
public void setMouseHandler(IIconBarMouseHandler handler)
internalSetMouseHandler
void internalSetMouseHandler(IIconBarMouseHandler handler)
addMouseListener
public void addMouseListener(org.eclipse.swt.events.MouseListener l)
- Description copied from class:
Control - Adds the listener to the collection of listeners who will
be notified when mouse buttons are pressed and released, by sending
it one of the messages defined in the
MouseListenerinterface.- Specified by:
addMouseListenerin interfaceIControl- Overrides:
addMouseListenerin classControl
removeMouseListener
public void removeMouseListener(org.eclipse.swt.events.MouseListener l)
- Description copied from class:
Control - Removes the listener from the collection of listeners who will
be notified when mouse buttons are pressed and released.
- Specified by:
removeMouseListenerin interfaceIControl- Overrides:
removeMouseListenerin classControl
addKeyListener
public void addKeyListener(org.eclipse.swt.events.KeyListener l)
- Description copied from class:
Control - Adds the listener to the collection of listeners who will
be notified when keys are pressed and released on the system keyboard, by sending
it one of the messages defined in the
KeyListenerinterface.- Specified by:
addKeyListenerin interfaceIControl- Overrides:
addKeyListenerin classControl
removeKeyListener
public void removeKeyListener(org.eclipse.swt.events.KeyListener l)
- Description copied from class:
Control - Removes the listener from the collection of listeners who will
be notified when keys are pressed and released on the system keyboard.
- Specified by:
removeKeyListenerin interfaceIControl- Overrides:
removeKeyListenerin classControl
getSelectionIndex
public int getSelectionIndex()
- Specified by:
getSelectionIndexin interfaceIIconBar
select
public void select(int index)
setColorScheme
public void setColorScheme(org.eclipse.swt.graphics.Color[] colors)
- Configure colors scheme:
[ IconBackground, IconHighLightBackground,
CanvasBackground, IconBarBackground,
ShadowDark, ShadowLight
]
Use null to skip color not required to change.
Back buffer and Canvas are not updated automatically.
Use paintBuffer() and redraw() to update back buffer and Canvas if required.
- Specified by:
setColorSchemein interfaceIIconBar
getColorScheme
public org.eclipse.swt.graphics.Color[] getColorScheme()
- Specified by:
getColorSchemein interfaceIIconBar
getIconBackground
public org.eclipse.swt.graphics.Color getIconBackground()
- Specified by:
getIconBackgroundin interfaceIIconBar
setLayout
public void setLayout(Layout layout)
- Note that IconBarLayout.align is overriden by alignment specified for IconBar constructor.
- Specified by:
setLayoutin interfaceIComposite- Overrides:
setLayoutin classComposite
getItems
public java.util.List getItems()
getItem
public java.lang.Object getItem(int n)
itemIndexAt
public int itemIndexAt(int x,
int y)
- Get item index at given pixel coordinates inside the IconBar.
Mouse event handler can use this to retreive the item under the mouse.
- Specified by:
itemIndexAtin interfaceIIconBar
getItemAt
public java.lang.Object getItemAt(int x, int y)
- Get the Action item at the given coordinate inside the IconBar.
Mouse event handler can use this to retreive the action.
getCanvas
public Canvas getCanvas()
getBackBuffer
public org.eclipse.swt.graphics.Image getBackBuffer()
- Specified by:
getBackBufferin interfaceIIconBar
getLayout
public Layout getLayout()
- Description copied from class:
Composite - Returns layout which is associated with the receiver, or
null if one has not been set.
- Specified by:
getLayoutin interfaceIComposite- Overrides:
getLayoutin classComposite
getViewOffset
public org.eclipse.swt.graphics.Point getViewOffset()
- Return the point in the content that currenly appears in the top left
corner of the scrolled composite.
- Specified by:
getViewOffsetin interfaceIIconBar
- Since:
- 2.0
setViewOffset
public void setViewOffset(int x,
int y)
- Specified by:
setViewOffsetin interfaceIIconBar
getAlwaysShowScrollBars
public boolean getAlwaysShowScrollBars()
- Returns the Always Show Scrollbars flag. True if the scrollbars are
always shown even if they are not required. False if the scrollbars are only
visible when some part of the composite needs to be scrolled to be seen.
The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the
horizontal and vertical directions.
- Specified by:
getAlwaysShowScrollBarsin interfaceIIconBar
setAlwaysShowScrollBars
public void setAlwaysShowScrollBars(boolean show)
- Set the Always Show Scrollbars flag. True if the scrollbars are
always shown even if they are not required. False if the scrollbars are only
visible when some part of the composite needs to be scrolled to be seen.
The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the
horizontal and vertical directions.
setExpandHorizontal
public void setExpandHorizontal(boolean expand)
- Configure the ScrolledComposite to resize the content object to be as wide as the
ScrolledComposite when the width of the ScrolledComposite is greater than the
minimum width specified in setMinWidth. If the ScrolledComposite is less than the
minimum width, the content will not resized and instead the horizontal scroll bar will be
used to view the entire width.
If expand is false, this behaviour is turned off. By default, this behaviour is turned off.
setExpandVertical
public void setExpandVertical(boolean expand)
- Configure the ScrolledComposite to resize the content object to be as tall as the
ScrolledComposite when the height of the ScrolledComposite is greater than the
minimum height specified in setMinHeight. If the ScrolledComposite is less than the
minimum height, the content will not resized and instead the vertical scroll bar will be
used to view the entire height.
If expand is false, this behaviour is turned off. By default, this behaviour is turned off.
setViewportSize
public void setViewportSize(org.eclipse.swt.graphics.Point size)
- Specify the minimum width and height at which the ScrolledComposite will begin scrolling the
content with the horizontal scroll bar. This value is only relevant if
setExpandHorizontal(true) and setExpandVertical(true) have been set.
setViewportSize
public void setViewportSize(int width,
int height)
- Specify the minimum width and height at which the ScrolledComposite will begin scrolling the
content with the horizontal scroll bar. This value is only relevant if
setExpandHorizontal(true) and setExpandVertical(true) have been set.
setViewportWidth
public void setViewportWidth(int width)
- Specify the minimum width at which the ScrolledComposite will begin scrolling the
content with the horizontal scroll bar. This value is only relevant if
setExpandHorizontal(true) has been set.
setViewportHeight
public void setViewportHeight(int height)
- Specify the minimum height at which the ScrolledComposite will begin scrolling the
content with the vertical scroll bar. This value is only relevant if
setExpandVertical(true) has been set.
layout
public void layout()
- 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 receiver does not have a layout, do nothing.
This is equivalent to calling
layout(true).
layout
public void layout(boolean flush)
- Relayout icons on the canvas.
Since IconBar pre-renderer icons into a back buffer, layout(true) cause
the back buffer to be repainted.
- Specified by:
layoutin interfaceIComposite- Overrides:
layoutin classComposite
setEnabled
public void setEnabled(int i,
boolean enabled)
- Enable/disable specified item.
paintCell
public void paintCell(int n,
boolean flush)
paintBuffer
public void paintBuffer(boolean flush)
getId
public java.lang.String getId()
setId
public void setId(java.lang.String id)
toString
public java.lang.String toString()
- Description copied from class:
Widget - Returns a string containing a concise, human-readable
description of the receiver.
paintCanvas
protected void paintCanvas(org.eclipse.swt.events.PaintEvent e)
resize
protected void resize()
hScroll
protected void hScroll()
vScroll
protected void vScroll()
|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ widgets overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC