| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/view.h" | 5 #include "views/view.h" |
| 6 | 6 |
| 7 #include "app/drag_drop_types.h" | 7 #include "app/drag_drop_types.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "gfx/canvas.h" | 9 #include "gfx/canvas.h" |
| 10 #include "gfx/path.h" | 10 #include "gfx/path.h" |
| 11 #include "views/accessibility/view_accessibility.h" |
| 11 #include "views/accessibility/view_accessibility_wrapper.h" | 12 #include "views/accessibility/view_accessibility_wrapper.h" |
| 12 #include "views/border.h" | 13 #include "views/border.h" |
| 13 #include "views/widget/root_view.h" | 14 #include "views/widget/root_view.h" |
| 14 #include "views/widget/widget.h" | 15 #include "views/widget/widget.h" |
| 16 #include "views/widget/widget_win.h" |
| 15 | 17 |
| 16 namespace views { | 18 namespace views { |
| 17 | 19 |
| 18 // static | 20 // static |
| 19 int View::GetDoubleClickTimeMS() { | 21 int View::GetDoubleClickTimeMS() { |
| 20 return ::GetDoubleClickTime(); | 22 return ::GetDoubleClickTime(); |
| 21 } | 23 } |
| 22 | 24 |
| 23 // static | 25 // static |
| 24 int View::GetMenuShowDelay() { | 26 int View::GetMenuShowDelay() { |
| 25 static DWORD delay = 0; | 27 static DWORD delay = 0; |
| 26 if (!delay && !SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &delay, 0)) | 28 if (!delay && !SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &delay, 0)) |
| 27 delay = View::kShowFolderDropMenuDelay; | 29 delay = View::kShowFolderDropMenuDelay; |
| 28 return delay; | 30 return delay; |
| 29 } | 31 } |
| 30 | 32 |
| 33 // Notifies accessibility clients of the event_type on this view. |
| 34 // Clients will call get_accChild found in ViewAccessibility with the supplied |
| 35 // child id we generate here to retrieve the IAccessible associated with this |
| 36 // view. |
| 37 void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type) { |
| 38 WidgetWin* view_widget = static_cast<WidgetWin*>(GetWidget()); |
| 39 int child_id = view_widget->AddAccessibilityViewEvent(this); |
| 40 ::NotifyWinEvent(ViewAccessibility::MSAAEvent(event_type), |
| 41 view_widget->GetNativeView(), OBJID_CLIENT, child_id); |
| 42 } |
| 43 |
| 31 ViewAccessibilityWrapper* View::GetViewAccessibilityWrapper() { | 44 ViewAccessibilityWrapper* View::GetViewAccessibilityWrapper() { |
| 32 if (accessibility_.get() == NULL) { | 45 if (accessibility_.get() == NULL) { |
| 33 accessibility_.reset(new ViewAccessibilityWrapper(this)); | 46 accessibility_.reset(new ViewAccessibilityWrapper(this)); |
| 34 } | 47 } |
| 35 return accessibility_.get(); | 48 return accessibility_.get(); |
| 36 } | 49 } |
| 37 | 50 |
| 38 int View::GetHorizontalDragThreshold() { | 51 int View::GetHorizontalDragThreshold() { |
| 39 static int threshold = -1; | 52 static int threshold = -1; |
| 40 if (threshold == -1) | 53 if (threshold == -1) |
| 41 threshold = GetSystemMetrics(SM_CXDRAG) / 2; | 54 threshold = GetSystemMetrics(SM_CXDRAG) / 2; |
| 42 return threshold; | 55 return threshold; |
| 43 } | 56 } |
| 44 | 57 |
| 45 int View::GetVerticalDragThreshold() { | 58 int View::GetVerticalDragThreshold() { |
| 46 static int threshold = -1; | 59 static int threshold = -1; |
| 47 if (threshold == -1) | 60 if (threshold == -1) |
| 48 threshold = GetSystemMetrics(SM_CYDRAG) / 2; | 61 threshold = GetSystemMetrics(SM_CYDRAG) / 2; |
| 49 return threshold; | 62 return threshold; |
| 50 } | 63 } |
| 51 | 64 |
| 52 } // namespace views | 65 } // namespace views |
| OLD | NEW |