Back to index

lightning-sunbird  0.9+nobinonly
nsXULSelectAccessible.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Kyle Yuan (kyle.yuan@sun.com)
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 #ifndef __nsXULSelectAccessible_h__
00039 #define __nsXULSelectAccessible_h__
00040 
00041 #include "nsCOMPtr.h"
00042 #include "nsIAccessibleSelectable.h"
00043 #include "nsXULMenuAccessible.h"
00044 
00045 class nsIWeakReference;
00046 
00069 /*
00070  * The basic implemetation of nsIAccessibleSelectable.
00071  */
00072 class nsXULSelectableAccessible : public nsAccessibleWrap
00073 {
00074 public:
00075   NS_DECL_ISUPPORTS_INHERITED
00076   NS_DECL_NSIACCESSIBLESELECTABLE
00077 
00078   nsXULSelectableAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
00079   virtual ~nsXULSelectableAccessible() {}
00080 
00081   NS_IMETHOD GetName(nsAString& _retval);
00082 
00083 protected:
00084   NS_IMETHOD ChangeSelection(PRInt32 aIndex, PRUint8 aMethod, PRBool *aSelState);
00085   nsresult AppendFlatStringFromSubtree(nsIContent *aContent, nsAString *aFlatString)
00086     { return NS_ERROR_FAILURE; }  // Overrides base impl in nsAccessible
00087 };
00088 
00089 /*
00090  * The list that contains all the options in the select.
00091  */
00092 class nsXULSelectListAccessible : public nsAccessibleWrap
00093 {
00094 public:
00095   
00096   nsXULSelectListAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
00097   virtual ~nsXULSelectListAccessible() {}
00098 
00099   /* ----- nsIAccessible ----- */
00100   NS_IMETHOD GetRole(PRUint32 *_retval);
00101   NS_IMETHOD GetState(PRUint32 *_retval);
00102 };
00103 
00104 /*
00105  * Options inside the select, contained within the list
00106  */
00107 class nsXULSelectOptionAccessible : public nsXULMenuitemAccessible
00108 {
00109 public:
00110   
00111   nsXULSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
00112   virtual ~nsXULSelectOptionAccessible() {}
00113 
00114   /* ----- nsIAccessible ----- */
00115   NS_IMETHOD GetRole(PRUint32 *_retval);
00116   NS_IMETHOD GetState(PRUint32 *_retval);
00117   nsIFrame*  GetBoundsFrame();
00118 };
00119 
00124 /*
00125  * A class the represents the XUL Listbox widget.
00126  */
00127 class nsXULListboxAccessible : public nsXULSelectableAccessible
00128 {
00129 public:
00130 
00131   nsXULListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
00132   virtual ~nsXULListboxAccessible() {}
00133 
00134   /* ----- nsIAccessible ----- */
00135   NS_IMETHOD GetRole(PRUint32 *_retval);
00136   NS_IMETHOD GetState(PRUint32 *_retval);
00137   NS_IMETHOD GetValue(nsAString& _retval);
00138 
00139 };
00140 
00144 class nsXULListitemAccessible : public nsXULMenuitemAccessible
00145 {
00146 public:
00147   NS_DECL_ISUPPORTS_INHERITED
00148   
00149   nsXULListitemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
00150   virtual ~nsXULListitemAccessible() {}
00151 
00152   /* ----- nsIAccessible ----- */
00153   NS_IMETHOD GetName(nsAString& _retval);
00154   NS_IMETHOD GetRole(PRUint32 *_retval);
00155   NS_IMETHOD GetState(PRUint32 *_retval);
00156   NS_IMETHOD GetActionName(PRUint8 index, nsAString& _retval);
00157 
00158 private:
00159   PRBool mIsCheckbox;
00160 };
00161 
00166 /*
00167  * A class the represents the XUL Combobox widget.
00168  */
00169 class nsXULComboboxAccessible : public nsXULSelectableAccessible
00170 {
00171 public:
00172 
00173   nsXULComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
00174   virtual ~nsXULComboboxAccessible() {}
00175 
00176   /* ----- nsIAccessible ----- */
00177   NS_IMETHOD GetChildCount(PRInt32 *_retval);
00178   NS_IMETHOD GetRole(PRUint32 *_retval);
00179   NS_IMETHOD GetState(PRUint32 *_retval);
00180 
00181   NS_IMETHOD GetValue(nsAString& _retval);
00182   NS_IMETHOD GetDescription(nsAString& aDescription);
00183 };
00184 
00185 #endif