This is PXKClipView.m in view mode; [Download] [Up]
/* PXKClipView.m NSClipView 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/PXKClipView.h> #include <gnustep/xdps/PXKScrollView.h> #include <gnustep/xdps/PXKView.h> @implementation PXKClipView - setXRelativePosition:(float)x; { NSRect r = [(PXKView *)[sub_views objectAtIndex:0] frame]; // fprintf(stdout, "x: %1.3f\n", x); r.origin.x = 0.0-((int)(((float)(r.size.width - frame.size.width)) * x)); if (r.origin.x > 0) { r.origin.x = 0; } // [[sub_views objectAtIndex:0] moveTo:r.origin.x :r.origin.y]; // fprintf(stdout , "ClipView: moveTo: %d %d\n", r.origin.x, r.origin.y); return self; } - setYRelativePosition:(float)y; { NSRect r = [(PXKView *)[sub_views objectAtIndex:0] frame]; // fprintf(stdout, "Y: %1.3f\n", y); r.origin.y = 0.0-((int)(((float)(r.size.height -frame.size.height))*y)); if (r.origin.y > 0) { r.origin.y = 0; } // [[sub_views objectAtIndex:0] moveTo:r.origin.x :r.origin.y]; // fprintf(stdout , "ClipView: moveTo: %d %d\n", r.origin.x, r.origin.y); return self; } - setView:(NSView *)aView; { if ([sub_views count] > 0) { [sub_views replaceObjectAtIndex:0 withObject:aView]; } else { [sub_views addObject:aView]; } [(PXKScrollView *)super_view updateScrollers]; return self; } - (NSView *)view; { if ([sub_views count] > 0) { return [sub_views objectAtIndex:0]; } else { return nil; } } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.