Top Description Fields Constructors Methods
org.eclipse.swt.widgets

public Class Decorations

extends Canvas
Class Inheritance
Known Direct Subclasses
org.eclipse.swt.widgets.Shell
Imports
org.eclipse.swt.*, org.eclipse.swt.graphics.*, org.eclipse.swt.internal.*, org.eclipse.swt.internal.gtk.*, org.eclipse.swt.internal.gtk3.*, org.eclipse.swt.internal.gtk4.*

Instances of this class provide the appearance and behavior of 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 Note

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:

Note: The styles supported by this class must be treated as HINTs, since the window manager for the desktop on which the instance is visible has ultimate control over the appearance and behavior of decorations. For example, some window managers only support resizable windows and will always assume the RESIZE style, even if it is not set.
Styles:
BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE, ON_TOP, TOOL
Events:
(none)
Class SWT provides two "convenience constants" for the most commonly required style combinations:
SHELL_TRIM
the result of combining the constants which are required to produce a typical application top level shell: (that is, CLOSE | TITLE | MIN | MAX | RESIZE)
DIALOG_TRIM
the result of combining the constants which are required to produce a typical application dialog shell: (that is, TITLE | CLOSE | BORDER)

Important Note

This class is intended to be subclassed only within the SWT implementation.

See Also
getMinimized, getMaximized, Shell, SWT, Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv long
pack-priv Button
pack-priv Image
pack-priv Image[]
pack-priv boolean
pack-priv boolean
pack-priv Button
pack-priv Control
pack-priv String
pack-priv long
Inherited from org.eclipse.swt.widgets.Canvas:
blinkcaretdrawFlagime

Constructor Summary

AccessConstructor and Description
pack-priv
public
Decorations(Composite
a composite control which will be the parent of the new instance (cannot be null)
parent
,
int
the style of control to construct
style
)

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
_setImages(Image[] images)

pack-priv void
addMenu(Menu menu)

pack-priv static int
protected void
checkSubclass()

Overrides org.eclipse.swt.widgets.Composite.checkSubclass.

Checks that this class can be subclassed.
pack-priv int
compare(ImageData data1, ImageData data2)

pack-priv Widget
pack-priv Control
pack-priv void
pack-priv void
pack-priv void
pack-priv void
pack-priv void
fixDecorations(Decorations newDecorations, Control control, Menu[] menus)

public Button

Returns:

the default button or null
getDefaultButton
()

Returns the receiver's default button if one had previously been set, otherwise returns null.

public Image

Returns:

the image
getImage
()

Returns the receiver's image if it had previously been set using setImage().

public Image[]

Returns:

the images
getImages
()

Returns the receiver's images if they had previously been set using setImages().

public boolean

Returns:

the maximized state
getMaximized
()

Returns true if the receiver is currently maximized, and false otherwise.

public Menu

Returns:

the menu bar or null
getMenuBar
()

Returns the receiver's menu bar if one had previously been set, otherwise returns null.

public boolean

Returns:

the minimized state
getMinimized
()

Returns true if the receiver is currently minimized, and false otherwise.

pack-priv String
public String

Returns:

the text
getText
()

Returns the receiver's text, which is the string that the window manager will typically display as the receiver's title.

public boolean
isReparentable()

Overrides org.eclipse.swt.widgets.Control.isReparentable.

Returns true if the underlying operating system supports this reparenting, otherwise false
pack-priv boolean
pack-priv boolean
pack-priv void
pack-priv void
pack-priv void
pack-priv void
pack-priv void
pack-priv boolean
public void
setDefaultButton(Button
the new default 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).

public void
setImage(Image
the new image (or null)
image
)

Sets the receiver's image to the argument, which may be null.

public void
setImages(Image[]
the new image array
images
)

Sets the receiver's images to the argument, which may be an empty array.

public void
setMaximized(boolean
the new maximized state
maximized
)

Sets the maximized state of the receiver.

public void
setMenuBar(Menu
the new menu bar
menu
)

Sets the receiver's menu bar to the argument, which may be null.

public void
setMinimized(boolean
the new minimized state
minimized
)

Sets the minimized stated of the receiver.

pack-priv void
pack-priv void
public void
setText(String
the new text
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.

pack-priv void
sort(Image[] images)

pack-priv boolean
pack-priv boolean
Inherited from org.eclipse.swt.widgets.Canvas:
drawBackgrounddrawCaretInFocusgetCaretgetIMCaretPosgetIMEgtk_button_press_eventgtk_commitgtk_drawgtk_focus_in_eventgtk_focus_out_eventgtk_preedit_changedredrawWidgetscrollscrollInPixelssetBoundssetCaretsetFontsetIMEupdateCaret

Field Detail

accelGroupback to summary
pack-priv long accelGroup
defaultButtonback to summary
pack-priv Button defaultButton
imageback to summary
pack-priv Image image
imagesback to summary
pack-priv Image[] images
maximizedback to summary
pack-priv boolean maximized
minimizedback to summary
pack-priv boolean minimized
saveDefaultback to summary
pack-priv Button saveDefault
savedFocusback to summary
pack-priv Control savedFocus
textback to summary
pack-priv String text
vboxHandleback to summary
pack-priv long vboxHandle

Constructor Detail

Decorationsback to summary
pack-priv Decorations()
Decorationsback to summary
public Decorations(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:Composite

a composite control which will be the parent of the new instance (cannot be null)

style:int

the style of control to construct

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the parent is null
SWTException:
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
See Also
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

Method Detail

_setImagesback to summary
pack-priv void _setImages(Image[] images)
addMenuback to summary
pack-priv void addMenu(Menu menu)
checkStyleback to summary
pack-priv static int checkStyle(int style)

Hides org.eclipse.swt.widgets.Composite.checkStyle.

checkSubclassback to summary
protected void checkSubclass()

Overrides org.eclipse.swt.widgets.Composite.checkSubclass.

Doc from org.eclipse.swt.widgets.Widget.checkSubclass.

Checks that this class can be subclassed.

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 Note

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.

Annotations
@Override
compareback to summary
pack-priv int compare(ImageData data1, ImageData data2)
computeTabGroupback to summary
pack-priv Widget computeTabGroup()

Overrides org.eclipse.swt.widgets.Control.computeTabGroup.

Annotations
@Override
computeTabRootback to summary
pack-priv Control computeTabRoot()

Overrides org.eclipse.swt.widgets.Control.computeTabRoot.

Annotations
@Override
createAccelGroupback to summary
pack-priv void createAccelGroup()
createWidgetback to summary
pack-priv void createWidget(int index)

Overrides org.eclipse.swt.widgets.Scrollable.createWidget.

Annotations
@Override
destroyAccelGroupback to summary
pack-priv void destroyAccelGroup()
fixAccelGroupback to summary
pack-priv void fixAccelGroup()
fixDecorationsback to summary
pack-priv void fixDecorations(Decorations newDecorations, Control control, Menu[] menus)
getDefaultButtonback to summary
public Button getDefaultButton()

Returns the receiver's default button if one had previously been set, otherwise returns null.

Returns:Button

the default button or null

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also
setDefaultButton(Button)
getImageback to summary
public Image getImage()

Returns the receiver's image if it had previously been set using 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.

Returns:Image

the image

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getImagesback to summary
public Image[] getImages()

Returns the receiver's images if they had previously been set using 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.

Returns:Image[]

the images

Exceptions
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
getMaximizedback to summary
public boolean getMaximized()

Returns true if the receiver is currently maximized, and false otherwise.

Returns:boolean

the maximized state

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also
setMaximized
getMenuBarback to summary
public Menu getMenuBar()

Returns the receiver's menu bar if one had previously been set, otherwise returns null.

Returns:Menu

the menu bar or null

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getMinimizedback to summary
public boolean getMinimized()

Returns true if the receiver is currently minimized, and false otherwise.

Returns:boolean

the minimized state

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also
setMinimized
getNameTextback to summary
pack-priv String getNameText()

Overrides org.eclipse.swt.widgets.Widget.getNameText.

Annotations
@Override
getTextback to summary
public String getText()

Returns the receiver's text, which is the string that the window manager will typically display as the receiver's title. If the text has not previously been set, returns an empty string.

Returns:String

the text

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
isReparentableback to summary
public boolean isReparentable()

Overrides org.eclipse.swt.widgets.Control.isReparentable.

Doc from org.eclipse.swt.widgets.Control.isReparentable.

Returns true if the underlying operating system supports this reparenting, otherwise false

Returns:boolean

true if the widget can be reparented, otherwise false

Annotations
@Override
isTabGroupback to summary
pack-priv boolean isTabGroup()

Overrides org.eclipse.swt.widgets.Composite.isTabGroup.

Annotations
@Override
isTabItemback to summary
pack-priv boolean isTabItem()

Overrides org.eclipse.swt.widgets.Control.isTabItem.

Annotations
@Override
releaseChildrenback to summary
pack-priv void releaseChildren(boolean destroy)

Overrides org.eclipse.swt.widgets.Canvas.releaseChildren.

Annotations
@Override
releaseHandleback to summary
pack-priv void releaseHandle()

Overrides org.eclipse.swt.widgets.Composite.releaseHandle.

Annotations
@Override
releaseWidgetback to summary
pack-priv void releaseWidget()

Overrides org.eclipse.swt.widgets.Composite.releaseWidget.

Annotations
@Override
removeMenuback to summary
pack-priv void removeMenu(Menu menu)
reskinChildrenback to summary
pack-priv void reskinChildren(int flags)

Overrides org.eclipse.swt.widgets.Canvas.reskinChildren.

Annotations
@Override
restoreFocusback to summary
pack-priv boolean restoreFocus()
setDefaultButtonback to summary
public 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). If no default button had previously been set, or the saved default button was disposed, the receiver's default button will be set to null.

The default button is the button that is selected when the receiver is active and the user presses ENTER.

Parameters
button:Button

the new default button

Exceptions
IllegalArgumentException:
  • ERROR_INVALID_ARGUMENT - if the button has been disposed
  • ERROR_INVALID_PARENT - if the control is not in the same widget tree
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setImageback to summary
public void setImage(Image image)

Sets the receiver's image to the argument, which may be null. 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.

Parameters
image:Image

the new image (or null)

Exceptions
IllegalArgumentException:
  • ERROR_INVALID_ARGUMENT - if the image has been disposed
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setImagesback to summary
public void setImages(Image[] images)

Sets the receiver's images to the argument, which may be an empty array. 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.

Parameters
images:Image[]

the new image array

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the array of images is null
  • ERROR_INVALID_ARGUMENT - if one of the images is null or has been disposed
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
setMaximizedback to summary
public void setMaximized(boolean maximized)

Sets the maximized state of the receiver. If the argument is 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.

Parameters
maximized:boolean

the new maximized state

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also
setMinimized
setMenuBarback to summary
public void setMenuBar(Menu menu)

Sets the receiver's menu bar to the argument, which may be null.

Parameters
menu:Menu

the new menu bar

Exceptions
IllegalArgumentException:
  • ERROR_INVALID_ARGUMENT - if the menu has been disposed
  • ERROR_INVALID_PARENT - if the menu is not in the same widget tree
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setMinimizedback to summary
public void setMinimized(boolean minimized)

Sets the minimized stated of the receiver. If the argument is 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.

Parameters
minimized:boolean

the new minimized state

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also
setMaximized
setOrientationback to summary
pack-priv void setOrientation(boolean create)

Overrides org.eclipse.swt.widgets.Composite.setOrientation.

Annotations
@Override
setSavedFocusback to summary
pack-priv void setSavedFocus(Control control)
setTextback to summary
public 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.

Note

If control characters like '\n', '\t' etc. are used in the string, then the behavior is platform dependent.

Parameters
string:String

the new text

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the text is null
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
sortback to summary
pack-priv void sort(Image[] images)
traverseItemback to summary
pack-priv boolean traverseItem(boolean next)

Overrides org.eclipse.swt.widgets.Control.traverseItem.

Annotations
@Override
traverseReturnback to summary
pack-priv boolean traverseReturn()

Overrides org.eclipse.swt.widgets.Control.traverseReturn.

Annotations
@Override