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 '\x55', '\xAA', '\x55', '\xAA', '\x55', '\xAA', '\x55', '\xAA'
44 #include "nopicture.xpm"
50 color menu_normal("light grey"), menu_highlight("slate grey");
51 color inside_3D(0xB000, 0xC000, 0xD000),
52 light_rim_3D(0xEF00, 0xF000, 0xFFFF),
53 dark_rim_3D(0x7000, 0x8000, 0x9000);
54 color Black("black"), White("white");
55 color _Red("red"), _Green("green");
57 font default_font("variable");
60 cursor hand_cursor(XC_hand1);
61 cursor text_cursor(XC_xterm);
62 cursor busy_cursor(XC_watch);
64 stipple dim_pattern(dim_bits, 8, 8);
66 gc menu_normal_gc(default_font, Black);
67 gc menu_dimmed_gc(default_font, Black, dim_pattern);
68 gc inside_3D_gc(inside_3D),
69 light_3D_gc(light_rim_3D), dark_3D_gc(dark_rim_3D);
71 gc red_gc(default_font, _Red), green_gc(default_font, _Green);
74 gc text_normal_gc(fixed, Black);
75 gc edit_cursor_gc(fixed, Black);
77 pixmap nopicture(nopicture_xpm);
79 xapplication::xapplication()
86 void xapplication::add_window(XID w_id, window *w_ptr)
88 wintab.xh_add(w_id, w_ptr);
91 void xapplication::remove_window(XID w_id)
96 void xapplication::Pgrab(window *w_ptr)
101 void xapplication::Topwin(managed_window *w_ptr)
106 /*=========================================================================
119 **=========================================================================
122 void xapplication::Initialize(void)
124 XSetFont(stddpy, stddpy.gc(), default_font);
125 edit_cursor_gc.SetFunction(GXxor);
126 edit_cursor_gc.SetForeground(stddpy.Black() ^ stddpy.White());
129 /*=========================================================================
142 **=========================================================================
145 void xapplication::ParseArguments(int argc, char *argv[])
149 void xapplication::SetupResources(void)
153 void xapplication::UserInit(void)
157 void xapplication::Cleanup(void)
161 int xapplication::DoCommand(int code)
166 int xapplication::DispatchEvent(XEvent ev)
171 target_win = wintab[ev.xany.window];
176 go_on = target_win->EV_Expose(ev.xexpose);
180 go_on = target_win->EV_NoExpose(ev.xnoexpose);
184 go_on = target_win->EV_KeyPress(ev.xkey);
188 if (Pgrab_window == None || target_win->SelectInput() & GrabPointerMask)
189 go_on = target_win->EV_ButtonPress(ev.xbutton);
191 go_on = Pgrab_window->EV_ButtonPress(ev.xbutton);
195 if (Pgrab_window == None || target_win->SelectInput() & GrabPointerMask)
196 go_on = target_win->EV_ButtonRelease(ev.xbutton);
198 go_on = Pgrab_window->EV_ButtonRelease(ev.xbutton);
202 go_on = target_win->EV_MotionNotify(ev.xmotion);
206 go_on = target_win->EV_EnterNotify(ev.xcrossing);
210 go_on = target_win->EV_LeaveNotify(ev.xcrossing);
214 go_on = target_win->EV_FocusOut(ev.xfocus);
218 go_on = target_win->EV_FocusIn(ev.xfocus);
221 case ConfigureNotify:
222 go_on = target_win->EV_ConfigureNotify(ev.xconfigure);
226 go_on = target_win->EV_ClientMessage(ev.xclient);
230 go_on = target_win->EV_Default(ev);
238 int xapplication::SendCommand(int code)
242 result = Top_window->DoCommand(code);
245 result = DoCommand(code);
251 /*=========================================================================
264 **=========================================================================
267 int main(int argc, char *argv[])
272 XApp->ParseArguments(argc, argv);
273 XApp->SetupResources();
280 while (XApp->DispatchEvent(ev));