OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "views/controls/scrollbar/native_scroll_bar_gtk.h" | 5 #include "views/controls/scrollbar/native_scroll_bar_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "ui/base/keycodes/keyboard_codes_posix.h" | 9 #include "ui/base/keycodes/keyboard_codes_posix.h" |
10 #include "views/controls/scrollbar/native_scroll_bar.h" | 10 #include "views/controls/scrollbar/native_scroll_bar.h" |
11 #include "views/controls/scrollbar/native_scroll_bar_views.h" | |
12 #include "views/controls/scrollbar/scroll_bar.h" | 11 #include "views/controls/scrollbar/scroll_bar.h" |
13 #include "views/widget/widget.h" | |
14 | 12 |
15 namespace views { | 13 namespace views { |
16 | 14 |
17 //////////////////////////////////////////////////////////////////////////////// | 15 //////////////////////////////////////////////////////////////////////////////// |
18 // NativeScrollBarGtk, public: | 16 // NativeScrollBarGtk, public: |
19 | 17 |
20 NativeScrollBarGtk::NativeScrollBarGtk(NativeScrollBar* scroll_bar) | 18 NativeScrollBarGtk::NativeScrollBarGtk(NativeScrollBar* scroll_bar) |
21 : NativeControlGtk(), | 19 : NativeControlGtk(), |
22 native_scroll_bar_(scroll_bar) { | 20 native_scroll_bar_(scroll_bar) { |
23 set_focus_view(scroll_bar); | 21 set_focus_view(scroll_bar); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(native_view())); | 192 GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(native_view())); |
195 MoveTo(adj->upper); | 193 MoveTo(adj->upper); |
196 } | 194 } |
197 | 195 |
198 //////////////////////////////////////////////////////////////////////////////// | 196 //////////////////////////////////////////////////////////////////////////////// |
199 // NativewScrollBarWrapper, public: | 197 // NativewScrollBarWrapper, public: |
200 | 198 |
201 // static | 199 // static |
202 NativeScrollBarWrapper* NativeScrollBarWrapper::CreateWrapper( | 200 NativeScrollBarWrapper* NativeScrollBarWrapper::CreateWrapper( |
203 NativeScrollBar* scroll_bar) { | 201 NativeScrollBar* scroll_bar) { |
204 if (Widget::IsPureViews()) | |
205 return new NativeScrollBarViews(scroll_bar); | |
206 return new NativeScrollBarGtk(scroll_bar); | 202 return new NativeScrollBarGtk(scroll_bar); |
207 } | 203 } |
208 | 204 |
209 // static | 205 // static |
210 int NativeScrollBarWrapper::GetHorizontalScrollBarHeight() { | 206 int NativeScrollBarWrapper::GetHorizontalScrollBarHeight() { |
211 // TODO(oshima): get this from gtk's widget property "slider-width". | 207 // TODO(oshima): get this from gtk's widget property "slider-width". |
212 return 20; | 208 return 20; |
213 } | 209 } |
214 | 210 |
215 // static | 211 // static |
216 int NativeScrollBarWrapper::GetVerticalScrollBarWidth() { | 212 int NativeScrollBarWrapper::GetVerticalScrollBarWidth() { |
217 // TODO(oshima): get this from gtk's widget property "slider-width". | 213 // TODO(oshima): get this from gtk's widget property "slider-width". |
218 return 20; | 214 return 20; |
219 } | 215 } |
220 | 216 |
221 } // namespace views | 217 } // namespace views |
OLD | NEW |