Annotation of chimera/BookmarksButton.mm, revision 1.2

1.1       hyatt       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"
1.2     ! hyatt      10: #include "nsIDOMElement.h"
        !            11: #include "nsString.h"
1.1       hyatt      12: 
                     13: @implementation BookmarksButton
                     14: 
                     15: - (id)initWithFrame:(NSRect)frame {
                     16:   self = [super initWithFrame:frame];
                     17:   if (self) {
                     18:     // Initialization code here.
1.2     ! hyatt      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]];
1.1       hyatt      25:   }
1.2     ! hyatt      26:   return self;
        !            27: }
1.1       hyatt      28: 
1.2     ! hyatt      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"]];
1.1       hyatt      38: 
1.2     ! hyatt      39:   nsAutoString name;
        !            40:   mElement->GetAttribute(NS_LITERAL_STRING("name"), name);
        !            41:   [self setTitle: [NSString stringWithCharacters: name.get() length: nsCRT::strlen(name.get())]];
1.1       hyatt      42: }
                     43: 
                     44: @end

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