/* ** ItemPanel.m ** ** Copyright (c) 2003 ** ** Author: Yen-Ju Chen ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ItemPanel.h" #include @implementation ItemPanel - (void) layoutWindow { NSRect frame; NSTextField *nameLabel, *categoryLabel, *locationLabel, *bundleLabel; frame = NSMakeRect(10, 120, 83, 18); categoryLabel = [[NSTextField alloc] initWithFrame: frame]; [categoryLabel setStringValue: _(@"Category:")]; [categoryLabel setEditable: NO]; [categoryLabel setSelectable: NO]; [categoryLabel setBordered: NO]; [categoryLabel setBezeled: NO]; [categoryLabel setBackgroundColor: [NSColor controlBackgroundColor]]; [[self contentView] addSubview: categoryLabel]; RELEASE(categoryLabel); frame = NSMakeRect(102, 120, 302, 20); categoryButton = [[NSPopUpButton alloc] initWithFrame: frame pullsDown: NO]; [[self contentView] addSubview: categoryButton]; RELEASE(categoryButton); frame = NSMakeRect(10, 94, 83, 18); nameLabel = [[NSTextField alloc] initWithFrame: frame]; [nameLabel setStringValue: _(@"Name:")]; [nameLabel setEditable: NO]; [nameLabel setSelectable: NO]; [nameLabel setBordered: NO]; [nameLabel setBezeled: NO]; [nameLabel setBackgroundColor: [NSColor controlBackgroundColor]]; [[self contentView] addSubview: nameLabel]; RELEASE(nameLabel); frame = NSMakeRect(102, 94, 302, 20); nameField = [[NSTextField alloc] initWithFrame: frame]; [[self contentView] addSubview: nameField]; RELEASE(nameField); frame = NSMakeRect(10, 68, 83, 18); locationLabel = [[NSTextField alloc] initWithFrame: frame]; [locationLabel setStringValue: _(@"Location:")]; [locationLabel setEditable: NO]; [locationLabel setSelectable: NO]; [locationLabel setBordered: NO]; [locationLabel setBezeled: NO]; [locationLabel setBackgroundColor: [NSColor controlBackgroundColor]]; [[self contentView] addSubview: locationLabel]; RELEASE(locationLabel); frame = NSMakeRect(102, 68, 302, 20); locationField = [[NSTextField alloc] initWithFrame: frame]; [[self contentView] addSubview: locationField]; RELEASE(locationField); frame = NSMakeRect(10, 43, 83, 18); bundleLabel = [[NSTextField alloc] initWithFrame: frame]; [bundleLabel setStringValue: _(@"Bundle:")]; [bundleLabel setEditable: NO]; [bundleLabel setSelectable: NO]; [bundleLabel setBordered: NO]; [bundleLabel setBezeled: NO]; [bundleLabel setBackgroundColor: [NSColor controlBackgroundColor]]; [[self contentView] addSubview: bundleLabel]; RELEASE(bundleLabel); frame = NSMakeRect(102, 43, 302, 20); bundleButton = [[NSPopUpButton alloc] initWithFrame: frame pullsDown: NO]; [[self contentView] addSubview: bundleButton]; RELEASE(bundleButton); frame = NSMakeRect(281, 8, 56, 24); cancelButton = [[NSButton alloc] initWithFrame: frame]; [cancelButton setButtonType: NSMomentaryPushButton]; [cancelButton setTitle: _(@"Cancel")]; [[self contentView] addSubview: cancelButton]; RELEASE(cancelButton); frame = NSMakeRect(348, 8, 56, 24); okButton = [[NSButton alloc] initWithFrame: frame]; [okButton setButtonType:NSMomentaryPushButton]; [okButton setKeyEquivalent: @"\r"]; [okButton setImagePosition: NSImageRight]; [okButton setImage: [NSImage imageNamed: @"common_ret"]]; [okButton setAlternateImage: [NSImage imageNamed: @"common_retH"]]; [okButton setTitle: _(@"OK")]; [[self contentView] addSubview:okButton]; RELEASE(okButton); frame = NSMakeRect(10, 8, 56, 24); helpButton = [[NSButton alloc] initWithFrame: frame]; [helpButton setButtonType: NSMomentaryPushButton]; [helpButton setKeyEquivalent: @"h"]; [helpButton setTitle: _(@"Help")]; [[self contentView] addSubview:helpButton]; RELEASE(helpButton); [categoryButton setNextKeyView: nameField]; [nameField setNextKeyView: locationField]; [locationField setNextKeyView: bundleButton]; [bundleButton setNextKeyView: okButton]; [okButton setNextKeyView: cancelButton]; [cancelButton setNextKeyView: helpButton]; [helpButton setNextKeyView: categoryButton]; } - (NSTextField *) nameField { return nameField; } - (NSTextField *) locationField { return locationField; } - (NSPopUpButton *) categoryButton { return categoryButton; } - (NSPopUpButton *) bundleButton { return bundleButton; } - (NSButton *) okButton { return okButton; } - (NSButton *) cancelButton { return cancelButton; } - (NSButton *) helpButton { return helpButton; } @end