/* Copyright (C) 2014 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 */

#include <glibmm/object.h>
#include <gtkmm/widget.h>

_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/object_p.h)

namespace Gtk
{
/** @defgroup Gestures Event Controllers and Gestures
 *
 * These classes handle input events.
 *
 * Event controllers are standalone objects that can perform specific actions
 * upon received GdkEvent%s. These are tied to a Widget, and can be told of
 * the event propagation phase at which they will manage the events.
 *
 * Gestures are a set of specific controllers that are prepared to handle pointer
 * and/or touch events. Each gestures implementation attempts to recognize specific
 * actions out the received events, notifying of the state/progress accordingly to
 * let the widget react to those. On multi-touch gestures, every interacting touch
 * sequence will be tracked independently.
 *
 * See the <a href="https://docs.gtk.org/gtk3/input-handling.html">
 * Overview of GTK input and event handling</a>
 * for more information about input events and gestures.
 *
 * @newin{3,14}
 */

_WRAP_ENUM(PropagationPhase, GtkPropagationPhase, decl_prefix GTKMM_API)

/** Self-contained handler of series of events.
 *
 * This is an abstract base class, low-level implementation for event
 * controllers. Those react to a series of GdkEvent%s, and possibly trigger
 * actions as a consequence of those.
 *
 * @newin{3,14}
 *
 * @ingroup Gestures
 */
class GTKMM_API EventController : public Glib::Object
{
  _CLASS_GOBJECT(EventController, GtkEventController, GTK_EVENT_CONTROLLER, Glib::Object, GObject, , , GTKMM_API)

protected:
  /** There is no create() method that corresponds to this constructor,
   * because only derived classes shall be created.
   */
  _CTOR_DEFAULT

public:
  // No create() because only derived classes shall be instantiated.

  _WRAP_METHOD(Widget* get_widget(), gtk_event_controller_get_widget)
  _WRAP_METHOD(const Widget* get_widget() const, gtk_event_controller_get_widget, constversion)
  _WRAP_METHOD(bool handle_event(const GdkEvent* event), gtk_event_controller_handle_event)
  _WRAP_METHOD(void reset(), gtk_event_controller_reset)
  _WRAP_METHOD(PropagationPhase get_propagation_phase() const, gtk_event_controller_get_propagation_phase)
  _WRAP_METHOD(void set_propagation_phase(PropagationPhase phase), gtk_event_controller_set_propagation_phase)

  _WRAP_PROPERTY("widget", Widget*)
  _WRAP_PROPERTY("propagation-phase", PropagationPhase)

  // EventController has no signals
};

} // namespace Gtk
