mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
make a textedit cell that leaves room for the proxy icon so that we
can use a regular NSTextField for the url bar. from nhamblen@mac.com (bug 198095)
This commit is contained in:
parent
46b563aa5e
commit
feee4cd410
@ -3,13 +3,13 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>263 57 653 383 0 0 1280 832 </string>
|
||||
<string>50 101 653 383 0 0 1024 746 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>124</key>
|
||||
<string>83 451 170 144 0 0 1280 832 </string>
|
||||
<key>160</key>
|
||||
<string>478 172 195 666 0 0 1152 848 </string>
|
||||
<string>602 52 195 666 0 0 1024 746 </string>
|
||||
<key>28</key>
|
||||
<string>542 342 195 457 0 0 1280 832 </string>
|
||||
<key>297</key>
|
||||
@ -23,16 +23,16 @@
|
||||
<key>463</key>
|
||||
<string>268 375 213 264 0 0 1280 832 </string>
|
||||
<key>56</key>
|
||||
<string>340 478 343 68 0 0 1024 746 </string>
|
||||
<string>355 485 314 64 0 0 1024 746 </string>
|
||||
<key>654</key>
|
||||
<string>159 629 198 144 0 0 1280 832 </string>
|
||||
<key>731</key>
|
||||
<string>185 277 654 459 0 0 1024 746 </string>
|
||||
<key>801</key>
|
||||
<string>418 480 188 64 0 0 1024 746 </string>
|
||||
<string>418 469 201 79 0 0 1024 746 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>291.0</string>
|
||||
<string>286.0</string>
|
||||
<key>IBGroupedObjects</key>
|
||||
<dict>
|
||||
<key>7</key>
|
||||
@ -45,7 +45,11 @@
|
||||
<string>8</string>
|
||||
<key>IBLockedObjects</key>
|
||||
<array/>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>56</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>6I32</string>
|
||||
<string>6L29</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
Binary file not shown.
@ -47,8 +47,34 @@ static const int kFrameMargin = 1;
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
//
|
||||
// AutoCompleteTextCell
|
||||
//
|
||||
// Text cell subclass used to make room for the proxy icon inside the textview
|
||||
//
|
||||
@interface AutoCompleteTextCell : NSTextFieldCell
|
||||
@end
|
||||
|
||||
@implementation AutoCompleteTextCell
|
||||
|
||||
- (NSRect)drawingRectForBounds:(NSRect)theRect
|
||||
{
|
||||
const float kProxIconOffset = 19.0;
|
||||
|
||||
theRect.origin.x += kProxIconOffset;
|
||||
theRect.size.width -= kProxIconOffset;
|
||||
return [super drawingRectForBounds:theRect];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
class AutoCompleteListener : public nsIAutoCompleteListener
|
||||
{
|
||||
public:
|
||||
@ -75,6 +101,8 @@ private:
|
||||
|
||||
NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||
|
||||
#pragma mark -
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@interface AutoCompleteTextField(Private)
|
||||
- (void)cleanup;
|
||||
@ -83,6 +111,27 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||
|
||||
@implementation AutoCompleteTextField
|
||||
|
||||
+ (Class) cellClass
|
||||
{
|
||||
return [AutoCompleteTextCell class];
|
||||
}
|
||||
|
||||
// This method shouldn't be necessary according to the docs. The superclass's
|
||||
// constructors should read in the cellClass and build a properly configured
|
||||
// instance on their own. Instead they ignore cellClass and build a NSTextFieldCell.
|
||||
- (id)initWithCoder:(NSCoder *)coder
|
||||
{
|
||||
[super initWithCoder:coder];
|
||||
AutoCompleteTextCell* cell = [[[AutoCompleteTextCell alloc] initTextCell:@""] autorelease];
|
||||
[cell setEditable:[self isEditable]];
|
||||
[cell setDrawsBackground:[self drawsBackground]];
|
||||
[cell setBordered:[self isBordered]];
|
||||
[cell setBezeled:[self isBezeled]];
|
||||
[cell setScrollable:YES];
|
||||
[self setCell:cell];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
NSTableColumn *column;
|
||||
@ -119,8 +168,15 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||
[mTableView setTarget:self];
|
||||
[mTableView setAction:@selector(onRowClicked:)];
|
||||
|
||||
// Create the icon column if we have a proxy icon
|
||||
// if we have a proxy icon
|
||||
if (mProxyIcon) {
|
||||
// place the proxy icon on top of this view so we can see it
|
||||
[mProxyIcon retain];
|
||||
[mProxyIcon removeFromSuperviewWithoutNeedingDisplay];
|
||||
[self addSubview:mProxyIcon];
|
||||
[mProxyIcon release];
|
||||
[mProxyIcon setFrameOrigin: NSMakePoint(3, 4)];
|
||||
// Create the icon column
|
||||
column = [[[NSTableColumn alloc] initWithIdentifier:@"icon"] autorelease];
|
||||
[column setWidth:[mProxyIcon frame].origin.x + [mProxyIcon frame].size.width];
|
||||
dataCell = [[[NSImageCell alloc] initImageCell:nil] autorelease];
|
||||
|
@ -772,8 +772,8 @@ static NSArray* sToolbarDefaults = nil;
|
||||
[toolbarItem setLabel:NSLocalizedString(@"Location", @"Location")];
|
||||
[toolbarItem setPaletteLabel:NSLocalizedString(@"Location", @"Location")];
|
||||
[toolbarItem setView:mLocationToolbarView];
|
||||
[toolbarItem setMinSize:NSMakeSize(128,20)];
|
||||
[toolbarItem setMaxSize:NSMakeSize(2560,32)];
|
||||
[toolbarItem setMinSize:NSMakeSize(128, NSHeight([mLocationToolbarView frame]))];
|
||||
[toolbarItem setMaxSize:NSMakeSize(2560, NSHeight([mLocationToolbarView frame]))];
|
||||
|
||||
[menuFormRep setTarget:self];
|
||||
[menuFormRep setAction:@selector(performAppropriateLocationAction)];
|
||||
|
Loading…
Reference in New Issue
Block a user