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