| 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 "app/keyboard_codes_posix.h" |    9 #include "base/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/scroll_bar.h" |   11 #include "views/controls/scrollbar/scroll_bar.h" | 
|   12  |   12  | 
|   13 namespace views { |   13 namespace views { | 
|   14  |   14  | 
|   15 //////////////////////////////////////////////////////////////////////////////// |   15 //////////////////////////////////////////////////////////////////////////////// | 
|   16 // NativeScrollBarGtk, public: |   16 // NativeScrollBarGtk, public: | 
|   17  |   17  | 
|   18 NativeScrollBarGtk::NativeScrollBarGtk(NativeScrollBar* scroll_bar) |   18 NativeScrollBarGtk::NativeScrollBarGtk(NativeScrollBar* scroll_bar) | 
|   19     : NativeControlGtk(), |   19     : NativeControlGtk(), | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
|   38   return gfx::Size(GetVerticalScrollBarWidth(), 0); |   38   return gfx::Size(GetVerticalScrollBarWidth(), 0); | 
|   39 } |   39 } | 
|   40  |   40  | 
|   41 // TODO(oshima|jcampan): key/mouse events are not delievered and |   41 // TODO(oshima|jcampan): key/mouse events are not delievered and | 
|   42 // the following code is not tested. It requires the focus manager to be fully |   42 // the following code is not tested. It requires the focus manager to be fully | 
|   43 // implemented. |   43 // implemented. | 
|   44 bool NativeScrollBarGtk::OnKeyPressed(const KeyEvent& event) { |   44 bool NativeScrollBarGtk::OnKeyPressed(const KeyEvent& event) { | 
|   45   if (!native_view()) |   45   if (!native_view()) | 
|   46     return false; |   46     return false; | 
|   47   switch (event.GetKeyCode()) { |   47   switch (event.GetKeyCode()) { | 
|   48     case app::VKEY_UP: |   48     case base::VKEY_UP: | 
|   49       if (!native_scroll_bar_->IsHorizontal()) |   49       if (!native_scroll_bar_->IsHorizontal()) | 
|   50         MoveStep(false /* negative */); |   50         MoveStep(false /* negative */); | 
|   51       break; |   51       break; | 
|   52     case app::VKEY_DOWN: |   52     case base::VKEY_DOWN: | 
|   53       if (!native_scroll_bar_->IsHorizontal()) |   53       if (!native_scroll_bar_->IsHorizontal()) | 
|   54         MoveStep(true /* positive */); |   54         MoveStep(true /* positive */); | 
|   55       break; |   55       break; | 
|   56     case app::VKEY_LEFT: |   56     case base::VKEY_LEFT: | 
|   57       if (native_scroll_bar_->IsHorizontal()) |   57       if (native_scroll_bar_->IsHorizontal()) | 
|   58         MoveStep(false /* negative */); |   58         MoveStep(false /* negative */); | 
|   59       break; |   59       break; | 
|   60     case app::VKEY_RIGHT: |   60     case base::VKEY_RIGHT: | 
|   61       if (native_scroll_bar_->IsHorizontal()) |   61       if (native_scroll_bar_->IsHorizontal()) | 
|   62         MoveStep(true /* positive */); |   62         MoveStep(true /* positive */); | 
|   63       break; |   63       break; | 
|   64     case app::VKEY_PRIOR: |   64     case base::VKEY_PRIOR: | 
|   65       MovePage(false /* negative */); |   65       MovePage(false /* negative */); | 
|   66       break; |   66       break; | 
|   67     case app::VKEY_NEXT: |   67     case base::VKEY_NEXT: | 
|   68       MovePage(true /* positive */); |   68       MovePage(true /* positive */); | 
|   69       break; |   69       break; | 
|   70     case app::VKEY_HOME: |   70     case base::VKEY_HOME: | 
|   71       MoveTo(0); |   71       MoveTo(0); | 
|   72       break; |   72       break; | 
|   73     case app::VKEY_END: |   73     case base::VKEY_END: | 
|   74       MoveToBottom(); |   74       MoveToBottom(); | 
|   75       break; |   75       break; | 
|   76     default: |   76     default: | 
|   77       return false; |   77       return false; | 
|   78   } |   78   } | 
|   79   return true; |   79   return true; | 
|   80 } |   80 } | 
|   81  |   81  | 
|   82 bool NativeScrollBarGtk::OnMouseWheel(const MouseWheelEvent& e) { |   82 bool NativeScrollBarGtk::OnMouseWheel(const MouseWheelEvent& e) { | 
|   83   if (!native_view()) |   83   if (!native_view()) | 
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  208   return 20; |  208   return 20; | 
|  209 } |  209 } | 
|  210  |  210  | 
|  211 // static |  211 // static | 
|  212 int NativeScrollBarWrapper::GetVerticalScrollBarWidth() { |  212 int NativeScrollBarWrapper::GetVerticalScrollBarWidth() { | 
|  213   // TODO(oshima): get this from gtk's widget property "slider-width". |  213   // TODO(oshima): get this from gtk's widget property "slider-width". | 
|  214   return 20; |  214   return 20; | 
|  215 } |  215 } | 
|  216  |  216  | 
|  217 }  // namespace views |  217 }  // namespace views | 
| OLD | NEW |