OLD | NEW |
(Empty) | |
| 1 // Copyright 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 #ifndef CC_LAYERS_PICTURE_SCROLLBAR_LAYER_IMPL_H_ |
| 6 #define CC_LAYERS_PICTURE_SCROLLBAR_LAYER_IMPL_H_ |
| 7 |
| 8 #include "cc/base/cc_export.h" |
| 9 |
| 10 #if !USE_REGULAR_SCROLLBAR |
| 11 |
| 12 #include "cc/input/scrollbar.h" |
| 13 #include "cc/layers/layer_impl.h" |
| 14 #include "cc/resources/ui_resource_manager.h" |
| 15 |
| 16 namespace cc { |
| 17 |
| 18 class LayerTreeImpl; |
| 19 class ScrollView; |
| 20 |
| 21 class CC_EXPORT ScrollbarLayerImpl : public LayerImpl { |
| 22 public: |
| 23 static scoped_ptr<ScrollbarLayerImpl> Create( |
| 24 LayerTreeImpl* tree_impl, |
| 25 int id, |
| 26 ScrollbarOrientation orientation); |
| 27 virtual ~ScrollbarLayerImpl(); |
| 28 |
| 29 // LayerImpl implementation. |
| 30 virtual ScrollbarLayerImpl* ToScrollbarLayer() OVERRIDE; |
| 31 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
| 32 OVERRIDE; |
| 33 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; |
| 34 |
| 35 virtual bool WillDraw(DrawMode draw_mode, |
| 36 ResourceProvider* resource_provider) OVERRIDE; |
| 37 virtual void AppendQuads(QuadSink* quad_sink, |
| 38 AppendQuadsData* append_quads_data) OVERRIDE; |
| 39 |
| 40 virtual void DidLoseOutputSurface() OVERRIDE; |
| 41 |
| 42 int scroll_layer_id() const { return scroll_layer_id_; } |
| 43 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; } |
| 44 |
| 45 ScrollbarOrientation Orientation() const; |
| 46 float CurrentPos() const; |
| 47 int Maximum() const; |
| 48 |
| 49 void set_thumb_thickness(int thumb_thickness) { |
| 50 thumb_thickness_ = thumb_thickness; |
| 51 } |
| 52 void set_thumb_length(int thumb_length) { |
| 53 thumb_length_ = thumb_length; |
| 54 } |
| 55 void set_track_start(int track_start) { |
| 56 track_start_ = track_start; |
| 57 } |
| 58 void set_track_length(int track_length) { |
| 59 track_length_ = track_length; |
| 60 } |
| 61 void set_vertical_adjust(float vertical_adjust) { |
| 62 vertical_adjust_ = vertical_adjust; |
| 63 } |
| 64 void set_track_resource_id(ResourceProvider::ResourceId id) { |
| 65 } |
| 66 void set_thumb_resource_id(ResourceProvider::ResourceId id) { |
| 67 } |
| 68 void set_visible_to_total_length_ratio(float ratio) { |
| 69 visible_to_total_length_ratio_ = ratio; |
| 70 } |
| 71 |
| 72 void SetCurrentPos(float current_pos) { current_pos_ = current_pos; } |
| 73 void SetMaximum(int maximum) { maximum_ = maximum; } |
| 74 |
| 75 gfx::Rect ComputeThumbQuadRect() const; |
| 76 |
| 77 void set_track_ui_resource_id(UIResourceId id); |
| 78 void set_thumb_ui_resource_id(UIResourceId id); |
| 79 |
| 80 protected: |
| 81 ScrollbarLayerImpl(LayerTreeImpl* tree_impl, |
| 82 int id, |
| 83 ScrollbarOrientation orientation); |
| 84 |
| 85 private: |
| 86 virtual const char* LayerTypeAsString() const OVERRIDE; |
| 87 |
| 88 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const; |
| 89 |
| 90 float current_pos_; |
| 91 int maximum_; |
| 92 int thumb_thickness_; |
| 93 int thumb_length_; |
| 94 int track_start_; |
| 95 int track_length_; |
| 96 ScrollbarOrientation orientation_; |
| 97 |
| 98 // Difference between the clip layer's height and the visible viewport |
| 99 // height (which may differ in the presence of top-controls hiding). |
| 100 float vertical_adjust_; |
| 101 |
| 102 float visible_to_total_length_ratio_; |
| 103 |
| 104 int scroll_layer_id_; |
| 105 |
| 106 UIResourceId track_ui_resource_id_; |
| 107 UIResourceId thumb_ui_resource_id_; |
| 108 |
| 109 bool is_scrollable_area_active_; |
| 110 bool is_scroll_view_scrollbar_; |
| 111 bool enabled_; |
| 112 bool is_custom_scrollbar_; |
| 113 bool is_overlay_scrollbar_; |
| 114 |
| 115 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImpl); |
| 116 }; |
| 117 |
| 118 } // namespace cc |
| 119 |
| 120 #endif |
| 121 |
| 122 #endif // CC_LAYERS_PICTURE_SCROLLBAR_LAYER_IMPL_H_ |
OLD | NEW |