/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/**
 * Implementation of the widgets interface.
 */

[generate_thunk]

label Chrome {
  M14 = 0.3,
  M23 = 0.4
};

/**
 * The interface for reusing browser widgets.
 */
interface PPB_Widget_Dev {
  /**
   * Returns PP_TRUE if the given resource is a Widget. Returns PP_FALSE if the
   * resource is invalid or some type other than an Widget.
   */
  PP_Bool IsWidget([in] PP_Resource resource);

  /**
   * Paint the given rectangle of the widget into the given image.
   * Returns PP_TRUE on success, PP_FALSE on failure.
   */
  [report_errors=False]
  PP_Bool Paint([in] PP_Resource widget,
                [in] PP_Rect rect,
                [in] PP_Resource image);

  /**
   * Pass in an event to a widget.  It'll return PP_TRUE if the event was
   * consumed.
   */
  [report_errors=False]
  PP_Bool HandleEvent([in] PP_Resource widget, [in] PP_Resource input_event);

  /**
   * Get the location of the widget.
   */
  [report_errors=False]
  PP_Bool GetLocation([in] PP_Resource widget,
                      [out] PP_Rect location);

  /**
   * Set the location of the widget.
   */
  [report_errors=False]
  void SetLocation([in] PP_Resource widget,
                   [in] PP_Rect location);

  /**
   * Set scale used during paint operations.
   */
  [version=0.4, report_errors=False]
  void SetScale([in] PP_Resource widget,
                [in] float_t scale);
};
