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