Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: ui/views/controls/scroll_view.h

Issue 2715813002: Change focus indicator for TableView and TreeView. (Closed)
Patch Set: commit the treeview change Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/views/collected_cookies_views.cc ('k') | ui/views/controls/scroll_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ 5 #ifndef UI_VIEWS_CONTROLS_SCROLL_VIEW_H_
6 #define UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ 6 #define UI_VIEWS_CONTROLS_SCROLL_VIEW_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 28 matching lines...) Expand all
39 public: 39 public:
40 static const char kViewClassName[]; 40 static const char kViewClassName[];
41 41
42 ScrollView(); 42 ScrollView();
43 43
44 ~ScrollView() override; 44 ~ScrollView() override;
45 45
46 // Creates a ScrollView with a theme specific border. 46 // Creates a ScrollView with a theme specific border.
47 static ScrollView* CreateScrollViewWithBorder(); 47 static ScrollView* CreateScrollViewWithBorder();
48 48
49 // Returns the ScrollView for which |contents| is its contents, or null if
50 // |contents| is not in a ScrollView.
51 static ScrollView* GetScrollViewForContents(View* contents);
52
49 // Set the contents. Any previous contents will be deleted. The contents 53 // Set the contents. Any previous contents will be deleted. The contents
50 // is the view that needs to scroll. 54 // is the view that needs to scroll.
51 void SetContents(View* a_view); 55 void SetContents(View* a_view);
52 const View* contents() const { return contents_; } 56 const View* contents() const { return contents_; }
53 View* contents() { return contents_; } 57 View* contents() { return contents_; }
54 58
55 // Sets the header, deleting the previous header. 59 // Sets the header, deleting the previous header.
56 void SetHeader(View* header); 60 void SetHeader(View* header);
57 61
58 // Sets the background color. The default is white when scrolling with layers, 62 // Sets the background color. The default is white when scrolling with layers,
(...skipping 22 matching lines...) Expand all
81 85
82 // Returns the horizontal/vertical scrollbar. This may return NULL. 86 // Returns the horizontal/vertical scrollbar. This may return NULL.
83 const ScrollBar* horizontal_scroll_bar() const { return horiz_sb_; } 87 const ScrollBar* horizontal_scroll_bar() const { return horiz_sb_; }
84 const ScrollBar* vertical_scroll_bar() const { return vert_sb_; } 88 const ScrollBar* vertical_scroll_bar() const { return vert_sb_; }
85 89
86 // Customize the scrollbar design. ScrollView takes the ownership of the 90 // Customize the scrollbar design. ScrollView takes the ownership of the
87 // specified ScrollBar. |horiz_sb| and |vert_sb| cannot be NULL. 91 // specified ScrollBar. |horiz_sb| and |vert_sb| cannot be NULL.
88 void SetHorizontalScrollBar(ScrollBar* horiz_sb); 92 void SetHorizontalScrollBar(ScrollBar* horiz_sb);
89 void SetVerticalScrollBar(ScrollBar* vert_sb); 93 void SetVerticalScrollBar(ScrollBar* vert_sb);
90 94
91 // Sets whether this ScrollView has a focus ring or not. 95 // Sets whether this ScrollView has a focus indicator or not.
92 void SetHasFocusRing(bool has_focus_ring); 96 void SetHasFocusRing(bool has_focus_ring);
Elly Fong-Jones 2017/02/24 14:44:30 might be good to rename this to SetHasFocusIndicat
Evan Stade 2017/02/24 16:55:56 the reason I didn't do that is because FocusRing w
93 97
94 // View overrides: 98 // View overrides:
95 gfx::Size GetPreferredSize() const override; 99 gfx::Size GetPreferredSize() const override;
96 int GetHeightForWidth(int width) const override; 100 int GetHeightForWidth(int width) const override;
97 void Layout() override; 101 void Layout() override;
98 bool OnKeyPressed(const ui::KeyEvent& event) override; 102 bool OnKeyPressed(const ui::KeyEvent& event) override;
99 bool OnMouseWheel(const ui::MouseWheelEvent& e) override; 103 bool OnMouseWheel(const ui::MouseWheelEvent& e) override;
100 void OnScrollEvent(ui::ScrollEvent* event) override; 104 void OnScrollEvent(ui::ScrollEvent* event) override;
101 void OnGestureEvent(ui::GestureEvent* event) override; 105 void OnGestureEvent(ui::GestureEvent* event) override;
102 const char* GetClassName() const override; 106 const char* GetClassName() const override;
107 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
103 108
104 // ScrollBarController overrides: 109 // ScrollBarController overrides:
105 void ScrollToPosition(ScrollBar* source, int position) override; 110 void ScrollToPosition(ScrollBar* source, int position) override;
106 int GetScrollIncrement(ScrollBar* source, 111 int GetScrollIncrement(ScrollBar* source,
107 bool is_page, 112 bool is_page,
108 bool is_positive) override; 113 bool is_positive) override;
109 114
110 // TODO(djacobo): Remove this method when http://crbug.com/656198 is closed. 115 // TODO(djacobo): Remove this method when http://crbug.com/656198 is closed.
111 // Force |contents_viewport_| to enable a Layer(). 116 // Force |contents_viewport_| to enable a Layer().
112 void EnableViewPortLayer(); 117 void EnableViewPortLayer();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 152
148 // Whether the ScrollView scrolls using ui::Layer APIs. 153 // Whether the ScrollView scrolls using ui::Layer APIs.
149 bool ScrollsWithLayers() const; 154 bool ScrollsWithLayers() const;
150 155
151 // Callback entrypoint when hosted Layers are scrolled by the Compositor. 156 // Callback entrypoint when hosted Layers are scrolled by the Compositor.
152 void OnLayerScrolled(const gfx::ScrollOffset& offset); 157 void OnLayerScrolled(const gfx::ScrollOffset& offset);
153 158
154 // Horizontally scrolls the header (if any) to match the contents. 159 // Horizontally scrolls the header (if any) to match the contents.
155 void ScrollHeader(); 160 void ScrollHeader();
156 161
162 void AddBorder();
163 void UpdateBorder();
164
157 // The current contents and its viewport. |contents_| is contained in 165 // The current contents and its viewport. |contents_| is contained in
158 // |contents_viewport_|. 166 // |contents_viewport_|.
159 View* contents_; 167 View* contents_;
160 View* contents_viewport_; 168 View* contents_viewport_;
161 169
162 // The current header and its viewport. |header_| is contained in 170 // The current header and its viewport. |header_| is contained in
163 // |header_viewport_|. 171 // |header_viewport_|.
164 View* header_; 172 View* header_;
165 View* header_viewport_; 173 View* header_viewport_;
166 174
(...skipping 12 matching lines...) Expand all
179 int max_height_; 187 int max_height_;
180 188
181 // The background color given to the viewport (for overscroll), and to the 189 // The background color given to the viewport (for overscroll), and to the
182 // contents when scrolling with layers. 190 // contents when scrolling with layers.
183 SkColor background_color_; 191 SkColor background_color_;
184 192
185 // If true, never show the horizontal scrollbar (even if the contents is wider 193 // If true, never show the horizontal scrollbar (even if the contents is wider
186 // than the viewport). 194 // than the viewport).
187 bool hide_horizontal_scrollbar_; 195 bool hide_horizontal_scrollbar_;
188 196
197 // In Harmony, the indicator is a focus ring. Pre-Harmony, the indicator is a
198 // different border painter.
199 bool draw_focus_indicator_ = false;
200
201 // Only needed for pre-Harmony. Remove when Harmony is default.
202 bool draw_border_ = false;
203
189 // Focus ring, if one is installed. 204 // Focus ring, if one is installed.
190 View* focus_ring_ = nullptr; 205 View* focus_ring_ = nullptr;
191 206
192 DISALLOW_COPY_AND_ASSIGN(ScrollView); 207 DISALLOW_COPY_AND_ASSIGN(ScrollView);
193 }; 208 };
194 209
195 // VariableRowHeightScrollHelper is intended for views that contain rows of 210 // VariableRowHeightScrollHelper is intended for views that contain rows of
196 // varying height. To use a VariableRowHeightScrollHelper create one supplying 211 // varying height. To use a VariableRowHeightScrollHelper create one supplying
197 // a Controller and delegate GetPageScrollIncrement and GetLineScrollIncrement 212 // a Controller and delegate GetPageScrollIncrement and GetLineScrollIncrement
198 // to the helper. VariableRowHeightScrollHelper calls back to the 213 // to the helper. VariableRowHeightScrollHelper calls back to the
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 private: 273 private:
259 int top_margin_; 274 int top_margin_;
260 int row_height_; 275 int row_height_;
261 276
262 DISALLOW_COPY_AND_ASSIGN(FixedRowHeightScrollHelper); 277 DISALLOW_COPY_AND_ASSIGN(FixedRowHeightScrollHelper);
263 }; 278 };
264 279
265 } // namespace views 280 } // namespace views
266 281
267 #endif // UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ 282 #endif // UI_VIEWS_CONTROLS_SCROLL_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/collected_cookies_views.cc ('k') | ui/views/controls/scroll_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698