Skip to content
60 changes: 54 additions & 6 deletions Headers/AppKit/NSClickGestureRecognizer.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/* Definition of class NSClickGestureRecognizer
Copyright (C) 2019 Free Software Foundation, Inc.

By: Gregory John Casamento
Date: Thu Dec 5 12:54:21 EST 2019

This file is part of the GNUstep Library.

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 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; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/

Expand All @@ -37,6 +37,54 @@ extern "C" {

APPKIT_EXPORT_CLASS
@interface NSClickGestureRecognizer : NSGestureRecognizer
{
/** The mouse button mask that triggers this gesture (default: left mouse button) */
NSUInteger _buttonMask;
/** The number of clicks required to trigger this gesture (default: 1) */
NSUInteger _numberOfClicksRequired;
/** The number of touches required for the gesture (default: 1) */
NSUInteger _numberOfTouchesRequired;
}

/**
* Returns the mouse button mask that triggers this gesture.
* The default value is 1 (left mouse button).
* Returns: The mouse button mask for this gesture
*/
- (NSUInteger)buttonMask;

/**
* Sets the mouse button mask that triggers this gesture.
* Use NSLeftMouseDownMask, NSRightMouseDownMask, etc.
* mask: The mouse button mask to set
*/
- (void)setButtonMask:(NSUInteger)mask;

/**
* Returns the number of clicks required to trigger this gesture.
* The default value is 1 (single click).
* Returns: The number of clicks required
*/
- (NSUInteger)numberOfClicksRequired;

/**
* Sets the number of clicks required to trigger this gesture.
* clicks: The number of clicks required (must be >= 1)
*/
- (void)setNumberOfClicksRequired:(NSUInteger)clicks;

/**
* Returns the number of touches required for this gesture.
* The default value is 1.
* Returns: The number of touches required
*/
- (NSUInteger)numberOfTouchesRequired;

/**
* Sets the number of touches required for this gesture.
* touches: The number of touches required (must be >= 1)
*/
- (void)setNumberOfTouchesRequired:(NSUInteger)touches;

@end

Expand Down
17 changes: 16 additions & 1 deletion Headers/AppKit/NSEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ APPKIT_EXPORT_CLASS
CGFloat deltaY;
/** Z-axis scroll delta for 3D scroll devices */
CGFloat deltaZ;
/** Magnification factor for gesture events */
CGFloat magnification;
} mouse;
/** Keyboard event data including characters and key codes */
struct
Expand Down Expand Up @@ -588,6 +590,7 @@ APPKIT_EXPORT_CLASS
* deltaX: Horizontal scroll delta for scroll events
* deltaY: Vertical scroll delta for scroll events
* deltaZ: Z-axis scroll delta for 3D scroll devices
* magnificationValue: Magnification factor for gesture events
* Returns: A new NSEvent object with extended mouse information
*/
+ (NSEvent*) mouseEventWithType: (NSEventType)type
Expand All @@ -602,7 +605,8 @@ APPKIT_EXPORT_CLASS
buttonNumber: (NSInteger)buttonNum
deltaX: (CGFloat)deltaX
deltaY: (CGFloat)deltaY
deltaZ: (CGFloat)deltaZ;
deltaZ: (CGFloat)deltaZ
magnification: (CGFloat)magnificationValue;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly we actually use this method in the MS Windows backend. Changing it here without a change there will break things. The best way to process would be to add a new method here with the additional argument, add that argument to all the backend code that uses the old method and after the next GNUstep release, remove the old method without that argument.

#endif

/**
Expand Down Expand Up @@ -756,6 +760,17 @@ APPKIT_EXPORT_CLASS
* Returns: The z-axis scroll distance for this scroll event
*/
- (CGFloat)deltaZ;

/**
* Returns the magnification factor for gesture events.
* For trackpad pinch/zoom gestures, this indicates the magnification
* change requested by the user. Positive values indicate zoom-in
* (magnification increase) while negative values indicate zoom-out
* (magnification decrease). The magnitude represents the relative
* change in scale factor for the gesture.
* Returns: The magnification factor for this gesture event
*/
- (CGFloat)magnification;
#endif
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
/**
Expand Down
Loading