Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtmail / MotifApp / MenuWindow.C
1 /* $TOG: MenuWindow.C /main/5 1997/06/04 18:42:40 mgreess $ */
2 /*
3  *+SNOTICE
4  *
5  *      RESTRICTED CONFIDENTIAL INFORMATION:
6  *      
7  *      The information in this document is subject to special
8  *      restrictions in a confidential disclosure agreement bertween
9  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
10  *      document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
11  *      Sun's specific written approval.  This documment and all copies
12  *      and derivative works thereof must be returned or destroyed at
13  *      Sun's request.
14  *
15  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
16  *
17  *+ENOTICE
18  */
19
20 ///////////////////////////////////////////////////////////////////////////////
21 //////////////////////////////////////////////////////////////////////////////
22 //         This example code is from the book:
23 //
24 //           Object-Oriented Programming with C++ and OSF/Motif
25 //         by
26 //           Douglas Young
27 //           Prentice Hall, 1992
28 //           ISBN 0-13-630252-1 
29 //
30 //         Copyright 1991 by Prentice Hall
31 //         All Rights Reserved
32 //
33 //  Permission to use, copy, modify, and distribute this software for 
34 //  any purpose except publication and without fee is hereby granted, provided 
35 //  that the above copyright notice appear in all copies of the software.
36 ///////////////////////////////////////////////////////////////////////////////
37 //////////////////////////////////////////////////////////////////////////////
38
39
40 //////////////////////////////////////////////////////////
41 // MenuWindow.C
42 //////////////////////////////////////////////////////////
43
44 #include "MenuWindow.h"
45 #include "MenuBar.h"
46
47
48 MenuWindow::MenuWindow( char *name, Boolean allowResize ) :
49 MainWindow ( name, allowResize ) 
50 {
51     _menuBar = NULL;
52 }
53
54 void MenuWindow::initialize()
55 {
56     
57     // Call base class to create XmMainWindow widget
58     // and set up the work area.
59     
60     MainWindow::initialize();
61     
62     // Specify the base widget of a MenuBar object 
63     // the XmMainWindow widget's menu bar.
64     
65     _menuBar = new MenuBar ( _main, "menubar" );
66     
67     XtVaSetValues ( _main, 
68                    XmNmenuBar, _menuBar->baseWidget(),
69                    NULL);
70     
71     // Call derived class hook to add panes to the menu
72     
73     createMenuPanes();
74     
75     _menuBar->manage();
76
77
78
79 }
80
81 MenuWindow::~MenuWindow()
82 {
83
84
85     delete _menuBar;
86 }
87
88 void
89 MenuWindow::getIconColors(Pixel & fore, Pixel & back)
90 {
91     if (_menuBar) {
92         XtVaGetValues (_menuBar->baseWidget(),
93                        XmNforeground, &fore,
94                        XmNbackground, &back,
95                        NULL);
96     }
97     else {
98         MainWindow::getIconColors(fore, back);
99     }
100 }