2 /****************************************************************************
3 * Copyright (C) 2002 by Leo Khramov
4 * email: leo@xnc.dubna.su
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 ****************************************************************************/
16 // $Id: xwellinput.cxx,v 1.1.1.1 2003/01/04 11:37:22 leo Exp $
18 /// module description
19 /// X11 implementation of WellInput class - make input text from user
20 /// display it through WellImageFont, convert X11 Key event to symbols
22 #include "xwellinput.h"
23 #include "xwellengine.h"
25 //===========================================================================
26 /// global XWellInput(char*)
27 /// constructor - fill name and get geometry
29 XWellInput::XWellInput(char* iname
) : WellInput(iname
)
31 xengine
=(XWellEngine
*) default_well_engine
;
32 mainw
=xengine
->get_main_window();
33 maingc
=xengine
->get_main_gc();
36 //===========================================================================
37 /// global process_event(wEvent)
38 /// stub that process events
40 bool XWellInput::process_event(wEvent ev
)
42 XEvent
*xev
=(XEvent
*)ev
.data
;
53 //===========================================================================
54 /// global draw_text()
55 /// draw text on the screen
57 void XWellInput::draw_text()
59 unsigned long *colors
=xengine
->get_colors();
60 fnt
->draw_text(buf
,buflen
,BackColor
);
61 XSetForeground(disp
,maingc
,colors
[BonusColor2
]);
62 XFillRectangle(disp
,mainw
,maingc
,geo
[1].tox
+buflen
*FONT2_L
,geo
[1].toy
,
66 //===========================================================================
67 /// global process_key(XEvent)
68 /// draw text on the screen
70 void XWellInput::process_key(XEvent
*xev
)
76 XLookupString(&xev
->xkey
, sym
, 4, &ks
, &cs
);
81 object_on_enter
.call(wEvent(aInputDone
,this));
94 if(buflen
<maxlen
&& sym
[0]>=32 && sym
[0]<127)