| 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/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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 bool CustomButton::AcceleratorPressed(const Accelerator& accelerator) { | 89 bool CustomButton::AcceleratorPressed(const Accelerator& accelerator) { |
| 90 if (enabled_) { | 90 if (enabled_) { |
| 91 SetState(BS_NORMAL); | 91 SetState(BS_NORMAL); |
| 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, false); |
| 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) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 243 |
| 244 bool CustomButton::IsHighlighted() const { | 244 bool CustomButton::IsHighlighted() const { |
| 245 return state_ == BS_HOT; | 245 return state_ == BS_HOT; |
| 246 } | 246 } |
| 247 | 247 |
| 248 bool CustomButton::IsPushed() const { | 248 bool CustomButton::IsPushed() const { |
| 249 return state_ == BS_PUSHED; | 249 return state_ == BS_PUSHED; |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace views | 252 } // namespace views |
| OLD | NEW |