HTMLControl.h

/*
    File: HTMLControl.h
    
    Description:
        Scrolling Text User Pane (HTML) control support routines.
    
    Routines defined in this header file are implemented in the
    file HTMLControl.c
    
    These routines allow you to create (or use an existing) user
    pane control as a scrolling edit text field.
    
    These routines use the refcon field inside of the user pane
    record for storage of interal variables.  You should not
    use the reference value field in the user pane control if you
    are calling these routines.
 
    Copyright:
        © Copyright 2000 Apple Computer, Inc. All rights reserved.
    
    Disclaimer:
        IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
        ("Apple") in consideration of your agreement to the following terms, and your
        use, installation, modification or redistribution of this Apple software
        constitutes acceptance of these terms.  If you do not agree with these terms,
        please do not use, install, modify or redistribute this Apple software.
 
        In consideration of your agreement to abide by the following terms, and subject
        to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs
        copyrights in this original Apple software (the "Apple Software"), to use,
        reproduce, modify and redistribute the Apple Software, with or without
        modifications, in source and/or binary forms; provided that if you redistribute
        the Apple Software in its entirety and without modifications, you must retain
        this notice and the following text and disclaimers in all such redistributions of
        the Apple Software.  Neither the name, trademarks, service marks or logos of
        Apple Computer, Inc. may be used to endorse or promote products derived from the
        Apple Software without specific prior written permission from Apple.  Except as
        expressly stated in this notice, no other rights or licenses, express or implied,
        are granted by Apple herein, including but not limited to any patent rights that
        may be infringed by your derivative works or by other works in which the Apple
        Software may be incorporated.
 
        The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
        WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
        WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
        PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
        COMBINATION WITH YOUR PRODUCTS.
 
        IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
        CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
        GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
        OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
        (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
        ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
    Change History (most recent first):
        Fri, Jan 28, 2000 -- created
*/
 
#define TARGET_API_MAC_CARBON 1
 
 
#ifndef __HTMLCONTROL__
#define __HTMLCONTROL__
 
#ifdef __APPLE_CC__
#include <Carbon/Carbon.h>
#else
#include <Carbon.h>
#endif
 
/* part codes */
 
    /* kHTMLTextPart is the part code we return to indicate the user has clicked
    in the text area of our control */
#define kHTMLTextPart 1
 
    /* kHTMLScrollPart is the part code we return to indicate the user has clicked
    in the scroll bar part of the control. */
#define kHTMLScrollPart 2
 
 
    /* routines for using existing user pane controls.
    These routines are useful for cases where you would like to use an
    existing user pane control in, say, a dialog window as a scrolling
    text edit field.*/
    
    /* HTMLOpenControl initializes a user pane control so it will be drawn
    and will behave as a scrolling text edit field inside of a window.
    This routine performs all of the initialization steps necessary,
    except it does not create the user pane control itself.  theControl
    should refer to a user pane control that you have either created
    yourself or extracted from a dialog's control heirarchy using
    the GetDialogItemAsControl routine.  */
OSStatus HTMLOpenControl(ControlHandle theControl);
 
    /* HTMLCloseControl deallocates all of the structures allocated
    by HTMLOpenControl.  */
OSStatus HTMLCloseControl(ControlHandle theControl);
 
 
 
    /* routines for creating new scrolling text user pane controls.
    These routines allow you to create new scrolling text
    user pane controls. */
 
    /* HTMLCreateControl creates a new user pane control and then it passes it
    to HTMLOpenControl to initialize it as a scrolling text user pane control. */
OSStatus HTMLCreateControl(WindowPtr theWindow, Rect *bounds, ControlHandle *theControl);
 
    /* HTMLDisposeControl calls HTMLCloseControl and then it calls DisposeControl. */
OSStatus HTMLDisposeControl(ControlHandle theControl);
 
 
 
/* Utility Routines */
 
    /* HTMLGotoURL displays HTML file referred to by the url in the
    rendering control.  if addToHistory is true, then the window
    will be added to the window's history list. */
OSStatus HTMLDisplayFile(ControlHandle theControl, FSSpec *theFile);
 
 
    /* HTMLDisplayBuffer displays the HTML described by the buffer. */
OSStatus HTMLDisplayBuffer(ControlHandle theControl, char *buffer, long bytecount);
 
 
    /* HTMLDisplayHandle displays the HTML in the handle htmlData. */
OSStatus HTMLDisplayHandle(ControlHandle theControl, Handle htmlData);
 
 
    /* HTMLDisplayHandle displays the HTML from the URL passed in the url parameter.
    This URL should refer to a file on disk. */
OSStatus HTMLDisplayURL(ControlHandle theControl, char const* url);
 
    /* IsHTMLControl returns true if theControl is not NULL
    and theControl refers to a HTML Control.  */
Boolean IsHTMLControl(ControlHandle theControl);
 
 
 
#endif