public class Scroll extends StyledComposite
Horizontal:
Vertical:
EMPTY_ELEMENT_ARRAY
Constructor and Description |
---|
Scroll()
Creates a horizontal scroll composite with a visible scrollbar.
|
Scroll(boolean horizontal,
boolean showScrollbar)
Creates a scroll composite specifying its orientation and the visibility of the scrollbar.
|
Modifier and Type | Method and Description |
---|---|
boolean |
handleEvent(int event)
Called by the system if a child of this composite is the owner of the focus of the active panel (recursively) and
have not consumed the specified event.
|
void |
hideNotify()
This method is called as soon as the renderable is hidden.
|
void |
scrollTo(int position)
Scrolls to a position without animation.
|
void |
scrollTo(int position,
boolean animate)
Scrolls to a position.
|
protected void |
setBoundsContent(Rectangle bounds)
Sets the bounds of this widget by taking into account the border, margin and padding specified in the style.
|
void |
setHorizontal(boolean horizontal)
Sets the scroll orientation: horizontal or vertical.
|
void |
setWidget(Widget content)
Sets the content to scroll.
|
void |
showNotify()
This method is called as soon as the renderable is visible.
|
void |
showScrollbar(boolean show)
Sets whether the scrollbar is visible or not.
|
Rectangle |
validateContent(Style style,
Rectangle bounds)
Gets the content size of the renderable without the border, margin and padding specified in the style.
|
add, addClassSelector, contains, gainFocus, getAttribute, getChild, getChildrenCount, getChildrenElements, getParentElement, getStyle, hasClassSelector, isInState, isTransparent, lostFocus, mergeStyle, removeAllClassSelectors, removeClassSelector, removeInstanceStyle, render, renderContent, setBounds, setClassSelectors, setEnabled, updateStyle, updateStyleOnly, validate
getFocus, getFocusIndex, getNext, getWidget, getWidgetAt, getWidgets, getWidgetsCount, iterator, remove, removeAllWidgets, requestFocus, requestFocus, requestFocusFrom
getAbsoluteX, getAbsoluteX, getAbsoluteY, getAbsoluteY, getEventHandler, getHeight, getPanel, getParent, getPreferredHeight, getPreferredWidth, getRelativeX, getRelativeY, getWidth, getX, getY, hasFocus, invalidate, isEnabled, isShown, isValid, isVisible, repaint, repaint, revalidate, revalidateSubTree, setEventHandler, setLocation, setPreferredSize, setSize, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEventHandler, getHeight, getWidth, getX, getY, isShown, repaint, repaint, setEventHandler
public Scroll()
public Scroll(boolean horizontal, boolean showScrollbar)
horizontal
- true
to scroll horizontally, false
to scroll vertically.showScrollbar
- true
to show the scrollbar, false
otherwise.public void setWidget(Widget content)
content
- the widget to scroll.public void setHorizontal(boolean horizontal)
horizontal
- true
to scroll horizontally, false
to scroll vertically.public void showScrollbar(boolean show)
show
- true
to show the scrollbar, false
to hide it.public Rectangle validateContent(Style style, Rectangle bounds)
StyledComposite
Lays out the children of this composite.
validateContent
in interface StyledRenderable
validateContent
in class StyledComposite
style
- the style to use.bounds
- the bounds available for the content. A width or a height equals to MWT.NONE
means no
constraint on this dimension.protected void setBoundsContent(Rectangle bounds)
StyledComposite
setBoundsContent
in class StyledComposite
bounds
- the bounds available for the content.public void showNotify()
Composite
Notifies its children widgets that they are shown.
showNotify
in interface Renderable
showNotify
in class Composite
public void hideNotify()
Composite
Notifies its children widgets that they are hidden.
hideNotify
in interface Renderable
hideNotify
in class Composite
public void scrollTo(int position, boolean animate)
position
- the x or y target (depending on the orientation).animate
- whether the scrolling action should be animated.public void scrollTo(int position)
position
- the x or y target (depending on the orientation).public boolean handleEvent(int event)
Composite
Command#UP
, Command#DOWN
,
Command#LEFT
, and Command#RIGHT
commands to manage navigation in its children.handleEvent
in interface Renderable
handleEvent
in class Composite
event
- the event to handletrue
if the composite consume the event, false
otherwiseWidget.setEventHandler(EventHandler)