public class MenuToolButton extends ToolButton
Next to the ToolButton itself, a MenuToolButton shows another little Button with an arrow. When the user clicks this additional Button, a drop-down Menu pops up.
The main usage of a MenuToolButton is to provide access to several related actions in a Toolbar without wasting too much screen space. For example, your application can have a MenuToolButton for the "New Document" action, using the attached Menu to let users choose what kind of new document they want to create.
A MenuToolButton has a default action, to be executed when user clicks the
main Button itself and not the the arrow Button. You can capture that
default event with the ToolButton.Clicked
signal. User Menu
selections are captured with the usual MenuItem.Activate
signal of
each MenuItem
.
ToolButton.Clicked
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 |
---|
MenuToolButton(Stock stock)
Creates a new MenuToolButton from the specific stock item.
|
MenuToolButton(Widget iconWidget,
String label)
Creates a new MenuToolButton using the given icon and Label.
|
Modifier and Type | Method and Description |
---|---|
Menu |
getMenu()
Get the Menu associated with the MenuToolButton.
|
void |
setMenu(Menu menu)
Sets the Menu to be popped up when the user clicks the arrow Button.
|
connect, getLabel, getLabelWidget, setLabel, setLabelWidget
getExpand, getRelatedAction, setExpand, setIsImportant, setRelatedAction
add, getChildren, remove, setBorderWidth
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 MenuToolButton(Stock stock)
stock
- The StockId that will determine the Label and icon of the
MenuToolButton.public MenuToolButton(Widget iconWidget, String label)
iconWidget
- The Widget to be used as the icon for the MenuToolButton.
Usually you will want to use a Widget display an image, such
as Image
. Use null
if you do not want
an icon.label
- The Label for the MenuToolButton, or null
to
provide not Label.public Menu getMenu()
null
if no Menu has been
set.public void setMenu(Menu menu)
You can pass null
to make arrow insensitive.