1 /**************************************************************************
2 ** (c) Copyright 1998, Andromeda Technology & Automation
3 ***************************************************************************
4 ** MODULE INFORMATION *
5 ***********************
6 ** FILE NAME : xappl.cpp
7 ** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation
8 ** VERSION NUMBER : $Revision: 1.1 $
10 ** DESCRIPTION : Implementation of xapplication class
15 ***************************************************************************
16 ** ADMINISTRATIVE INFORMATION *
17 ********************************
18 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
19 ** CREATION DATE : Feb 06, 1998
20 ** LAST UPDATE : Feb 22, 1998
22 **************************************************************************/
24 /*****************************
26 Revision 1.1 2002-07-25 08:01:27 arjen
27 First checkin, AXE release 0.2
29 *****************************/
31 static const char *RCSID = "$Id: xappl.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $";
37 static char dim_bits[] =
39 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA
42 #include "nopicture.xpm"
47 color menu_normal("light grey"), menu_highlight("slate grey");
48 color inside_3D(0xB000, 0xC000, 0xD000),
49 light_rim_3D(0xEF00, 0xF000, 0xFFFF),
50 dark_rim_3D(0x7000, 0x8000, 0x9000);
51 color Black("black"), White("white");
52 color _Red("red"), _Green("green");
54 font default_font("variable");
57 cursor hand_cursor(XC_hand1);
58 cursor text_cursor(XC_xterm);
59 cursor busy_cursor(XC_watch);
61 stipple dim_pattern(dim_bits, 8, 8);
63 gc menu_normal_gc(default_font, Black);
64 gc menu_dimmed_gc(default_font, Black, dim_pattern);
65 gc inside_3D_gc(inside_3D),
66 light_3D_gc(light_rim_3D), dark_3D_gc(dark_rim_3D);
68 gc red_gc(default_font, _Red), green_gc(default_font, _Green);
71 gc text_normal_gc(fixed, Black);
72 gc edit_cursor_gc(fixed, Black);
74 pixmap nopicture(nopicture_xpm);
76 xapplication::xapplication()
83 void xapplication::add_window(XID w_id, window *w_ptr)
85 wintab.xh_add(w_id, w_ptr);
88 void xapplication::remove_window(XID w_id)
93 void xapplication::Pgrab(window *w_ptr)
98 void xapplication::Topwin(managed_window *w_ptr)
103 /*=========================================================================
116 **=========================================================================
119 void xapplication::Initialize(void)
121 XSetFont(stddpy, stddpy.gc(), default_font);
122 edit_cursor_gc.SetFunction(GXxor);
123 edit_cursor_gc.SetForeground(stddpy.Black() ^ stddpy.White());
126 /*=========================================================================
139 **=========================================================================
142 void xapplication::ParseArguments(int argc, char *argv[])
146 void xapplication::SetupResources(void)
150 void xapplication::UserInit(void)
154 void xapplication::Cleanup(void)
158 int xapplication::DoCommand(int code)
163 int xapplication::DispatchEvent(XEvent ev)
168 target_win = wintab[ev.xany.window];
173 go_on = target_win->EV_Expose(ev.xexpose);
177 go_on = target_win->EV_NoExpose(ev.xnoexpose);
181 go_on = target_win->EV_KeyPress(ev.xkey);
185 if (Pgrab_window == None || target_win->SelectInput() & GrabPointerMask)
186 go_on = target_win->EV_ButtonPress(ev.xbutton);
188 go_on = Pgrab_window->EV_ButtonPress(ev.xbutton);
192 if (Pgrab_window == None || target_win->SelectInput() & GrabPointerMask)
193 go_on = target_win->EV_ButtonRelease(ev.xbutton);
195 go_on = Pgrab_window->EV_ButtonRelease(ev.xbutton);
199 go_on = target_win->EV_MotionNotify(ev.xmotion);
203 go_on = target_win->EV_EnterNotify(ev.xcrossing);
207 go_on = target_win->EV_LeaveNotify(ev.xcrossing);
211 go_on = target_win->EV_FocusOut(ev.xfocus);
215 go_on = target_win->EV_FocusIn(ev.xfocus);
218 case ConfigureNotify:
219 go_on = target_win->EV_ConfigureNotify(ev.xconfigure);
223 go_on = target_win->EV_ClientMessage(ev.xclient);
227 go_on = target_win->EV_Default(ev);
235 int xapplication::SendCommand(int code)
239 result = Top_window->DoCommand(code);
242 result = DoCommand(code);
248 /*=========================================================================
261 **=========================================================================
264 int main(int argc, char *argv[])
269 XApp->ParseArguments(argc, argv);
270 XApp->SetupResources();
277 while (XApp->DispatchEvent(ev));