Re: Call for SplitView suggestions
Re: Call for SplitView suggestions
- Subject: Re: Call for SplitView suggestions
- From: Shaun Wexler <email@hidden>
- Date: Sat, 25 Sep 2004 19:34:46 -0700
On Sep 24, 2004, at 6:07 PM, Rainer Brockerhoff wrote:
Folks,
After somewhat over a week of trying to make NSSplitView do what I
want it to do, I gave up. I'm redoing it from scratch. I'll also be
doing a custom IB palette for it as it's something I've always wanted
to learn.
So far, high priority on my list of things to do:
- Strict obeyance of size limits on the subviews
- Programmatical collapsing/expanding
- Collapsing/expanding by double-clicking on the divider
- Easy fixed-size subviews
If anybody has other requirements, please send them in; perhaps
privately would be better. I'll be publishing the source code
afterwards if all goes well.
I've also recently had to use NSSplitView again, and decided to do the
same. Since its sole ivar is a private data struct, I'm probably
duplicating some existing info, but I have it maintain an additional
array of 32-byte structs:
typedef struct SKWSplitViewSplit {
NSView *view;
float percentage;
float preferredPercentage;
float preferredSize;
float minSize;
float maxSize;
float resizeIncrement;
BOOL dividerVisible;
BOOL canCollapse;
BOOL userCollapsed;
BOOL constraintCollapsed;
} SKWSplitViewSplit;
@interface SKWSplitView : NSSplitView
{
SKWSplitViewSplit *splits;
}
I cache the view pointer in each struct for faster access rather than
hammering NSArray. For my needs, I also wanted the ability to have
panes which weren't resizable, such as for NSTextField labels above
NSTableViews. I also decided to add an option-key "venetian blind"
resizing behavior so that one divider can collapse any number of
adjacent subviews, depending on their constraints. If a pane collapses
itself due to constraint during window live resize, it will pop back
open when space is available. If a user drags to collapse a pane, it
stays closed. I allow double-click to snap open panes, but haven't
decided how to handle collapsing them (ie which direction?!!).
There's also a focus ring bug workaround (unfiled). Normally if you
allow a subview pane to collapse and it happens to be first responder
with a focus ring, the ring is not erased. My workaround is to
validate subview collapsibility by testing them and their descendants
for firstResponder status before beginning a resize. Otherwise I allow
all subviews to be collapsed if they have constraints set.
I did away with the standard delegation, and only implement one
delegate method:
- (void)splitView:(SKWSplitView *)splitView
updateSplits:(SKWSplitViewSplit *)splits count:(UInt32)count;
which is called once initially, and whenever views are added or
removed, requesting that the delegate configure all subview properties.
Otherwise the split properties can be set manually.
--
Shaun Wexler
MacFOH
http://www.macfoh.com
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden