summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/accessibility/accessibility_types.h17
-rw-r--r--views/accessibility/view_accessibility.cc18
-rw-r--r--views/controls/button/custom_button.cc22
-rw-r--r--views/controls/button/custom_button.h1
4 files changed, 54 insertions, 4 deletions
diff --git a/views/accessibility/accessibility_types.h b/views/accessibility/accessibility_types.h
index 79108b1..fd9f35b 100644
--- a/views/accessibility/accessibility_types.h
+++ b/views/accessibility/accessibility_types.h
@@ -25,10 +25,19 @@ class AccessibilityTypes {
typedef uint32 State;
enum StateFlag {
STATE_CHECKED = 1 << 0,
- STATE_HASPOPUP = 1 << 1,
- STATE_LINKED = 1 << 2,
- STATE_PROTECTED = 1 << 3,
- STATE_READONLY = 1 << 4
+ STATE_COLLAPSED = 1 << 1,
+ STATE_DEFAULT = 1 << 2,
+ STATE_EXPANDED = 1 << 3,
+ STATE_HASPOPUP = 1 << 4,
+ STATE_HOTTRACKED = 1 << 5,
+ STATE_INVISIBLE = 1 << 6,
+ STATE_LINKED = 1 << 7,
+ STATE_OFFSCREEN = 1 << 8,
+ STATE_PRESSED = 1 << 9,
+ STATE_PROTECTED = 1 << 10,
+ STATE_READONLY = 1 << 11,
+ STATE_SELECTED = 1 << 12,
+ STATE_UNAVAILABLE = 1 << 13
};
// This defines an enumeration of the supported accessibility roles in our
diff --git a/views/accessibility/view_accessibility.cc b/views/accessibility/view_accessibility.cc
index 179c9f6..8bb9ed4 100644
--- a/views/accessibility/view_accessibility.cc
+++ b/views/accessibility/view_accessibility.cc
@@ -854,14 +854,32 @@ int32 ViewAccessibility::MSAAState(AccessibilityTypes::State state) {
int32 msaa_state = 0;
if (state & AccessibilityTypes::STATE_CHECKED)
msaa_state |= STATE_SYSTEM_CHECKED;
+ if (state & AccessibilityTypes::STATE_COLLAPSED)
+ msaa_state |= STATE_SYSTEM_COLLAPSED;
+ if (state & AccessibilityTypes::STATE_DEFAULT)
+ msaa_state |= STATE_SYSTEM_DEFAULT;
+ if (state & AccessibilityTypes::STATE_EXPANDED)
+ msaa_state |= STATE_SYSTEM_EXPANDED;
if (state & AccessibilityTypes::STATE_HASPOPUP)
msaa_state |= STATE_SYSTEM_HASPOPUP;
+ if (state & AccessibilityTypes::STATE_HOTTRACKED)
+ msaa_state |= STATE_SYSTEM_HOTTRACKED;
+ if (state & AccessibilityTypes::STATE_INVISIBLE)
+ msaa_state |= STATE_SYSTEM_INVISIBLE;
if (state & AccessibilityTypes::STATE_LINKED)
msaa_state |= STATE_SYSTEM_LINKED;
+ if (state & AccessibilityTypes::STATE_OFFSCREEN)
+ msaa_state |= STATE_SYSTEM_OFFSCREEN;
+ if (state & AccessibilityTypes::STATE_PRESSED)
+ msaa_state |= STATE_SYSTEM_PRESSED;
if (state & AccessibilityTypes::STATE_PROTECTED)
msaa_state |= STATE_SYSTEM_PROTECTED;
if (state & AccessibilityTypes::STATE_READONLY)
msaa_state |= STATE_SYSTEM_READONLY;
+ if (state & AccessibilityTypes::STATE_SELECTED)
+ msaa_state |= STATE_SYSTEM_SELECTED;
+ if (state & AccessibilityTypes::STATE_UNAVAILABLE)
+ msaa_state |= STATE_SYSTEM_UNAVAILABLE;
return msaa_state;
}
diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc
index 8bf68b2..7b203de 100644
--- a/views/controls/button/custom_button.cc
+++ b/views/controls/button/custom_button.cc
@@ -51,6 +51,25 @@ void CustomButton::SetAnimationDuration(int duration) {
////////////////////////////////////////////////////////////////////////////////
// CustomButton, View overrides:
+bool CustomButton::GetAccessibleState(AccessibilityTypes::State* state) {
+ *state = 0;
+ switch (state_) {
+ case BS_NORMAL:
+ *state = 0;
+ case BS_HOT:
+ *state = AccessibilityTypes::STATE_HOTTRACKED;
+ case BS_PUSHED:
+ *state = AccessibilityTypes::STATE_PRESSED;
+ case BS_DISABLED:
+ *state = AccessibilityTypes::STATE_UNAVAILABLE;
+ case BS_COUNT:
+ // No additional accessibility state set for this button state.
+ break;
+ }
+
+ return true;
+}
+
void CustomButton::SetEnabled(bool enabled) {
if (enabled && state_ == BS_DISABLED) {
SetState(BS_NORMAL);
@@ -214,6 +233,9 @@ void CustomButton::ViewHierarchyChanged(bool is_add, View *parent,
void CustomButton::SetHotTracked(bool flag) {
if (state_ != BS_DISABLED)
SetState(flag ? BS_HOT : BS_NORMAL);
+
+ if (flag)
+ NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS);
}
bool CustomButton::IsHotTracked() const {
diff --git a/views/controls/button/custom_button.h b/views/controls/button/custom_button.h
index 5801401..9cfdc54 100644
--- a/views/controls/button/custom_button.h
+++ b/views/controls/button/custom_button.h
@@ -42,6 +42,7 @@ class CustomButton : public Button,
void SetAnimationDuration(int duration);
// Overridden from View:
+ virtual bool GetAccessibleState(AccessibilityTypes::State* state);
virtual void SetEnabled(bool enabled);
virtual bool IsEnabled() const;
virtual bool IsFocusable() const;