ftp.nice.ch/pub/next/developer/languages/smalltalk/squeak-2.0-0.3d109.NIHS.bs.tar.gz#/squeak-2.0/nextstep/SqButton.h

This is SqButton.h in view mode; [Download] [Up]

/******************************************************************************
FILE
    SqButton.h
DESCRIPTION
	NeXTstep user Interface for Squeak.
	This class reifies a Smalltalk mouse button.
AUTHOR
	<PJB> Pascal J. Bourguignon
MODIFICATIONS
	1998/06/25 <PJB> Creation .
LEGAL
	Copyright Pascal J. Bourguignon 1998 - 1998

	This program is free software; you can redistribute it and/or
	modify it under the terms of the version 2 of the GNU General Public 
	License as published by the Free Software Foundation.
	
	This program 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 General Public License 
	hereafter for more details.
******************************************************************************/
#import <appkit/appkit.h>


enum {
	SqButton_LeftMouseEventFlag=0x8000,
	SqButton_RightMouseEventFlag=0x4000
};

@interface SqButton:Object
{
	int                 flags;
	int                 mask;
	char                configuration[8];
	SqButton*           nextButton;
}

	-(id)init;
	-(id)free;
	
	-(void)setNextButton:(SqButton*)next;
		/*
			To discriminate between buttons on the smallest set of bits
			(thus allowing modified-clicks), buttons needs to know each 
			others to compute a minimal mask of signficant bits. Just
			circular-chain them, they'll team up.
		*/
	
	-(BOOL)needsLeftMouse;
	-(BOOL)needsRightMouse;
	-(BOOL)needsCommand;
	-(BOOL)needsAlternate;
	-(BOOL)needsControl;
	-(BOOL)needsShift;

	-(void)setNeedsLeftMouse:(BOOL)bit;
	-(void)setNeedsRightMouse:(BOOL)bit;
	-(void)setNeedsCommand:(BOOL)bit;
	-(void)setNeedsAlternate:(BOOL)bit;
	-(void)setNeedsControl:(BOOL)bit;
	-(void)setNeedsShift:(BOOL)bit;

	-(BOOL)isPressedWhen:(int)eventFlags;
		/*
			eventFlags = event->flags | SqButton_LeftMouseEventFlag 
			                          | SqButton_RightMouseEventFlag.
		*/
	
	-(void)configureMatrix:(Matrix*)matrix;
	-(void)takeFromMatrix:(Matrix*)matrix;
		/*
			OK, I know it's not MVC, but it's quick-and-dirty easier this way.
			The matrix should contain tagged switches:
				0 = Left Mouse
				1 = Right Mouse
				2 = Command
				3 = Alternate
				4 = Control
				5 = Shift
		*/

	-(const char*)stringConfiguration;
		/*
			RETURN: a string that may be used to store the configuration 
					of the button in the default. The string is a set of 
					characters indicating the needed flags.
						l = left mouse
						r = right mouse
						m = command
						a = alternate 
						c = control
						s = shift
		*/
	-(void)takeFromString:(const char*)string;
		/*
			DO:		Configure itself with the bits indicated by the string
					(see stringConfiguration for the encoding).
		*/

@end // SqButton.

/*** SqButton.h / Thu Aug 27 23:20:15 MET 1998 / PJB ***/

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.