File:  [mozdev] / chimera / BookmarksToolbar.mm
Revision 1.3: download - view: text, annotated - select for diffs - revision graph
Wed Apr 17 07:38:31 2002 UTC (15 years, 7 months ago) by hyatt
Branches: MAIN
CVS tags: HEAD
New bookmark icon.  WOrking on the personal toolbar.

//
//  BookmarksToolbar.mm
//  Chimera
//
//  Created by David Hyatt on Mon Apr 15 2002.
//  Copyright (c) 2001 __MyCompanyName__. All rights reserved.
//

#import "BookmarksButton.h"
#import "BookmarksToolbar.h"
#import "BookmarksService.h"

@implementation BookmarksToolbar

- (id)initWithFrame:(NSRect)frame {
  self = [super initWithFrame:frame];
  if (self) {
    mBookmarks = nsnull;
  }

  // Create a sample button.
/*  BookmarksButton* testButton = [[[BookmarksButton alloc] initWithFrame: NSMakeRect(2, 1, 100, 17)] autorelease];
  [testButton setTitle: @"Gamespot - Gaming Site"];
  [self addSubview: testButton]; 
  */
  
  return self;
}

-(void)initializeToolbar
{
  // Initialization code here.
  mBookmarks = new BookmarksService(self);
  mBookmarks->AddObserver();
  mBookmarks->ConstructBookmarksToolbar();
}

-(void) dealloc
{
  mBookmarks->RemoveObserver();
  delete mBookmarks;
  [super dealloc];
}

- (void)drawRect:(NSRect)aRect {
  // Fill the background with our background color.
//  [[NSColor colorWithCalibratedWhite: 0.98 alpha: 1.0] set];
//  NSRectFill(aRect);

  //printf("The rect is: %f %f %f %f\n", aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height);
  
  if (aRect.origin.y + aRect.size.height ==
      [self bounds].size.height) {
    // The personal toolbar is 21 pixels tall.  The bottom two pixels
    // are a separator.
    [[NSColor colorWithCalibratedWhite: 0.92 alpha: 1.0] set];
    NSRectFill(NSMakeRect(aRect.origin.x, aRect.origin.y, aRect.size.width, 2));
  }

  // The buttons will paint themselves.
}

@end

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>