Home | History | Annotate | Download | only in accessibility
      1 // Copyright (c) 2012 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 CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_GTK_H_
      6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_GTK_H_
      7 
      8 #include <atk/atk.h>
      9 
     10 #include "base/compiler_specific.h"
     11 #include "content/browser/accessibility/browser_accessibility.h"
     12 
     13 namespace content {
     14 
     15 class BrowserAccessibilityGtk;
     16 class BrowserAccessibilityManagerGtk;
     17 
     18 G_BEGIN_DECLS
     19 
     20 #define BROWSER_ACCESSIBILITY_TYPE (browser_accessibility_get_type())
     21 #define BROWSER_ACCESSIBILITY(obj) \
     22     (G_TYPE_CHECK_INSTANCE_CAST( \
     23              (obj), BROWSER_ACCESSIBILITY_TYPE, BrowserAccessibilityAtk))
     24 #define BROWSER_ACCESSIBILITY_CLASS(klass) \
     25     (G_TYPE_CHECK_CLASS_CAST( \
     26         (klass), BROWSER_ACCESSIBILITY_TYPE, BrowserAccessibilityAtkClass))
     27 #define IS_BROWSER_ACCESSIBILITY(obj) \
     28     (G_TYPE_CHECK_INSTANCE_TYPE((obj), BROWSER_ACCESSIBILITY_TYPE))
     29 #define IS_BROWSER_ACCESSIBILITY_CLASS(klass) \
     30     (G_TYPE_CHECK_CLASS_TYPE((klass), BROWSER_ACCESSIBILITY_TYPE))
     31 #define BROWSER_ACCESSIBILITY_GET_CLASS(obj) \
     32     (G_TYPE_INSTANCE_GET_CLASS( \
     33         (obj), BROWSER_ACCESSIBILITY_TYPE, BrowserAccessibilityAtkClass))
     34 
     35 typedef struct _BrowserAccessibilityAtk      BrowserAccessibilityAtk;
     36 typedef struct _BrowserAccessibilityAtkClass BrowserAccessibilityAtkClass;
     37 
     38 struct _BrowserAccessibilityAtk {
     39   AtkObject parent;
     40   BrowserAccessibilityGtk* m_object;
     41 };
     42 
     43 struct _BrowserAccessibilityAtkClass {
     44   AtkObjectClass parent_class;
     45 };
     46 
     47 GType browser_accessibility_get_type (void) G_GNUC_CONST;
     48 
     49 BrowserAccessibilityAtk* browser_accessibility_new(
     50     BrowserAccessibilityGtk* object);
     51 
     52 BrowserAccessibilityGtk* browser_accessibility_get_object(
     53     BrowserAccessibilityAtk* atk_object);
     54 
     55 void browser_accessibility_detach (BrowserAccessibilityAtk* atk_object);
     56 
     57 AtkObject* browser_accessibility_get_focused_element(
     58     BrowserAccessibilityAtk* atk_object);
     59 
     60 G_END_DECLS
     61 
     62 class BrowserAccessibilityGtk : public BrowserAccessibility {
     63  public:
     64   BrowserAccessibilityGtk();
     65 
     66   virtual ~BrowserAccessibilityGtk();
     67 
     68   AtkObject* GetAtkObject() const;
     69 
     70   AtkRole atk_role() { return atk_role_; }
     71 
     72   // BrowserAccessibility methods.
     73   virtual void PreInitialize() OVERRIDE;
     74   virtual bool IsNative() const OVERRIDE;
     75 
     76  private:
     77   virtual void InitRoleAndState();
     78 
     79   // Give BrowserAccessibility::Create access to our constructor.
     80   friend class BrowserAccessibility;
     81 
     82   AtkObject* atk_object_;
     83   AtkRole atk_role_;
     84   int interface_mask_;
     85 
     86  private:
     87   DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityGtk);
     88 };
     89 
     90 }  // namespace content
     91 
     92 #endif  // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_GTK_H_
     93