2
* Copyright (C) 2004 Stefan Kleine Stegemann
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
#include <AppKit/NSEvent.h>
20
#include <AppKit/NSWindow.h>
26
@interface FindView (Private)
27
- (void) _centerVerticallyInView: (NSView*)aView;
31
@implementation FindView
33
- (id) initWithFrame: (NSRect)aFrame
35
if ((self = [super initWithFrame: aFrame]))
37
[self setAutoresizesSubviews: NO];
39
text = [[NSTextField alloc] init];
40
[text setFrame: NSMakeRect(5, 0, 200, 24)];
41
[self _centerVerticallyInView: text];
42
[self addSubview: text];
45
NSLog(@"DEBUG %@", [[text nextResponder] description]);
60
[[text window] makeFirstResponder: text];
72
/* ----------------------------------------------------- */
73
/* Category Private */
74
/* ----------------------------------------------------- */
76
@implementation FindView (Private)
79
* Center a view vertically in this view.
81
- (void) _centerVerticallyInView: (NSView*)aView
85
newFrame = NSMakeRect(NSMinX([aView frame]),
86
(NSHeight([self frame]) / 2) - (NSHeight([aView frame]) / 2),
87
NSWidth([aView frame]),
88
NSHeight([aView frame]));
90
[aView setFrame: newFrame];