1 2@c %start of fragment 3 4@deftp Class <gtk-menu> 5Derives from @code{<gtk-menu-shell>}. 6 7This class defines the following slots: 8 9@table @code 10@item tearoff-state 11A boolean that indicates whether the menu is torn-off 12 13@item tearoff-title 14A title that may be displayed by the window manager when this menu is torn-off 15 16@end table 17 18@end deftp 19 20@defop Signal <gtk-menu> move-scroll (arg0@tie{}@code{<gtk-scroll-type>}) 21@end defop 22 23@deffn Function gtk-menu-new @result{}@tie{} (ret@tie{}@code{<gtk-widget>}) 24Creates a new @code{<gtk-menu>}. 25 26@table @var 27@item ret 28a new @code{<gtk-menu>}. 29 30@end table 31 32@end deffn 33 34@deffn Function gtk-menu-set-screen (self@tie{}@code{<gtk-menu>}) (screen@tie{}@code{<gdk-screen>}) 35@deffnx Method set-screen 36Sets the @code{<gdk-screen>} on which the menu will be displayed. 37 38@table @var 39@item menu 40a @code{<gtk-menu>}. 41 42@item screen 43a @code{<gdk-screen>}, or @samp{@code{#f}} if the screen should be determined by 44the widget the menu is attached to. 45 46@end table 47 48Since 2.2 49 50@end deffn 51 52@deffn Function gtk-menu-reorder-child (self@tie{}@code{<gtk-menu>}) (child@tie{}@code{<gtk-widget>}) (position@tie{}@code{int}) 53@deffnx Method reorder-child 54Moves a @code{<gtk-menu-item>} to a new position within the @code{<gtk-menu>}. 55 56@table @var 57@item menu 58a @code{<gtk-menu>}. 59 60@item child 61the @code{<gtk-menu-item>} to move. 62 63@item position 64the new position to place @var{child}. Positions are numbered from 0 to n-1. 65 66@end table 67 68@end deffn 69 70@deffn Function gtk-menu-attach (self@tie{}@code{<gtk-menu>}) (child@tie{}@code{<gtk-widget>}) (left_attach@tie{}@code{unsigned-int}) (right_attach@tie{}@code{unsigned-int}) (top_attach@tie{}@code{unsigned-int}) (bottom_attach@tie{}@code{unsigned-int}) 71@deffnx Method attach 72Adds a new @code{<gtk-menu-item>} to a (table) menu. The number of 'cells' that 73an item will occupy is specified by @var{left-attach}, @var{right-attach}, 74@var{top-attach} and @var{bottom-attach}. These each represent the leftmost, 75rightmost, uppermost and lower column and row numbers of the table. (Columns and 76rows are indexed from zero). 77 78Note that this function is not related to @code{gtk-menu-detach}. 79 80@table @var 81@item menu 82a @code{<gtk-menu>}. 83 84@item child 85a @code{<gtk-menu-item>}. 86 87@item left-attach 88The column number to attach the left side of the item to. 89 90@item right-attach 91The column number to attach the right side of the item to. 92 93@item top-attach 94The row number to attach the top of the item to. 95 96@item bottom-attach 97The row number to attach the bottom of the item to. 98 99@end table 100 101Since 2.4 102 103@end deffn 104 105@deffn Function gtk-menu-popup (self@tie{}@code{<gtk-menu>}) (parent_menu_shell@tie{}@code{<gtk-widget>}) (parent_menu_item@tie{}@code{<gtk-widget>}) (menu_position_func@tie{}@code{scm}) (button@tie{}@code{unsigned-int}) (activate_time@tie{}@code{unsigned-int32}) 106@deffnx Method popup 107Displays a menu and makes it available for selection. Applications can use this 108function to display context-sensitive menus, and will typically supply 109@samp{@code{#f}} for the @var{parent-menu-shell}, @var{parent-menu-item}, 110@var{func} and @var{data} parameters. The default menu positioning function will 111position the menu at the current mouse cursor position. 112 113The @var{button} parameter should be the mouse button pressed to initiate the 114menu popup. If the menu popup was initiated by something other than a mouse 115button press, such as a mouse button release or a keypress, @var{button} should 116be 0. 117 118The @var{activate-time} parameter should be the time stamp of the event that 119initiated the popup. If such an event is not available, use 120@code{gtk-get-current-event-time} instead. 121 122@table @var 123@item menu 124a @code{<gtk-menu>}. 125 126@item parent-menu-shell 127the menu shell containing the triggering menu item, or @samp{@code{#f}} 128 129@item parent-menu-item 130the menu item whose activation triggered the popup, or @samp{@code{#f}} 131 132@item func 133a user supplied function used to position the menu, or @samp{@code{#f}} 134 135@item data 136user supplied data to be passed to @var{func}. 137 138@item button 139the mouse button which was pressed to initiate the event. 140 141@item activate-time 142the time at which the activation event occurred. 143 144@end table 145 146@end deffn 147 148@deffn Function gtk-menu-set-accel-group (self@tie{}@code{<gtk-menu>}) (accel_group@tie{}@code{<gtk-accel-group>}) 149@deffnx Method set-accel-group 150Set the @code{<gtk-accel-group>} which holds global accelerators for the menu. 151This accelerator group needs to also be added to all windows that this menu is 152being used in with @code{gtk-window-add-accel-group}, in order for those windows 153to support all the accelerators contained in this group. 154 155@table @var 156@item menu 157a @code{<gtk-menu>}. 158 159@item accel-group 160the @code{<gtk-accel-group>} to be associated with the menu. 161 162@end table 163 164@end deffn 165 166@deffn Function gtk-menu-get-accel-group (self@tie{}@code{<gtk-menu>}) @result{}@tie{} (ret@tie{}@code{<gtk-accel-group>}) 167@deffnx Method get-accel-group 168Gets the @code{<gtk-accel-group>} which holds global accelerators for the menu. 169See @code{gtk-menu-set-accel-group}. 170 171@table @var 172@item menu 173a @code{<gtk-menu>}. 174 175@item ret 176the @code{<gtk-accel-group>} associated with the menu. 177 178@end table 179 180@end deffn 181 182@deffn Function gtk-menu-set-accel-path (self@tie{}@code{<gtk-menu>}) (accel_path@tie{}@code{mchars}) 183@deffnx Method set-accel-path 184Sets an accelerator path for this menu from which accelerator paths for its 185immediate children, its menu items, can be constructed. The main purpose of this 186function is to spare the programmer the inconvenience of having to call 187@code{gtk-menu-item-set-accel-path} on each menu item that should support 188runtime user changable accelerators. Instead, by just calling 189@code{gtk-menu-set-accel-path} on their parent, each menu item of this menu, 190that contains a label describing its purpose, automatically gets an accel path 191assigned. For example, a menu containing menu items "New" and "Exit", will, 192after @samp{gtk_menu_set_accel_path (menu, "<Gnumeric-Sheet>/File");} has been 193called, assign its items the accel paths: @samp{"<Gnumeric-Sheet>/File/New"} and 194@samp{"<Gnumeric-Sheet>/File/Exit"}. Assigning accel paths to menu items then 195enables the user to change their accelerators at runtime. More details about 196accelerator paths and their default setups can be found at 197@code{gtk-accel-map-add-entry}. 198 199@table @var 200@item menu 201a valid @code{<gtk-menu>} 202 203@item accel-path 204a valid accelerator path 205 206@end table 207 208@end deffn 209 210@deffn Function gtk-menu-set-title (self@tie{}@code{<gtk-menu>}) (title@tie{}@code{mchars}) 211@deffnx Method set-title 212Sets the title string for the menu. The title is displayed when the menu is 213shown as a tearoff menu. If @var{title} is @samp{@code{#f}}, the menu will see 214if it is attached to a parent menu item, and if so it will try to use the same 215text as that menu item's label. 216 217@table @var 218@item menu 219a @code{<gtk-menu>} 220 221@item title 222a string containing the title for the menu. 223 224@end table 225 226@end deffn 227 228@deffn Function gtk-menu-get-tearoff-state (self@tie{}@code{<gtk-menu>}) @result{}@tie{} (ret@tie{}@code{bool}) 229@deffnx Method get-tearoff-state 230Returns whether the menu is torn off. See @code{gtk-menu-set-tearoff-state}. 231 232@table @var 233@item menu 234a @code{<gtk-menu>} 235 236@item ret 237@samp{@code{#t}} if the menu is currently torn off. 238 239@end table 240 241@end deffn 242 243@deffn Function gtk-menu-get-title (self@tie{}@code{<gtk-menu>}) @result{}@tie{} (ret@tie{}@code{mchars}) 244@deffnx Method get-title 245Returns the title of the menu. See @code{gtk-menu-set-title}. 246 247@table @var 248@item menu 249a @code{<gtk-menu>} 250 251@item ret 252the title of the menu, or @samp{@code{#f}} if the menu has no title set on it. 253This string is owned by the widget and should not be modified or freed. 254 255@end table 256 257@end deffn 258 259@deffn Function gtk-menu-popdown (self@tie{}@code{<gtk-menu>}) 260@deffnx Method popdown 261Removes the menu from the screen. 262 263@table @var 264@item menu 265a @code{<gtk-menu>}. 266 267@end table 268 269@end deffn 270 271@deffn Function gtk-menu-reposition (self@tie{}@code{<gtk-menu>}) 272@deffnx Method reposition 273Repositions the menu according to its position function. 274 275@table @var 276@item menu 277a @code{<gtk-menu>}. 278 279@end table 280 281@end deffn 282 283@deffn Function gtk-menu-get-active (self@tie{}@code{<gtk-menu>}) @result{}@tie{} (ret@tie{}@code{<gtk-widget>}) 284@deffnx Method get-active 285Returns the selected menu item from the menu. This is used by the 286@code{<gtk-option-menu>}. 287 288@table @var 289@item menu 290a @code{<gtk-menu>}. 291 292@item ret 293the @code{<gtk-menu-item>} that was last selected in the menu. If a selection 294has not yet been made, the first menu item is selected. 295 296@end table 297 298@end deffn 299 300@deffn Function gtk-menu-set-active (self@tie{}@code{<gtk-menu>}) (index@tie{}@code{unsigned-int}) 301@deffnx Method set-active 302Selects the specified menu item within the menu. This is used by the 303@code{<gtk-option-menu>} and should not be used by anyone else. 304 305@table @var 306@item menu 307a @code{<gtk-menu>}. 308 309@item index 310the index of the menu item to select. Index values are from 0 to n-1. 311 312@end table 313 314@end deffn 315 316@deffn Function gtk-menu-set-tearoff-state (self@tie{}@code{<gtk-menu>}) (torn_off@tie{}@code{bool}) 317@deffnx Method set-tearoff-state 318Changes the tearoff state of the menu. A menu is normally displayed as drop down 319menu which persists as long as the menu is active. It can also be displayed as a 320tearoff menu which persists until it is closed or reattached. 321 322@table @var 323@item menu 324a @code{<gtk-menu>}. 325 326@item torn-off 327If @samp{@code{#t}}, menu is displayed as a tearoff menu. 328 329@end table 330 331@end deffn 332 333@deffn Function gtk-menu-detach (self@tie{}@code{<gtk-menu>}) 334@deffnx Method detach 335Detaches the menu from the widget to which it had been attached. This function 336will call the callback function, @var{detacher}, provided when the 337@code{gtk-menu-attach-to-widget} function was called. 338 339@table @var 340@item menu 341a @code{<gtk-menu>}. 342 343@end table 344 345@end deffn 346 347@deffn Function gtk-menu-get-attach-widget (self@tie{}@code{<gtk-menu>}) @result{}@tie{} (ret@tie{}@code{<gtk-widget>}) 348@deffnx Method get-attach-widget 349Returns the @code{<gtk-widget>} that the menu is attached to. 350 351@table @var 352@item menu 353a @code{<gtk-menu>}. 354 355@item ret 356the @code{<gtk-widget>} that the menu is attached to. 357 358@end table 359 360@end deffn 361 362@deffn Function gtk-menu-get-for-attach-widget (widget@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{glist-of}) 363Returns a list of the menus which are attached to this widget. This list is 364owned by GTK+ and must not be modified. 365 366@table @var 367@item widget 368a @code{<gtk-widget>} 369 370@item ret 371the list of menus attached to his widget. 372 373@end table 374 375Since 2.6 376 377@end deffn 378 379@deffn Function gtk-menu-set-monitor (self@tie{}@code{<gtk-menu>}) (monitor_num@tie{}@code{int}) 380@deffnx Method set-monitor 381Informs GTK+ on which monitor a menu should be popped up. See 382@code{gdk-screen-get-monitor-geometry}. 383 384This function should be called from a @code{<gtk-menu-position-func>} if the 385menu should not appear on the same monitor as the pointer. This information 386can't be reliably inferred from the coordinates returned by a 387@code{<gtk-menu-position-func>}, since, for very long menus, these coordinates 388may extend beyond the monitor boundaries or even the screen boundaries. 389 390@table @var 391@item menu 392a @code{<gtk-menu>} 393 394@item monitor-num 395the number of the monitor on which the menu should be popped up 396 397@end table 398 399Since 2.4 400 401@end deffn 402 403 404@c %end of fragment 405