|
Eclipse Rich Ajax Platform | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.swt.widgets.Widget org.eclipse.swt.widgets.Control org.eclipse.swt.widgets.Scrollable org.eclipse.swt.widgets.Composite org.eclipse.swt.widgets.Canvas org.eclipse.swt.widgets.Decorations org.eclipse.swt.widgets.Shell
public class Shell
Instances of this class represent the "windows"
which the desktop or "window manager" is managing.
Instances that do not have a parent (that is, they
are built using the constructor, which takes a
Display
as the argument) are described
as top level shells. Instances that do have
a parent are described as secondary or
dialog shells.
Instances are always displayed in one of the maximized, minimized or normal states:
RESIZE
) until it is
no longer maximized.
The modality of an instance may be specified using
style bits. The modality style bits are used to determine
whether input is blocked for other shells on the display.
The PRIMARY_MODAL
style allows an instance to block
input to its parent. The APPLICATION_MODAL
style
allows an instance to block input to every other shell in the
display. The SYSTEM_MODAL
style allows an instance
to block input to all shells, including shells belonging to
different applications.
Note: The styles supported by this class are 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
and modality. For example, some window managers only
support resizable windows and will always assume the
RESIZE style, even if it is not set. In addition, if a
modality style is not supported, it is "upgraded" to a
more restrictive modality style that is supported. For
example, if PRIMARY_MODAL
is not supported,
it would be upgraded to APPLICATION_MODAL
.
A modality style may also be "downgraded" to a less
restrictive style. For example, most operating systems
no longer support SYSTEM_MODAL
because
it can freeze up the desktop, so this is typically
downgraded to APPLICATION_MODAL
.
SWT
provides two "convenience constants"
for the most commonly required style combinations:
SHELL_TRIM
CLOSE | TITLE | MIN | MAX | RESIZE
)
DIALOG_TRIM
TITLE | CLOSE | BORDER
)
Note: Only one of the styles APPLICATION_MODAL, MODELESS, PRIMARY_MODAL and SYSTEM_MODAL may be specified.
IMPORTANT: This class is not intended to be subclassed.
SWT
Constructor Summary | |
---|---|
Shell()
Constructs a new instance of this class. |
|
Shell(Display display)
Constructs a new instance of this class given only the display to create it on. |
|
Shell(Display display,
int style)
Constructs a new instance of this class given the display to create it on and a style value describing its behavior and appearance. |
|
Shell(int style)
Constructs a new instance of this class given only the style value describing its behavior and appearance. |
|
Shell(Shell parent)
Constructs a new instance of this class given only its parent. |
|
Shell(Shell parent,
int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. |
Method Summary | ||
---|---|---|
void |
addShellListener(ShellListener listener)
Adds the listener to the collection of listeners who will be notified when operations are performed on the receiver, by sending the listener one of the messages defined in the ShellListener interface. |
|
void |
close()
Requests that the window manager close the receiver in the same way it would be closed when the user clicks on the "close box" or performs some other platform specific key or mouse combination that indicates the window should be removed. |
|
Rectangle |
computeTrim(int x,
int y,
int width,
int height)
Given a desired client area for the receiver (as described by the arguments), returns the bounding rectangle which would be required to produce that client area. |
|
void |
forceActive()
If the receiver is visible, moves it to the top of the drawing order for the display on which it was created (so that all other shells on that display, which are not the receiver's children will be drawn behind it) and forces the window manager to make the shell active. |
|
|
getAdapter(java.lang.Class<T> adapter)
Implementation of the Adaptable interface. |
|
int |
getAlpha()
Returns the receiver's alpha value. |
|
int |
getBorderWidth()
Returns the receiver's border width. |
|
Rectangle |
getClientArea()
Returns a rectangle which describes the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings"). |
|
Button |
getDefaultButton()
Returns the receiver's default button if one had previously been set, otherwise returns null. |
|
boolean |
getFullScreen()
Returns true if the receiver is currently
in fullscreen state, and false otherwise. |
|
boolean |
getMaximized()
Returns true if the receiver is currently
maximized, and false otherwise. |
|
boolean |
getMinimized()
Returns true if the receiver is currently
minimized, and false otherwise. |
|
Point |
getMinimumSize()
Returns a point describing the minimum receiver's size. |
|
boolean |
getModified()
Gets the receiver's modified state. |
|
Shell[] |
getShells()
Returns an array containing all shells which are descendents of the receiver. |
|
java.lang.String |
getText()
Returns the receiver's text, which is the string that the window manager will typically display as the receiver's title. |
|
ToolBar |
getToolBar()
Returns the instance of the ToolBar object representing the tool bar that can appear on the trim of the shell. |
|
boolean |
isEnabled()
Returns true if the receiver is enabled and all
ancestors up to and including the receiver's nearest ancestor
shell are enabled. |
|
boolean |
isVisible()
Returns true if the receiver is visible and all
ancestors up to and including the receiver's nearest ancestor
shell are visible. |
|
void |
open()
Moves the receiver to the top of the drawing order for the display on which it was created (so that all other shells on that display, which are not the receiver's children will be drawn behind it), marks it visible, sets the focus and asks the window manager to make the shell active. |
|
void |
removeShellListener(ShellListener listener)
Removes the listener from the collection of listeners who will be notified when operations are performed on the receiver. |
|
void |
setActive()
If the receiver is visible, moves it to the top of the drawing order for the display on which it was created (so that all other shells on that display, which are not the receiver's children will be drawn behind it) and asks the window manager to make the shell active |
|
void |
setAlpha(int alpha)
Sets the receiver's alpha value. |
|
void |
setBounds(Rectangle bounds)
Sets the receiver's size and location to the rectangular area specified by the argument. |
|
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 |
setEnabled(boolean enabled)
Enables the receiver if the argument is true ,
and disables it otherwise. |
|
void |
setFullScreen(boolean fullScreen)
Sets the full screen state of the receiver. |
|
void |
setMaximized(boolean maximized)
Sets the maximized state of the receiver. |
|
void |
setMinimized(boolean minimized)
Sets the minimized stated of the receiver. |
|
void |
setMinimumSize(int width,
int height)
Sets the receiver's minimum size to the size specified by the arguments. |
|
void |
setMinimumSize(Point size)
Sets the receiver's minimum size to the size specified by the argument. |
|
void |
setModified(boolean modified)
Sets the receiver's modified state as specified by the argument. |
|
void |
setText(java.lang.String text)
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. |
Methods inherited from class org.eclipse.swt.widgets.Decorations |
---|
getImage, getImages, getMenuBar, setImage, setImages, setMenuBar |
Methods inherited from class org.eclipse.swt.widgets.Canvas |
---|
addPaintListener, removePaintListener |
Methods inherited from class org.eclipse.swt.widgets.Composite |
---|
changed, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList |
Methods inherited from class org.eclipse.swt.widgets.Scrollable |
---|
getHorizontalBar, getVerticalBar |
Methods inherited from class org.eclipse.swt.widgets.Widget |
---|
addDisposeListener, addListener, checkSubclass, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, reskin, setData, setData, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Shell()
Shell((Display) null)
.
SWTException
- public Shell(int style)
Shell((Display) null, 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.
style
- the style of control to construct
SWTException
- SWT.BORDER
,
SWT.CLOSE
,
SWT.MIN
,
SWT.MAX
,
SWT.RESIZE
,
SWT.TITLE
,
SWT.NO_TRIM
,
SWT.SHELL_TRIM
,
,
,
SWT.SHEET
public Shell(Display display)
SWT.SHELL_TRIM
.
Note: Currently, null can be passed in for the display argument. This has the effect of creating the shell on the currently active display if there is one. If there is no current display, the shell is created on a "default" display. Passing in null as the display argument is not considered to be good coding style, and may not be supported in a future release of SWT.
display
- the display to create the shell on
SWTException
- public Shell(Display display, 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.
Note: Currently, null can be passed in for the display argument. This has the effect of creating the shell on the currently active display if there is one. If there is no current display, the shell is created on a "default" display. Passing in null as the display argument is not considered to be good coding style, and may not be supported in a future release of SWT.
display
- the display to create the shell onstyle
- the style of control to construct
SWTException
- SWT.BORDER
,
SWT.CLOSE
,
SWT.MIN
,
SWT.MAX
,
SWT.RESIZE
,
SWT.TITLE
,
SWT.NO_TRIM
,
SWT.SHELL_TRIM
,
SWT.DIALOG_TRIM
,
SWT.MODELESS
,
SWT.PRIMARY_MODAL
,
SWT.APPLICATION_MODAL
,
SWT.SYSTEM_MODAL
,
SWT.SHEET
public Shell(Shell parent)
SWT.DIALOG_TRIM
.
Note: Currently, null can be passed in for the parent. This has the effect of creating the shell on the currently active display if there is one. If there is no current display, the shell is created on a "default" display. Passing in null as the parent is not considered to be good coding style, and may not be supported in a future release of SWT.
parent
- a shell which will be the parent of the new instance
java.lang.IllegalArgumentException
- SWTException
- public Shell(Shell 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.
Note: Currently, null can be passed in for the parent. This has the effect of creating the shell on the currently active display if there is one. If there is no current display, the shell is created on a "default" display. Passing in null as the parent is not considered to be good coding style, and may not be supported in a future release of SWT.
parent
- a shell which will be the parent of the new instancestyle
- the style of control to construct
java.lang.IllegalArgumentException
- SWTException
- SWT.BORDER
,
SWT.CLOSE
,
SWT.MIN
,
SWT.MAX
,
SWT.RESIZE
,
SWT.TITLE
,
SWT.NO_TRIM
,
SWT.SHELL_TRIM
,
SWT.DIALOG_TRIM
,
SWT.ON_TOP
,
SWT.TOOL
,
,
Method Detail |
---|
public Shell[] getShells()
SWTException
- public void setActive()
SWTException
- Control.moveAbove(org.eclipse.swt.widgets.Control)
,
Control.setFocus()
,
Control.setVisible(boolean)
,
,
setDefaultButton(Button)
,
open()
,
setActive()
public void forceActive()
SWTException
- Control.moveAbove(org.eclipse.swt.widgets.Control)
,
Control.setFocus()
,
Control.setVisible(boolean)
,
,
open()
,
setActive()
public Rectangle getClientArea()
Scrollable
getClientArea
in class Scrollable
Scrollable.computeTrim(int, int, int, int)
public Rectangle computeTrim(int x, int y, int width, int height)
Scrollable
In other words, it returns a rectangle such that, if the receiver's bounds were set to that rectangle, the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings") would be the rectangle described by the arguments (relative to the receiver's parent).
computeTrim
in class Scrollable
x
- the desired x coordinate of the client areay
- the desired y coordinate of the client areawidth
- the desired width of the client areaheight
- the desired height of the client area
Scrollable.getClientArea()
public int getBorderWidth()
Control
getBorderWidth
in class Control
public <T> T getAdapter(java.lang.Class<T> adapter)
Canvas
Adaptable
interface.
IMPORTANT: This method is not part of the RWT public API. It is marked public only so that it can be shared within the packages provided by RWT. It should never be accessed from application code.
getAdapter
in interface Adaptable
getAdapter
in class Decorations
adapter
- the lookup class
null
if
there is no adapter associated with the given class.public void setEnabled(boolean enabled)
Control
true
,
and disables it otherwise. A disabled control is typically
not selectable from the user interface and draws with an
inactive or "grayed" look.
setEnabled
in class Control
enabled
- the new enabled statepublic boolean isEnabled()
Control
true
if the receiver is enabled and all
ancestors up to and including the receiver's nearest ancestor
shell are enabled. Otherwise, false
is returned.
A disabled control is typically not selectable from the user
interface and draws with an inactive or "grayed" look.
isEnabled
in class Control
Control.getEnabled()
public boolean isVisible()
Control
true
if the receiver is visible and all
ancestors up to and including the receiver's nearest ancestor
shell are visible. Otherwise, false
is returned.
isVisible
in class Control
Control.getVisible()
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 statepublic void open()
SWTException
- Control.moveAbove(org.eclipse.swt.widgets.Control)
,
Control.setFocus()
,
Control.setVisible(boolean)
,
,
setDefaultButton(Button)
,
setActive()
,
forceActive()
public void close()
SWTException
- SWT.Close
,
Widget.dispose()
public void setText(java.lang.String text)
text
- the new text
java.lang.IllegalArgumentException
- SWTException
- public java.lang.String getText()
SWTException
- 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 button
java.lang.IllegalArgumentException
- SWTException
- public Button getDefaultButton()
SWTException
- setDefaultButton(Button)
public void setAlpha(int alpha)
This operation may not be available on some platforms.
alpha
- the alpha value
SWTException
- public int getAlpha()
SWTException
- public void setModified(boolean modified)
modified
- the new modified state for the receiver
SWTException
- public boolean getModified()
SWTException
- public void setMinimumSize(int width, int height)
width
- the new minimum width for the receiverheight
- the new minimum height for the receiver
SWTException
- public void setMinimumSize(Point size)
size
- the new minimum size for the receiver
java.lang.IllegalArgumentException
- SWTException
- public Point getMinimumSize()
SWTException
- public void setBounds(Rectangle bounds)
Control
x
and
y
fields of the rectangle are relative to
the receiver's parent (or its display if its parent is null).
Note: Attempting to set the width or height of the receiver to a negative number will cause that value to be set to zero instead.
setBounds
in class Control
bounds
- the new bounds for the receiverpublic ToolBar getToolBar()
null
if the platform does not support tool
bars that not part of the content area of the shell, or if the style of the shell does not
support a tool bar.
SWTException
- public void addShellListener(ShellListener listener)
ShellListener
interface.
listener
- the listener which should be notified
java.lang.IllegalArgumentException
- SWTException
- ShellListener
,
removeShellListener(org.eclipse.swt.events.ShellListener)
public void removeShellListener(ShellListener listener)
listener
- the listener which should no longer be notified
java.lang.IllegalArgumentException
- SWTException
- ShellListener
,
addShellListener(org.eclipse.swt.events.ShellListener)
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.
minimized
- the new maximized state
SWTException
- setMaximized(boolean)
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.
maximized
- the new maximized state
SWTException
- setMinimized(boolean)
public boolean getMinimized()
true
if the receiver is currently
minimized, and false otherwise.
SWTException
- setMinimized(boolean)
public boolean getMaximized()
true
if the receiver is currently
maximized, and false otherwise.
SWTException
- setMaximized(boolean)
public void setFullScreen(boolean fullScreen)
true
causes the receiver
to switch to the full screen state, and if the argument is
false
and the receiver was previously switched
into full screen state, causes the receiver to switch back
to either the maximized or normal states.
Note: The result of intermixing calls to setFullScreen(true)
,
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.
fullScreen
- the new fullscreen state
SWTException
- public boolean getFullScreen()
true
if the receiver is currently
in fullscreen state, and false otherwise.
SWTException
-
|
Eclipse Rich Ajax Platform | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) EclipseSource and others 2002, 2012. All rights reserved.