2 Copyright (C) 2004 Marcus Mueller <znek@mulle-kybernetik.com>
4 This file is part of OGo
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 // $Id: SOPEXBrowserWindow.m 1 2004-08-20 11:17:52Z znek $
22 // Created by znek on Mon Mar 22 2004.
25 #import "SOPEXBrowserWindow.h"
28 #define USE_NSTheme_PRIVATE_API 0
31 #if USE_NSTheme_PRIVATE_API
32 @interface NSView (NSTheme_PrivateAPI_We_Know_Exists)
33 - (void)addFileButton:(id)fp8;
38 @implementation NSImageView (HACQUE_alert)
39 - (NSString *)representedFilename
47 @interface SOPEXBrowserWindow (PrivateAPI)
48 - (NSView *)borderView;
49 - (NSRect)favIconFrameForTitle:(NSString *)_title;
53 @implementation SOPEXBrowserWindow
58 [self->favIconView release];
63 - (NSView *)borderView
65 return self->_borderView;
68 #if !USE_NSTheme_PRIVATE_API
69 - (NSRect)favIconFrameForTitle:(NSString *)_title
72 NSRect frame, bvFrame;
75 attrs = [NSDictionary dictionaryWithObjectsAndKeys:[NSFont systemFontOfSize:[NSFont systemFontSize]], NSFontAttributeName, nil];
76 textWidth = [_title sizeWithAttributes:attrs].width;
77 bvFrame = [[self borderView] frame];
78 frame = NSMakeRect((NSMidX(bvFrame) - (textWidth / 2.0)) - 24, NSHeight(bvFrame) - 19, 16, 16);
83 - (void)setFavIcon:(NSImage *)_favIcon
86 if(self->favIconView == nil)
88 #if !USE_NSTheme_PRIVATE_API
89 self->favIconView = [[NSImageView alloc] initWithFrame:[self favIconFrameForTitle:[self title]]];
90 [self->favIconView setAutoresizingMask:(NSViewMinYMargin | NSViewMinXMargin | NSViewMaxXMargin)];
92 self->favIconView = [[self borderView] newFileButton];
93 [self->favIconView retain];
96 #if !USE_NSTheme_PRIVATE_API
97 [[self borderView] addSubview:self->favIconView];
99 [[self borderView] addFileButton:self->favIconView];
101 [self->favIconView release];
103 [self->favIconView setImage:_favIcon];
107 #if !USE_NSTheme_PRIVATE_API
108 - (void)setTitle:(NSString *)_title
110 if(self->favIconView != nil)
112 [self->favIconView setFrame:[self favIconFrameForTitle:_title]];
113 [[self borderView] setNeedsDisplay:YES];
115 [super setTitle:_title];