| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <atlbase.h> | 5 #include <atlbase.h> |
| 6 #include <atlapp.h> | 6 #include <atlapp.h> |
| 7 | 7 |
| 8 #include "chrome/views/menu_button.h" | 8 #include "chrome/views/menu_button.h" |
| 9 | 9 |
| 10 #include "chrome/app/theme/theme_resources.h" | 10 #include "chrome/app/theme/theme_resources.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 if (show_menu_marker_) { | 84 if (show_menu_marker_) { |
| 85 gfx::Insets insets = GetInsets(); | 85 gfx::Insets insets = GetInsets(); |
| 86 | 86 |
| 87 // We can not use the views' mirroring infrastructure for mirroring a | 87 // We can not use the views' mirroring infrastructure for mirroring a |
| 88 // MenuButton control (see TextButton::Paint() for a detailed explanation | 88 // MenuButton control (see TextButton::Paint() for a detailed explanation |
| 89 // regarding why we can not flip the canvas). Therefore, we need to | 89 // regarding why we can not flip the canvas). Therefore, we need to |
| 90 // manually mirror the position of the down arrow. | 90 // manually mirror the position of the down arrow. |
| 91 gfx::Rect arrow_bounds(width() - insets.right() - | 91 gfx::Rect arrow_bounds(width() - insets.right() - |
| 92 kMenuMarker->width() - kMenuMarkerPaddingRight, | 92 kMenuMarker->width() - kMenuMarkerPaddingRight, |
| 93 height() / 2, | 93 height() / 2 - kMenuMarker->height() / 2, |
| 94 kMenuMarker->width(), | 94 kMenuMarker->width(), |
| 95 kMenuMarker->height()); | 95 kMenuMarker->height()); |
| 96 arrow_bounds.set_x(MirroredLeftPointForRect(arrow_bounds)); | 96 arrow_bounds.set_x(MirroredLeftPointForRect(arrow_bounds)); |
| 97 canvas->DrawBitmapInt(*kMenuMarker, arrow_bounds.x(), arrow_bounds.y()); | 97 canvas->DrawBitmapInt(*kMenuMarker, arrow_bounds.x(), arrow_bounds.y()); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 //////////////////////////////////////////////////////////////////////////////// | 101 //////////////////////////////////////////////////////////////////////////////// |
| 102 // | 102 // |
| 103 // MenuButton - Events | 103 // MenuButton - Events |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // BaseButton::OnMouseExited will get the event and will set the button's state | 250 // BaseButton::OnMouseExited will get the event and will set the button's state |
| 251 // to BS_NORMAL instead of keeping the state BM_PUSHED. This, in turn, will | 251 // to BS_NORMAL instead of keeping the state BM_PUSHED. This, in turn, will |
| 252 // cause the button to appear depressed while the menu is displayed. | 252 // cause the button to appear depressed while the menu is displayed. |
| 253 void MenuButton::OnMouseExited(const MouseEvent& event) { | 253 void MenuButton::OnMouseExited(const MouseEvent& event) { |
| 254 if ((state_ != BS_DISABLED) && (!menu_visible_) && (!InDrag())) { | 254 if ((state_ != BS_DISABLED) && (!menu_visible_) && (!InDrag())) { |
| 255 SetState(BS_NORMAL); | 255 SetState(BS_NORMAL); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace views | 259 } // namespace views |
| OLD | NEW |