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