GtkMenu {RGtk2}R Documentation

GtkMenu

Description

A menu widget

Methods and Functions

gtkMenuNew(show = TRUE)
gtkMenuSetScreen(object, screen = NULL)
gtkMenuReorderChild(object, child, position)
gtkMenuAttach(object, child, left.attach, right.attach, top.attach, bottom.attach)
gtkMenuPopup(object, parent.menu.shell = NULL, parent.menu.item = NULL, func = NULL, data = NULL, button, activate.time)
gtkMenuSetAccelGroup(object, accel.group)
gtkMenuGetAccelGroup(object)
gtkMenuSetAccelPath(object, accel.path)
gtkMenuSetTitle(object, title)
gtkMenuGetTearoffState(object)
gtkMenuGetTitle(object)
gtkMenuPopdown(object)
gtkMenuReposition(object)
gtkMenuGetActive(object)
gtkMenuSetActive(object, index)
gtkMenuSetTearoffState(object, torn.off)
gtkMenuAttachToWidget(object, attach.widget)
gtkMenuDetach(object)
gtkMenuGetAttachWidget(object)
gtkMenuGetForAttachWidget(object)
gtkMenuSetMonitor(object, monitor.num)
gtkMenu(show = TRUE)

Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkMenuShell
                                 +----GtkMenu
                                       +----GtkRecentChooserMenu

Interfaces

GtkMenu implements GtkBuildable and AtkImplementorIface.

Detailed Description

A GtkMenu is a GtkMenuShell that implements a drop down menu consisting of a list of GtkMenuItem objects which can be navigated and activated by the user to perform application functions.

A GtkMenu is most commonly dropped down by activating a GtkMenuItem in a GtkMenuBar or popped up by activating a GtkMenuItem in another GtkMenu.

A GtkMenu can also be popped up by activating a GtkOptionMenu. Other composite widgets such as the GtkNotebook can pop up a GtkMenu as well.

Applications can display a GtkMenu as a popup menu by calling the gtkMenuPopup function. The example below shows how an application can pop up a menu when the 3rd mouse button is pressed.

    # connect our handler which will popup the menu 
    gSignalConnect(window, "button_press_event", my_popup_handler, menu, user.data.first=T)
# The popup handler
my_popup_handler <- function(widget, event)
{
  stopifnot(widget != NULL)
  checkPtrType(widget, "GtkMenu")
  stopifnot(event != NULL)

  # The "widget" is the menu that was supplied when 
  # gSignalConnect() was called.
  #
  menu <- widget

  if (event[["type"]] == "button-press")
    {
      if (event[["button"]] == 3)
        {
          menu$popup(button=event[["button"]], activate.time=event[["time"]])
          return(TRUE)
        }
    }

  return(FALSE)
}

Structures

GtkMenu
The GtkMenu struct contains private data only, and should be accessed using the functions below.

Convenient Construction

gtkMenu is the equivalent of gtkMenuNew.

User Functions

GtkMenuPositionFunc(menu, x, y, push.in, user.data)
A user function supplied when calling gtkMenuPopup which controls the positioning of the menu when it is displayed. The function sets the x and y parameters to the coordinates where the menu is to be drawn.

menu
[GtkMenu] a GtkMenu.
x
[integer] the integer representing the horizontal position where the menu shall be drawn. This is an output parameter.
y
[integer] the integer representing the vertical position where the menu shall be drawn. This is an output parameter.
push.in
[logical] whether the first menu item should be offset (pushed in) to be aligned with the menu popup position (only useful for GtkOptionMenu).
user.data
[R object] the data supplied by the user in the gtkMenuPopup data parameter.

GtkMenuDetachFunc(attach.widget, menu)
A user function supplied when calling gtkMenuAttachToWidget which will be called when the menu is later detached from the widget.

attach.widget
[GtkWidget] the GtkWidget that the menu is being detached from.
menu
[GtkMenu] the GtkMenu being detached.

Signals

The (menu, arg1, user.data)
undocumented

menu
[GtkMenu] the object which received the signal.
arg1
[GtkScrollType]
user.data
[R object] user data set when the signal handler was connected.

Properties

tearoff-state [logical : Read / Write]

A boolean that indicates whether the menu is torn-off.

Default value: FALSE Since 2.6

tearoff-title [character : Read / Write]

A title that may be displayed by the window manager when this menu is torn-off. Default value: ""

Style Properties

double-arrows [logical : Read]

When scrolling, always show both arrows. Default value: TRUE

horizontal-offset [integer : Read]

When the menu is a submenu, position it this number of pixels offset horizontally. Default value: -2

horizontal-padding [integer : Read]

Extra space at the left and right edges of the menu. Allowed values: >= 0 Default value: 0

vertical-offset [integer : Read]

When the menu is a submenu, position it this number of pixels offset vertically. Default value: 0

vertical-padding [integer : Read]

Extra space at the top and bottom of the menu. Allowed values: >= 0 Default value: 1

Author(s)

Derived by RGtkGen from GTK+ documentation

References

http://developer.gnome.org/doc/API/2.0/gtk/GtkMenu.html


[Package RGtk2 version 2.12.5-3 Index]