OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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 CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ |
6 #define CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ | 6 #define CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ |
7 | 7 |
8 #include "cc/base/cc_export.h" | 8 #include "cc/base/cc_export.h" |
9 #include "cc/input/scrollbar.h" | 9 #include "cc/input/scrollbar.h" |
10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
11 #include "cc/resources/ui_resource_manager_client.h" | |
11 | 12 |
12 namespace cc { | 13 namespace cc { |
13 | 14 |
14 class LayerTreeImpl; | 15 class LayerTreeImpl; |
15 class ScrollView; | 16 class ScrollView; |
16 | 17 |
17 class CC_EXPORT ScrollbarLayerImpl : public LayerImpl { | 18 class CC_EXPORT ScrollbarLayerImpl : public LayerImpl { |
18 public: | 19 public: |
19 static scoped_ptr<ScrollbarLayerImpl> Create( | 20 static scoped_ptr<ScrollbarLayerImpl> Create( |
20 LayerTreeImpl* tree_impl, | 21 LayerTreeImpl* tree_impl, |
(...skipping 29 matching lines...) Expand all Loading... | |
50 } | 51 } |
51 void set_track_start(int track_start) { | 52 void set_track_start(int track_start) { |
52 track_start_ = track_start; | 53 track_start_ = track_start; |
53 } | 54 } |
54 void set_track_length(int track_length) { | 55 void set_track_length(int track_length) { |
55 track_length_ = track_length; | 56 track_length_ = track_length; |
56 } | 57 } |
57 void set_vertical_adjust(float vertical_adjust) { | 58 void set_vertical_adjust(float vertical_adjust) { |
58 vertical_adjust_ = vertical_adjust; | 59 vertical_adjust_ = vertical_adjust; |
59 } | 60 } |
60 void set_track_resource_id(ResourceProvider::ResourceId id) { | 61 |
61 track_resource_id_ = id; | |
62 } | |
63 void set_thumb_resource_id(ResourceProvider::ResourceId id) { | |
64 thumb_resource_id_ = id; | |
65 } | |
66 void set_visible_to_total_length_ratio(float ratio) { | 62 void set_visible_to_total_length_ratio(float ratio) { |
67 visible_to_total_length_ratio_ = ratio; | 63 visible_to_total_length_ratio_ = ratio; |
68 } | 64 } |
69 | 65 |
70 void SetCurrentPos(float current_pos) { current_pos_ = current_pos; } | 66 void SetCurrentPos(float current_pos) { current_pos_ = current_pos; } |
71 void SetMaximum(int maximum) { maximum_ = maximum; } | 67 void SetMaximum(int maximum) { maximum_ = maximum; } |
72 | 68 |
73 gfx::Rect ComputeThumbQuadRect() const; | 69 gfx::Rect ComputeThumbQuadRect() const; |
74 | 70 |
71 void set_track_ui_resource_id(UIResourceId id); | |
aelias_OOO_until_Jul13
2013/07/23 00:06:48
Please move these up near the other set_...() call
powei
2013/07/24 02:28:29
Done.
| |
72 void set_thumb_ui_resource_id(UIResourceId id); | |
73 | |
75 protected: | 74 protected: |
76 ScrollbarLayerImpl(LayerTreeImpl* tree_impl, | 75 ScrollbarLayerImpl(LayerTreeImpl* tree_impl, |
77 int id, | 76 int id, |
78 ScrollbarOrientation orientation); | 77 ScrollbarOrientation orientation); |
79 | 78 |
80 private: | 79 private: |
81 virtual const char* LayerTypeAsString() const OVERRIDE; | 80 virtual const char* LayerTypeAsString() const OVERRIDE; |
82 | 81 |
83 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const; | 82 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const; |
84 | 83 |
85 ResourceProvider::ResourceId track_resource_id_; | |
86 ResourceProvider::ResourceId thumb_resource_id_; | |
87 | |
88 float current_pos_; | 84 float current_pos_; |
89 int maximum_; | 85 int maximum_; |
90 int thumb_thickness_; | 86 int thumb_thickness_; |
91 int thumb_length_; | 87 int thumb_length_; |
92 int track_start_; | 88 int track_start_; |
93 int track_length_; | 89 int track_length_; |
94 ScrollbarOrientation orientation_; | 90 ScrollbarOrientation orientation_; |
95 | 91 |
96 // Difference between the clip layer's height and the visible viewport | 92 // Difference between the clip layer's height and the visible viewport |
97 // height (which may differ in the presence of top-controls hiding). | 93 // height (which may differ in the presence of top-controls hiding). |
98 float vertical_adjust_; | 94 float vertical_adjust_; |
99 | 95 |
100 float visible_to_total_length_ratio_; | 96 float visible_to_total_length_ratio_; |
101 | 97 |
102 int scroll_layer_id_; | 98 int scroll_layer_id_; |
103 | 99 |
100 UIResourceId track_ui_resource_id_; | |
101 UIResourceId thumb_ui_resource_id_; | |
102 | |
104 bool is_scrollable_area_active_; | 103 bool is_scrollable_area_active_; |
105 bool is_scroll_view_scrollbar_; | 104 bool is_scroll_view_scrollbar_; |
106 bool enabled_; | 105 bool enabled_; |
107 bool is_custom_scrollbar_; | 106 bool is_custom_scrollbar_; |
108 bool is_overlay_scrollbar_; | 107 bool is_overlay_scrollbar_; |
109 | 108 |
110 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImpl); | 109 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImpl); |
111 }; | 110 }; |
112 | 111 |
113 } // namespace cc | 112 } // namespace cc |
114 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ | 113 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ |
OLD | NEW |