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

Side by Side Diff: views/controls/scrollbar/native_scroll_bar_gtk.cc

Issue 6480001: Migrate Event API methods to Google Style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
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"
(...skipping 26 matching lines...) Expand all
37 return gfx::Size(0, GetHorizontalScrollBarHeight()); 37 return gfx::Size(0, GetHorizontalScrollBarHeight());
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.key_code()) {
48 case ui::VKEY_UP: 48 case ui::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 ui::VKEY_DOWN: 52 case ui::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 ui::VKEY_LEFT: 56 case ui::VKEY_LEFT:
57 if (native_scroll_bar_->IsHorizontal()) 57 if (native_scroll_bar_->IsHorizontal())
(...skipping 17 matching lines...) Expand all
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())
84 return false; 84 return false;
85 MoveBy(-e.GetOffset()); // e.GetOffset() > 0 means scroll up. 85 MoveBy(-e.offset()); // e.GetOffset() > 0 means scroll up.
86 return true; 86 return true;
87 } 87 }
88 88
89 //////////////////////////////////////////////////////////////////////////////// 89 ////////////////////////////////////////////////////////////////////////////////
90 // NativeScrollBarGtk, NativeControlGtk overrides: 90 // NativeScrollBarGtk, NativeControlGtk overrides:
91 91
92 void NativeScrollBarGtk::CreateNativeControl() { 92 void NativeScrollBarGtk::CreateNativeControl() {
93 GtkObject* adj = gtk_adjustment_new(native_scroll_bar_->GetMinPosition(), 93 GtkObject* adj = gtk_adjustment_new(native_scroll_bar_->GetMinPosition(),
94 native_scroll_bar_->GetMinPosition(), 94 native_scroll_bar_->GetMinPosition(),
95 native_scroll_bar_->GetMaxPosition(), 95 native_scroll_bar_->GetMaxPosition(),
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698