public class ToolButton extends ToolItem
This is the item you will want to add in most cases to your application Toolbar(s). It is a acts a like a normal Button, but its appearance is designed to look better on a Toolbar.
A ToolButton has an image or icon and a Label. The user Toolbar preferences determine whether the Label is actually shown on screen. Even if you disable the Label in your desktop preferences, you should provide a valid Label to your application ToolButtons, as other users will have them showing and your program will look a bit silly without textual labels.
|Modifier and Type||Class and Description|
Signal generated when a user presses and releases a ToolButton, causing it to activate.
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.Destroy, Widget.Draw, Widget.EnterNotifyEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.QueryTooltip, Widget.ScrollEvent, Widget.SizeAllocate, Widget.UnmapEvent, Widget.VisibilityNotifyEvent
|Constructor and Description|
Creates a new stock ToolButton.
Creates a new ToolButton using the given icon and Label.
|Modifier and Type||Method and Description|
Connect a handler to the
Get the text Label previously set with
Get the Widget used as "label", if any.
Set the Label of the Button.
Set the Widget to be used as the "label" for this ToolButton.
getExpand, getRelatedAction, setExpand, setIsImportant, setRelatedAction
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, destroy, getAllocatedHeight, getAllocatedWidth, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getPreferredHeightForWidthMinimum, getPreferredHeightForWidthNatural, getPreferredHeightMinimum, getPreferredHeightNatural, getPreferredWidthForHeightMinimum, getPreferredWidthForHeightNatural, getPreferredWidthMinimum, getPreferredWidthNatural, getRequestMode, getRequisition, getSensitive, getStyleContext, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, overrideBackground, overrideColor, overrideFont, queueDraw, queueDrawArea, realize, setAlignHorizontal, setAlignVertical, setCanDefault, setCanFocus, setEvents, setExpandHorizontal, setExpandVertical, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll
public ToolButton(Stock stock)
stock- The Stock that will determine the Label and icon on the ToolButton.
public ToolButton(Widget iconWidget, String label)
iconWidget- The Widget to be used as the icon for the ToolButton. Usually you will want to use a Widget that displays a graphic, such as
label- The Label for the ToolButton.
public void connect(ToolButton.Clicked handler)
public String getLabel()
nullif not Label has been set. Note that a
nullreturn value doesn't mean that the ToolButton doesn't have a Label, as it can have a Widget Label or a Label taken from a stock item.
public Widget getLabelWidget()
nullif this ToolButton doesn't have a Widget overriding its label.
public void setLabel(String label)
Note that any value of the Label set by this method won't be actually
displayed if you have set a Widget Label using
label- The String to be used as Label, or
public void setLabelWidget(Widget labelWidget)
setLabel() before using this,
because in most cases that is what you want.
Usually ToolButtons have either a text Label set with
setLabel(), or text automatically determined by a stock
item. However, in some cases you will want to provide another kind of
Widget as the label, and this method is how.
labelWidget- A Widget to be used as a Label, or
nullto not use the Widget Label (in this case, the text Label will be used. If the text Label is also
null, the default stock item label is used. In this later case, if this ToolButton has no stock item, then no Label will be used at all). Note that if you do pass a non-
nullWidget here, this argument will be used as the label despite the text in the normal Label or one generated as a result of using a stock item.