1
/****************************************************************************
5
Copyright (C) 1999-2002 Lubos Lunak <l.lunak@kde.org>
7
Distributed under the terms of the GNU General Public License version 2.
9
****************************************************************************/
26
KDE_EXPORT extern Gesture* gesture_handler;
28
class KDE_EXPORT Stroke
31
// maximum number of numbers in stroke
32
enum { MAX_SEQUENCE = 25 };
33
// largest number of points allowed to be sampled
34
enum { MAX_POINTS = 5000 };
35
// default percentage of sample points in a bin from all points to be valid
36
enum { MIN_BIN_POINTS_PERCENTAGE = 5 };
37
// default threshold of size of smaller axis needed for it to define its own bin size
38
enum { SCALE_RATIO = 4 };
39
// default number of sample points required to have a valid stroke
40
enum { MIN_POINTS = 10 };
43
bool record( int x, int y );
44
char* translate( int min_bin_points_percentage_P = MIN_BIN_POINTS_PERCENTAGE,
45
int scale_ratio_P = SCALE_RATIO, int min_points_P = MIN_POINTS ); // CHECKME returns ret_val ( see below )
48
int bin( int x, int y );
49
// metrics for input stroke
54
int bound_x_1, bound_x_2;
55
int bound_y_1, bound_y_2;
62
char ret_val[ MAX_SEQUENCE ];
65
class KDE_EXPORT Gesture
66
: public QWidget // not QObject because of x11EventFilter()
70
Gesture( bool enabled_P, QObject* parent_P );
72
void enable( bool enable_P );
73
void set_mouse_button( unsigned int button_P );
74
void set_timeout( int time_P );
75
void set_exclude( Windowdef_list* windows_P );
76
void register_handler( QObject* receiver_P, const char* slot_P );
77
void unregister_handler( QObject* receiver_P, const char* slot_P );
79
virtual bool x11Event( XEvent* ev_P );
81
void stroke_timeout();
82
void active_window_changed( WId window_P );
84
void handle_gesture( const QString &gesture, WId window );
87
void grab_mouse( bool grab_P );
88
void mouse_replay( bool release_P );
92
QTimer nostroke_timer;
97
Windowdef_list* exclude;
98
QMap< QObject*, bool > handlers; // bool is just a dummy
101
// Gesture class must be QWidget derived because of x11Event()
102
// but it should be QObject owned -> use a QObject proxy that will delete it
108
DeleteObject( QWidget* widget_P, QObject* parent_P )
109
: QObject( parent_P ), widget( widget_P ) {}
110
virtual ~DeleteObject() { delete widget; }
116
//***************************************************************************
118
//***************************************************************************
120
} // namespace KHotKeys