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 (17 years, 9 months ago) by hyatt
Branches: MAIN
CVS tags: HEAD
New bookmark icon.  WOrking on the personal toolbar.

    1: //
    2: //  BookmarksToolbar.mm
    3: //  Chimera
    4: //
    5: //  Created by David Hyatt on Mon Apr 15 2002.
    6: //  Copyright (c) 2001 __MyCompanyName__. All rights reserved.
    7: //
    8: 
    9: #import "BookmarksButton.h"
   10: #import "BookmarksToolbar.h"
   11: #import "BookmarksService.h"
   12: 
   13: @implementation BookmarksToolbar
   14: 
   15: - (id)initWithFrame:(NSRect)frame {
   16:   self = [super initWithFrame:frame];
   17:   if (self) {
   18:     mBookmarks = nsnull;
   19:   }
   20: 
   21:   // Create a sample button.
   22: /*  BookmarksButton* testButton = [[[BookmarksButton alloc] initWithFrame: NSMakeRect(2, 1, 100, 17)] autorelease];
   23:   [testButton setTitle: @"Gamespot - Gaming Site"];
   24:   [self addSubview: testButton]; 
   25:   */
   26:   
   27:   return self;
   28: }
   29: 
   30: -(void)initializeToolbar
   31: {
   32:   // Initialization code here.
   33:   mBookmarks = new BookmarksService(self);
   34:   mBookmarks->AddObserver();
   35:   mBookmarks->ConstructBookmarksToolbar();
   36: }
   37: 
   38: -(void) dealloc
   39: {
   40:   mBookmarks->RemoveObserver();
   41:   delete mBookmarks;
   42:   [super dealloc];
   43: }
   44: 
   45: - (void)drawRect:(NSRect)aRect {
   46:   // Fill the background with our background color.
   47: //  [[NSColor colorWithCalibratedWhite: 0.98 alpha: 1.0] set];
   48: //  NSRectFill(aRect);
   49: 
   50:   //printf("The rect is: %f %f %f %f\n", aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height);
   51:   
   52:   if (aRect.origin.y + aRect.size.height ==
   53:       [self bounds].size.height) {
   54:     // The personal toolbar is 21 pixels tall.  The bottom two pixels
   55:     // are a separator.
   56:     [[NSColor colorWithCalibratedWhite: 0.92 alpha: 1.0] set];
   57:     NSRectFill(NSMakeRect(aRect.origin.x, aRect.origin.y, aRect.size.width, 2));
   58:   }
   59: 
   60:   // The buttons will paint themselves.
   61: }
   62: 
   63: @end

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