OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 #ifndef CC_LAYERS_OVERLAY_SCROLLBAR_LAYER_IMPL_H_ |
| 6 #define CC_LAYERS_OVERLAY_SCROLLBAR_LAYER_IMPL_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "cc/base/cc_export.h" |
| 10 #include "cc/input/scrollbar.h" |
| 11 #include "cc/layers/scrollbar_layer_impl_base.h" |
| 12 #include "cc/quads/nine_patch_generator.h" |
| 13 #include "cc/resources/ui_resource_client.h" |
| 14 |
| 15 namespace cc { |
| 16 |
| 17 class LayerTreeImpl; |
| 18 |
| 19 class CC_EXPORT OverlayScrollbarLayerImpl : public ScrollbarLayerImplBase { |
| 20 public: |
| 21 static std::unique_ptr<OverlayScrollbarLayerImpl> Create( |
| 22 LayerTreeImpl* tree_impl, |
| 23 int id, |
| 24 ScrollbarOrientation orientation, |
| 25 bool is_left_side_vertical_scrollbar); |
| 26 ~OverlayScrollbarLayerImpl() override; |
| 27 |
| 28 // LayerImpl implementation. |
| 29 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 30 void PushPropertiesTo(LayerImpl* layer) override; |
| 31 |
| 32 bool WillDraw(DrawMode draw_mode, |
| 33 ResourceProvider* resource_provider) override; |
| 34 void AppendQuads(RenderPass* render_pass, |
| 35 AppendQuadsData* append_quads_data) override; |
| 36 |
| 37 void SetThumbThickness(int thumb_thickness); |
| 38 void SetThumbLength(int thumb_length); |
| 39 void SetTrackStart(int track_start); |
| 40 void SetTrackLength(int track_length); |
| 41 |
| 42 void SetImageBounds(const gfx::Size& bounds); |
| 43 void SetAperture(const gfx::Rect& aperture); |
| 44 |
| 45 void set_thumb_ui_resource_id(UIResourceId uid) { |
| 46 thumb_ui_resource_id_ = uid; |
| 47 } |
| 48 |
| 49 protected: |
| 50 OverlayScrollbarLayerImpl(LayerTreeImpl* tree_impl, |
| 51 int id, |
| 52 ScrollbarOrientation orientation, |
| 53 bool is_left_side_vertical_scrollbar); |
| 54 |
| 55 // ScrollbarLayerImplBase implementation. |
| 56 int ThumbThickness() const override; |
| 57 int ThumbLength() const override; |
| 58 float TrackLength() const override; |
| 59 int TrackStart() const override; |
| 60 bool IsThumbResizable() const override; |
| 61 |
| 62 private: |
| 63 const char* LayerTypeAsString() const override; |
| 64 |
| 65 UIResourceId thumb_ui_resource_id_; |
| 66 |
| 67 int thumb_thickness_; |
| 68 int thumb_length_; |
| 69 int track_start_; |
| 70 int track_length_; |
| 71 |
| 72 gfx::Size image_bounds_; |
| 73 gfx::Rect aperture_; |
| 74 |
| 75 NinePatchGenerator quad_generator_; |
| 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(OverlayScrollbarLayerImpl); |
| 78 }; |
| 79 |
| 80 } // namespace cc |
| 81 #endif // CC_LAYERS_OVERLAY_SCROLLBAR_LAYER_IMPL_H_ |
OLD | NEW |