NSScrollView and NSInterfaceStyle updates

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4399 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-06-12 08:36:38 +00:00
parent 8c1c980464
commit e83e2f7d90
5 changed files with 112 additions and 26 deletions

View file

@ -1,8 +1,23 @@
Sat Jun 12 9:35:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSResponder.m: Update encoding/decoding for interface styles
* Model/GMAppKit.m: Update for interface styles
* Headers/AppKit/NSScrollView.h: Added MacOS-X methods -
setHorizontalLineScroll, setVerticalLineScroll,
setHorizontalPageScroll, setVerticalPageScroll
horizontalLineScroll, verticalLineScroll,
horizontalPageScroll, verticalPageScroll
* Source/NSScrollView.m: Added new MacOS-X methods -
setHorizontalLineScroll, setVerticalLineScroll,
setHorizontalPageScroll, setVerticalPageScroll
horizontalLineScroll, verticalLineScroll,
horizontalPageScroll, verticalPageScroll
Fri Jun 11 8:35:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk> Fri Jun 11 8:35:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* NSScroller.m: Fixed bug in recognising page-scrolls - now sets the * Source/NSScroller.m: Fixed bug in recognising page-scrolls -
NSINcrementPage and NSDecrementPage correctly. now sets the NSIncrementPage and NSDecrementPage correctly.
* NSScxrollView.m: Fixed bug in scrolling by page - now uses the * Source/NSScrollView.m: Fixed bug in scrolling by page - now uses the
page size as the context to retain, as it should. page size as the context to retain, as it should.
Thu Jun 10 22:25:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk> Thu Jun 10 22:25:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>

View file

@ -44,8 +44,10 @@
NSScroller* _vertScroller; NSScroller* _vertScroller;
NSRulerView* _horizRuler; NSRulerView* _horizRuler;
NSRulerView* _vertRuler; NSRulerView* _vertRuler;
float _lineScroll; float _hLineScroll;
float _pageScroll; float _hPageScroll;
float _vLineScroll;
float _vPageScroll;
NSBorderType _borderType; NSBorderType _borderType;
BOOL _hasHorizScroller; BOOL _hasHorizScroller;
BOOL _hasVertScroller; BOOL _hasVertScroller;
@ -115,6 +117,16 @@
- (float)pageScroll; - (float)pageScroll;
- (void)setScrollsDynamically:(BOOL)flag; - (void)setScrollsDynamically:(BOOL)flag;
- (BOOL)scrollsDynamically; - (BOOL)scrollsDynamically;
#ifndef STRICT_OPENSTEP
- (float) horizontalLineScroll;
- (float) horizontalPageScroll;
- (float) verticalLineScroll;
- (float) verticalPageScroll;
- (void) setHorizontalLineScroll: (float)aFloat;
- (void) setHorizontalPageScroll: (float)aFloat;
- (void) setVerticalLineScroll: (float)aFloat;
- (void) setVerticalPageScroll: (float)aFloat;
#endif
/* Updating display after scrolling */ /* Updating display after scrolling */
- (void)reflectScrolledClipView:(NSClipView*)aClipView; - (void)reflectScrolledClipView:(NSClipView*)aClipView;

View file

@ -850,11 +850,18 @@ void __dummy_GMAppKit_functionForLinking() {}
if ((nextResponder = [self nextResponder])) if ((nextResponder = [self nextResponder]))
[archiver encodeObject:nextResponder withName:@"nextResponder"]; [archiver encodeObject:nextResponder withName:@"nextResponder"];
if ([self respondsToSelector: @selector(interfaceStyle)])
[archiver encodeUnsignedInt: [self interfaceStyle]
withName:@"interfaceStyle"];
} }
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver - (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
{ {
[self setNextResponder:[unarchiver decodeObjectWithName:@"nextResponder"]]; [self setNextResponder:[unarchiver decodeObjectWithName:@"nextResponder"]];
if ([self respondsToSelector: @selector(setInterfaceStyle:)])
[self setInterfaceStyle:
[unarchiver decodeUnsignedIntWithName:@"interfaceStyle"]];
return self; return self;
} }

View file

@ -240,11 +240,15 @@
- (void) encodeWithCoder: (NSCoder*)aCoder - (void) encodeWithCoder: (NSCoder*)aCoder
{ {
[aCoder encodeConditionalObject: next_responder]; [aCoder encodeConditionalObject: next_responder];
[aCoder encodeValueOfObjCType: @encode(NSInterfaceStyle)
at: &interface_style];
} }
- (id) initWithCoder: (NSCoder*)aDecoder - (id) initWithCoder: (NSCoder*)aDecoder
{ {
next_responder = [aDecoder decodeObject]; next_responder = [aDecoder decodeObject];
[aDecoder decodeValueOfObjCType: @encode(NSInterfaceStyle)
at: &interface_style];
return self; return self;
} }

View file

@ -30,6 +30,7 @@
#include <gnustep/gui/config.h> #include <gnustep/gui/config.h>
#include <math.h> #include <math.h>
#include <Foundation/NSException.h>
#include <AppKit/NSScroller.h> #include <AppKit/NSScroller.h>
#include <AppKit/NSClipView.h> #include <AppKit/NSClipView.h>
#include <AppKit/NSScrollView.h> #include <AppKit/NSScrollView.h>
@ -158,8 +159,10 @@ static Class rulerViewClass = nil;
{ {
[super initWithFrame: rect]; [super initWithFrame: rect];
[self setContentView: AUTORELEASE([NSClipView new])]; [self setContentView: AUTORELEASE([NSClipView new])];
_lineScroll = 10; _hLineScroll = 10;
_pageScroll = 10; _hPageScroll = 10;
_vLineScroll = 10;
_vPageScroll = 10;
_borderType = NSBezelBorder; _borderType = NSBezelBorder;
_scrollsDynamically = YES; _scrollsDynamically = YES;
[self tile]; [self tile];
@ -296,33 +299,31 @@ static Class rulerViewClass = nil;
{ {
if (hitPart == NSScrollerIncrementLine) if (hitPart == NSScrollerIncrementLine)
{ {
amount = _lineScroll; if (scroller == _horizScroller)
amount = _hLineScroll;
else
amount = _vLineScroll;
} }
else if (hitPart == NSScrollerDecrementLine) else if (hitPart == NSScrollerDecrementLine)
{ {
amount = -_lineScroll; if (scroller == _horizScroller)
amount = -_hLineScroll;
else
amount = -_vLineScroll;
} }
else if (hitPart == NSScrollerIncrementPage) else if (hitPart == NSScrollerIncrementPage)
{ {
if (scroller == _horizScroller) if (scroller == _horizScroller)
{ amount = clipViewBounds.size.width - _hPageScroll;
amount = clipViewBounds.size.width - _pageScroll;
}
else else
{ amount = clipViewBounds.size.height - _vPageScroll;
amount = clipViewBounds.size.height - _pageScroll;
}
} }
else if (hitPart == NSScrollerDecrementPage) else if (hitPart == NSScrollerDecrementPage)
{ {
if (scroller == _horizScroller) if (scroller == _horizScroller)
{ amount = _hPageScroll - clipViewBounds.size.width;
amount = _pageScroll - clipViewBounds.size.width;
}
else else
{ amount = _vPageScroll - clipViewBounds.size.height;
amount = _pageScroll - clipViewBounds.size.height;
}
} }
else else
{ {
@ -367,7 +368,6 @@ static Class rulerViewClass = nil;
} }
[_contentView scrollToPoint: point]; [_contentView scrollToPoint: point];
[window update];
} }
- (void) reflectScrolledClipView: (NSClipView*)aClipView - (void) reflectScrolledClipView: (NSClipView*)aClipView
@ -690,22 +690,70 @@ static Class rulerViewClass = nil;
- (void) setLineScroll: (float)aFloat - (void) setLineScroll: (float)aFloat
{ {
_lineScroll = aFloat; _hLineScroll = aFloat;
_vLineScroll = aFloat;
}
- (void) setHorizontalLineScroll: (float)aFloat
{
_hLineScroll = aFloat;
}
- (void) setVerticalLineScroll: (float)aFloat
{
_vLineScroll = aFloat;
} }
- (float) lineScroll - (float) lineScroll
{ {
return _lineScroll; if (_hLineScroll != _vLineScroll)
[NSException raise: NSInternalInconsistencyException
format: @"horizontal and vertical values not same"];
return _vLineScroll;
}
- (float) horizontalLineScroll
{
return _hLineScroll;
}
- (float) verticalLineScroll
{
return _vLineScroll;
} }
- (void) setPageScroll: (float)aFloat - (void) setPageScroll: (float)aFloat
{ {
_pageScroll = aFloat; _hPageScroll = aFloat;
_vPageScroll = aFloat;
}
- (void) setHorizontalPageScroll: (float)aFloat
{
_hPageScroll = aFloat;
}
- (void) setVerticalPageScroll: (float)aFloat
{
_vPageScroll = aFloat;
} }
- (float) pageScroll - (float) pageScroll
{ {
return _pageScroll; if (_hPageScroll != _vPageScroll)
[NSException raise: NSInternalInconsistencyException
format: @"horizontal and vertical values not same"];
return _vPageScroll;
}
- (float) horizontalPageScroll
{
return _hPageScroll;
}
- (float) verticalPageScroll
{
return _vPageScroll;
} }
- (void) setScrollsDynamically: (BOOL)flag - (void) setScrollsDynamically: (BOOL)flag