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 libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * $XConsortium: WindowSystemMotif.hh /main/15 1996/11/27 12:29:47 rcs $
26 * Copyright (c) 1991 HaL Computer Systems, Inc. All rights reserved.
27 * UNPUBLISHED -- rights reserved under the Copyright Laws of the United
28 * States. Use of a copyright notice is precautionary only and does not
29 * imply publication or disclosure.
31 * This software contains confidential information and trade secrets of HaL
32 * Computer Systems, Inc. Use, disclosure, or reproduction is prohibited
33 * without the prior express written permission of HaL Computer Systems, Inc.
35 * RESTRICTED RIGHTS LEGEND
36 * Use, duplication, or disclosure by the Government is subject to
37 * restrictions as set forth in subparagraph (c)(l)(ii) of the Rights in
38 * Technical Data and Computer Software clause at DFARS 252.227-7013.
39 * HaL Computer Systems, Inc.
40 * 1315 Dell Avenue, Campbell, CA 95008
44 #include <WWL/WApplicationShell.h>
45 #include "Other/AppPrintData.hh"
52 // VideoShell structure definition
54 typedef struct _VideoShell
66 typedef void _DtHelpDeSelectAll_t(_WidgetRec*,_XEvent*,char**,unsigned*);
67 typedef _DtHelpDeSelectAll_t * DeSelectAll_ptr;
68 typedef void _DtHelpSelectAll_t(_WidgetRec*,_XEvent*,char**,unsigned*);
69 typedef _DtHelpSelectAll_t * SelectAll_ptr;
70 typedef void _DtHelpActivateLink_t(_WidgetRec*,_XEvent*,char**,unsigned*);
71 typedef _DtHelpActivateLink_t * ActivateLink_ptr;
72 typedef void _DtHelpCopyAction_t(_WidgetRec*,_XEvent*,char**,unsigned*);
73 typedef _DtHelpCopyAction_t * CopyAction_ptr;
74 typedef void _DtHelpPageUpOrDown_t(_WidgetRec*,_XEvent*,char**,unsigned*);
75 typedef _DtHelpPageUpOrDown_t * PageUpOrDown_ptr;
76 typedef void _DtHelpPageLeftOrRight_t(_WidgetRec*,_XEvent*,char**,unsigned*);
77 typedef _DtHelpPageLeftOrRight_t * PageLeftOrRight_ptr;
78 typedef void _DtHelpNextLink_t(_WidgetRec*,_XEvent*,char**,unsigned*);
79 typedef _DtHelpNextLink_t * NextLink_ptr;
80 typedef void XmuCvtStringToGravity_t(XrmValue*,unsigned*,XrmValue*,XrmValue*);
81 typedef XmuCvtStringToGravity_t * XmuCvtStringToGravity_ptr;
85 typedef void core_dump_handler_t(int signal_number);
86 typedef core_dump_handler_t * core_dump_handler_ptr;
87 typedef void interrupt_handler_t(int signal_number);
88 typedef interrupt_handler_t * interrupt_handler_ptr;
89 typedef int xevent_error_aborter_t(Display *display,XErrorEvent* error_event);
90 typedef xevent_error_aborter_t * xevent_error_aborter_ptr;
95 class WindowSystem : public WWL, public FolioObject
97 struct CursorStackElement
99 Cursor cursor; // Cursor set at this stack level.
100 Widget exception; // Any exception to this cursor.
105 WindowSystem (int &argc, char *argv[]);
114 XtAppContext app_context(){ return f_application_context ; }
115 XtAppContext applicationContext() { return app_context(); }
116 AppPrintData * GetAppPrintData() { return f_AppPrintData; };
118 WApplicationShell &toplevel();
119 WApplicationShell &printToplevel();
120 WApplicationShell &onlineToplevel();
125 Display *printDisplay();
126 Display *onlineDisplay();
127 void setPrintDisplay(Widget widget);
128 void setPrinting(Boolean state);
129 VideoShell *videoShell();
130 Atom WM_DELETE_WINDOW()
131 { return f_wm_delete_window; }
133 Pixmap locked_pixmap(Widget w);
134 Pixmap unlocked_pixmap(Widget w);
135 Pixmap semilocked_pixmap(Widget w);
137 Pixmap default_pixmap (Dimension *width, Dimension *height);
138 // NOTE: until we get a real detached pixmap, use default
139 Pixmap detached_pixmap(Dimension *width, Dimension *height);
141 static WindowSystem &window_system()
142 { return (*f_window_system); }
145 XmString make_space(int num_pixels, Widget w);
148 { XBell (f_display, 0); }
150 void show_all_windows();
152 // use this only after a fork!!
153 void close_display_connection();
155 // Color and Preferences
157 // get_color returns 0 for failure
158 unsigned long get_color(const char *colorval, unsigned long &pixel) const ;
163 Cursor create_cursor (const char *filename);
165 void register_shell (WShell *);
166 void register_full_modal_shell (WShell *);
167 void register_primary_modal_shell (WShell *);
168 void set_cursor (Cursor cursor, Widget exception = NULL);
169 void reset_cursor (WCallback *wcb = NULL);
170 void full_modal_cursor (WCallback *wcb = NULL);
171 void primary_modal_cursor (WCallback *wcb = NULL);
173 { set_cursor (f_wait_cursor); }
175 // NOTE: replace calls to set_wait_state with other calls
176 void set_wait_state (WaitState state)
177 { if (state == WS_ON) wait_cursor(); else reset_cursor(); }
179 // Get bool value from resource file
180 bool get_boolean_app_resource (const char *name)
181 { return (get_boolean_default (name)); }
183 bool get_boolean_default (const char *name);
184 int get_int_default (const char *name);
185 const char *get_string_default (const char *name);
186 const WindowGeometry &get_geometry_default (const char *name);
188 Pixel get_color_default(const char *name);
190 // Get message from resource file
191 char *get_message(const char *message_name);
193 void update_display();
196 { return f_nofonts; }
198 XmFontListEntry dtinfo_font();
199 XmFontListEntry dtinfo_space_font();
201 private: // functions
202 void unregister_shell (WCallback *);
203 static void core_dump_handler (int signal_number);
204 static void interrupt_handler (int signal_number);
206 Pixmap read_pixmap(const char *name,
210 protected: // variables
213 WApplicationShell f_toplevel;
215 Display *f_print_display;
218 Cursor f_wait_cursor;
219 Cursor f_modal_cursor;
220 Cursor f_bomb_cursor;
221 Atom f_wm_delete_window;
222 Pixmap f_locked_pixmap;
223 Pixmap f_unlocked_pixmap;
224 Pixmap f_semilocked_pixmap;
225 Pixmap f_default_pixmap;
226 Pixmap f_default_print_pixmap;
227 // Node Pixmaps - default and detached
228 Dimension f_defpix_width;
229 Dimension f_defpix_height;
230 Dimension f_print_defpix_width;
231 Dimension f_print_defpix_height;
232 Pixmap f_detached_pixmap ;
233 Dimension f_detached_width ;
234 Dimension f_detached_height ;
236 CursorStackElement f_cursor_stack[16];
237 short f_cursor_stack_pos;
239 static WindowSystem *f_window_system;
240 AppPrintData * f_AppPrintData;
241 VideoShell * f_video_shell;
242 WApplicationShell f_print_toplevel;
243 Screen *f_print_screen;
244 XmFontListEntry f_dtinfo_font;
245 XmFontListEntry f_dtinfo_space_font;
247 XtAppContext f_application_context;
252 inline WindowSystem &
255 return (WindowSystem::window_system());
259 class Wait_Cursor : public Destructable
263 { window_system().set_wait_state (WS_ON); }
265 { window_system().set_wait_state (WS_OFF); }
268 enum { DTINFO_FONT, DTINFO_SPACE_FONT };
270 extern XmFontListEntry dtinfo_font(int);