
The whole Cocoa concept of bindings still eludes me however. I simply have not been able to use them at all in this project, meaning that I've had to develop everything with pages of old style glue code to stick the user interface and data objects together. It's very frustrating, but for now I'm going to have to live with it. Most of the maintenance type UI is now done so I shouldn't need to do much more of this.
/* ***************************************************************/
/* objectFrameInDrawer. */
/* Finds the visible height and width of the furtherest objects */
/* in the drawer. Used to setup the size of the drawer when the */
/* content view gets changed */
/* ***************************************************************/
-(NSSize)objectFrameInDrawer
{
id view;
NSEnumerator *viewEnumerator;
float width = 0.0, height = 0.0;
NSSize returnSize;
viewEnumerator = [[[entryDrawer contentView] subviews] objectEnumerator];
while(view=[viewEnumerator nextObject]) {
if(([view frame].origin.y + [view frame].size.height)>height)
height = [view frame].origin.y + [view frame].size.height;
if(([view frame].origin.x + [view frame].size.width)>width)
width = [view frame].origin.x + [view frame].size.width;
}
returnSize.height = height;
returnSize.width = width;
return returnSize;
}
-(void)alignDrawer
{
float defaultMargin = 50.00;
[entryDrawer setLeadingOffset:([window frame].size.height - drawerBounds.height - [entryDrawer trailingOffset])- defaultMargin];
}
/* **********************************************************************************/
/* objectFrameInDrawer. */
/* Before the drawer is opened determine the size of the view inside of the drawer */
/* set the minimum size and the size of the content view to this determined size */
/* and align the drawer vertically along the window */
/* **********************************************************************************/
-(void)drawerWillOpen:(NSNotification *)notification
{
drawerBounds = [self objectFrameInDrawer];
[entryDrawer setContentSize:drawerBounds];
[entryDrawer setMinContentSize:drawerBounds];
[self alignDrawer];
}
-(void)windowDidResize:(NSNotification *)notification
{
[self alignDrawer];
}