org.gnome.gtk
Class MenuToolButton
Object
org.freedesktop.bindings.Pointer
org.freedesktop.bindings.Proxy
org.gnome.glib.Object
org.gnome.gtk.Object
org.gnome.gtk.Widget
org.gnome.gtk.Container
org.gnome.gtk.Bin
org.gnome.gtk.ToolItem
org.gnome.gtk.ToolButton
org.gnome.gtk.MenuToolButton
- All Implemented Interfaces:
- Activatable
public class MenuToolButton
- extends ToolButton
A MenuToolButton is an special kind of ToolButton that has an additional
drop-down Menu.
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
.
- Since:
- 4.0.4
- Author:
- Vreixo Formoso
- See Also:
Toolbar
,
Menu
Nested classes/interfaces inherited from class org.gnome.gtk.Widget |
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.EnterNotifyEvent, Widget.ExposeEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.ScrollEvent, Widget.UnmapEvent, Widget.VisibilityNotifyEvent |
Constructor Summary |
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. |
Method Summary |
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. |
Methods inherited from class org.gnome.gtk.Bin |
getChild |
Methods inherited from class org.gnome.gtk.Widget |
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getRequisition, getSensitive, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, modifyBackground, modifyBase, modifyFont, modifyText, queueDraw, queueDrawArea, realize, setCanDefault, setCanFocus, setColormap, setEvents, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll |
Methods inherited from class org.freedesktop.bindings.Pointer |
toString |
Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MenuToolButton
public MenuToolButton(Stock stock)
- Creates a new MenuToolButton from the specific stock item. Both the
Label and icon will be set properly from the stock item. By using a
system stock item, the newly created MenuToolButton with use the same
Label and Image as other GNOME applications. To ensure consistent look
and feel between applications, it is highly recommended that you use
provided stock items whenever possible.
- Parameters:
stock
- The StockId that will determine the Label and icon of the
MenuToolButton.
MenuToolButton
public MenuToolButton(Widget iconWidget,
String label)
- Creates a new MenuToolButton using the given icon and Label.
- Parameters:
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.
getMenu
public Menu getMenu()
- Get the Menu associated with the MenuToolButton.
- Returns:
- The associated Menu or
null
if no Menu has been
set.
setMenu
public void setMenu(Menu menu)
- Sets the Menu to be popped up when the user clicks the arrow Button.
You can pass null
to make arrow insensitive.