| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // We're about to show the menu from a mouse press. By showing from the | 150 // We're about to show the menu from a mouse press. By showing from the |
| 151 // mouse press event we block RootView in mouse dispatching. This also | 151 // mouse press event we block RootView in mouse dispatching. This also |
| 152 // appears to cause RootView to get a mouse pressed BEFORE the mouse | 152 // appears to cause RootView to get a mouse pressed BEFORE the mouse |
| 153 // release is seen, which means RootView sends us another mouse press no | 153 // release is seen, which means RootView sends us another mouse press no |
| 154 // matter where the user pressed. To force RootView to recalculate the | 154 // matter where the user pressed. To force RootView to recalculate the |
| 155 // mouse target during the mouse press we explicitly set the mouse handler | 155 // mouse target during the mouse press we explicitly set the mouse handler |
| 156 // to NULL. | 156 // to NULL. |
| 157 GetRootView()->SetMouseHandler(NULL); | 157 GetRootView()->SetMouseHandler(NULL); |
| 158 | 158 |
| 159 menu_visible_ = true; | 159 menu_visible_ = true; |
| 160 menu_delegate_->RunMenu(this, menu_position.ToPOINT(), | 160 menu_delegate_->RunMenu(this, menu_position, GetWidget()->GetHWND()); |
| 161 GetWidget()->GetHWND()); | |
| 162 menu_visible_ = false; | 161 menu_visible_ = false; |
| 163 menu_closed_time_ = Time::Now(); | 162 menu_closed_time_ = Time::Now(); |
| 164 | 163 |
| 165 // Now that the menu has closed, we need to manually reset state to | 164 // Now that the menu has closed, we need to manually reset state to |
| 166 // "normal" since the menu modal loop will have prevented normal | 165 // "normal" since the menu modal loop will have prevented normal |
| 167 // mouse move messages from getting to this View. We set "normal" | 166 // mouse move messages from getting to this View. We set "normal" |
| 168 // and not "hot" because the likelihood is that the mouse is now | 167 // and not "hot" because the likelihood is that the mouse is now |
| 169 // somewhere else (user clicked elsewhere on screen to close the menu | 168 // somewhere else (user clicked elsewhere on screen to close the menu |
| 170 // or selected an item) and we will inevitably refresh the hot state | 169 // or selected an item) and we will inevitably refresh the hot state |
| 171 // in the event the mouse _is_ over the view. | 170 // in the event the mouse _is_ over the view. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 248 } |
| 250 | 249 |
| 251 bool MenuButton::GetAccessibleState(VARIANT* state) { | 250 bool MenuButton::GetAccessibleState(VARIANT* state) { |
| 252 DCHECK(state); | 251 DCHECK(state); |
| 253 | 252 |
| 254 state->lVal |= STATE_SYSTEM_HASPOPUP; | 253 state->lVal |= STATE_SYSTEM_HASPOPUP; |
| 255 return true; | 254 return true; |
| 256 } | 255 } |
| 257 | 256 |
| 258 } // namespace views | 257 } // namespace views |
| OLD | NEW |