gmenu                package:gWidgets                R Documentation

_C_o_n_s_t_r_u_c_t_o_r_s _t_o _m_a_k_e _m_e_n_u_b_a_r _o_r _t_o_o_l_b_a_r_s

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

     A menubar or toolbar are created using these constructors. These
     are specified using a lists, and these may be seen as simply
     mapping these lists into the corresponding widget.

_U_s_a_g_e:

     gmenu(menulist,  popup = FALSE, action=NULL, container = NULL, ..., toolkit = guiToolkit())

     gtoolbar (toolbarlist, style = c("both", "icons", "text",
              "both-horiz"), 
              action=NULL, container = NULL, 
         ..., toolkit = guiToolkit()) 

_A_r_g_u_m_e_n_t_s:

menulist: A list defining a menu bar

   popup: Logical indicating if this should return a popup menu

toolbarlist: A list defining a toolbar

   style: What style to use

  action: Passed to menubar handlers

container: Optional container to attach widget to

     ...: ingored

 toolkit: Which GUI toolkit to use

_D_e_t_a_i_l_s:

     The lists defining a menubar or toolbar are very similar.

     Each is a list with named components. A component is a terminal
     node if it has a 'handler' component, which is a function to be
     called (without arguments) when the menu item or toolbar item is
     selected. Optionally, an 'icon' component can be given specifying
     a stock icon to accompany the text. A non-null component named
     'separator' will also indicate a terminal node. In this case, a
     visible separator will be displayed.

     A menubar list can use the hierarchical nature of a list to
     generate submenus. For toolbars this is not the case.

     These constructors map the list into the widget. The methods for
     the constructors refer to these list defining the widget.

     The 'svalue' method returns the list.

     The 'svalue<-' method can be used to change the list, and hence
     redo the menubar.

     The '"["' method refers to the components of the list.

     The code{"[<-"} method can be used to change pieces of the menubar
     or toolbar.

     The 'add' method with signature '(obj,lst)' or
     '(obj,gmenu.instance)' can be used to apped to the current
     menubar/toolbar. The second argument is a list or an gmenu or
     gtoolbar instance.

     The 'delete' method  can be used to delete part of the
     menubar/toolbar. The 'value' argument can be either a character
     vector with the top-level names to delete, or a named list, or an
     instance of either gmenu or gtoolbar.

_E_x_a_m_p_l_e_s:

     ## Not run: 
      lst = list()
      lst$File$Open$handler = function(h,...) print("open")
      lst$File$Quit$handler = function(h,...) print("quit")
      lst$File$Quit$icon = "quit"
      lst$Edit$Find$handler = function(h,...) print("Find")
      lst$Edit$Replace$handler = function(h,...) print("Replace")

      obj = gmenu(lst, container=TRUE)

      lst1 = list()
      lst1$Help$Help$handler = function(h,...) print("help")

      add(obj, lst1)

      
     ## End(Not run)

