// SPDX-License-Identifier: GPL-2.0-or-later #ifndef INK_LIVECODE_INPUT_H #define INK_LIVECODE_INPUT_H /* * Input state keeper for the livecoding tool * * Authors: * Sol Bekic * Copyright (C) 2019 Authors * * Released under GNU GPL v2+, read the file 'COPYING' for more information. */ #include #include <2geom/point.h> #include <2geom/geom.h> namespace Inkscape { namespace Livecode { class API; enum InputState { INPUTSTATE_NONE, INPUTSTATE_HOVER, INPUTSTATE_PRESSED, INPUTSTATE_HELD, INPUTSTATE_RELEASED, }; class Mouse { public: Geom::Point pos() const; Geom::Point delta() const; Geom::Point ui_pos() const; Geom::Point ui_delta() const; InputState event(guint button = 1) const; bool pressed(guint button = 1) const; bool held(guint button = 1) const; bool released(guint button = 1) const; private: API& api; guint last_mask, prev_mask; Geom::Point last_pos, prev_pos; Mouse(API &api); void push_event(GdkEvent *event); void finish_frame(); friend class API; }; } } #endif // INK_LIVECODE_INPUT_H /* Local Variables: mode:c++ c-file-style:"stroustrup" c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :