// 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.
//
// $Header: /Network/Source/CVS/OmniGroup/Frameworks/OmniHTML/Forms.subproj/OHFormElementProtocol.h,v 1.7 2000/01/20 00:27:51 kc Exp $

// workaround for a bug in gcc's #import
#ifndef OHFORMELEMENTPROTOCOL_H
#define OHFORMELEMENTPROTOCOL_H

#import "OWScriptResponderProtocol.h"

@class NSArray, NSString, OWContentType;
@class OWScriptEventHandlerHolder;

#import "OWScriptEvent.h" // For OWScriptEventType

@protocol OHFormElement <NSObject>

/* **** NOTE ****
   All form element methods described in this protocol must be thread safe.
*/

- (void)reset;
    // Resets the form element to its original value

    // TODO: The -reset method is redundant since it can be implemented with -resetFromFormValues: and -defaultFormValues. Eventually -reset should be eliminated. 

- (void)clear;
    // Clears the form element to an empty value (unlike -reset, which sets it to its original value).  Used to clear a radio button when another is selected.

- (NSString *)name;
    // Returns the name of the form element.  (This is currently only used to clear the value of other identically-named radio buttons when a radio button is selected.)
    // (Also used by JavaScript.)

- (NSString *)type;
    // Returns the type of the form element, eg "Button", "Checkbox", "Radio"

- (NSArray *)formValues;
    // Returns an array of OHFormValue objects to be submitted by the form

- (NSArray *)defaultFormValues;
    // Returns an array of OHFormValue objects representing the default value of the form element, i.e. what the element would be set to if reset

- (void)resetFromFormValues:(NSArray *)values;
    // Reset the form element to the value(s) it stored in this array

- (OWScriptEventHandlerHolder *)eventHandlers;
    // An object which holds the event handlers for this form element

@end

#endif /* OHFORMELEMENTPROTOCOL_H */

