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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |