This is ZoomScrollView.m in view mode; [Download] [Up]
#import "ZoomScrollView.h"
@implementation ZoomScrollView
- changeZoom:sender
{
[self setScaleFactor: [[sender selectedCell] tag] / 100.0];
return self;
}
- initFrame:(const NXRect *)theFrame
{
[super initFrame: theFrame];
[self setBackgroundGray: NX_WHITE];
scaleFactor = 1.0;
return self;
}
- awakeFromNib
{
[self setVertScrollerRequired: YES];
[self setHorizScrollerRequired:YES];
[self setBorderType:NX_LINE];
/* The next 3 lines install the subview
* and set its size to be the same as
* the ScrollView's contentView.
*/
[self setDocView: subView];
[contentView getFrame: &originalContentViewFrame];
[subView setFrame: &originalContentViewFrame];
return self;
}
- setScaleFactor:(float)aFactor
{
if (scaleFactor != aFactor) {
float delta = aFactor/scaleFactor;
scaleFactor = aFactor;
[contentView scale: delta : delta];
}
return self;
}
- tile
{
NXRect scrollerRect, buttonRect;
[super tile];
/* The next line makes the zoomButton itself
* one of the zommScrollView's subviews the
* first time that the tile message is sent.
*/
if ([zoomButton superview] != self) {
[self addSubview:zoomButton];
}
/* make the hScroller smaller and stick the
* pop-up list next to it.
*/
[hScroller getFrame: &scrollerRect];
NXDivideRect(&scrollerRect, &buttonRect, 60.0, 2);
[hScroller setFrame: &scrollerRect];
NXInsetRect(&buttonRect, 1.0, 1.0);
[zoomButton setFrame: &buttonRect];
return self;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.