public class RoundedToolItem
extends org.eclipse.swt.widgets.Item
Note: Only one of the styles CHECK, PUSH, RADIO, TOGGLE and DROP_DOWN may be specified.
Constructor and Description |
---|
RoundedToolItem(RoundedToolbar parent)
Constructs a new instance of this class given its parent (which must be a
ToolBar ) and a style value describing its behavior and
appearance. |
RoundedToolItem(RoundedToolbar parent,
int style)
Constructs a new instance of this class given its parent (which must be a
ToolBar ) and a style value describing its behavior and
appearance. |
Modifier and Type | Method and Description |
---|---|
void |
addListener(int eventType,
org.eclipse.swt.widgets.Listener listener) |
void |
addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Adds the listener to the collection of listeners who will be notified
when the control is selected by the user, by sending it one of the
messages defined in the
SelectionListener interface. |
(package private) org.eclipse.swt.graphics.Point |
computeDefaultSize() |
void |
dispose() |
(package private) void |
drawButton(org.eclipse.swt.graphics.GC gc,
int x,
int toolbarHeight,
boolean isLast) |
(package private) void |
fireSelectionEvent() |
(package private) void |
forceSelection(boolean newSelection) |
int |
getAlignment()
Returns a value which describes the position of the text in the receiver.
|
org.eclipse.swt.graphics.Rectangle |
getBounds()
Returns a rectangle describing the receiver's size and location relative
to its parent (or its display if its parent is null), unless the receiver
is a shell.
|
org.eclipse.swt.graphics.Image |
getDisabledImage() |
boolean |
getEnabled()
Returns
true if the receiver is enabled, and
false otherwise. |
int |
getHeight()
Returns the whole height of the widget.
|
RoundedToolbar |
getParent()
Returns the receiver's parent, which must be a
RoundedToolBar . |
boolean |
getSelection()
Returns
true if the receiver is selected, and false
otherwise. |
org.eclipse.swt.graphics.Image |
getSelectionImage() |
org.eclipse.swt.graphics.Color |
getTextColor()
Returns the color of the text when the button is enabled and not
selected.
|
org.eclipse.swt.graphics.Color |
getTextColorSelected()
Returns the color of the text when the button is not selected.
|
java.lang.String |
getTooltipText()
Returns the receiver's tool tip text, or null if it has not been set.
|
int |
getVerticalAlignment()
Returns a value which describes the position of the text in the receiver.
|
int |
getWidth()
Returns the whole height of the widget.
|
(package private) boolean |
isCheckbox() |
(package private) boolean |
isDropDown() |
boolean |
isEnabled()
Returns
true if the receiver is enabled, and
false otherwise. |
(package private) boolean |
isPushButon() |
(package private) boolean |
isRadio() |
(package private) boolean |
isToogleButon() |
void |
removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Removes the listener from the collection of listeners who will be
notified when the control is selected by the user.
|
void |
setAlignment(int alignment)
Controls how text will be displayed in the receiver.
|
void |
setBounds(org.eclipse.swt.graphics.Rectangle rectangle)
Sets the receiver's size and location to the rectangular area specified
by the argument.
|
void |
setDisabledImage(org.eclipse.swt.graphics.Image image)
Sets the receiver's image to the argument when this is one is disabled,
which may be null indicating that no image should be displayed.
|
void |
setEnabled(boolean enabled)
Enables the receiver if the argument is
true , and disables
it otherwise. |
void |
setHeight(int height)
Sets the height of the receiver.
|
void |
setSelection(boolean selected)
Sets the selection state of the receiver.
|
void |
setSelectionImage(org.eclipse.swt.graphics.Image image)
Sets the receiver's image to the argument when this one is selected,
which may be null indicating that no image should be displayed.
|
void |
setTextColor(org.eclipse.swt.graphics.Color textColor)
Sets the receiver's text color to the argument, which may be null
indicating that no image should be displayed.
|
void |
setTextColorSelected(org.eclipse.swt.graphics.Color textColor)
Sets the receiver's text color to the argument when this one is selected,
which may be null indicating that no image should be displayed.
|
void |
setTooltipText(java.lang.String string)
Sets the receiver's tool tip text to the argument, which may be null
indicating that the default tool tip for the control will be shown.
|
void |
setVerticalAlignment(int verticalAlignment)
Controls how text will be displayed in the receiver.
|
void |
setWidth(int width)
Sets the width of the receiver.
|
checkSubclass, getImage, getText, setImage, setText
public RoundedToolItem(RoundedToolbar parent)
ToolBar
) and a style value describing its behavior and
appearance. The item is added to the end of the items maintained by its
parent.
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)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- Widget.getStyle()
public RoundedToolItem(RoundedToolbar parent, int style)
ToolBar
) and a style value describing its behavior and
appearance. The item is added to the end of the items maintained by its
parent.
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 constructjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- Widget.getStyle()
public void addListener(int eventType, org.eclipse.swt.widgets.Listener listener)
addListener
in class org.eclipse.swt.widgets.Widget
Widget.addListener(int, org.eclipse.swt.widgets.Listener)
public void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
SelectionListener
interface.
widgetDefaultSelected
is not called.
listener
- the listener which should be notified when the control is
selected by the user,java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- SelectionListener
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionEvent
org.eclipse.swt.graphics.Point computeDefaultSize()
public void dispose()
dispose
in class org.eclipse.swt.widgets.Widget
Widget.dispose()
void drawButton(org.eclipse.swt.graphics.GC gc, int x, int toolbarHeight, boolean isLast)
void fireSelectionEvent()
public int getAlignment()
LEFT
, RIGHT
or
CENTER
.org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Rectangle getBounds()
org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Image getDisabledImage()
org.eclipse.swt.SWTException
- public boolean getEnabled()
true
if the receiver is enabled, and
false
otherwise. A disabled control is typically not
selectable from the user interface and draws with an inactive or "grayed"
look.org.eclipse.swt.SWTException
- isEnabled()
public int getHeight()
org.eclipse.swt.SWTException
- public RoundedToolbar getParent()
RoundedToolBar
.org.eclipse.swt.SWTException
- public boolean getSelection()
true
if the receiver is selected, and false
otherwise.org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Image getSelectionImage()
org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getTextColor()
org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getTextColorSelected()
org.eclipse.swt.SWTException
- public java.lang.String getTooltipText()
org.eclipse.swt.SWTException
- public int getVerticalAlignment()
TOP
, BOTTOM
or
CENTER
.org.eclipse.swt.SWTException
- public int getWidth()
org.eclipse.swt.SWTException
- public boolean isEnabled()
true
if the receiver is enabled, and
false
otherwise. A disabled control is typically not
selectable from the user interface and draws with an inactive or "grayed"
look.org.eclipse.swt.SWTException
- getEnabled()
public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- SelectionListener
,
addSelectionListener(org.eclipse.swt.events.SelectionListener)
public void setAlignment(int alignment)
LEFT
, RIGHT
or CENTER
.alignment
- the new alignmentorg.eclipse.swt.SWTException
- public void setBounds(org.eclipse.swt.graphics.Rectangle rectangle)
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.
rect
- the new bounds for the receiverorg.eclipse.swt.SWTException
- public void setDisabledImage(org.eclipse.swt.graphics.Image image)
image
- the image to display on the receiver (may be null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setEnabled(boolean enabled)
true
, and disables
it otherwise.
A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.
enabled
- the new enabled stateorg.eclipse.swt.SWTException
- public void setHeight(int height)
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.
height
- the new widthorg.eclipse.swt.SWTException
- public void setSelection(boolean selected)
selected
- the new selection stateorg.eclipse.swt.SWTException
- public void setSelectionImage(org.eclipse.swt.graphics.Image image)
image
- the image to display on the receiver (may be null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setTextColor(org.eclipse.swt.graphics.Color textColor)
textColor
- the text color to display on the receiver (may be null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setTextColorSelected(org.eclipse.swt.graphics.Color textColor)
textColor
- the text color to display on the receiver (may be null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setTooltipText(java.lang.String string)
The mnemonic indicator (character '&') is not displayed in a tool tip. To display a single '&' in the tool tip, the character '&' can be escaped by doubling it in the string.
string
- the new tool tip text (or null)org.eclipse.swt.SWTException
- public void setVerticalAlignment(int verticalAlignment)
TOP
, BOTTOM
or CENTER
.alignment
- the new alignmentorg.eclipse.swt.SWTException
- public void setWidth(int width)
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.
width
- the new widthorg.eclipse.swt.SWTException
- boolean isToogleButon()
boolean isPushButon()
boolean isCheckbox()
boolean isRadio()
boolean isDropDown()
void forceSelection(boolean newSelection)