00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _INPUT_H_
00012 #define _INPUT_H_
00013
00014 #include <tqobject.h>
00015 #include <tqwindowdefs.h>
00016 #include <tqmap.h>
00017 #include <tqwidget.h>
00018 #include <tqvaluelist.h>
00019 #include <kshortcut.h>
00020
00021 #include <X11/X.h>
00022 #include <fixx11h.h>
00023
00024 class KGlobalAccel;
00025
00026 namespace KHotKeys
00027 {
00028
00029 class Kbd_receiver
00030 {
00031 public:
00032 virtual bool handle_key( const KShortcut& shortcut_P ) = 0;
00033 };
00034
00035 class Kbd
00036 : public QObject
00037 {
00038 Q_OBJECT
00039 public:
00040 Kbd( bool grabbing_enabled_P, TQObject* parent_P );
00041 virtual ~Kbd();
00042 void insert_item( const KShortcut& shortcut_P, Kbd_receiver* receiver_P );
00043 void remove_item( const KShortcut& shortcut_P, Kbd_receiver* receiver_P );
00044 void activate_receiver( Kbd_receiver* receiver_P );
00045 void deactivate_receiver( Kbd_receiver* receiver_P );
00046 static bool send_macro_key( const KKey& key, Window window_P = InputFocus );
00047 protected:
00048 bool x11EventFilter( const XEvent* );
00049 void grab_shortcut( const KShortcut& shortcut_P );
00050 void ungrab_shortcut( const KShortcut& shortcut_P );
00051 private slots:
00052 void key_slot( TQString key_P );
00053 void update_connections();
00054 private:
00055 struct Receiver_data
00056 {
00057 Receiver_data();
00058 TQValueList< KShortcut > shortcuts;
00059 bool active;
00060 };
00061 TQMap< Kbd_receiver*, Receiver_data > receivers;
00062 TQMap< KShortcut, int > grabs;
00063 KGlobalAccel* kga;
00064 };
00065
00066 class Mouse
00067 {
00068 public:
00069 static bool send_mouse_button( int button_P, bool release_P );
00070 };
00071
00072
00073
00074
00075
00076
00077
00078
00079 inline
00080 Kbd::Receiver_data::Receiver_data()
00081 : active( false )
00082 {
00083 }
00084
00085 }
00086
00087 #endif