xref: /haiku/docs/user/interface/Menu.dox (revision 2b76973fa2401f7a5edf68e6470f3d3210cbcff3)
1/*
2 * Copyright 2013 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		John Scipione, jscipione@gmail.com
7 *
8 * Corresponds to:
9 *		headers/os/interface/Menu.h	 hrev46321
10 *		src/kits/interface/Menu.cpp	 hrev46321
11 */
12
13
14/*!
15	\file Menu.h
16	\ingroup interface
17	\ingroup libbe
18	\brief BMenu class definition and support structures.
19*/
20
21
22/*!
23	\enum menu_layout
24	\ingroup interface
25
26	Constants to define the layout of the menu items in a menu.
27*/
28
29
30/*!
31	\var menu_layout B_ITEMS_IN_ROW
32
33	Items are arranged in a row, one next to the other.
34*/
35
36
37/*!
38	\var menu_layout B_ITEMS_IN_COLUMN
39
40	Items are arranged in a column, one on top of the other.
41*/
42
43
44/*!
45	\var menu_layout B_ITEMS_IN_MATRIX
46
47	Items are arranged in a matrix, a free-form arrangement that you create.
48*/
49
50
51/*!
52	\struct menu_info
53	\ingroup interface
54	\ingroup libbe
55	\brief Information about a menu such as font size and family, background
56	       color, and flags.
57*/
58
59
60/*!
61	\var menu_info::font_size
62
63	The font size to draw menu items with.
64*/
65
66
67/*!
68	\var menu_info::f_family
69
70	The font family used to draw menu items.
71*/
72
73
74/*!
75	\var menu_info::f_style
76
77	The font style used to draw menu items.
78*/
79
80
81/*!
82	\var menu_info::background_color
83
84	The menu's background color.
85*/
86
87
88/*!
89	\var menu_info::separator
90
91	The style of horizontal line to use to separates groups of items in a menu.
92*/
93
94
95/*!
96	\var menu_info::click_to_open
97
98	Whether or not the menu opens on click. The default value is \c true.
99*/
100
101
102/*!
103	\var menu_info::triggers_always_shown
104
105	Whether or not trigger underlines should always be shown. The default value
106	is \c false.
107*/
108
109
110/*!
111	\fn status_t get_menu_info(menu_info* info)
112	\brief Fill out the menu_info struct into \a info.
113*/
114
115
116/*!
117	\fn status_t set_menu_info(menu_info* info)
118	\brief Set the menu's menu_info struct to \a info adjusting how the menu
119	       will look and work.
120*/
121
122
123/*!
124	\typedef bool (*menu_tracking_hook)(BMenu* menu, void* state)
125	\brief Defines the function passed into BMenu::SetTrackingHook().
126*/
127
128
129/*!
130	\class BMenu
131	\ingroup interface
132	\ingroup libbe
133	\brief Displays a list of menu items including additional menus
134	       arranged hierarchically.
135
136	A newly created BMenu object doesn't contain any menu items, you need to call
137	AddItem() or AddList() to add some.
138
139	In addition to BMenuItem objects you can also add additional BMenu objects in
140	order to create a menu hierarchy. Unlike menus in other operating systems you
141	can always select both the submenu and menu items, although selecting the
142	submenu might not actually produce any action other than to close the menu.
143	The name of a submenu is used to draw its label.
144
145	\image html BMenu_example.png
146
147	BMenu is the basis of several other Interface Kit classes including BMenuBar
148	and BPopUpMenu. See BMenu::SetRadioMode() and BMenu::SetLabelFromMarked()
149	for additional details on how BMenu and BPopUpMenu are related.
150
151	Menus arrange their items in one of three possible layouts:
152	<table>
153		<tr>
154			<td>\c B_ITEMS_IN_COLUMN</td>
155			<td>
156				The menu items are stacked vertically in a column, one on top
157				of another, as in a typical pop-up menu.
158			</td>
159		</tr>
160		<tr>
161			<td>\c B_ITEMS_IN_ROW</td>
162			<td>
163				The menu items are laid out horizontally in a row, from end to
164				end, as in a typical menu bar.
165			</td>
166		</tr>
167		<tr>
168			<td>\c B_ITEMS_IN_MATRIX</td>
169			<td>
170				The menu items are arranged in a free-form arrangement that you
171				create, such as a matrix.
172			</td>
173		</tr>
174	</table>
175
176	Either \c B_ITEMS_IN_COLUMN or \c B_ITEMS_IN_ROW can be passed into the
177	default constructor, but, you should use the constructor that allows you to
178	set the height and width of the menu in order to utilize the
179	\c B_ITEMS_IN_MATRIX layout.
180
181	Several methods will only work in some layouts as noted in the method
182	description below.
183*/
184
185
186/*!
187	\fn BMenu::BMenu(const char* name, menu_layout layout)
188	\brief Creates a new menu object with the specified \a name and \a layout.
189
190	Don't pass \c B_ITEMS_IN_MATRIX into \a layout with this method, use
191	BMenu::BMenu(const char* name, float width, float height) instead.
192
193	\param name The menu's \a name, serves as a label for submenus.
194	\param layout The menu layout, possibilities include:
195	       - \c B_ITEMS_IN_ROW items are displayed in a single row,
196	       - \c B_ITEMS_IN_COLUMN items are displayed in a single column.
197*/
198
199
200/*!
201	\fn BMenu::BMenu(const char* name, float width, float height)
202	\brief Creates a new menu object with a \c B_ITEMS_IN_MATRIX layout and the
203	       specified \a name, \a width, and \a height.
204
205	\param name The menu's \a name, serves as a label for submenus.
206	\param width The menu \a width.
207	\param height The menu \a height.
208*/
209
210
211/*!
212	\fn BMenu::BMenu(BMessage* archive)
213	\brief Archive constructor.
214
215	\param archive The message data to construct the menu from.
216*/
217
218
219/*!
220	\fn BMenu::~BMenu()
221	\brief Destructor.
222
223	Also frees the memory used by any attached menu items and submenus.
224*/
225
226
227/*!
228	\fn BArchivable* BMenu::Instantiate(BMessage* archive)
229	\brief Creates a new BMenu object from an \a archive message.
230
231	\returns A newly created BMenu object or \c NULL if the message doesn't
232	         contain an archived BMenu.
233*/
234
235
236/*!
237	\fn status_t BMenu::Archive(BMessage* data, bool deep) const
238	\brief Archives the the BMenu object into the \a data message.
239
240	\param data A pointer to the BMessage to archive the object into.
241	\param deep Whether or not to archive attached menu items as well.
242
243	\return A status code, \c B_OK if everything went well or an error code
244	        otherwise.
245	\retval B_OK The object was archived successfully.
246	\retval B_NO_MEMORY Ran out of memory while archiving the object.
247*/
248
249
250/*!
251	\fn void BMenu::AttachedToWindow()
252	\brief Lays out the menu items and resizes the menu to fit.
253*/
254
255
256/*!
257	\fn void BMenu::Draw(BRect updateRect)
258	\brief Draws the menu.
259
260	\param updateRect The area to draw in.
261*/
262
263
264/*!
265	\fn void BMenu::MessageReceived(BMessage* message)
266	\brief Handles a \a message received by the associated looper.
267
268	Responds to mouse wheel events scrolling the menu if it is too
269	long to fit in the window. Hold \c B_SHIFT_KEY to cause the menu
270	to scroll faster.
271
272	\param message The \a message received by the associated looper.
273*/
274
275
276/*!
277	\fn void BMenu::KeyDown(const char* bytes, int32 numBytes)
278	\brief Hook method that is called when a keyboard key is pressed.
279
280	Handles keyboard navigation and triggers.
281
282	\param bytes The bytes of the key combination pressed.
283	\param numBytes The number of bytes in \a bytes.
284*/
285
286
287/*!
288	\fn bool BMenu::AddItem(BMenuItem* item)
289	\brief Adds a menu \a item to the end of the list.
290
291	\warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN
292	         or \c B_ITEMS_IN_ROW layout, it is an error to use this method for
293	         a menu in \c B_ITEMS_IN_MATRIX layout.
294
295	\param item The menu \a item to add.
296
297	\return Whether or not the \a item was added to the menu.
298*/
299
300
301/*!
302	\fn bool BMenu::AddItem(BMenuItem* item, int32 index)
303	\brief Adds a menu \a item at the specified \a index.
304
305	\warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN
306	         or \c B_ITEMS_IN_ROW layout, it is an error to use this method for
307	         a menu in \c B_ITEMS_IN_MATRIX layout.
308
309	\param item The menu \a item to add.
310	\param index The \a index where to add the \a item to the menu.
311
312	\return Whether or not the \a item was added to the menu.
313*/
314
315
316/*!
317	\fn bool BMenu::AddItem(BMenuItem* item, BRect frame)
318	\brief Adds a menu \a item in the specified \a frame rectangle within the menu.
319
320	\warning This method should only be used for a menu in \c B_ITEMS_IN_MATRIX
321	         layout, it is an error to use this method for a menu in
322	         \c B_ITEMS_IN_COLUMN or \c B_ITEMS_IN_ROW layout.
323
324	\param item The menu \a item to add.
325	\param frame The \a frame rectangle where to add the \a item to the menu.
326
327	\return Whether or not the \a item was added to the menu.
328*/
329
330
331/*!
332	\fn bool BMenu::AddItem(BMenu* submenu)
333	\brief Add a \a submenu to the end of the list.
334
335	\warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN
336	         or \c B_ITEMS_IN_ROW layout, it is an error to use this method for
337	         a menu in \c B_ITEMS_IN_MATRIX layout.
338
339	\param submenu The submenu to add.
340
341	\return Whether or not the \a submenu was added to the menu.
342*/
343
344
345/*!
346	\fn bool BMenu::AddItem(BMenu* submenu, int32 index)
347	\brief Add a \a submenu at the specified \a index.
348
349	\warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN
350	         or \c B_ITEMS_IN_ROW layout, it is an error to use this method for
351	         a menu in \c B_ITEMS_IN_MATRIX layout.
352
353	\param submenu The \a submenu to add.
354	\param index The \a index where to add the \a submenu to the menu.
355
356	\return Whether or not the \a submenu was added to the menu.
357*/
358
359
360/*!
361	\fn bool BMenu::AddItem(BMenu* submenu, BRect frame)
362	\brief Adds a \a submenu in the specified \a frame rectangle within the
363	       menu.
364
365	\warning This method should only be used for a menu in \c B_ITEMS_IN_MATRIX
366	         layout, it is an error to use this method for a menu in
367	         \c B_ITEMS_IN_COLUMN or \c B_ITEMS_IN_ROW layout.
368
369	\param submenu The submenu to add.
370	\param frame The \a frame rectangle where to add the submenu to the menu.
371
372	\return Whether or not the \a submenu was added to the menu.
373*/
374
375
376/*!
377	\fn bool BMenu::AddList(BList* list, int32 index)
378	\brief Add a \a list of menu items at the specified \a index.
379
380	\warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN
381	         or \c B_ITEMS_IN_ROW layout, it is an error to use this method for
382	         a menu in \c B_ITEMS_IN_MATRIX layout.
383
384	\param list The \a list of menu items to add.
385	\param index The \a index where to add the \a list to the menu.
386
387	\return Whether or not the \a list of menu items was added to the menu.
388*/
389
390
391/*!
392	\fn bool BMenu::AddSeparatorItem()
393	\brief Adds a separator item to the end of the menu.
394
395	\warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN
396	         layout, it is an error to use this method for a menu in
397	         \c B_ITEMS_IN_ROW or \c B_ITEMS_IN_MATRIX layout.
398
399	\return Whether or not the separator item was added to the menu.
400*/
401
402
403/*!
404	\fn bool BMenu::RemoveItem(BMenuItem* item)
405	\brief Remove and delete the specified \a item from the menu.
406
407	\return Whether or not the \a item was removed from the menu.
408*/
409
410
411/*!
412	\fn BMenuItem* BMenu::RemoveItem(int32 index)
413	\brief Remove the item at the specified \a index from the menu.
414
415	The menu item object is not deleted.
416
417	\warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN
418	         or \c B_ITEMS_IN_ROW layout, it is an error to use this method for
419	         a menu in \c B_ITEMS_IN_MATRIX layout.
420
421	\param index The \a index of where to remove the menu item.
422
423	\return The menu item object or \c NULL if not found.
424*/
425
426
427/*!
428	\fn bool BMenu::RemoveItems(int32 index, int32 count, bool deleteItems)
429	\brief Remove \a count number of items from the menu starting at the specified
430	       \a index and delete them if \a deleteItems is \c true.
431
432	\warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN
433	         or \c B_ITEMS_IN_ROW layout, it is an error to use this method for
434	         a menu in \c B_ITEMS_IN_MATRIX layout.
435
436	\param index The \a index of where to start removing menu items.
437	\param count The number of items to remove.
438	\param deleteItems Whether or not to delete the items after removing them.
439
440	\return Whether or not the items were removed from the menu.
441*/
442
443
444/*!
445	\fn bool BMenu::RemoveItem(BMenu* submenu)
446	\brief Remove and delete a \a submenu from the menu.
447
448	\param submenu The submenu to remove.
449
450	\return Whether or not the \a submenu was removed from the menu.
451*/
452
453
454/*!
455	\fn int32 BMenu::CountItems() const
456	\brief Returns the number of items added to the menu.
457
458	\return The number of items added to the menu.
459*/
460
461
462/*!
463	\fn BMenuItem* BMenu::ItemAt(int32 index) const
464	\brief Returns a pointer to the menu item at the specified \a index.
465
466	\warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN
467	         or \c B_ITEMS_IN_ROW layout, it is an error to use this method for
468	         a menu in \c B_ITEMS_IN_MATRIX layout.
469
470	\return A pointer to a menu item or \c NULL if not found.
471*/
472
473
474/*!
475	\fn BMenu* BMenu::SubmenuAt(int32 index) const
476	\brief Returns a pointer to a submenu at the specified \a index.
477
478	\warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN
479	         or \c B_ITEMS_IN_ROW layout, it is an error to use this method for a
480	         menu in \c B_ITEMS_IN_MATRIX layout.
481
482	\return A pointer to a submenu or \c NULL if not found.
483*/
484
485
486/*!
487	\fn int32 BMenu::IndexOf(BMenuItem* item) const
488	\brief Returns the index of the specified menu \a item.
489
490	The index starts at the left for a menu in \c B_ITEMS_IN_COLUMN layout going
491	right or start at the top for a menu in \c B_ITEMS_IN_ROW layout going down.
492
493	\warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN
494	         or \c B_ITEMS_IN_ROW layout, it is an error to use this method for
495	         a menu in \c B_ITEMS_IN_MATRIX layout.
496
497	\return The index of the menu \a item or \c B_ERROR of not found.
498*/
499
500
501/*!
502	\fn int32 BMenu::IndexOf(BMenu* submenu) const
503	\brief Returns the index of the specified \a submenu.
504
505	The index starts at the left for a menu in \c B_ITEMS_IN_COLUMN layout going
506	right or at the top for a menu in \c B_ITEMS_IN_ROW layout going down.
507
508	\warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN
509	         or \c B_ITEMS_IN_ROW layout, it is an error to use this method for
510	         a menu in \c B_ITEMS_IN_MATRIX layout.
511
512	\return The index of the \a submenu or \c B_ERROR of not found.
513*/
514
515
516/*!
517	\fn BMenuItem* BMenu::FindItem(const char* label) const
518	\brief Returns a pointer to the menu item with the specified \a label.
519
520	\param label The \a label of the menu item to find.
521
522	\return A pointer to a menu item or \c NULL if not found.
523*/
524
525
526/*!
527	\fn BMenuItem* BMenu::FindItem(uint32 command) const
528	\brief Returns a pointer to the menu item with the specified \a command for
529	       its associated message.
530
531	\param command The \a command of the associated message of the menu item to
532	       find.
533
534	\return A pointer to a menu item or \c NULL if not found.
535*/
536
537
538/*!
539	\fn status_t BMenu::SetTargetForItems(BHandler* handler)
540	\brief Set the target to \a handler for each item in the menu.
541
542	This is a convenient way to set the target for all the items in a menu.
543
544	\param handler The BHandler object to set the target of the menu item to.
545
546	This method doesn't descend into submenus recursively and only acts on items
547	that have already been added to the menu.
548
549	\return \c B_OK on success or an error code on error.
550*/
551
552
553/*!
554	\fn status_t BMenu::SetTargetForItems(BMessenger messenger)
555	\brief Set the target to \a messenger for each item in the menu.
556
557	This is a convenient way to set the target for all the items in a menu.
558
559	This method doesn't descend into submenus recursively and only acts on items
560	that have already been added to the menu.
561
562	\param messenger The BMessenger object to set the target of the menu item
563	                 to.
564
565	\return \c B_OK on success or an error code on error.
566*/
567
568
569/*!
570	\fn void BMenu::SetEnabled(bool enable)
571	\brief Enables or disables the menu.
572
573	\param enable \c true to enable, \c false to disable.
574*/
575
576
577/*!
578	\fn void BMenu::SetRadioMode(bool on)
579	\brief Turns radio mode on or off.
580
581	Turning radio mode off also turns off label-from-marked mode.
582
583	Radio mode means that only one menu item can be set as marked at a time.
584	Marking a menu item automatically unmarks all other menu items and draws
585	a check mark on the left side of the marked menu item. You don't have to
586	call BMenuItem::SetMarked() yourself for a menu in radio mode, this is done
587	for you automatically.
588
589	Radio mode does not work recursively, only the current menu is considered.
590	If you want to make a menu work in radio mode recursively you'll have to
591	turn radio mode off and iterate through each menu marking and unmarking
592	the items yourself.
593
594	\param on \c true to turn radio mode on, \c false to turn it off.
595*/
596
597
598/*!
599	\fn void BMenu::SetTriggersEnabled(bool enable)
600	\brief Enables or disables triggers.
601
602	\param enable \c true to enable triggers, \c false to disable triggers.
603*/
604
605
606/*!
607	\fn void BMenu::SetMaxContentWidth(float width)
608	\brief Sets the maximum width of the menu items' content area.
609
610	This is the maximum width that a menu item can draw in. Note that menu
611	items have built-in margins on the left and right sides that are not
612	included as part of the maximum content width.
613
614	\param width The maximum width for the menu item contents to draw in.
615*/
616
617
618/*!
619	\fn void BMenu::SetLabelFromMarked(bool on)
620	\brief Sets whether or not the label of the menu is set according to the
621	       marked item.
622
623	Turning label-from-marked mode on also turns radio mode on.
624
625	\param on \c true to turn label-from-marked mode on, \c false to turn it
626	          off.
627*/
628
629
630/*!
631	\fn bool BMenu::IsLabelFromMarked()
632	\brief Returns whether or not the menu is in label-from-marked mode.
633
634	\return \c true if menu is in label-from-marked mode, \c false if not.
635*/
636
637
638/*!
639	\fn bool BMenu::IsEnabled() const
640	\brief Returns whether or not the menu is enabled.
641
642	\return \c true if menu is enabled, \c false if it is disabled.
643*/
644
645
646/*!
647	\fn bool BMenu::IsRadioMode() const
648	\brief Returns whether or not the menu is in radio mode.
649
650	\return \c true if menu is in radio mode, \c false if not.
651*/
652
653
654/*!
655	\fn bool BMenu::AreTriggersEnabled() const
656	\brief Returns whether or not triggers are enabled.
657
658	\return \c true if triggers are enabled, \c false if triggers are disabled.
659*/
660
661
662/*!
663	\fn bool BMenu::IsRedrawAfterSticky() const
664	\brief Returns whether or not the menu is in redraw-after-sticky mode.
665
666	\return \c true if menu is in redraw-after-sticky mode, \c false if not.
667*/
668
669
670/*!
671	\fn float BMenu::MaxContentWidth() const
672	\brief Return the maximum width of the menu items' content area.
673
674	\return The maximum width of the menu items' content area as a float.
675*/
676
677
678/*!
679	\fn BMenuItem* BMenu::FindMarked()
680	\brief Return a pointer to the first marked menu item.
681
682	The index starts at the left for a menu in \c B_ITEMS_IN_COLUMN layout going
683	right or at the top for a menu in \c B_ITEMS_IN_ROW layout going down.
684
685	\warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN
686	         or \c B_ITEMS_IN_ROW layout, it is an error to use this method for
687	         a menu in \c B_ITEMS_IN_MATRIX layout.
688
689	\return A pointer to the first marked menu item or \c NULL if not found.
690*/
691
692
693/*!
694	\fn int32 BMenu::FindMarkedIndex()
695	\brief Return the index of the first marked menu item.
696
697	The index starts at the left for a menu in \c B_ITEMS_IN_COLUMN layout going
698	right or at the top for a menu in \c B_ITEMS_IN_ROW layout going down.
699
700	\warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN
701	         or \c B_ITEMS_IN_ROW layout, it is an error to use this method for
702	         a menu in \c B_ITEMS_IN_MATRIX layout.
703
704	\return The index of the first marked menu item or -1 if not found.
705*/
706
707
708/*!
709	\fn BMenu* BMenu::Supermenu() const
710	\brief Returns the pointer to the menu that this menu it attached to.
711
712	\return A pointer to a BMenu object or \c NULL if not found.
713*/
714
715
716/*!
717	\fn BMenuItem* BMenu::Superitem() const
718	\brief Returns the pointer to the menu item that this menu it attached to.
719
720	\return A pointer to a BMenuItem object or \c NULL if not found.
721*/
722
723
724/*!
725	\fn BMenu::BMenu(BRect frame, const char* name, uint32 resizingMode,
726		uint32 flags, menu_layout layout, bool resizeToFit)
727	\brief Implemented by derived classes to create a new menu object.
728
729	This method is intended to be used by derived classes that don't simply wish
730	to utilize different sorts of menu items or arrange them in a different way,
731	but wish to invent a different kind of menu altogether.
732
733	If the \a layout is set to \c B_ITEMS_IN_MATRIX the \a resizeToFit flag should
734	be set to \c false.
735
736	\param frame The \a frame rectangle to create the menu in.
737	\param name The menu's \a name, serves as a label for submenus.
738	\param resizingMode The resizing mode flags, see BView for more details.
739	\param flags The view \a flags, see BView for more details.
740	\param layout The menu layout, possibilities include:
741	       - \c B_ITEMS_IN_ROW items are displayed in a single row,
742	       - \c B_ITEMS_IN_COLUMN items are displayed in a single column,
743	       - \c B_ITEMS_IN_MATRIX items are displayed in a custom matrix.
744	\param resizeToFit Whether or not the menu should automatically resize
745	       itself to fit its contents, this will not work in
746	       \c B_ITEMS_IN_MATRIX layout.
747*/
748
749
750/*!
751	\fn void BMenu::SetItemMargins(float left, float top, float right,
752		float bottom)
753	\brief Set the menu item margins.
754
755	\param left The left margin to set.
756	\param top The top margin to set.
757	\param right The right margin to set.
758	\param bottom The bottom margin to set.
759*/
760
761
762/*!
763	\fn void BMenu::GetItemMargins(float* _left, float* _top, float* _right,
764		float* _bottom) const
765	\brief Fill out the margins into the passed in float pointers.
766
767	\param _left The left margin to fill out, can be \c NULL.
768	\param _top The top margin to fill out, can be \c NULL.
769	\param _right The right margin to fill out, can be \c NULL.
770	\param _bottom The bottom margin to fill out, can be \c NULL.
771*/
772
773
774/*!
775	\fn menu_layout BMenu::Layout() const
776	\brief Returns the current menu_layout constant.
777*/
778
779
780/*!
781	\fn BMenuItem* BMenu::Track(bool sticky, BRect* clickToOpenRect)
782	\brief Initiates tracking the cursor within the menu.
783
784	This method passes tracking control to submenus hierarchically depending on
785	where the user moves their mouse.
786
787	You only need to call this method yourself if you are implementing a menu
788	that needs to track the cursor under nonstandard circumstances.
789
790	\param sticky If \c true Track() leaves the menu open even after the mouse
791	       button is no longer held down.
792	\param clickToOpenRect If \a sticky is \c true, leave the menu open even if
793	       the user releases the mouse button while the cursor is inside
794		   \a clickToOpenRect.
795
796	\return A BMenuItem object if the user ends tracking by invoking an item or
797	        \c NULL if the user didn't invoke an item.
798*/
799
800
801/*!
802	\fn bool BMenu::AddDynamicItem(add_state state)
803	\brief Implemented by subclasses to Add a dynamic item to the menu.
804
805	\param state Possibilities include:
806	       - \c B_INITIAL_ADD,
807	       - \c B_PROCESSING,
808	       - \c B_ABORT
809
810	\return \c true if the dynamic item was added, \c false otherwise.
811*/
812
813
814/*!
815	\fn void BMenu::DrawBackground(BRect updateRect)
816	\brief Draw the menu background within the bounds of \a updateRect.
817
818	\param updateRect The area to draw the background in.
819*/
820
821
822/*!
823	\fn void BMenu::SetTrackingHook(menu_tracking_hook func, void* state)
824	\brief Sets a hook function that is called when tracking begins.
825
826	\param func The hook function to call.
827	\param state A variable passed to the hook function.
828*/
829
830
831/*!
832	\fn void BMenu::_DrawItems(BRect updateRect)
833	\brief Draw the menu items within \a updateRect.
834
835	\param updateRect The area to draw the menu items in.
836*/
837