/* 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 <gtkmm/gesturedrag.h>
#include <gtkmm/enums.h>

_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/gesturedrag_p.h)

namespace Gtk
{
_WRAP_ENUM(PanDirection, GtkPanDirection)

/** Pan gesture.
 *
 * This is a Gesture implementation able to recognize
 * pan gestures. Those are drags that are locked to happen along one
 * axis. The axis that a GesturePan handles is defined at
 * construct time, and can be changed through set_orientation().
 *
 * When the gesture starts to be recognized, GesturePan will
 * attempt to determine as early as possible whether the sequence
 * is moving in the expected direction, and denying the sequence if
 * this does not happen.
 *
 * Once a panning gesture along the expected axis is recognized,
 * signal_pan() will be emitted as input events
 * are received, containing the offset in the given axis.
 *
 * @newin{3,14}
 *
 * @ingroup Gestures
 */
class GesturePan : public GestureDrag
{
  _CLASS_GOBJECT(GesturePan, GtkGesturePan, GTK_GESTURE_PAN, GestureDrag, GtkGestureDrag)

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

  /** Constructs a Gesture that recognizes pan gestures.
   */
  _WRAP_CTOR(GesturePan(Widget& widget, Orientation orientation), gtk_gesture_pan_new)

public:
  /** Creates a Gesture that recognizes pan gestures.
   *
   * @newin{3,14}
   *
   * @param widget Widget the gesture relates to.
   * @param orientation Expected orientation.
   * @return A RefPtr to a new GesturePan.
   */
  _WRAP_CREATE(Widget& widget, Orientation orientation)

  _WRAP_METHOD(Orientation get_orientation() const, gtk_gesture_pan_get_orientation)
  _WRAP_METHOD(void set_orientation(Orientation orientation), gtk_gesture_pan_set_orientation)

  // no_default_handler because GtkGesturePanClass is private.
  _WRAP_SIGNAL(void pan(PanDirection direction, double offset), "pan", no_default_handler)

  _WRAP_PROPERTY("orientation", Orientation)
};

} // namespace Gtk
