1 /*
2 * Inkscape::DeviceManager - a view of input devices available.
3 *
4 * Copyright 2010 Jon A. Cruz <jon@joncruz.org>
5 *
6 * Released under GNU GPL, read the file 'COPYING' for more information
7 */
9 #ifndef SEEN_INKSCAPE_DEVICE_MANAGER_H
10 #define SEEN_INKSCAPE_DEVICE_MANAGER_H
13 #include <list>
14 #include <glibmm/ustring.h>
15 #include <gdkmm/device.h>
17 namespace Inkscape {
19 class InputDevice : public Glib::Object {
20 public:
21 virtual Glib::ustring getId() const = 0;
22 virtual Glib::ustring getName() const = 0;
23 virtual Gdk::InputSource getSource() const = 0;
24 virtual Gdk::InputMode getMode() const = 0;
25 virtual bool hasCursor() const = 0;
26 virtual gint getNumAxes() const = 0;
27 virtual gint getNumKeys() const = 0;
28 virtual Glib::ustring getLink() const = 0;
29 virtual gint getLiveAxes() const = 0;
30 virtual gint getLiveButtons() const = 0;
32 protected:
33 InputDevice();
34 virtual ~InputDevice();
36 private:
37 InputDevice(InputDevice const &); // no copy
38 void operator=(InputDevice const &); // no assign
39 };
41 class DeviceManager : public Glib::Object {
42 public:
43 static DeviceManager& getManager();
45 virtual void loadConfig() = 0;
46 virtual void saveConfig() = 0;
48 virtual std::list<Glib::RefPtr<InputDevice const> > getDevices() = 0;
50 virtual sigc::signal<void, Glib::RefPtr<InputDevice const> > signalDeviceChanged() = 0;
51 virtual sigc::signal<void, Glib::RefPtr<InputDevice const> > signalAxesChanged() = 0;
52 virtual sigc::signal<void, Glib::RefPtr<InputDevice const> > signalButtonsChanged() = 0;
53 virtual sigc::signal<void, Glib::RefPtr<InputDevice const> > signalLinkChanged() = 0;
55 virtual void addAxis(Glib::ustring const & id, gint axis) = 0;
56 virtual void addButton(Glib::ustring const & id, gint button) = 0;
57 virtual void setLinkedTo(Glib::ustring const & id, Glib::ustring const& link) = 0;
59 virtual void setMode( Glib::ustring const & id, Gdk::InputMode mode ) = 0;
60 virtual void setAxisUse( Glib::ustring const & id, guint index, Gdk::AxisUse use ) = 0;
61 virtual void setKey( Glib::ustring const & id, guint index, guint keyval, Gdk::ModifierType mods ) = 0;
63 protected:
64 DeviceManager();
65 virtual ~DeviceManager();
67 private:
68 DeviceManager(DeviceManager const &); // no copy
69 void operator=(DeviceManager const &); // no assign
70 };
74 } // namespace Inkscape
76 #endif // SEEN_INKSCAPE_DEVICE_MANAGER_H
78 /*
79 Local Variables:
80 mode:c++
81 c-file-style:"stroustrup"
82 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
83 indent-tabs-mode:nil
84 fill-column:99
85 End:
86 */
87 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :