gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help adding horizontal scrolling to NSBrowser


From: Richard Frith-Macdonald
Subject: Re: Help adding horizontal scrolling to NSBrowser
Date: Thu, 11 Feb 2010 08:24:36 +0000

On 10 Feb 2010, at 21:38, Eric Wasylishen wrote:

> Hi,
> Yesterday I added support for horizontal scrolling to NSScrollView and X11 
> -back, which is a really nice improvement for people with trackpads or Apple 
> mice. 
> 
> I was trying to add support for this to NSBrowser, but it's a bit trickier. I 
> need the columns' scroll views to forward -scrollWheel: events with a 
> horizontal component up to the NSBrowser.  I think using a private 
> NSScrollView subclass for the columns is the only way to do this (for what 
> it's worth, Cocoa subclasses NSScrollView too).
> 
> Here is a patch that more or less works, but it won't interact properly with 
> nib/gorm saving and loading. In particular, when I save a .nib containing a 
> NSBrowser in Interface Builder, there are no NSScrollView's saved in the nib. 
> However, when I save a .nib containing a NSBrowser in GORM, the NSScrollViews 
> are saved. I guess I could change the class of the NSScrollView to 
> GSBrowserScrollView when loading the nib, but that seems a bit ugly. 
> 
> Any ideas how I should tackle this?

Greg will know about GORM and the way it handles NSBrowser, but from the point 
of view of archiving/unarchiving objects to/from nib the solution is probably 
to:
1. continue to support existing gorm files by retaining the existing decoding 
implementation, but
2. increment the class version, and use the class version to switch to a new 
path in encodeWithCoder: and initWithCoder: which doesn't store the scrollviews 
but (presumably regenerates them some way when decoding).
3. modify the keyed archiver support to match the behavior of Cocoa nibs while 
retaining backward compatibility (similar to the change for old style coding 
which was controlled by the class version, but in keyed archiving the behavior 
is controlled by the presence of the particular keyed values in the archive).

So, that's probably limited to changes to three NSBrowser methods:
+initialize (set the class version)
-encodeWithCoder: (for encoding)
-initWithCoder: (for decoding)

The tricky bit might be figuring out exactly how NSBrowser should generate its 
constituent scrollviews when it is decoded from an archive ... but perhaps 
that's just a case of extracting part of the code from main initialiser.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]