2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: MainWindow.c /main/3 1996/05/09 03:39:51 drk $ */
24 #include "PrintDemo.h"
27 * static function declarations
29 static void MainWindow_createMenuBar(MainWindow* me);
30 static void MainWindow_createToolBar(MainWindow* me);
33 * ------------------------------------------------------------------------
34 * Name: MainWindow_new
38 * Creates the main window of the DtPrint demo program.
42 * A pointer to a new MainWindow structure.
46 MainWindow_new(Widget parent)
48 MainWindow* me = (MainWindow*)XtCalloc(1, sizeof(MainWindow));
50 * create the main window
53 XtVaCreateWidget("MainWindow",
54 xmMainWindowWidgetClass,
58 * create the menu bar and tool bar
60 MainWindow_createMenuBar(me);
61 MainWindow_createToolBar(me);
69 * ------------------------------------------------------------------------
70 * Name: MainWindow_createMenuBar
74 * Creates the menu bar for the main window of the DtPrint demo
79 MainWindow_createMenuBar(MainWindow* me)
88 menu_bar = XmCreateMenuBar(me->widget, "MenuBar", NULL, 0);
90 * create the file menu
92 file_menu = XmCreatePulldownMenu(menu_bar, "FileMenu", NULL, 0);
94 * create the file menu cascade button
96 label = XmStringCreateLocalized("File");
97 XtVaCreateManagedWidget("FileCascade",
98 xmCascadeButtonGadgetClass,
100 XmNsubMenuId, file_menu,
101 XmNlabelString, label,
105 * create the "Print..." file menu item
107 label = XmStringCreateLocalized("Print...");
108 me->print_menu_button =
109 XtVaCreateManagedWidget("PrintButton",
110 xmPushButtonWidgetClass,
112 XmNlabelString, label,
118 XtVaCreateManagedWidget("", xmSeparatorGadgetClass, file_menu, NULL);
122 label = XmStringCreateLocalized("Exit");
124 XtVaCreateManagedWidget("ExitButton",
125 xmPushButtonWidgetClass,
127 XmNlabelString, label,
131 * manage the menu bar and return it
133 XtManageChild(menu_bar);
137 * ------------------------------------------------------------------------
138 * Name: MainWindow_createToolBar
142 * Creates a simple tool bar for the main window of the DtPrint demo
147 MainWindow_createToolBar(MainWindow* me)
152 row = XtVaCreateManagedWidget(
154 xmRowColumnWidgetClass,
156 XmNorientation, XmHORIZONTAL,
157 XmNscrolledWindowChildType, XmCOMMAND_WINDOW,
160 * create just the "quick print" button
162 label = XmStringCreateLocalized("Quick Print");
163 me->quick_print_button =
164 XtVaCreateManagedWidget("QuickPrintButton",
165 xmPushButtonWidgetClass,
167 XmNlabelString, label,