[banshee/a11y] [a11y] Use STATE_ACTIVE in ListView cells properly



commit 612af2b35c408e77d05b22874263fc52d7243031
Author: Eitan Isaacson <eitan ascender com>
Date:   Mon Oct 12 12:23:31 2009 -0700

    [a11y] Use STATE_ACTIVE in ListView cells properly

 .../Accessibility/ColumnCellAccessible.cs          |    3 ++
 .../Accessibility/ICellAccessibleParent.cs         |    1 +
 .../Accessibility/ListViewAccessible.cs            |   21 +++++++++++++------
 3 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ColumnCellAccessible.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ColumnCellAccessible.cs
index da2975a..10dbc4e 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ColumnCellAccessible.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ColumnCellAccessible.cs
@@ -63,6 +63,9 @@ namespace Hyena.Data.Gui.Accessibility
             if (cell_parent.IsCellSelected (this))
                 states.AddState (Atk.StateType.Selected);
 
+            if (cell_parent.IsCellActive (this))
+                states.AddState (Atk.StateType.Active);
+
             return states;
         }
 
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ICellAccessibleParent.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ICellAccessibleParent.cs
index da4a29e..499a2ab 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ICellAccessibleParent.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ICellAccessibleParent.cs
@@ -37,6 +37,7 @@ namespace Hyena.Data.Gui.Accessibility
         bool IsCellShowing (ColumnCellAccessible cell);
         bool IsCellFocused (ColumnCellAccessible cell);
         bool IsCellSelected (ColumnCellAccessible cell);
+        bool IsCellActive (ColumnCellAccessible cell);
         void InvokeColumnHeaderMenu (ColumnCellAccessible column);
         void ClickColumnHeader (ColumnCellAccessible column);
         void CellRedrawn (int column, int row);
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible.cs
index 80d8f9b..953d6c8 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible.cs
@@ -132,14 +132,16 @@ namespace Hyena.Data.Gui.Accessibility
 
         private void OnSelectionFocusChanged (object o, EventArgs a)
         {
-            Atk.Object cell;
-
-            if (list_view.HeaderFocused)
-                cell = OnRefChild (list_view.ActiveColumn);
-            else
-                cell = RefAt (list_view.Selection.FocusedIndex, list_view.ActiveColumn);
+            GLib.Signal.Emit (this, "active-descendant-changed", ActiveCell);
+        }
 
-            GLib.Signal.Emit (this, "active-descendant-changed", cell.Handle);
+        private Atk.Object ActiveCell {
+            get {
+                if (list_view.HeaderFocused)
+                    return OnRefChild (list_view.ActiveColumn);
+                else
+                    return RefAt (list_view.Selection.FocusedIndex, list_view.ActiveColumn);
+            }
         }
 
         private int n_columns {
@@ -207,6 +209,11 @@ namespace Hyena.Data.Gui.Accessibility
             return IsChildSelected (GetCellIndex (cell));
         }
 
+        public bool IsCellActive (ColumnCellAccessible cell)
+        {
+            return (ActiveCell == (Atk.Object)cell);
+        }
+
         public void InvokeColumnHeaderMenu (ColumnCellAccessible cell)
         {
             list_view.InvokeColumnHeaderMenu (GetCellIndex (cell));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]