File:  [mozdev] / chimera / BookmarksToolbar.mm
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Tue Apr 16 07:26:07 2002 UTC (17 years, 9 months ago) by hyatt
Branches: MAIN
CVS tags: HEAD
Playing around with the bookmarks bar.

    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: 
   12: @implementation BookmarksToolbar
   13: 
   14: - (id)initWithFrame:(NSRect)frame {
   15:   self = [super initWithFrame:frame];
   16:   if (self) {
   17:     // Initialization code here.
   18:   }
   19: 
   20:   // Create a sample button.
   21:   BookmarksButton* testButton = [[[BookmarksButton alloc] initWithFrame: NSMakeRect(2, 1, 100, 17)] autorelease];
   22:   [testButton setTitle: @"Gamespot - Gaming Site"];
   23:   [self addSubview: testButton]; 
   24:   
   25:   return self;
   26: }
   27: 
   28: - (void)drawRect:(NSRect)aRect {
   29:   // Fill the background with our background color.
   30: //  [[NSColor colorWithCalibratedWhite: 0.98 alpha: 1.0] set];
   31: //  NSRectFill(aRect);
   32: 
   33:   //printf("The rect is: %f %f %f %f\n", aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height);
   34:   
   35:   if (aRect.origin.y + aRect.size.height ==
   36:       [self bounds].size.height) {
   37:     // The personal toolbar is 21 pixels tall.  The bottom two pixels
   38:     // are a separator.
   39:     [[NSColor colorWithCalibratedWhite: 0.92 alpha: 1.0] set];
   40:     NSRectFill(NSMakeRect(aRect.origin.x, aRect.origin.y, aRect.size.width, 2));
   41:   }
   42: 
   43:   // The buttons will paint themselves.
   44: }
   45: 
   46: @end

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