2
/******************************************************************************
4
* DESCRIPTION: Abstract events
5
* COPYRIGHT : (C) 1999 Joris van der Hoeven
6
*******************************************************************************
7
* This software falls under the GNU general public license and comes WITHOUT
8
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
9
* If you don't have this file, write to the Free Software Foundation, Inc.,
10
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
11
******************************************************************************/
19
template<class T> class list;
20
typedef list<rectangle> rectangles;
22
enum gravity { north_west, north, north_east,
24
south_west, south, south_east };
26
/******************************************************************************
28
******************************************************************************/
30
#define __EVENT_CLASS_MASK 0xffff0000
32
extern int event_count;
33
struct event_rep: public abstract_struct {
34
int type; // the event type
35
inline event_rep (int type2): type (type2) { DEBUG(event_count++); }
36
inline virtual ~event_rep () { DEBUG(event_count--); }
37
virtual operator tree () = 0; // for displaying events (debugging)
42
inline operator tree () { return (tree) (*rep); }
43
friend class event_ptr_base;
47
inline ostream& operator << (ostream& out, event ev) {
48
return out << ((tree) ev); }
50
/******************************************************************************
52
******************************************************************************/
54
/*** basic events ***/
55
event get_size (SI& w, SI& h, int mode=0);
56
event get_widget (string which, wk_widget& w);
57
event set_widget (string which, wk_widget w);
58
event emit_attach_window (window win);
59
event emit_reposition ();
60
event emit_position (SI ox, SI oy, SI w, SI h, gravity grav=north_west);
63
event emit_destroy ();
64
event emit_keypress (string key, time_t t);
65
event emit_keyboard_focus (bool in_out_flag, time_t t=0);
66
event emit_mouse (string type, SI x, SI y, int mods, time_t t);
67
event emit_alarm (string message, time_t t);
68
event emit_clear (SI x1, SI y1, SI x2, SI y2);
69
event emit_repaint (SI x1, SI y1, SI x2, SI y2, bool& stop);
71
event emit_invalidate_all ();
72
event emit_invalidate (SI x1, SI y1, SI x2, SI y2);
73
event emit_keyboard_grab (bool in_out_flag, time_t t=0);
74
event emit_mouse_grab (bool in_out_flag, time_t t=0);
75
event emit_request_alarm (event ev, time_t delay);
76
event emit_find_child (SI x, SI y, int& which);
78
/*** composite events ***/
80
event emit_insert (string where, wk_widget wid);
81
event emit_remove (string where);
83
/*** attribute events ***/
84
event get_integer (string which, int& i);
85
event get_double (string which, double& d);
86
event get_string (string which, string& s);
87
event get_coord1 (string which, SI& c1);
88
event get_coord2 (string which, SI& c1, SI& c2);
89
event get_coord3 (string which, SI& c1, SI& c2, SI& c3);
90
event get_coord4 (string which, SI& c1, SI& c2, SI& c3, SI& c4);
91
event set_integer (string which, int i);
92
event set_double (string which, double d);
93
event set_string (string which, string s);
94
event set_coord1 (string which, SI c1);
95
event set_coord2 (string which, SI c1, SI c2);
96
event set_coord3 (string which, SI c1, SI c2, SI c3);
97
event set_coord4 (string which, SI c1, SI c2, SI c3, SI c4);
99
/*** scroll events ***/
100
event set_scrollable (wk_widget w);
101
event set_extents (SI x1, SI y1, SI x2, SI y2);
102
event set_scroll_pos (SI x, SI y);
103
event get_visible (SI& x1, SI& y1, SI& x2, SI& y2);
104
event get_extents (SI& x1, SI& y1, SI& x2, SI& y2);
105
event get_scroll_pos (SI& x, SI& y);
107
/*** user input events ***/
108
event set_input_string (string s);
109
event get_input_string (string& s);
111
#endif // defined EVENT_H