// Copyright 1997-2000 Omni Development, Inc.  All rights reserved.
//
// This software may only be used and reproduced according to the
// terms in the file OmniSourceLicense.html, which should be
// distributed with this project and can also be found at
// http://www.omnigroup.com/DeveloperResources/OmniSourceLicense.html.

#import "OHFormSelectOption.h"

#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#import <OmniBase/OmniBase.h>
#import <OmniFoundation/OmniFoundation.h>

RCS_ID("$Header: /Network/Source/CVS/OmniGroup/Frameworks/OmniHTML/Forms.subproj/OHFormSelectOption.m,v 1.3 2000/01/20 00:27:52 kc Exp $")

@implementation OHFormSelectOption

- init;
{
    if (![super init])
	return nil;

    text = nil;
    tag = nil;
    initiallySelected = NO;

    return self;
}

- (void)dealloc;
{
    [text release];
    [tag release];
    [super dealloc];
}

- (NSString *)text;
{
    return text;
}

- (NSString *)tag;
{
    return tag ? tag : text;
}

- (BOOL)initiallySelected;
{
    return initiallySelected;
}

- (void)setText:(NSString *)someText;
{
    if (text == someText)
	return;
    [text release];
    text = [someText retain];
}

- (void)setTag:(NSString *)aTag;
{
    if (tag == aTag)
	return;
    [tag release];
    tag = [aTag retain];
}

- (void)setInitiallySelected:(BOOL)startsSelected;
{
    initiallySelected = startsSelected;
}

// Debugging

- (NSMutableDictionary *)debugDictionary;
{
    NSMutableDictionary *debugDictionary;

    debugDictionary = [super debugDictionary];
    if (tag)
	[debugDictionary setObject:tag forKey:@"tag"];
    if (text)
	[debugDictionary setObject:text forKey:@"text"];
    [debugDictionary setObject:initiallySelected ? @"YES" : @"NO" forKey:@"initiallySelected"];
    return debugDictionary;
}

@end
