Annotation of chimera/BookmarksToolbar.mm, revision 1.3

1.1       hyatt       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: 
1.2       hyatt       9: #import "BookmarksButton.h"
1.1       hyatt      10: #import "BookmarksToolbar.h"
1.3     ! hyatt      11: #import "BookmarksService.h"
1.1       hyatt      12: 
                     13: @implementation BookmarksToolbar
                     14: 
                     15: - (id)initWithFrame:(NSRect)frame {
                     16:   self = [super initWithFrame:frame];
                     17:   if (self) {
1.3     ! hyatt      18:     mBookmarks = nsnull;
1.1       hyatt      19:   }
1.2       hyatt      20: 
                     21:   // Create a sample button.
1.3     ! hyatt      22: /*  BookmarksButton* testButton = [[[BookmarksButton alloc] initWithFrame: NSMakeRect(2, 1, 100, 17)] autorelease];
1.2       hyatt      23:   [testButton setTitle: @"Gamespot - Gaming Site"];
                     24:   [self addSubview: testButton]; 
1.3     ! hyatt      25:   */
1.2       hyatt      26:   
1.1       hyatt      27:   return self;
1.3     ! hyatt      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];
1.1       hyatt      43: }
                     44: 
                     45: - (void)drawRect:(NSRect)aRect {
                     46:   // Fill the background with our background color.
1.2       hyatt      47: //  [[NSColor colorWithCalibratedWhite: 0.98 alpha: 1.0] set];
                     48: //  NSRectFill(aRect);
1.1       hyatt      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: 
1.2       hyatt      60:   // The buttons will paint themselves.
1.1       hyatt      61: }
                     62: 
                     63: @end

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