| 1 |
/* Copyright (C) 2014 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#include <gtkmm/gesturedrag.h> |
| 18 |
#include <gtkmm/enums.h> |
| 19 |
|
| 20 |
_DEFS(gtkmm,gtk) |
| 21 |
_PINCLUDE(gtkmm/private/gesturedrag_p.h) |
| 22 |
|
| 23 |
namespace Gtk |
| 24 |
{ |
| 25 |
_WRAP_ENUM(PanDirection, GtkPanDirection, decl_prefix GTKMM_API) |
| 26 |
|
| 27 |
/** Pan gesture. |
| 28 |
* |
| 29 |
* This is a Gesture implementation able to recognize |
| 30 |
* pan gestures. Those are drags that are locked to happen along one |
| 31 |
* axis. The axis that a GesturePan handles is defined at |
| 32 |
* construct time, and can be changed through set_orientation(). |
| 33 |
* |
| 34 |
* When the gesture starts to be recognized, GesturePan will |
| 35 |
* attempt to determine as early as possible whether the sequence |
| 36 |
* is moving in the expected direction, and denying the sequence if |
| 37 |
* this does not happen. |
| 38 |
* |
| 39 |
* Once a panning gesture along the expected axis is recognized, |
| 40 |
* signal_pan() will be emitted as input events |
| 41 |
* are received, containing the offset in the given axis. |
| 42 |
* |
| 43 |
* @newin{3,14} |
| 44 |
* |
| 45 |
* @ingroup Gestures |
| 46 |
*/ |
| 47 |
class GTKMM_API GesturePan : public GestureDrag |
| 48 |
{ |
| 49 |
_CLASS_GOBJECT(GesturePan, GtkGesturePan, GTK_GESTURE_PAN, GestureDrag, GtkGestureDrag, , , GTKMM_API) |
| 50 |
|
| 51 |
protected: |
| 52 |
/** There is no create() method that corresponds to this constructor, |
| 53 |
* because this constructor shall only be used by derived classes. |
| 54 |
*/ |
| 55 |
_CTOR_DEFAULT |
| 56 |
|
| 57 |
/** Constructs a Gesture that recognizes pan gestures. |
| 58 |
*/ |
| 59 |
_WRAP_CTOR(GesturePan(Widget& widget, Orientation orientation), gtk_gesture_pan_new) |
| 60 |
|
| 61 |
public: |
| 62 |
/** Creates a Gesture that recognizes pan gestures. |
| 63 |
* |
| 64 |
* @newin{3,14} |
| 65 |
* |
| 66 |
* @param widget Widget the gesture relates to. |
| 67 |
* @param orientation Expected orientation. |
| 68 |
* @return A RefPtr to a new GesturePan. |
| 69 |
*/ |
| 70 |
_WRAP_CREATE(Widget& widget, Orientation orientation) |
| 71 |
|
| 72 |
_WRAP_METHOD(Orientation get_orientation() const, gtk_gesture_pan_get_orientation) |
| 73 |
_WRAP_METHOD(void set_orientation(Orientation orientation), gtk_gesture_pan_set_orientation) |
| 74 |
|
| 75 |
// no_default_handler because GtkGesturePanClass is private. |
| 76 |
_WRAP_SIGNAL(void pan(PanDirection direction, double offset), "pan", no_default_handler) |
| 77 |
|
| 78 |
_WRAP_PROPERTY("orientation", Orientation) |
| 79 |
}; |
| 80 |
|
| 81 |
} // namespace Gtk |