| 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/gesturesingle.h> |
| 18 |
#include <gdkmm/rectangle.h> |
| 19 |
|
| 20 |
_DEFS(gtkmm,gtk) |
| 21 |
_PINCLUDE(gtkmm/private/gesturesingle_p.h) |
| 22 |
|
| 23 |
namespace Gtk |
| 24 |
{ |
| 25 |
/** Multipress gesture. |
| 26 |
* |
| 27 |
* This is a Gesture implementation able to recognize |
| 28 |
* multiple clicks on a nearby zone, which can be listened for through |
| 29 |
* signal_pressed(). Whenever time or distance between |
| 30 |
* clicks exceed the GTK+ defaults, signal_stopped() is emitted, |
| 31 |
* and the click counter is reset. |
| 32 |
* |
| 33 |
* Callers may also restrict the area that is considered valid for a >1 |
| 34 |
* touch/button press through set_area(), so any |
| 35 |
* click happening outside that area is considered to be a first click of |
| 36 |
* its own. |
| 37 |
* |
| 38 |
* %GestureMultiPress is a subclass of GestureSingle. It can handle only one pressed |
| 39 |
* button at a time. If another button is pressed while one button is kept |
| 40 |
* pressed, the event sequence may be cancelled, and no signal_released() |
| 41 |
* may be emitted. To detect such a situation, connect to Gesture::signal_cancel(). |
| 42 |
* |
| 43 |
* @newin{3,14} |
| 44 |
* |
| 45 |
* @ingroup Gestures |
| 46 |
*/ |
| 47 |
class GTKMM_API GestureMultiPress : public GestureSingle |
| 48 |
{ |
| 49 |
_CLASS_GOBJECT(GestureMultiPress, GtkGestureMultiPress, GTK_GESTURE_MULTI_PRESS, GestureSingle, GtkGestureSingle, , , 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 single and multiple presses. |
| 58 |
*/ |
| 59 |
_WRAP_CTOR(GestureMultiPress(Widget& widget), gtk_gesture_multi_press_new) |
| 60 |
|
| 61 |
public: |
| 62 |
/** Creates a Gesture that recognizes single and multiple presses. |
| 63 |
* |
| 64 |
* @newin{3,14} |
| 65 |
* |
| 66 |
* @param widget Widget the gesture relates to. |
| 67 |
* @return A RefPtr to a new GestureMultiPress. |
| 68 |
*/ |
| 69 |
_WRAP_CREATE(Widget& widget) |
| 70 |
|
| 71 |
_WRAP_METHOD(bool get_area(Gdk::Rectangle& rect) const, gtk_gesture_multi_press_get_area) |
| 72 |
_WRAP_METHOD(void set_area(const Gdk::Rectangle& rect), gtk_gesture_multi_press_set_area) |
| 73 |
|
| 74 |
/** Resets the press area to an unrestricted state. |
| 75 |
* |
| 76 |
* @newin{3,14} |
| 77 |
*/ |
| 78 |
void unset_area(); |
| 79 |
|
| 80 |
// no_default_handler because GtkGestureMultiPressClass is private. |
| 81 |
_WRAP_SIGNAL(void pressed(int n_press, double x, double y), "pressed", no_default_handler) |
| 82 |
_WRAP_SIGNAL(void released(int n_press, double x, double y), "released", no_default_handler) |
| 83 |
_WRAP_SIGNAL(void stopped(), "stopped", no_default_handler) |
| 84 |
|
| 85 |
// GestureMultiPress has no properties |
| 86 |
}; |
| 87 |
|
| 88 |
} // namespace Gtk |