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: Test.C /main/2 1995/07/17 14:07:26 drk $ */
25 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
26 * (c) Copyright 1993, 1994 International Business Machines Corp. *
27 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
28 * (c) Copyright 1993, 1994 Novell, Inc. *
31 #include "Application.h"
32 #include "MainWindow.h"
36 #include "Container.h"
43 static void ExitCB(void *data)
45 delete ((BaseUI *)data)->Parent();
49 static void PrintUICB(void *data)
51 ((AnyUI *) data)->DumpUIHierarchy(true);
54 static void PrintObjectsCB(void *data)
56 ((BaseUI *) data)->DumpHierarchy();
59 class TestWindow : public MainWindow
66 TestWindow(MotifUI *p,char *name) : MainWindow(p,name,NULL,"Fpprnt.l.pm") { }
70 void TestWindow::Initialize()
75 mbar = new MenuBar(this);
76 container = new Container("PrinterSubSystem", this, "Printers");
77 container->WidthHeight(600, 400);
78 container->ContainerView(TREE);
79 SetWorkWindow(container);
82 menu = new Menu(mbar, "File", "F");
83 new Button(menu, "Exit", PUSH_BUTTON, ExitCB, this, "x", "ALT+F4");
86 menu = new Menu(mbar, "Edit", "E");
87 new Button(menu, "Cut", PUSH_BUTTON, NULL, NULL, "t", "Shift+Del");
88 new Button(menu, "Copy", PUSH_BUTTON, NULL, NULL, "C", "Ctrl+Ins");
89 new Button(menu, "Paste", PUSH_BUTTON, NULL, NULL, "P", "Shift+Ins");
90 new Button(menu, "Delete", PUSH_BUTTON, NULL, NULL, "D");
93 menu = new Menu(mbar, "View", "V");
94 new Button(menu, "New", PUSH_BUTTON, NULL, NULL, "N");
96 new Button(menu, "Select All", PUSH_BUTTON, NULL, NULL, "S", "Ctrl+/");
97 new Button(menu, "Unselect All", PUSH_BUTTON, NULL, NULL, "U", "Ctrl+\\");
99 new Button(menu, "Set Preferences...", PUSH_BUTTON, NULL, NULL, "P");
101 new Button(menu, "Save Settings...", PUSH_BUTTON, NULL, NULL, "t");
104 menu = new Menu(mbar, "Actions", "A");
105 new Button(menu, "Monitor", PUSH_BUTTON, NULL, NULL, "M");
106 new Button(menu, "Cancel Job", PUSH_BUTTON, NULL, NULL, "C");
109 menu = new Menu(mbar, "Help", "H");
110 new Button(menu, "Introduction", PUSH_BUTTON, NULL, NULL, "I");
112 new Button(menu, "Tasks", PUSH_BUTTON, NULL, NULL, "T");
113 new Button(menu, "Reference", PUSH_BUTTON, NULL, NULL, "R");
114 new Button(menu, "On Item", PUSH_BUTTON, NULL, NULL, "O");
116 new Button(menu, "Using Help", PUSH_BUTTON, NULL, NULL, "U");
118 new Button(menu, "Version", PUSH_BUTTON, NULL, NULL, "V");
119 mbar->SetHelpMenu(menu);
122 menu = new Menu(mbar, "Debug", "G");
123 new Button(menu, "Print Objects", PUSH_BUTTON, PrintObjectsCB, Parent());
124 new Button(menu, "Print UI", PUSH_BUTTON, PrintUICB, Parent());
131 Application *app = new Application("Printer", "Dtprinter", &argc, argv);
132 TestWindow *window = new TestWindow(app, "Printer");
133 window->Initialize();
135 window->AddAction("Exit", "PrinterSubSystem", ExitCB, NULL, "x", "Alt+F4");
136 window->AddAction("Properties...", "Queue", NULL, NULL, "p",
138 window->AddSep("Queue");
139 window->AddAction("Start", "Queue", NULL, NULL, "S");
140 window->AddAction("Stop", "Queue", NULL, NULL, "t");
141 window->AddSep("Queue");
142 window->AddAction("Monitor", "Queue", NULL, NULL, "M");
143 window->AddAction("Cancel", "PrintJob", NULL, NULL, "C");
145 window->RegisterPopup(window->container);
147 IconObj *lp0 = new IconObj("Queue", window->container, "lp0", "Fpprnt");
148 window->RegisterPopup(lp0);
149 IconObj *tmp = new IconObj("PrintJob", lp0, "job1", "DtPrtjb");
150 window->RegisterPopup(tmp);
151 tmp = new IconObj("PrintJob", lp0, "job2", "DtPrtjb");
152 window->RegisterPopup(tmp);
153 tmp = new IconObj("PrintJob", lp0, "job3", "DtPrtjb");
154 window->RegisterPopup(tmp);
155 IconObj *lp1 = new IconObj("Queue", window->container, "lp1", "Fpprnt");
156 window->RegisterPopup(lp1);
157 tmp = new IconObj("PrintJob", lp1, "job4", "DtPrtjb");
158 window->RegisterPopup(tmp);
159 tmp = new IconObj("PrintJob", lp1, "job5", "DtPrtjb");
160 window->RegisterPopup(tmp);