
5.2 The MenuBar
Creating a MenuBar is a fairly complex operation, and one that is completely independent of the MainWindow itself.
However, one of the principal reasons for using the MainWindow widget is that it manages the layout of a MenuBar.
In this section, we demonstrate the simplest means of creating a MenuBar. Once a MenuBar has been created, you
simply tell the MainWindow to include it in the window layout by specifying the MenuBar as the value of the
XmNmenuBar resource for the MainWindow.
In the Motif toolkit, a MenuBar is not implemented as a separate widget, but as a set of CascadeButtons arranged
horizontally in a RowColumn widget. Each CascadeButton is associated with a PulldownMenu that can contain
PushButtons, ToggleButtons, Labels, and Separators. The managing RowColumn widget has a resource setting
indicating that it is being used as a MenuBar. You do not need to know any specific details about any of these widgets
in order to create a functional MenuBar, since Motif provides convenience routines that allow you to create
self−sufficient menu systems. While the specifics on creating PopupMenus, PulldownMenus, and MenuBars are
covered in more detail in Chapter 15, Menus, the basic case that we present in this section is quite simple.
There are a variety of methods that you can use to create and manage a MenuBar, but the easiest method is to use the
convenience menu creation ...