1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 */ 5 6 /* From dev/ppb_widget_dev.idl modified Mon Aug 20 10:21:06 2012. */ 7 8 #ifndef PPAPI_C_DEV_PPB_WIDGET_DEV_H_ 9 #define PPAPI_C_DEV_PPB_WIDGET_DEV_H_ 10 11 #include "ppapi/c/pp_bool.h" 12 #include "ppapi/c/pp_macros.h" 13 #include "ppapi/c/pp_point.h" 14 #include "ppapi/c/pp_rect.h" 15 #include "ppapi/c/pp_resource.h" 16 #include "ppapi/c/pp_size.h" 17 #include "ppapi/c/pp_stdint.h" 18 19 #define PPB_WIDGET_DEV_INTERFACE_0_3 "PPB_Widget(Dev);0.3" 20 #define PPB_WIDGET_DEV_INTERFACE_0_4 "PPB_Widget(Dev);0.4" 21 #define PPB_WIDGET_DEV_INTERFACE PPB_WIDGET_DEV_INTERFACE_0_4 22 23 /** 24 * @file 25 * Implementation of the widgets interface. 26 */ 27 28 29 /** 30 * @addtogroup Interfaces 31 * @{ 32 */ 33 /** 34 * The interface for reusing browser widgets. 35 */ 36 struct PPB_Widget_Dev_0_4 { 37 /** 38 * Returns PP_TRUE if the given resource is a Widget. Returns PP_FALSE if the 39 * resource is invalid or some type other than an Widget. 40 */ 41 PP_Bool (*IsWidget)(PP_Resource resource); 42 /** 43 * Paint the given rectangle of the widget into the given image. 44 * Returns PP_TRUE on success, PP_FALSE on failure. 45 */ 46 PP_Bool (*Paint)(PP_Resource widget, 47 const struct PP_Rect* rect, 48 PP_Resource image); 49 /** 50 * Pass in an event to a widget. It'll return PP_TRUE if the event was 51 * consumed. 52 */ 53 PP_Bool (*HandleEvent)(PP_Resource widget, PP_Resource input_event); 54 /** 55 * Get the location of the widget. 56 */ 57 PP_Bool (*GetLocation)(PP_Resource widget, struct PP_Rect* location); 58 /** 59 * Set the location of the widget. 60 */ 61 void (*SetLocation)(PP_Resource widget, const struct PP_Rect* location); 62 /** 63 * Set scale used during paint operations. 64 */ 65 void (*SetScale)(PP_Resource widget, float scale); 66 }; 67 68 typedef struct PPB_Widget_Dev_0_4 PPB_Widget_Dev; 69 70 struct PPB_Widget_Dev_0_3 { 71 PP_Bool (*IsWidget)(PP_Resource resource); 72 PP_Bool (*Paint)(PP_Resource widget, 73 const struct PP_Rect* rect, 74 PP_Resource image); 75 PP_Bool (*HandleEvent)(PP_Resource widget, PP_Resource input_event); 76 PP_Bool (*GetLocation)(PP_Resource widget, struct PP_Rect* location); 77 void (*SetLocation)(PP_Resource widget, const struct PP_Rect* location); 78 }; 79 /** 80 * @} 81 */ 82 83 #endif /* PPAPI_C_DEV_PPB_WIDGET_DEV_H_ */ 84 85