OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_ |
| 7 |
| 8 #include <gtk/gtk.h> |
| 9 |
| 10 #include <string> |
| 11 #include <vector> |
| 12 |
| 13 #include "base/basictypes.h" |
| 14 #include "base/singleton.h" |
| 15 #include "chrome/browser/gtk/accessibility_event_router_gtk.h" |
| 16 #include "chrome/common/accessibility_events.h" |
| 17 |
| 18 class Profile; |
| 19 |
| 20 // Helper class that helps to manage the accessibility information for all |
| 21 // of the widgets in a container. Create an instance of this class for |
| 22 // each container GtkWidget (like a dialog) that should send accessibility |
| 23 // events for all of its descendants. |
| 24 // |
| 25 // Most controls have default behavior for accessibility; when this needs |
| 26 // to be augmented, call one of the methods below to ignore a particular |
| 27 // widget or change its details. |
| 28 // |
| 29 // All of the information managed by this class is registered with the |
| 30 // (global) AccessibilityEventRouter and unregistered when this object is |
| 31 // destroyed. |
| 32 class AccessibleWidgetHelper { |
| 33 public: |
| 34 // Contruct an AccessibleWidgetHelper that makes the given root widget |
| 35 // accessible for the lifetime of this object, sending accessibility |
| 36 // notifications to the given profile. |
| 37 AccessibleWidgetHelper(GtkWidget* root_widget, Profile* profile); |
| 38 |
| 39 virtual ~AccessibleWidgetHelper(); |
| 40 |
| 41 // Do not send accessibility events for this widget |
| 42 void IgnoreWidget(GtkWidget* widget); |
| 43 |
| 44 // Use the following string as the name of this widget, instead of the |
| 45 // gtk label associated with the widget. |
| 46 void SetWidgetName(GtkWidget* widget, std::string name); |
| 47 |
| 48 // Use the following string as the name of this widget, instead of the |
| 49 // gtk label associated with the widget. |
| 50 void SetWidgetName(GtkWidget* widget, int string_id); |
| 51 |
| 52 private: |
| 53 AccessibilityEventRouter* accessibility_event_router_; |
| 54 GtkWidget* root_widget_; |
| 55 std::vector<GtkWidget*> managed_widgets_; |
| 56 }; |
| 57 |
| 58 #endif // CHROME_BROWSER_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_ |
OLD | NEW |