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

Side by Side Diff: views/controls/button/custom_button.cc

Issue 235025: Use windows keycodes under linux (and all non-windows platforms). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
« no previous file with comments | « chrome/browser/views/tab_contents/tab_contents_view_gtk.cc ('k') | views/event.h » ('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) 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/button/custom_button.h" 5 #include "views/controls/button/custom_button.h"
6 6
7 #include "app/throb_animation.h" 7 #include "app/throb_animation.h"
8 #include "base/keyboard_codes.h" 8 #include "base/keyboard_codes.h"
9 9
10 namespace views { 10 namespace views {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 #if defined(OS_WIN) 92 #if defined(OS_WIN)
93 KeyEvent key_event(Event::ET_KEY_RELEASED, accelerator.GetKeyCode(), 0, 0); 93 KeyEvent key_event(Event::ET_KEY_RELEASED, accelerator.GetKeyCode(), 0, 0);
94 #elif defined(OS_LINUX) 94 #elif defined(OS_LINUX)
95 GdkEventKey gdk_key; 95 GdkEventKey gdk_key;
96 memset(&gdk_key, 0, sizeof(GdkEventKey)); 96 memset(&gdk_key, 0, sizeof(GdkEventKey));
97 gdk_key.type = GDK_KEY_RELEASE; 97 gdk_key.type = GDK_KEY_RELEASE;
98 gdk_key.keyval = accelerator.GetKeyCode(); 98 gdk_key.keyval = accelerator.GetKeyCode();
99 gdk_key.state = (accelerator.IsAltDown() << 3) + 99 gdk_key.state = (accelerator.IsAltDown() << 3) +
100 (accelerator.IsCtrlDown() << 2) + 100 (accelerator.IsCtrlDown() << 2) +
101 accelerator.IsShiftDown(); 101 accelerator.IsShiftDown();
102 KeyEvent key_event(&gdk_key, false); 102 KeyEvent key_event(&gdk_key);
103 #endif 103 #endif
104 NotifyClick(key_event); 104 NotifyClick(key_event);
105 return true; 105 return true;
106 } 106 }
107 return false; 107 return false;
108 } 108 }
109 109
110 bool CustomButton::OnMousePressed(const MouseEvent& e) { 110 bool CustomButton::OnMousePressed(const MouseEvent& e) {
111 if (state_ != BS_DISABLED) { 111 if (state_ != BS_DISABLED) {
112 if (ShouldEnterPushedState(e) && HitTest(e.location())) 112 if (ShouldEnterPushedState(e) && HitTest(e.location()))
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 bool CustomButton::IsHighlighted() const { 258 bool CustomButton::IsHighlighted() const {
259 return state_ == BS_HOT; 259 return state_ == BS_HOT;
260 } 260 }
261 261
262 bool CustomButton::IsPushed() const { 262 bool CustomButton::IsPushed() const {
263 return state_ == BS_PUSHED; 263 return state_ == BS_PUSHED;
264 } 264 }
265 265
266 } // namespace views 266 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/views/tab_contents/tab_contents_view_gtk.cc ('k') | views/event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698