public class ImageMenuItem extends MenuItem
frequently need to do a UI activity from more than one place and Action
will (among other things) generate the ImageMenuItem for a given Stock
item. See also Button's
setImage() for a
discussion of the relationship between Images and Label text.
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|
Create a MenuItem displaying an image next to text.
Create a MenuItem displaying an image next to text, and hook up an
Create a MenuItem displaying a stock icon image.
Convenience constructor, allowing you to create a MenuItem displaying a stock icon while simultaneously hooking up the handler which will take its
|Modifier and Type||Method and Description|
Activate the key binding that comes with the stock configuration, for the case that this ImageMenuItem was constructed using a Stock item.
Force the icon accompanying this ImageMenuItem to always be shown, overriding the setting inherited from GtkSettings and GNOME.
Set the Image that will be used as an icon beside the text in the ImageMenuItem.
connect, getRelatedAction, getSubmenu, setAccelerator, setRelatedAction, setSubmenu
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 ImageMenuItem(Image image, String label)
Don't use an empty string as a label! Users can turn off display of icons in menus, and if they do you'll end up with a MenuItem with "nothing" in it.
There is also a constructor which allows you to connect an
MenuItem.Activate handler in-line, see
public ImageMenuItem(Image image, String label, MenuItem.Activate handler)
MenuItem.Activatehandler at the same time.
public ImageMenuItem(Stock stock)
public void setAccelerator(AcceleratorGroup group)
public void setAlwaysShowImage(boolean setting)
As at GNOME 2.28, the default was changed by the `control-center` hackers to not show menu and button icons. This is very inconvenient, so you'll find yourself needing to call this frequently.
public void setImage(Image image)
Be aware that there are system wide settings which allow a user to turn off icons appearing in menus. Since there is always a chance that the "image" Widget being added will be hidden, don't create an ImageMenuItem with an empty label.