This is PXKButton.m in view mode; [Download] [Up]
/*
PXKButton.m
NSButton for GNUstep GUI X/DPS Backend
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Pascal Forget <pascal@wsc.com>
Date: October 1995
This file is part of the GNUstep GUI X/DPS Backend.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library 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
Library General Public License for more details.
If you are interested in a warranty or support for this source code,
contact Scott Christley <scottc@net-community.com> for more information.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gnustep/xdps/PXKButton.h>
#include <gnustep/xdps/PXKApplication.h>
@implementation PXKButton
#if 0
- mouseDown:(XEvent *)e;
{
// fprintf(stdout, "mouse down\n");
// if (type == PXK_TOGGLE_MODE) {
if (NO) {
// fprintf(stdout, "PXKButton mouseDown: (toggle mode)\n");
[self toggleState];
[self sendAction];
} else {
// fprintf(stdout, "PXKButton mouseDown: (!toggle mode)\n");
state = 1;
}
[self display];
return self;
}
- mouseDragged:(XEvent *)e;
{
XEvent event = *e;
PXKPoint location;
Window root, child;
int root_x, root_y, pos_x, pos_y;
unsigned int keys_buttons;
location.x = event.xmotion.x;
location.y = event.xmotion.y;
while (1) {
XNextEvent(pxkDisplay, &event);
if (event.type == MotionNotify) {
#if 0
puts("Button: got a mouse drag event.");
location.x = event.xmotion.x;
location.y = event.xmotion.y;
if (!XQueryPointer(pxkDisplay, event.xmotion.window,
&root, &child, &root_x, &root_y, &pos_x,
&pos_y, &keys_buttons))
/* pointer is on other screen */
break;
if (child == [superview xWindow]) {
location.x = pos_x;
location.y = pos_y;
} else {
location.x = pos_x + frame.origin.x;
location.y = pos_y + frame.origin.y;
}
printf("x: %i y: %i\n", location.x, location.y);
[self moveTo:location.x :location.y];
[self display];
#endif
continue;
} else if (event.type == ButtonRelease) {
[self mouseUp:&event];
}
break;
}
return self;
}
- mouseUp:(XEvent *)e;
{
// fprintf(stdout, "mouse up\n");
// if (type == PXK_MOMENTARY_PUSH_MODE) {
if (YES) {
//fprintf(stdout, "PXKButton mouseUp: (momentary push mode)\n");
state = 0;
[self display];
[self sendAction];
}
return self;
}
#endif
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.