File:  [mozdev] / chimera / BookmarksButton.mm
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Wed Apr 17 08:31:11 2002 UTC (17 years, 1 month ago) by hyatt
Branches: MAIN
CVS tags: HEAD
Nearly have the personal toolbar going.

    1: //
    2: //  BookmarksButton.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: #include "nsIDOMElement.h"
   11: #include "nsString.h"
   12: 
   13: @implementation BookmarksButton
   14: 
   15: - (id)initWithFrame:(NSRect)frame {
   16:   self = [super initWithFrame:frame];
   17:   if (self) {
   18:     // Initialization code here.
   19:     mElement = nsnull;
   20:     [self setBezelStyle: NSRegularSquareBezelStyle];
   21:     [self setBordered: NO];
   22:     [self setImagePosition: NSImageLeft];
   23:     [self setRefusesFirstResponder: YES];
   24:     [self setFont: [NSFont labelFontOfSize: 11.0]];
   25:   }
   26:   return self;
   27: }
   28: 
   29: -(void)setElement: (nsIDOMElement*)aElt
   30: {
   31:   mElement = aElt;
   32:   nsAutoString tag;
   33:   mElement->GetLocalName(tag);
   34:   if (tag.Equals(NS_LITERAL_STRING("folder")))
   35:     [self setImage: [NSImage imageNamed: @"folder"]];
   36:   else
   37:     [self setImage: [NSImage imageNamed: @"smallbookmark"]];
   38: 
   39:   nsAutoString name;
   40:   mElement->GetAttribute(NS_LITERAL_STRING("name"), name);
   41:   [self setTitle: [NSString stringWithCharacters: name.get() length: nsCRT::strlen(name.get())]];
   42: }
   43: 
   44: @end

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