LCOV - code coverage report
Current view: directory - accessible/src/xul - nsXULTreeGridAccessible.h (source / functions) Found Hit Coverage
Test: app.info Lines: 5 2 40.0 %
Date: 2012-06-02 Functions: 10 2 20.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is mozilla.org code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Mozilla Foundation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 2009
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Alexander Surkov <surkov.alexander@gmail.com> (original author)
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      27                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #ifndef __nsXULTreeGridAccessible_h__
      40                 : #define __nsXULTreeGridAccessible_h__
      41                 : 
      42                 : #include "nsIAccessibleTable.h"
      43                 : 
      44                 : #include "nsXULTreeAccessible.h"
      45                 : 
      46                 : /**
      47                 :  * Represents accessible for XUL tree in the case when it has multiple columns.
      48                 :  */
      49                 : class nsXULTreeGridAccessible : public nsXULTreeAccessible,
      50                 :                                 public nsIAccessibleTable
      51               0 : {
      52                 : public:
      53                 :   nsXULTreeGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
      54                 : 
      55                 :   // nsISupports
      56                 :   NS_DECL_ISUPPORTS_INHERITED
      57                 : 
      58                 :   // nsIAccessibleTable
      59                 :   NS_DECL_NSIACCESSIBLETABLE
      60                 : 
      61                 :   // nsAccessible
      62                 :   virtual mozilla::a11y::role NativeRole();
      63                 : 
      64                 : protected:
      65                 : 
      66                 :   // nsXULTreeAccessible
      67                 :   virtual already_AddRefed<nsAccessible> CreateTreeItemAccessible(PRInt32 aRow);
      68                 : };
      69                 : 
      70                 : 
      71                 : /**
      72                 :  * Represents accessible for XUL tree item in the case when XUL tree has
      73                 :  * multiple columns.
      74                 :  */
      75                 : class nsXULTreeGridRowAccessible : public nsXULTreeItemAccessibleBase
      76               0 : {
      77                 : public:
      78                 :   using nsAccessible::GetChildCount;
      79                 :   using nsAccessible::GetChildAt;
      80                 : 
      81                 :   nsXULTreeGridRowAccessible(nsIContent* aContent, nsDocAccessible* aDoc,
      82                 :                              nsAccessible* aParent, nsITreeBoxObject* aTree,
      83                 :                              nsITreeView* aTreeView, PRInt32 aRow);
      84                 : 
      85                 :   // nsISupports and cycle collection
      86                 :   NS_DECL_ISUPPORTS_INHERITED
      87            1464 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeGridRowAccessible,
      88                 :                                            nsXULTreeItemAccessibleBase)
      89                 : 
      90                 :   // nsAccessNode
      91                 :   virtual void Shutdown();
      92                 : 
      93                 :   // nsAccessible
      94                 :   virtual mozilla::a11y::role NativeRole();
      95                 :   NS_IMETHOD GetName(nsAString& aName);
      96                 :   virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
      97                 :                                      EWhichChildAtPoint aWhichChild);
      98                 : 
      99                 :   virtual nsAccessible* GetChildAt(PRUint32 aIndex);
     100                 :   virtual PRInt32 GetChildCount();
     101                 : 
     102                 :   // nsXULTreeItemAccessibleBase
     103                 :   virtual nsAccessible* GetCellAccessible(nsITreeColumn *aColumn);
     104                 :   virtual void RowInvalidated(PRInt32 aStartColIdx, PRInt32 aEndColIdx);
     105                 : 
     106                 : protected:
     107                 : 
     108                 :   // nsAccessible
     109                 :   virtual void CacheChildren();
     110                 : 
     111                 :   // nsXULTreeItemAccessibleBase
     112                 :   nsAccessibleHashtable mAccessibleCache;
     113                 : };
     114                 : 
     115                 : 
     116                 : /**
     117                 :  * Represents an accessible for XUL tree cell in the case when XUL tree has
     118                 :  * multiple columns.
     119                 :  */
     120                 : 
     121                 : #define NS_XULTREEGRIDCELLACCESSIBLE_IMPL_CID         \
     122                 : {  /* 84588ad4-549c-4196-a932-4c5ca5de5dff */         \
     123                 :   0x84588ad4,                                         \
     124                 :   0x549c,                                             \
     125                 :   0x4196,                                             \
     126                 :   { 0xa9, 0x32, 0x4c, 0x5c, 0xa5, 0xde, 0x5d, 0xff }  \
     127                 : }
     128                 : 
     129                 : class nsXULTreeGridCellAccessible : public nsLeafAccessible,
     130                 :                                     public nsIAccessibleTableCell
     131               0 : {
     132                 : public:
     133                 :   using nsAccessible::GetParent;
     134                 : 
     135                 :   nsXULTreeGridCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc,
     136                 :                               nsXULTreeGridRowAccessible* aRowAcc,
     137                 :                               nsITreeBoxObject* aTree, nsITreeView* aTreeView,
     138                 :                               PRInt32 aRow, nsITreeColumn* aColumn);
     139                 : 
     140                 :   // nsISupports
     141                 :   NS_DECL_ISUPPORTS_INHERITED
     142            1464 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeGridCellAccessible,
     143                 :                                            nsLeafAccessible)
     144                 : 
     145                 :   // nsIAccessible
     146                 : 
     147                 :   NS_IMETHOD GetName(nsAString& aName);
     148                 :   NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
     149                 :                        PRInt32 *aWidth, PRInt32 *aHeight);
     150                 : 
     151                 :   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
     152                 :   NS_IMETHOD DoAction(PRUint8 aIndex);
     153                 : 
     154                 :   // nsIAccessibleTableCell
     155                 :   NS_DECL_NSIACCESSIBLETABLECELL
     156                 : 
     157                 :   // nsAccessNode
     158                 :   virtual bool IsDefunct() const;
     159                 :   virtual bool Init();
     160                 :   virtual bool IsPrimaryForNode() const;
     161                 : 
     162                 :   // nsAccessible
     163                 :   virtual nsAccessible* FocusedChild();
     164                 :   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
     165                 :   virtual PRInt32 IndexInParent() const;
     166                 :   virtual Relation RelationByType(PRUint32 aType);
     167                 :   virtual mozilla::a11y::role NativeRole();
     168                 :   virtual PRUint64 NativeState();
     169                 : 
     170                 :   // ActionAccessible
     171                 :   virtual PRUint8 ActionCount();
     172                 : 
     173                 :   // nsXULTreeGridCellAccessible
     174                 :   NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEGRIDCELLACCESSIBLE_IMPL_CID)
     175                 : 
     176                 :   /**
     177                 :    * Return index of the column.
     178                 :    */
     179                 :   PRInt32 GetColumnIndex() const;
     180                 : 
     181                 :   /**
     182                 :    * Fire name or state change event if the accessible text or value has been
     183                 :    * changed.
     184                 :    */
     185                 :   void CellInvalidated();
     186                 : 
     187                 : protected:
     188                 :   // nsAccessible
     189                 :   virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
     190                 :                                            nsresult *aError = nsnull) const;
     191                 :   virtual void DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex);
     192                 : 
     193                 :   // nsXULTreeGridCellAccessible
     194                 : 
     195                 :   /**
     196                 :    * Return true if value of cell can be modified.
     197                 :    */
     198                 :   bool IsEditable() const;
     199                 : 
     200                 :   enum { eAction_Click = 0 };
     201                 : 
     202                 :   nsCOMPtr<nsITreeBoxObject> mTree;
     203                 :   nsCOMPtr<nsITreeView> mTreeView;
     204                 : 
     205                 :   PRInt32 mRow;
     206                 :   nsCOMPtr<nsITreeColumn> mColumn;
     207                 : 
     208                 :   nsString mCachedTextEquiv;
     209                 : };
     210                 : 
     211                 : NS_DEFINE_STATIC_IID_ACCESSOR(nsXULTreeGridCellAccessible,
     212                 :                               NS_XULTREEGRIDCELLACCESSIBLE_IMPL_CID)
     213                 : 
     214                 : #endif

Generated by: LCOV version 1.7