saveas 4.12 KB
Newer Older
Neil Turton's avatar
Neil Turton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
/* Copyright 1996 Acorn Computers Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/****************************************************************************
 * This source file was written by Acorn Computers Limited. It is part of   *
 * the RISCOS library for writing applications in C for RISC OS. It may be  *
 * used freely in the creation of programs for Archimedes. It should be     *
 * used with Acorn's C Compiler Release 3 or later.                         *
 *                                                                          *
 ***************************************************************************/

/* Title:   saveas.h
 * Purpose: export of data by dragging icon from dialogue box
 *
 */

#ifndef __saveas_h
#define __saveas_h

#ifndef BOOL
#define BOOL int
#define TRUE 1
#define FALSE 0
#endif

#ifndef __xfersend_h
#include "xfersend.h"
#endif

/* ----------------------------- saveas -------------------------------------
 * Description:   Displays a dialogue box, for the user to export application
 *                data.
 *
 * Parameters:    int filetype -- type of file to save to
 *                char *name -- suggested file name
 *                int estsize -- estimated size of the file
 *                xfersend_saveproc -- caller-supplied function for saving
 *                                     application data to a file
 *                xfersend_sendproc -- caller-supplied function for RAM
 *                                     data transfer (if application is able
 *                                     to do this)
 *                xfersend_printproc -- caller-supplied function for printing
 *                                      application data, if "save icon" is
 *                                      dragged onto printer application
 *                void *handle -- handle to be passed to handler functions
 * Returns:       TRUE if data exported successfully.
 * Other Info:    This function displays a dialogue box with the following
 *                fields:
 *                     i) a sprite icon appropriate to the given file type
 *                    ii) the suggested filename
 *                   iii) an OK button
 *                (Note: a template called "xfer_send" must be in the
 *                application's templates file to use this function, set up
 *                as in the !Edit, !Draw and !Paint applications)
 *                Xfersend deals with the complexities of message-passing
 *                protocols to achieve the data transfer. Refer to the
 *                typedefs in xfersend.h for an explanation of what the
 *                three caller-supplied functions should do.
 *                If you pass 0 as the xfersend_sendproc, then no in-core
 *                data transfer will be attempted
 *                If you pass 0 as the xfersend_printproc, then the file
 *                format for printing is assumed to be the same as for saving
 *                The estimated file size is not essential, but may improve
 *                performance.
 *
 */

BOOL saveas(int filetype, char *name, int estsize,
            xfersend_saveproc, xfersend_sendproc, xfersend_printproc,
            void *handle);


/* ----------------------- saveas_read_leafname_during_send -----------------
 * Description:   Gets the "leaf" of the file name in the "filename" field
 *                of the "xfer-send" dialogue box.
 *
 * Parameters:    char *name -- buffer to put file name in
 *                int length -- size in bytes of supplied buffer
 * Returns:       void.
 * Other Info:    none.
 *
 */

void saveas_read_leafname_during_send(char *name, int length);

#endif

/* end saveas.h */