GtkMenu                package:RGtk2                R Documentation

_G_t_k_M_e_n_u

_D_e_s_c_r_i_p_t_i_o_n:

     A menu widget

_M_e_t_h_o_d_s _a_n_d _F_u_n_c_t_i_o_n_s:

     '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)'

_H_i_e_r_a_r_c_h_y:

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

_I_n_t_e_r_f_a_c_e_s:

     GtkMenu implements AtkImplementorIface and  'GtkBuildable'.

_D_e_t_a_i_l_e_d _D_e_s_c_r_i_p_t_i_o_n:

     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.  

     _Connecting the popup signal handler._


     ## connect our handler which will popup the menu 
     gSignalConnect(window, "button_press_event", my_popup_handler,
     menu,
                    user.data.first=TRUE)
      _Signal handler which displays a popup menu._


     # 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)
     }



_S_t_r_u_c_t_u_r_e_s:


     '_G_t_k_M_e_n_u' The 'GtkMenu' struct contains private data only, and
          should be accessed using the functions below.


_C_o_n_v_e_n_i_e_n_t _C_o_n_s_t_r_u_c_t_i_o_n:

     'gtkMenu' is the equivalent of 'gtkMenuNew'.

_U_s_e_r _F_u_n_c_t_i_o_n_s:


     '_G_t_k_M_e_n_u_P_o_s_i_t_i_o_n_F_u_n_c(_m_e_n_u, _x, _y, _p_u_s_h._i_n, _u_s_e_r._d_a_t_a)' 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.

          '_m_e_n_u' ['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.

          '_p_u_s_h._i_n' [logical] This parameter controls how menus placed
               outside the monitor are handled. If this is set to TRUE
               and part of the menu is outside the monitor then GTK+
               pushes the window into the visible area, effectively
               modifying the popup position. Note that moving and
               possibly resizing the menu around will alter the scroll
               position to keep the menu items "in place", i.e. at the
               same monitor position they would have been without
               resizing. In practice, this behavior is only useful for
               combobox popups or option menus and cannot be used to
               simply confine a menu to monitor boundaries. In that
               case, changing the scroll offset is not desirable. To
               simply constrain the menu within the monitor, get its
               size with 'gtkWidgetSizeRequest' before showing it, and
               alter the coordinates passed to 'gtkMenuPopup'
               accordingly.

          '_u_s_e_r._d_a_t_a' [R object] the data supplied by the user in the
               'gtkMenuPopup' 'data' parameter.


     '_G_t_k_M_e_n_u_D_e_t_a_c_h_F_u_n_c(_a_t_t_a_c_h._w_i_d_g_e_t, _m_e_n_u)' A user function supplied
          when calling 'gtkMenuAttachToWidget' which  will be called
          when the menu is later detached from the widget.

          '_a_t_t_a_c_h._w_i_d_g_e_t' ['GtkWidget'] the 'GtkWidget' that the menu
               is being detached from.

          '_m_e_n_u' ['GtkMenu'] the 'GtkMenu' being detached.


_S_i_g_n_a_l_s:


     '_m_o_v_e-_s_c_r_o_l_l(_m_e_n_u, _a_r_g_1, _u_s_e_r._d_a_t_a)' _undocumented _

          '_m_e_n_u' ['GtkMenu'] the object which received the signal.

          '_a_r_g_1' ['GtkScrollType'] 

          '_u_s_e_r._d_a_t_a' [R object] user data set when the signal handler
               was connected.


_P_r_o_p_e_r_t_i_e_s:


     '_t_e_a_r_o_f_f-_s_t_a_t_e' [_l_o_g_i_c_a_l : _R_e_a_d / _W_r_i_t_e] A boolean that indicates
          whether the menu is torn-off.  

          Default value: FALSE  Since  2.6


     '_t_e_a_r_o_f_f-_t_i_t_l_e' [_c_h_a_r_a_c_t_e_r : _R_e_a_d / _W_r_i_t_e] A title that may be
          displayed by the window manager when this menu is torn-off. 
          Default value: ""


_S_t_y_l_e _P_r_o_p_e_r_t_i_e_s:


     '_d_o_u_b_l_e-_a_r_r_o_w_s' [_l_o_g_i_c_a_l : _R_e_a_d] When scrolling, always show both
          arrows.  Default value: TRUE


     '_h_o_r_i_z_o_n_t_a_l-_o_f_f_s_e_t' [_i_n_t_e_g_e_r : _R_e_a_d] When the menu is a submenu,
          position it this number of pixels offset horizontally. 
          Default value: -2


     '_h_o_r_i_z_o_n_t_a_l-_p_a_d_d_i_n_g' [_i_n_t_e_g_e_r : _R_e_a_d] Extra space at the left and
          right edges of the menu.  Allowed values: >= 0  Default
          value: 0


     '_v_e_r_t_i_c_a_l-_o_f_f_s_e_t' [_i_n_t_e_g_e_r : _R_e_a_d] When the menu is a submenu,
          position it this number of pixels offset vertically.  Default
          value: 0


     '_v_e_r_t_i_c_a_l-_p_a_d_d_i_n_g' [_i_n_t_e_g_e_r : _R_e_a_d] Extra space at the top and
          bottom of the menu.  Allowed values: >= 0  Default value: 1


_A_u_t_h_o_r(_s):

     Derived by RGtkGen from GTK+ documentation

_R_e_f_e_r_e_n_c_e_s:

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

