public class Wrapper extends StyledComposite
By default it is sized after its child's dimensions. Shall you wish to make the wrapper bigger than its child (for
example for layout purposes), use setAdjustedToChild(boolean)
.
Only the area of its child is reactive to the pointer events. That means that if the wrapper is not adjusted to its child, a zone may not react to pointer events. If the wrapper does not have any child, its whole size react to pointer events.
contains(int, int)
EMPTY_ELEMENT_ARRAY
Constructor and Description |
---|
Wrapper()
Creates a wrapper that is adjusted to its child.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int x,
int y)
Gets whether or not a location (x,y) is in the widget's bounds.
|
boolean |
isAdjustedToChild()
Gets whether the wrapper is adjusted to its child.
|
void |
setAdjustedToChild(boolean value)
Sets whether the wrapper is adjusted to its child, meaning that its dimensions fit its child's dimensions.
|
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 |
setWidget(Widget widget)
Sets the only child of this composite.
|
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, 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, handleEvent, hideNotify, iterator, remove, removeAllWidgets, requestFocus, requestFocus, requestFocusFrom, showNotify
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, handleEvent, hideNotify, isShown, repaint, repaint, setEventHandler, showNotify
public void setWidget(Widget widget)
widget
- the widget to add in this composite.public boolean contains(int x, int y)
Widget
The given location is considered here as a relative location to parent.
contains
in class StyledComposite
x
- x coordinate.y
- y coordinate.true
if the (x,y)
location is in widget bounds, false
otherwise.Widget.isTransparent()
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 boolean isAdjustedToChild()
true
if the wrapper is adjusted to its child, false
otherwise.public void setAdjustedToChild(boolean value)
When the wrapper is not adjusted to its child, the child's location depends on the wrapper's style alignment rules.
value
- true
to adjust the wrapper's dimensions to its child's dimensions, false
otherwise.Style.getAlignment()