| 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 <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "views/views_delegate.h" | |
| 11 | 10 |
| 12 namespace views { | 11 namespace views { |
| 13 | 12 |
| 14 // static | 13 // static |
| 15 int View::GetDoubleClickTimeMS() { | 14 int View::GetDoubleClickTimeMS() { |
| 16 GdkDisplay* display = gdk_display_get_default(); | 15 GdkDisplay* display = gdk_display_get_default(); |
| 17 return display ? display->double_click_time : 500; | 16 return display ? display->double_click_time : 500; |
| 18 } | 17 } |
| 19 | 18 |
| 20 int View::GetMenuShowDelay() { | 19 int View::GetMenuShowDelay() { |
| 21 return kShowFolderDropMenuDelay; | 20 return kShowFolderDropMenuDelay; |
| 22 } | 21 } |
| 23 | 22 |
| 24 void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type) { | 23 void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type) { |
| 25 NotifyAccessibilityEvent(event_type, true); | 24 // Not implemented on GTK. |
| 26 } | |
| 27 | |
| 28 void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type, | |
| 29 bool send_native_event) { | |
| 30 // Send the notification to the delegate. | |
| 31 if (ViewsDelegate::views_delegate) | |
| 32 ViewsDelegate::views_delegate->NotifyAccessibilityEvent(this, event_type); | |
| 33 | |
| 34 // In the future if we add native GTK accessibility support, the | |
| 35 // notification should be sent here. | |
| 36 } | 25 } |
| 37 | 26 |
| 38 ViewAccessibilityWrapper* View::GetViewAccessibilityWrapper() { | 27 ViewAccessibilityWrapper* View::GetViewAccessibilityWrapper() { |
| 39 NOTIMPLEMENTED(); | 28 NOTIMPLEMENTED(); |
| 40 return NULL; | 29 return NULL; |
| 41 } | 30 } |
| 42 | 31 |
| 43 int View::GetHorizontalDragThreshold() { | 32 int View::GetHorizontalDragThreshold() { |
| 44 static bool determined_threshold = false; | 33 static bool determined_threshold = false; |
| 45 static int drag_threshold = 8; | 34 static int drag_threshold = 8; |
| 46 if (determined_threshold) | 35 if (determined_threshold) |
| 47 return drag_threshold; | 36 return drag_threshold; |
| 48 determined_threshold = true; | 37 determined_threshold = true; |
| 49 GtkSettings* settings = gtk_settings_get_default(); | 38 GtkSettings* settings = gtk_settings_get_default(); |
| 50 if (!settings) | 39 if (!settings) |
| 51 return drag_threshold; | 40 return drag_threshold; |
| 52 int value = 0; | 41 int value = 0; |
| 53 g_object_get(G_OBJECT(settings), "gtk-dnd-drag-threshold", &value, NULL); | 42 g_object_get(G_OBJECT(settings), "gtk-dnd-drag-threshold", &value, NULL); |
| 54 if (value) | 43 if (value) |
| 55 drag_threshold = value; | 44 drag_threshold = value; |
| 56 return drag_threshold; | 45 return drag_threshold; |
| 57 } | 46 } |
| 58 | 47 |
| 59 int View::GetVerticalDragThreshold() { | 48 int View::GetVerticalDragThreshold() { |
| 60 // Vertical and horizontal drag threshold are the same in Gtk. | 49 // Vertical and horizontal drag threshold are the same in Gtk. |
| 61 return GetHorizontalDragThreshold(); | 50 return GetHorizontalDragThreshold(); |
| 62 } | 51 } |
| 63 | 52 |
| 64 } // namespace views | 53 } // namespace views |
| OLD | NEW |