|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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.
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
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
.
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.
Decorations
,
SWT
Field Summary |
---|
Fields inherited from class org.eclipse.swt.widgets.Control |
---|
enableTraverse, internal_parent |
Fields inherited from class org.eclipse.swt.widgets.Widget |
---|
internal_handle, internal_style |
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. |
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. |
int |
getImeInputMode()
Returns the receiver's input method editor mode. |
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. |
Shell |
getShell()
Returns the receiver's shell. |
Shell[] |
getShells()
Returns an array containing all shells which are descendents of the receiver. |
protected void |
internal_createHandle(int index)
|
protected int |
internal_getNativeStyle()
|
protected boolean |
isValidSubclass()
|
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 |
setImage(Image image)
Sets the receiver's image to the argument, which may be null. |
void |
setImeInputMode(int mode)
Sets the input method editor mode to the argument which should be the result of bitwise OR'ing together one or more of the following constants defined in class SWT :
NONE , ROMAN , DBCS ,
PHONETIC , NATIVE , ALPHA . |
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 |
setText(java.lang.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. |
java.lang.String |
toString()
Returns a string containing a concise, human-readable description of the receiver. |
Methods inherited from class org.eclipse.swt.widgets.Decorations |
---|
getDefaultButton, getImage, getMenuBar, getText, isReparentable, setBounds, setDefaultButton, setLocation |
Methods inherited from class org.eclipse.swt.widgets.Canvas |
---|
removeInternalFilter, scroll, traverse |
Methods inherited from class org.eclipse.swt.widgets.Composite |
---|
allowTraverseByArrowKey, checkSubclass, computeSize, getChildren, getLayout, getTabList, internal_removeChild, layout, layout, setFocus, setLayout, setSize, setTabList, traverse |
Methods inherited from class org.eclipse.swt.widgets.Scrollable |
---|
computeTrim, getClientArea, getHorizontalBar, getVerticalBar |
Methods inherited from class org.eclipse.swt.widgets.Widget |
---|
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getStyle, internal_sendEvent, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, sendEvent, setData, setData |
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.DIALOG_TRIM
,
SWT.MODELESS
,
SWT.PRIMARY_MODAL
,
SWT.APPLICATION_MODAL
,
SWT.SYSTEM_MODAL
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
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.MODELESS
,
SWT.PRIMARY_MODAL
,
SWT.APPLICATION_MODAL
,
SWT.SYSTEM_MODAL
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
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
Method Detail |
---|
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 close()
SWTException
- SWT.Close
,
Control.dispose()
protected void internal_createHandle(int index)
internal_createHandle
in class Composite
public void forceActive()
SWTException
- Control.moveAbove(org.eclipse.swt.widgets.Control)
,
Control.setFocus()
,
Control.setVisible(boolean)
,
Display.getActiveShell()
,
Decorations.setDefaultButton(org.eclipse.swt.widgets.Button)
,
open()
,
setActive()
public int getImeInputMode()
SWT
:
NONE
, ROMAN
, DBCS
,
PHONETIC
, NATIVE
, ALPHA
.
SWTException
- SWT
protected int internal_getNativeStyle()
internal_getNativeStyle
in class Decorations
public boolean getMaximized()
true
if the receiver is currently
maximized, and false otherwise.
getMaximized
in class Decorations
SWTException
- setMaximized(boolean)
public boolean getMinimized()
true
if the receiver is currently
minimized, and false otherwise.
getMinimized
in class Decorations
SWTException
- setMinimized(boolean)
public void setImage(Image image)
setImage
in class Decorations
image
- the new image (or null)
java.lang.IllegalArgumentException
- SWTException
- public Shell getShell()
getShell
in class Control
SWTException
- Control.getParent()
public Shell[] getShells()
SWTException
- 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 open()
SWTException
- Control.moveAbove(org.eclipse.swt.widgets.Control)
,
Control.setFocus()
,
Control.setVisible(boolean)
,
Display.getActiveShell()
,
Decorations.setDefaultButton(org.eclipse.swt.widgets.Button)
,
setActive()
,
forceActive()
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 setActive()
SWTException
- Control.moveAbove(org.eclipse.swt.widgets.Control)
,
Control.setFocus()
,
Control.setVisible(boolean)
,
Display.getActiveShell()
,
Decorations.setDefaultButton(org.eclipse.swt.widgets.Button)
,
open()
,
setActive()
public void setImeInputMode(int mode)
SWT
:
NONE
, ROMAN
, DBCS
,
PHONETIC
, NATIVE
, ALPHA
.
mode
- the new IME mode
SWTException
- SWT
public void setMaximized(boolean maximized)
Decorations
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.
setMaximized
in class Decorations
maximized
- the new maximized stateDecorations.setMinimized(boolean)
public void setMinimized(boolean minimized)
Decorations
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.
setMinimized
in class Decorations
minimized
- the new maximized stateDecorations.setMaximized(boolean)
public void setMenuBar(Menu menu)
Decorations
setMenuBar
in class Decorations
menu
- the new menu barpublic void setText(java.lang.String string)
Decorations
setText
in class Decorations
string
- the new textpublic java.lang.String toString()
Widget
toString
in class Widget
protected boolean isValidSubclass()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |