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 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 class LayerTreeImpl; | 14 class LayerTreeImpl; |
15 class ScrollView; | 15 class ScrollView; |
16 | 16 |
17 class CC_EXPORT ScrollbarLayerImpl : public LayerImpl { | 17 class CC_EXPORT ScrollbarLayerImpl : public LayerImpl { |
18 public: | 18 public: |
19 static scoped_ptr<ScrollbarLayerImpl> Create( | 19 static scoped_ptr<ScrollbarLayerImpl> Create( |
20 LayerTreeImpl* tree_impl, | 20 LayerTreeImpl* tree_impl, |
21 int id, | 21 int id, |
22 ScrollbarOrientation orientation); | 22 ScrollbarOrientation orientation, |
23 bool is_solid_color); | |
23 virtual ~ScrollbarLayerImpl(); | 24 virtual ~ScrollbarLayerImpl(); |
24 | 25 |
25 // LayerImpl implementation. | 26 // LayerImpl implementation. |
26 virtual ScrollbarLayerImpl* ToScrollbarLayer() OVERRIDE; | 27 virtual ScrollbarLayerImpl* ToScrollbarLayer() OVERRIDE; |
27 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 28 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
28 OVERRIDE; | 29 OVERRIDE; |
29 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; | 30 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; |
30 | 31 |
31 virtual bool WillDraw(DrawMode draw_mode, | 32 virtual bool WillDraw(DrawMode draw_mode, |
32 ResourceProvider* resource_provider) OVERRIDE; | 33 ResourceProvider* resource_provider) OVERRIDE; |
33 virtual void AppendQuads(QuadSink* quad_sink, | 34 virtual void AppendQuads(QuadSink* quad_sink, |
34 AppendQuadsData* append_quads_data) OVERRIDE; | 35 AppendQuadsData* append_quads_data) OVERRIDE; |
35 | 36 |
36 virtual void DidLoseOutputSurface() OVERRIDE; | 37 virtual void DidLoseOutputSurface() OVERRIDE; |
37 | 38 |
38 int scroll_layer_id() const { return scroll_layer_id_; } | 39 int scroll_layer_id() const { return scroll_layer_id_; } |
39 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; } | 40 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; } |
40 | 41 |
41 ScrollbarOrientation Orientation() const; | 42 ScrollbarOrientation Orientation() const; |
43 bool is_solid_color() const; | |
44 void set_is_solid_color(bool is_solid_color); | |
jamesr
2013/07/03 21:26:24
inline these if you're going to use hacker_style n
| |
42 float CurrentPos() const; | 45 float CurrentPos() const; |
43 int Maximum() const; | 46 int Maximum() const; |
44 | 47 |
45 void set_thumb_thickness(int thumb_thickness) { | 48 void set_thumb_thickness(int thumb_thickness) { |
46 thumb_thickness_ = thumb_thickness; | 49 thumb_thickness_ = thumb_thickness; |
47 } | 50 } |
48 void set_thumb_length(int thumb_length) { | 51 void set_thumb_length(int thumb_length) { |
49 thumb_length_ = thumb_length; | 52 thumb_length_ = thumb_length; |
50 } | 53 } |
51 void set_track_start(int track_start) { | 54 void set_track_start(int track_start) { |
(...skipping 16 matching lines...) Expand all Loading... | |
68 } | 71 } |
69 | 72 |
70 void SetCurrentPos(float current_pos) { current_pos_ = current_pos; } | 73 void SetCurrentPos(float current_pos) { current_pos_ = current_pos; } |
71 void SetMaximum(int maximum) { maximum_ = maximum; } | 74 void SetMaximum(int maximum) { maximum_ = maximum; } |
72 | 75 |
73 gfx::Rect ComputeThumbQuadRect() const; | 76 gfx::Rect ComputeThumbQuadRect() const; |
74 | 77 |
75 protected: | 78 protected: |
76 ScrollbarLayerImpl(LayerTreeImpl* tree_impl, | 79 ScrollbarLayerImpl(LayerTreeImpl* tree_impl, |
77 int id, | 80 int id, |
78 ScrollbarOrientation orientation); | 81 ScrollbarOrientation orientation, |
82 bool is_solid_color); | |
79 | 83 |
80 private: | 84 private: |
81 virtual const char* LayerTypeAsString() const OVERRIDE; | 85 virtual const char* LayerTypeAsString() const OVERRIDE; |
82 | 86 |
83 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const; | 87 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const; |
84 | 88 |
85 ResourceProvider::ResourceId track_resource_id_; | 89 ResourceProvider::ResourceId track_resource_id_; |
86 ResourceProvider::ResourceId thumb_resource_id_; | 90 ResourceProvider::ResourceId thumb_resource_id_; |
87 | 91 |
88 float current_pos_; | 92 float current_pos_; |
(...skipping 10 matching lines...) Expand all Loading... | |
99 | 103 |
100 float visible_to_total_length_ratio_; | 104 float visible_to_total_length_ratio_; |
101 | 105 |
102 int scroll_layer_id_; | 106 int scroll_layer_id_; |
103 | 107 |
104 bool is_scrollable_area_active_; | 108 bool is_scrollable_area_active_; |
105 bool is_scroll_view_scrollbar_; | 109 bool is_scroll_view_scrollbar_; |
106 bool enabled_; | 110 bool enabled_; |
107 bool is_custom_scrollbar_; | 111 bool is_custom_scrollbar_; |
108 bool is_overlay_scrollbar_; | 112 bool is_overlay_scrollbar_; |
113 bool is_solid_color_; | |
109 | 114 |
110 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImpl); | 115 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImpl); |
111 }; | 116 }; |
112 | 117 |
113 } // namespace cc | 118 } // namespace cc |
114 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ | 119 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ |
OLD | NEW |