/* 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.
 */
/***************************************************/
/* File   : Object.h                               */
/*                                                 */
/* Purpose: Handling OBJECT, APPLET and EMBED.     */
/*                                                 */
/* Author : A.D.Hodgkinson                         */
/*                                                 */
/* History: 05-Oct-97: Created.                    */
/***************************************************/

/* Structures */

/* The object_info structure is used to hold information */
/* about each object (or applet or embed) tag that a     */
/* browser is dealing with.                              */

typedef struct object_info
{
  unsigned int   plugin_instance_handle; /* Only if isplugin (below) set */
  unsigned int   plugin_task_handle;     /* Only if isplugin (below) set */

  HStream      * token;

  int            x;
  int            y;

  int            w;
  int            h;

  unsigned       isimage       :1;
  unsigned       isplugin      :1;
  unsigned       broadcast_sent:1;
}
object_info;

/* Function prototypes */

_kernel_oserror * object_new_object                (browser_data * b, HStream * t);
_kernel_oserror * object_discard                   (browser_data * b);

_kernel_oserror * object_get_token_object_size     (browser_data * b, HStream * t, BBox * size);
_kernel_oserror * object_set_token_object_size     (browser_data * b, HStream * t, BBox * size);
int               object_get_token_object_position (browser_data * b, HStream * t, int * x, int * y);
int               object_set_token_object_position (browser_data * b, HStream * t, int x, int y);
int               object_get_token_object_box      (browser_data * b, HStream * t, BBox * box);

_kernel_oserror * object_get_token_object_plugin   (browser_data * b, HStream * t, unsigned int * plugin_instance, unsigned int * plugin_task);
_kernel_oserror * object_set_token_object_plugin   (browser_data * b, HStream * t, unsigned int plugin_instance, unsigned int plugin_task);
int               object_return_info               (browser_data * b, unsigned int plugin_instance_handle, HStream ** token, unsigned int * plugin_task);

_kernel_oserror * object_redraw                    (browser_data * b, WimpRedrawWindowBlock * r, HStream * token, int x, int y);

int               object_token_is_image            (browser_data * b, HStream * t);