/* Copyright 1997 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 toolbox library for writing desktop applications in C. It may be     *
 * used freely in the creation of programs for RISC OS.                     *
 *                                                                          *
 * Copyright  Acorn Computers Ltd, 1994                                    *
 *                                                                          *
 ***************************************************************************/



/*
 * Name        : printdbox.h
 * Description : C veneers to the Methods provided by the printdbox class
 */



#ifndef __printdbox_h
#define __printdbox_h


#ifndef __kernel_h
#include "kernel.h"
#endif

#ifndef __toolbox_h
#include "toolbox.h"
#endif

#ifndef __window_h
#include "window.h"
#endif

/****************************************************************************
 * PrintDbox Templates                                                      *
 ****************************************************************************/

/*-- flags --*/

#define PrintDbox_GenerateShowEvent    0x00000001
#define PrintDbox_GenerateHideEvent    0x00000002
#define PrintDbox_GenerateSetupEvent   0x00000004
#define PrintDbox_IncludeAllFromTo     0x00000008
#define PrintDbox_IncludeCopies        0x00000010
#define PrintDbox_IncludeScale         0x00000020
#define PrintDbox_IncludeOrientation   0x00000040
#define PrintDbox_IncludeSave          0x00000080
#define PrintDbox_IncludeSetUp         0x00000100
#define PrintDbox_IncludeDraft         0x00000200
#define PrintDbox_SelectFromTo         0x00000400
#define PrintDbox_SelectSideways       0x00000800
#define PrintDbox_SelectDraft          0x00001000


/*-- templates --*/

typedef struct
{
  int         flags;
  int         from;
  int         to;
  int         copies;
  int         scale;
  char        *further_options;
  char        *window;
} PrintDboxTemplate;


/****************************************************************************
 * PrintDbox SWI Calls                                                      *
 ****************************************************************************/

#define PrintDbox_SWIChunkBase    0x82b00
#define PrintDbox_ObjectClass     PrintDbox_SWIChunkBase
#define PrintDbox_ClassSWI        (PrintDbox_SWIChunkBase + 0)
#define PrintDbox_PostFilter      (PrintDbox_SWIChunkBase + 1)
#define PrintDbox_PreFilter       (PrintDbox_SWIChunkBase + 2)

/****************************************************************************
 * PrintDbox SWI and event constants                                        *
 ****************************************************************************/

#define PrintDbox_PageRangeAll          -1

/****************************************************************************
 * PrintDbox Methods                                                        *
 ****************************************************************************/

#define PrintDbox_GetWindowId           0
#define PrintDbox_SetPageRange          1
#define PrintDbox_GetPageRange          2
#define PrintDbox_SetCopies             3
#define PrintDbox_GetCopies             4
#define PrintDbox_SetScale              5
#define PrintDbox_GetScale              6
#define PrintDbox_SetOrientation        7
#define PrintDbox_GetOrientation        8
#define PrintDbox_GetTitle              9
#define PrintDbox_SetDraft             10
#define PrintDbox_GetDraft             11


/****************************************************************************
 * PrintDbox Toolbox Events                                                 *
 ****************************************************************************/

#define PrintDbox_AboutToBeShown       PrintDbox_SWIChunkBase
#define PrintDbox_DialogueCompleted    (PrintDbox_SWIChunkBase + 1)
#define PrintDbox_SetUpAboutToBeShown  (PrintDbox_SWIChunkBase + 2)
#define PrintDbox_Save                 (PrintDbox_SWIChunkBase + 3)
#define PrintDbox_SetUp                (PrintDbox_SWIChunkBase + 4)
#define PrintDbox_Print                (PrintDbox_SWIChunkBase + 5)

#define PrintDboxEvents_PrintSave_Sideways 0x00000001
#define PrintDboxEvents_PrintSave_Draft    0x00000002


typedef struct
{
  ToolboxEventHeader hdr;
  int                show_type;
  union
  {
    TopLeft               pos;
    WindowShowObjectBlock full;
  } info;
} PrintDboxAboutToBeShownEvent;


typedef struct
{
  ToolboxEventHeader hdr;
} PrintDboxDialogueCompletedEvent;


typedef struct
{
  ToolboxEventHeader hdr;
  ObjectId           object_id;
  int                show_type;
  union
  {
    TopLeft               pos;
    WindowShowObjectBlock full;
  } info;
} PrintDboxSetUpAboutToBeShownEvent;


typedef struct
{
  ToolboxEventHeader hdr;
  int                start_page;
  int                finish_page;
  int                copies;
  int                scale_factor;
} PrintDboxSaveEvent;


typedef struct
{
  ToolboxEventHeader hdr;
} PrintDboxSetUpEvent;


typedef struct
{
  ToolboxEventHeader hdr;
  int                start_page;
  int                finish_page;
  int                copies;
  int                scale_factor;
} PrintDboxPrintEvent;





/****************************************************************************
 * The following functions provide veneers to the methods that are          *
 * associated with this particular class.  Please read the User Interface   *
 * Toolbox manual for more detailed information on their functionality.     *
 ****************************************************************************/



#ifdef __cplusplus
  extern "C" {
#endif


/*
 * Name        : printdbox_get_draft
 * Description : Gets whether draft printing is set for the specified print dbox
 * In          : unsigned int flags
 *               ObjectId printdbox
 * Out         : int *draft
 * Returns     : pointer to error block
 */

extern _kernel_oserror *printdbox_get_draft ( unsigned int flags,
                                              ObjectId printdbox,
                                              int *draft
                                            );


/*
 * Name        : printdbox_set_draft
 * Description : Sets whether draft printing is set for the specified print dbox
 * In          : unsigned int flags
 *               ObjectId printdbox
 *               int draft
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *printdbox_set_draft ( unsigned int flags,
                                              ObjectId printdbox,
                                              int draft
                                            );


/*
 * Name        : printdbox_get_title
 * Description : Gets the title for the specified print dbox
 * In          : unsigned int flags
 *               ObjectId printdbox
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *printdbox_get_title ( unsigned int flags,
                                              ObjectId printdbox,
                                              char *buffer,
                                              int buff_size,
                                              int *nbytes
                                            );


/*
 * Name        : printdbox_get_orientation
 * Description : Gets the orientation for the specified print dbox
 * In          : unsigned int flags
 *               ObjectId printdbox
 * Out         : int *orientation
 * Returns     : pointer to error block
 */

extern _kernel_oserror *printdbox_get_orientation ( unsigned int flags,
                                                    ObjectId printdbox,
                                                    int *orientation
                                                  );


/*
 * Name        : printdbox_set_orientation
 * Description : Sets the orientation for the specified print dbox
 * In          : unsigned int flags
 *               ObjectId printdbox
 *               int orientation
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *printdbox_set_orientation ( unsigned int flags,
                                                    ObjectId printdbox,
                                                    int orientation
                                                  );


/*
 * Name        : printdbox_get_scale
 * Description : Gets the scale factor for the specified print dbox
 * In          : unsigned int flags
 *               ObjectId printdbox
 * Out         : int *scale_factor
 * Returns     : pointer to error block
 */

extern _kernel_oserror *printdbox_get_scale ( unsigned int flags,
                                              ObjectId printdbox,
                                              int *scale_factor
                                            );


/*
 * Name        : printdbox_set_scale
 * Description : Sets the scale factor for the specified print dbox
 * In          : unsigned int flags
 *               ObjectId printdbox
 *               int scale_factor
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *printdbox_set_scale ( unsigned int flags,
                                              ObjectId printdbox,
                                              int scale_factor
                                            );


/*
 * Name        : printdbox_get_copies
 * Description : Gets the number of copies set for the specified print dbox
 * In          : unsigned int flags
 *               ObjectId printdbox
 * Out         : int *copies
 * Returns     : pointer to error block
 */

extern _kernel_oserror *printdbox_get_copies ( unsigned int flags,
                                               ObjectId printdbox,
                                               int *copies
                                             );


/*
 * Name        : printdbox_set_copies
 * Description : Sets the number of copies to print for the print dbox
 * In          : unsigned int flags
 *               ObjectId printdbox
 *               int copies
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *printdbox_set_copies ( unsigned int flags,
                                               ObjectId printdbox,
                                               int copies
                                             );


/*
 * Name        : printdbox_get_page_range
 * Description : Gets the page range for the specified print dbox
 * In          : unsigned int flags
 *               ObjectId printdbox
 * Out         : int *start
 *               int *end
 * Returns     : pointer to error block
 */

extern _kernel_oserror *printdbox_get_page_range ( unsigned int flags,
                                                   ObjectId printdbox,
                                                   int *start,
                                                   int *end
                                                 );


/*
 * Name        : printdbox_set_page_range
 * Description : Sets the page range for the specified print dbox
 * In          : unsigned int flags
 *               ObjectId printdbox
 *               int start
 *               int end
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *printdbox_set_page_range ( unsigned int flags,
                                                   ObjectId printdbox,
                                                   int start,
                                                   int end
                                                 );


/*
 * Name        : printdbox_get_window_id
 * Description : Gets the id of the underlying window object for the specified print dbox
 * In          : unsigned int flags
 *               ObjectId printdbox
 * Out         : ObjectId *window
 * Returns     : pointer to error block
 */

extern _kernel_oserror *printdbox_get_window_id ( unsigned int flags,
                                                  ObjectId printdbox,
                                                  ObjectId *window
                                                );


#ifdef __cplusplus
  }
#endif


#endif
