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_scrollbar_dev.idl modified Wed Oct 5 14:06:02 2011. */ 7 8 #ifndef PPAPI_C_DEV_PPB_SCROLLBAR_DEV_H_ 9 #define PPAPI_C_DEV_PPB_SCROLLBAR_DEV_H_ 10 11 #include "ppapi/c/pp_bool.h" 12 #include "ppapi/c/pp_instance.h" 13 #include "ppapi/c/pp_macros.h" 14 #include "ppapi/c/pp_point.h" 15 #include "ppapi/c/pp_rect.h" 16 #include "ppapi/c/pp_resource.h" 17 #include "ppapi/c/pp_size.h" 18 #include "ppapi/c/pp_stdint.h" 19 20 #define PPB_SCROLLBAR_DEV_INTERFACE_0_5 "PPB_Scrollbar(Dev);0.5" 21 #define PPB_SCROLLBAR_DEV_INTERFACE PPB_SCROLLBAR_DEV_INTERFACE_0_5 22 23 /** 24 * @file 25 * This file defines the <code>PPB_Buffer_Dev</code> interface. 26 */ 27 28 29 /** 30 * @addtogroup Enums 31 * @{ 32 */ 33 typedef enum { 34 PP_SCROLLBY_PIXEL = 0, 35 PP_SCROLLBY_LINE = 1, 36 PP_SCROLLBY_PAGE = 2, 37 PP_SCROLLBY_DOCUMENT = 3 38 } PP_ScrollBy_Dev; 39 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ScrollBy_Dev, 4); 40 /** 41 * @} 42 */ 43 44 /** 45 * @addtogroup Interfaces 46 * @{ 47 */ 48 /** 49 * The interface for a scrollbar. A scrollbar is a widget, so the functions 50 * in PPB_Widget can also be used with scrollbar objects. 51 */ 52 struct PPB_Scrollbar_Dev_0_5 { 53 /** 54 * Create a new scrollbar. Returns 0 if the instance is invalid. 55 */ 56 PP_Resource (*Create)(PP_Instance instance, PP_Bool vertical); 57 /** 58 * Returns PP_TRUE if the given resource is a Scrollbar. Returns PP_FALSE if 59 * the resource is invalid or some type other than a scrollbar. 60 */ 61 PP_Bool (*IsScrollbar)(PP_Resource resource); 62 /** 63 * Gets the thickness of a scrollbar. 64 */ 65 uint32_t (*GetThickness)(PP_Resource resource); 66 /** 67 * Returns PP_TRUE if the system scrollbar style is an overlap scrollbar. 68 */ 69 PP_Bool (*IsOverlay)(PP_Resource scrollbar); 70 /** 71 * Gets the value of the scrollbar. 72 */ 73 uint32_t (*GetValue)(PP_Resource scrollbar); 74 /** 75 * Sets the value of the scrollbar. 76 */ 77 void (*SetValue)(PP_Resource scrollbar, uint32_t value); 78 /** 79 * Set the document size (i.e. total length of the region that's being 80 * scrolled). 81 */ 82 void (*SetDocumentSize)(PP_Resource scrollbar, uint32_t size); 83 /** 84 * Updates the tickmarks. Only valid for vertical scrollbars. "tick_marks" 85 * contains "count" PP_Rect objects. 86 */ 87 void (*SetTickMarks)(PP_Resource scrollbar, 88 const struct PP_Rect tick_marks[], 89 uint32_t count); 90 /** 91 * Scroll by "multiplier" pixels/lines/pages units. Positive values are 92 * forward and negative are backward. If "unit" is document then any positive 93 * value goes to the end while any negative value goes to the beginning. 94 */ 95 void (*ScrollBy)(PP_Resource scrollbar, 96 PP_ScrollBy_Dev unit, 97 int32_t multiplier); 98 }; 99 100 typedef struct PPB_Scrollbar_Dev_0_5 PPB_Scrollbar_Dev; 101 /** 102 * @} 103 */ 104 105 #endif /* PPAPI_C_DEV_PPB_SCROLLBAR_DEV_H_ */ 106 107