public class Decorations extends Canvas
Shells
, but are not top
level shells or dialogs. Class Shell
shares a significant amount of code with this class,
and is a subclass.
IMPORTANT: This class was intended to be abstract and
should never be referenced or instantiated.
Instead, the class Shell
should be used.
Instances are always displayed in one of the maximized, minimized or normal states:
RESIZE
) until it is
no longer maximized.
SWT
provides two "convenience constants"
for the most commonly required style combinations:
SHELL_TRIM
CLOSE | TITLE | MIN | MAX | RESIZE
)
DIALOG_TRIM
TITLE | CLOSE | BORDER
)
IMPORTANT: This class is intended to be subclassed only within the SWT implementation.
getMinimized()
,
getMaximized()
,
Shell
,
SWT
,
Sample code and further informationConstructor and Description |
---|
Decorations(Composite parent,
int style)
Constructs a new instance of this class given its parent
and a style value describing its behavior and appearance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkSubclass()
Checks that this class can be subclassed.
|
void |
dispose()
Disposes of the operating system resources associated with
the receiver and all its descendants.
|
Button |
getDefaultButton()
Returns the receiver's default button if one had
previously been set, otherwise returns null.
|
Image |
getImage()
Returns the receiver's image if it had previously been
set using
setImage() . |
Image[] |
getImages()
Returns the receiver's images if they had previously been
set using
setImages() . |
boolean |
getMaximized()
Returns
true if the receiver is currently
maximized, and false otherwise. |
Menu |
getMenuBar()
Returns the receiver's menu bar if one had previously
been set, otherwise returns null.
|
boolean |
getMinimized()
Returns
true if the receiver is currently
minimized, and false otherwise. |
String |
getText()
Returns the receiver's text, which is the string that the
window manager will typically display as the receiver's
title.
|
boolean |
isReparentable()
Returns
true if the underlying operating
system supports this reparenting, otherwise false |
void |
setDefaultButton(Button button)
If the argument is not null, sets the receiver's default
button to the argument, and if the argument is null, sets
the receiver's default button to the first button which
was set as the receiver's default button (called the
saved default button).
|
void |
setImage(Image image)
Sets the receiver's image to the argument, which may
be null.
|
void |
setImages(Image[] images)
Sets the receiver's images to the argument, which may
be an empty array.
|
void |
setMaximized(boolean maximized)
Sets the maximized state of the receiver.
|
void |
setMenuBar(Menu menu)
Sets the receiver's menu bar to the argument, which
may be null.
|
void |
setMinimized(boolean minimized)
Sets the minimized stated of the receiver.
|
void |
setOrientation(int orientation)
Sets the orientation of the receiver, which must be one
of the constants
SWT.LEFT_TO_RIGHT or SWT.RIGHT_TO_LEFT . |
void |
setText(String string)
Sets the receiver's text, which is the string that the
window manager will typically display as the receiver's
title, to the argument, which must not be null.
|
void |
setVisible(boolean visible)
Marks the receiver as visible if the argument is
true ,
and marks it invisible otherwise. |
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
changed, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isAutoScalable, isEnabled, isFocusControl, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public Decorations(Composite parent, int style)
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.
parent
- a composite control which will be the parent of the new instance (cannot be null)style
- the style of control to constructIllegalArgumentException
- SWTException
- SWT.BORDER
,
SWT.CLOSE
,
SWT.MIN
,
SWT.MAX
,
SWT.RESIZE
,
SWT.TITLE
,
SWT.NO_TRIM
,
SWT.NO_MOVE
,
SWT.SHELL_TRIM
,
SWT.DIALOG_TRIM
,
SWT.ON_TOP
,
SWT.TOOL
,
Widget.checkSubclass()
,
Widget.getStyle()
protected void checkSubclass()
Widget
The SWT class library is intended to be subclassed
only at specific, controlled points (most notably,
Composite
and Canvas
when
implementing new widgets). This method enforces this
rule unless it is overridden.
IMPORTANT: By providing an implementation of this method that allows a subclass of a class which does not normally allow subclassing to be created, the implementer agrees to be fully responsible for the fact that any such subclass will likely fail between SWT releases and will be strongly platform specific. No support is provided for user-written classes which are implemented in this fashion.
The ability to subclass outside of the allowed SWT classes is intended purely to enable those not on the SWT development team to implement patches in order to get around specific limitations in advance of when those limitations can be addressed by the team. Subclassing should not be attempted without an intimate and detailed understanding of the hierarchy.
checkSubclass
in class Composite
public void dispose()
Widget
true
when sent the message isDisposed()
.
Any internal connections between the widgets in the tree will
have been removed to facilitate garbage collection.
This method does nothing if the widget is already disposed.
NOTE: This method is not called recursively on the descendants
of the receiver. This means that, widget implementers can not
detect when a widget is being disposed of by re-implementing
this method, but should instead listen for the Dispose
event.
public Button getDefaultButton()
SWTException
- setDefaultButton(Button)
public Image getImage()
setImage()
. The image is typically
displayed by the window manager when the instance is
marked as iconified, and may also be displayed somewhere
in the trim when the instance is in normal or maximized
states.
Note: This method will return null if called before
setImage()
is called. It does not provide
access to a window manager provided, "default" image
even if one exists.
SWTException
- public Image[] getImages()
setImages()
. Images are typically
displayed by the window manager when the instance is
marked as iconified, and may also be displayed somewhere
in the trim when the instance is in normal or maximized
states. Depending where the icon is displayed, the platform
chooses the icon with the "best" attributes. It is expected
that the array will contain the same icon rendered at different
sizes, with different depth and transparency attributes.
Note: This method will return an empty array if called before
setImages()
is called. It does not provide
access to a window manager provided, "default" image
even if one exists.
SWTException
- public boolean getMaximized()
true
if the receiver is currently
maximized, and false otherwise.
SWTException
- setMaximized(boolean)
public Menu getMenuBar()
SWTException
- public boolean getMinimized()
true
if the receiver is currently
minimized, and false otherwise.
SWTException
- setMinimized(boolean)
public String getText()
SWTException
- public boolean isReparentable()
Control
true
if the underlying operating
system supports this reparenting, otherwise false
isReparentable
in class Control
true
if the widget can be reparented, otherwise false
public void setDefaultButton(Button button)
The default button is the button that is selected when the receiver is active and the user presses ENTER.
button
- the new default buttonIllegalArgumentException
- SWTException
- public void setImage(Image image)
image
- the new image (or null)IllegalArgumentException
- SWTException
- public void setImages(Image[] images)
images
- the new image arrayIllegalArgumentException
- SWTException
- public void setMaximized(boolean maximized)
true
causes the receiver
to switch to the maximized state, and if the argument is
false
and the receiver was previously maximized,
causes the receiver to switch back to either the minimized
or normal states.
Note: The result of intermixing calls to setMaximized(true)
and setMinimized(true)
will vary by platform. Typically,
the behavior will match the platform user's expectations, but not
always. This should be avoided if possible.
maximized
- the new maximized stateSWTException
- setMinimized(boolean)
public void setMenuBar(Menu menu)
menu
- the new menu barIllegalArgumentException
- SWTException
- public void setMinimized(boolean minimized)
true
causes the receiver
to switch to the minimized state, and if the argument is
false
and the receiver was previously minimized,
causes the receiver to switch back to either the maximized
or normal states.
Note: The result of intermixing calls to setMaximized(true)
and setMinimized(true)
will vary by platform. Typically,
the behavior will match the platform user's expectations, but not
always. This should be avoided if possible.
minimized
- the new maximized stateSWTException
- setMaximized(boolean)
public void setOrientation(int orientation)
Control
SWT.LEFT_TO_RIGHT
or SWT.RIGHT_TO_LEFT
.
setOrientation
in class Control
orientation
- new orientation stylepublic void setText(String string)
Note: If control characters like '\n', '\t' etc. are used in the string, then the behavior is platform dependent.
string
- the new textIllegalArgumentException
- SWTException
- public void setVisible(boolean visible)
Control
true
,
and marks it invisible otherwise.
If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, marking it visible may not actually cause it to be displayed.
setVisible
in class Control
visible
- the new visibility stateCopyright © 2017. All Rights Reserved.