~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/accessible/src/xul/nsXULFormControlAccessible.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 
2
/* ***** BEGIN LICENSE BLOCK *****
 
3
 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
 
4
 *
 
5
 * The contents of this file are subject to the Netscape Public License
 
6
 * Version 1.1 (the "License"); you may not use this file except in
 
7
 * compliance with the License. You may obtain a copy of the License at
 
8
 * http://www.mozilla.org/NPL/
 
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
 * Netscape Communications Corporation.
 
19
 * Portions created by the Initial Developer are Copyright (C) 1998
 
20
 * the Initial Developer. All Rights Reserved.
 
21
 *
 
22
 * Original Author: John Gaunt (jgaunt@netscape.com)
 
23
 * Contributor(s):
 
24
 *   Aaron Leventhal (aaronl@netscape.com)
 
25
 *   Kyle Yuan (kyle.yuan@sun.com)
 
26
 *
 
27
 * Alternatively, the contents of this file may be used under the terms of
 
28
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 
29
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
30
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
31
 * of those above. If you wish to allow use of your version of this file only
 
32
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
33
 * use your version of this file under the terms of the NPL, indicate your
 
34
 * decision by deleting the provisions above and replace them with the notice
 
35
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
36
 * the provisions above, a recipient may use your version of this file under
 
37
 * the terms of any one of the NPL, the GPL or the LGPL.
 
38
 *
 
39
 * ***** END LICENSE BLOCK ***** */
 
40
 
 
41
// NOTE: alphabetically ordered
 
42
#include "nsXULFormControlAccessible.h"
 
43
#include "nsIDOMXULButtonElement.h"
 
44
#include "nsIDOMXULCheckboxElement.h"
 
45
#include "nsIDOMXULMenuListElement.h"
 
46
#include "nsIDOMXULSelectCntrlItemEl.h"
 
47
#include "nsAccessibleTreeWalker.h"
 
48
 
 
49
/**
 
50
  * XUL Button: can contain arbitrary HTML content
 
51
  */
 
52
 
 
53
/**
 
54
  * Default Constructor
 
55
  */
 
56
 
 
57
// Don't inherit from nsFormControlAccessible - it doesn't allow children and a button can have a dropmarker child
 
58
nsXULButtonAccessible::nsXULButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 
59
nsAccessibleWrap(aNode, aShell)
 
60
 
61
}
 
62
 
 
63
NS_IMETHODIMP nsXULButtonAccessible::GetName(nsAString& aResult)
 
64
{
 
65
  return GetXULName(aResult);
 
66
}
 
67
 
 
68
/**
 
69
  * Only one actions available
 
70
  */
 
71
NS_IMETHODIMP nsXULButtonAccessible::GetNumActions(PRUint8 *_retval)
 
72
{
 
73
  *_retval = eSingle_Action;
 
74
  return NS_OK;;
 
75
}
 
76
 
 
77
/**
 
78
  * Return the name of our only action
 
79
  */
 
80
NS_IMETHODIMP nsXULButtonAccessible::GetActionName(PRUint8 index, nsAString& _retval)
 
81
{
 
82
  if (index == eAction_Click) {
 
83
    nsAccessible::GetTranslatedString(NS_LITERAL_STRING("press"), _retval); 
 
84
    return NS_OK;
 
85
  }
 
86
  return NS_ERROR_INVALID_ARG;
 
87
}
 
88
 
 
89
/**
 
90
  * Tell the button to do it's action
 
91
  */
 
92
NS_IMETHODIMP nsXULButtonAccessible::DoAction(PRUint8 index)
 
93
{
 
94
  if (index == 0) {
 
95
    nsCOMPtr<nsIDOMXULElement> buttonElement(do_QueryInterface(mDOMNode));
 
96
    if ( buttonElement )
 
97
    {
 
98
      buttonElement->Click();
 
99
      return NS_OK;
 
100
    }
 
101
    return NS_ERROR_FAILURE;
 
102
  }
 
103
  return NS_ERROR_INVALID_ARG;
 
104
}
 
105
 
 
106
/**
 
107
  * We are a pushbutton
 
108
  */
 
109
NS_IMETHODIMP nsXULButtonAccessible::GetRole(PRUint32 *_retval)
 
110
{
 
111
  *_retval = ROLE_PUSHBUTTON;
 
112
  return NS_OK;
 
113
}
 
114
 
 
115
/**
 
116
  * Possible states: focused, focusable, unavailable(disabled)
 
117
  */
 
118
NS_IMETHODIMP nsXULButtonAccessible::GetState(PRUint32 *_retval)
 
119
{
 
120
  // get focus and disable status from base class
 
121
  nsAccessible::GetState(_retval);
 
122
 
 
123
  PRBool disabled = PR_FALSE;
 
124
  nsCOMPtr<nsIDOMXULControlElement> xulFormElement(do_QueryInterface(mDOMNode));  
 
125
  if (xulFormElement) {
 
126
    xulFormElement->GetDisabled(&disabled);
 
127
    if (disabled)
 
128
      *_retval |= STATE_UNAVAILABLE;
 
129
    else 
 
130
      *_retval |= STATE_FOCUSABLE;
 
131
  }
 
132
 
 
133
  // Buttons can be checked -- they simply appear pressed in rather than checked
 
134
  nsCOMPtr<nsIDOMXULButtonElement> xulButtonElement(do_QueryInterface(mDOMNode));
 
135
  if (xulButtonElement) {
 
136
    PRBool checked = PR_FALSE;
 
137
    PRInt32 checkState = 0;
 
138
    xulButtonElement->GetChecked(&checked);
 
139
    if (checked) {
 
140
      *_retval |= STATE_PRESSED;
 
141
      xulButtonElement->GetCheckState(&checkState);
 
142
      if (checkState == nsIDOMXULButtonElement::CHECKSTATE_MIXED)  
 
143
        *_retval |= STATE_MIXED;
 
144
    }
 
145
  }
 
146
 
 
147
  nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
 
148
  NS_ASSERTION(element, "No nsIDOMElement for button node!");
 
149
  PRBool isDefault = PR_FALSE;
 
150
  element->HasAttribute(NS_LITERAL_STRING("default"), &isDefault) ;
 
151
  if (isDefault)
 
152
    *_retval |= STATE_DEFAULT;
 
153
 
 
154
  return NS_OK;
 
155
}
 
156
 
 
157
/**
 
158
  * Perhaps 1 child - if there's a <dropmarker>
 
159
  */
 
160
NS_IMETHODIMP nsXULButtonAccessible::GetFirstChild(nsIAccessible **aResult)
 
161
{
 
162
  if (!mFirstChild) {
 
163
    nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, PR_TRUE);
 
164
    walker.GetLastChild();
 
165
 
 
166
    // If the anonymous tree walker can find accessible children, 
 
167
    // and the last one is a push button, then use it as the only accessible 
 
168
    // child -- because this is the scenario where we have a dropmarker child
 
169
 
 
170
    if (walker.mState.accessible) {    
 
171
      PRUint32 role;
 
172
      if (NS_SUCCEEDED(walker.mState.accessible->GetRole(&role)) && role == ROLE_PUSHBUTTON) {
 
173
        mFirstChild = walker.mState.accessible;
 
174
        nsCOMPtr<nsPIAccessible> privChildAcc = do_QueryInterface(mFirstChild);
 
175
        privChildAcc->SetNextSibling(nsnull);
 
176
      }
 
177
    }
 
178
  }
 
179
 
 
180
  mAccChildCount = (mFirstChild != nsnull);
 
181
  NS_IF_ADDREF(*aResult = mFirstChild);
 
182
  return NS_OK;
 
183
}
 
184
 
 
185
NS_IMETHODIMP nsXULButtonAccessible::GetLastChild(nsIAccessible **aResult)
 
186
{
 
187
  return GetFirstChild(aResult);
 
188
}
 
189
 
 
190
NS_IMETHODIMP nsXULButtonAccessible::GetChildCount(PRInt32 *aResult)
 
191
{
 
192
  nsCOMPtr<nsIAccessible> accessible;
 
193
  GetFirstChild(getter_AddRefs(accessible));
 
194
  *aResult = mAccChildCount;
 
195
 
 
196
  return NS_OK;
 
197
}
 
198
 
 
199
/**
 
200
  * XUL Dropmarker: can contain arbitrary HTML content
 
201
  */
 
202
 
 
203
/**
 
204
  * Default Constructor
 
205
  */
 
206
nsXULDropmarkerAccessible::nsXULDropmarkerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 
207
nsFormControlAccessible(aNode, aShell)
 
208
 
209
}
 
210
 
 
211
/**
 
212
  * Only one actions available
 
213
  */
 
214
NS_IMETHODIMP nsXULDropmarkerAccessible::GetNumActions(PRUint8 *aResult)
 
215
{
 
216
  *aResult = eSingle_Action;
 
217
  return NS_OK;;
 
218
}
 
219
 
 
220
PRBool nsXULDropmarkerAccessible::DropmarkerOpen(PRBool aToggleOpen)
 
221
{
 
222
  PRBool isOpen = PR_FALSE;
 
223
 
 
224
  nsCOMPtr<nsIDOMNode> parentButtonNode;
 
225
  mDOMNode->GetParentNode(getter_AddRefs(parentButtonNode));
 
226
  nsCOMPtr<nsIDOMXULButtonElement> parentButtonElement(do_QueryInterface(parentButtonNode));
 
227
 
 
228
  if (parentButtonElement) {
 
229
    parentButtonElement->GetOpen(&isOpen);
 
230
    if (aToggleOpen)
 
231
      parentButtonElement->SetOpen(!isOpen);
 
232
  }
 
233
  else {
 
234
    nsCOMPtr<nsIDOMXULMenuListElement> parentMenuListElement(do_QueryInterface(parentButtonNode));
 
235
    if (parentMenuListElement) {
 
236
      parentMenuListElement->GetOpen(&isOpen);
 
237
      if (aToggleOpen)
 
238
        parentMenuListElement->SetOpen(!isOpen);
 
239
    }
 
240
  }
 
241
 
 
242
  return isOpen;
 
243
}
 
244
 
 
245
/**
 
246
  * Return the name of our only action
 
247
  */
 
248
NS_IMETHODIMP nsXULDropmarkerAccessible::GetActionName(PRUint8 index, nsAString& aResult)
 
249
{
 
250
  if (index == eAction_Click) {
 
251
    if (DropmarkerOpen(PR_FALSE))
 
252
      aResult = NS_LITERAL_STRING("close");
 
253
    else
 
254
      aResult = NS_LITERAL_STRING("open");
 
255
    return NS_OK;
 
256
  }
 
257
 
 
258
  return NS_ERROR_INVALID_ARG;
 
259
}
 
260
 
 
261
/**
 
262
  * Tell the Dropmarker to do it's action
 
263
  */
 
264
NS_IMETHODIMP nsXULDropmarkerAccessible::DoAction(PRUint8 index)
 
265
{
 
266
  if (index == eAction_Click) {
 
267
    DropmarkerOpen(PR_TRUE); // Reverse the open attribute
 
268
    return NS_OK;
 
269
  }
 
270
  return NS_ERROR_INVALID_ARG;
 
271
}
 
272
 
 
273
/**
 
274
  * We are a pushbutton
 
275
  */
 
276
NS_IMETHODIMP nsXULDropmarkerAccessible::GetRole(PRUint32 *aResult)
 
277
{
 
278
  *aResult = ROLE_PUSHBUTTON;
 
279
  return NS_OK;
 
280
}
 
281
 
 
282
NS_IMETHODIMP nsXULDropmarkerAccessible::GetState(PRUint32 *aResult)
 
283
{
 
284
  *aResult = 0;
 
285
  
 
286
  if (DropmarkerOpen(PR_FALSE))
 
287
    *aResult = STATE_PRESSED;
 
288
 
 
289
  return NS_OK;
 
290
}
 
291
 
 
292
/**
 
293
  * XUL checkbox
 
294
  */
 
295
 
 
296
/**
 
297
  * Default Constructor
 
298
  */
 
299
nsXULCheckboxAccessible::nsXULCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 
300
nsFormControlAccessible(aNode, aShell)
 
301
 
302
}
 
303
 
 
304
/**
 
305
  * We are a CheckButton
 
306
  */
 
307
NS_IMETHODIMP nsXULCheckboxAccessible::GetRole(PRUint32 *_retval)
 
308
{
 
309
  *_retval = ROLE_CHECKBUTTON;
 
310
  return NS_OK;
 
311
}
 
312
 
 
313
/**
 
314
  * Only one action available
 
315
  */
 
316
NS_IMETHODIMP nsXULCheckboxAccessible::GetNumActions(PRUint8 *_retval)
 
317
{
 
318
  *_retval = eSingle_Action;
 
319
  return NS_OK;
 
320
}
 
321
 
 
322
/**
 
323
  * Return the name of our only action
 
324
  */
 
325
NS_IMETHODIMP nsXULCheckboxAccessible::GetActionName(PRUint8 index, nsAString& _retval)
 
326
{
 
327
  if (index == eAction_Click) {
 
328
    // check or uncheck
 
329
    PRUint32 state;
 
330
    GetState(&state);
 
331
 
 
332
    if (state & STATE_CHECKED)
 
333
      _retval = NS_LITERAL_STRING("uncheck");
 
334
    else
 
335
      _retval = NS_LITERAL_STRING("check");
 
336
 
 
337
    return NS_OK;
 
338
  }
 
339
  return NS_ERROR_INVALID_ARG;
 
340
}
 
341
 
 
342
/**
 
343
  * Tell the checkbox to do its only action -- check( or uncheck) itself
 
344
  */
 
345
NS_IMETHODIMP nsXULCheckboxAccessible::DoAction(PRUint8 index)
 
346
{
 
347
  if (index == eAction_Click) {
 
348
    nsCOMPtr<nsIDOMXULElement> xulCheckboxElement(do_QueryInterface(mDOMNode));
 
349
    if (xulCheckboxElement) {
 
350
      xulCheckboxElement->Click();
 
351
      return NS_OK;
 
352
    }
 
353
    return NS_ERROR_FAILURE;
 
354
  }
 
355
  return NS_ERROR_INVALID_ARG;
 
356
}
 
357
 
 
358
/**
 
359
  * Possible states: focused, focusable, unavailable(disabled), checked
 
360
  */
 
361
NS_IMETHODIMP nsXULCheckboxAccessible::GetState(PRUint32 *_retval)
 
362
{
 
363
  // Get focus and disable status from base class
 
364
  nsFormControlAccessible::GetState(_retval);
 
365
 
 
366
  // Determine Checked state
 
367
  nsCOMPtr<nsIDOMXULCheckboxElement> xulCheckboxElement(do_QueryInterface(mDOMNode));
 
368
  if (xulCheckboxElement) {
 
369
    PRBool checked = PR_FALSE;
 
370
    xulCheckboxElement->GetChecked(&checked);
 
371
    if (checked) {
 
372
      *_retval |= STATE_CHECKED;
 
373
      PRInt32 checkState = 0;
 
374
      xulCheckboxElement->GetCheckState(&checkState);
 
375
      if (checkState == nsIDOMXULCheckboxElement::CHECKSTATE_MIXED)   
 
376
        *_retval |= STATE_MIXED;
 
377
    }
 
378
  }
 
379
  
 
380
  return NS_OK;
 
381
}
 
382
 
 
383
/**
 
384
  * XUL groupbox
 
385
  */
 
386
 
 
387
nsXULGroupboxAccessible::nsXULGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 
388
nsAccessibleWrap(aNode, aShell)
 
389
 
390
}
 
391
 
 
392
NS_IMETHODIMP nsXULGroupboxAccessible::GetRole(PRUint32 *_retval)
 
393
{
 
394
  *_retval = ROLE_GROUPING;
 
395
  return NS_OK;
 
396
}
 
397
 
 
398
NS_IMETHODIMP nsXULGroupboxAccessible::GetState(PRUint32 *_retval)
 
399
{
 
400
  // Groupbox doesn't support any states!
 
401
  *_retval = 0;
 
402
 
 
403
  return NS_OK;
 
404
}
 
405
 
 
406
NS_IMETHODIMP nsXULGroupboxAccessible::GetName(nsAString& _retval)
 
407
{
 
408
  _retval.Assign(NS_LITERAL_STRING(""));  // Default name is blank 
 
409
 
 
410
  nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
 
411
  if (element) {
 
412
    nsCOMPtr<nsIDOMNodeList> captions;
 
413
    element->GetElementsByTagName(NS_LITERAL_STRING("caption"), getter_AddRefs(captions));
 
414
    if (captions) {
 
415
      nsCOMPtr<nsIDOMNode> captionNode;
 
416
      captions->Item(0, getter_AddRefs(captionNode));
 
417
      if (captionNode) {
 
418
        element = do_QueryInterface(captionNode);
 
419
        NS_ASSERTION(element, "No nsIDOMElement for caption node!");
 
420
        element->GetAttribute(NS_LITERAL_STRING("label"), _retval) ;
 
421
      }
 
422
    }
 
423
  }
 
424
  return NS_OK;
 
425
}
 
426
 
 
427
/**
 
428
  * progressmeter
 
429
  */
 
430
NS_IMPL_ISUPPORTS_INHERITED0(nsXULProgressMeterAccessible, nsFormControlAccessible)
 
431
 
 
432
nsXULProgressMeterAccessible::nsXULProgressMeterAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 
433
nsFormControlAccessible(aNode, aShell)
 
434
 
435
}
 
436
 
 
437
NS_IMETHODIMP nsXULProgressMeterAccessible::GetRole(PRUint32 *_retval)
 
438
{
 
439
  *_retval = ROLE_PROGRESSBAR;
 
440
  return NS_OK;
 
441
}
 
442
 
 
443
/**
 
444
  * No states supported for progressmeter
 
445
  */
 
446
NS_IMETHODIMP nsXULProgressMeterAccessible::GetState(PRUint32 *_retval)
 
447
{
 
448
  *_retval =0;
 
449
  return NS_OK;
 
450
}
 
451
 
 
452
NS_IMETHODIMP nsXULProgressMeterAccessible::GetValue(nsAString& _retval)
 
453
{
 
454
  nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
 
455
  NS_ASSERTION(element, "No element for DOM node!");
 
456
  element->GetAttribute(NS_LITERAL_STRING("value"), _retval);
 
457
  if (!_retval.IsEmpty() && _retval.Last() != '%')
 
458
    _retval.Append(NS_LITERAL_STRING("%"));
 
459
  return NS_OK;
 
460
}
 
461
 
 
462
/**
 
463
  * XUL Radio Button
 
464
  */
 
465
 
 
466
/** Constructor */
 
467
nsXULRadioButtonAccessible::nsXULRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 
468
nsRadioButtonAccessible(aNode, aShell)
 
469
 
470
}
 
471
 
 
472
/** Our only action is to click */
 
473
NS_IMETHODIMP nsXULRadioButtonAccessible::DoAction(PRUint8 index)
 
474
{
 
475
  if (index == eAction_Click) {
 
476
    nsCOMPtr<nsIDOMXULElement> radioButton(do_QueryInterface(mDOMNode));
 
477
    if (radioButton) {
 
478
      radioButton->Click();
 
479
      return NS_OK;
 
480
    }
 
481
  }
 
482
  return NS_ERROR_INVALID_ARG;
 
483
}
 
484
 
 
485
/** We are Focusable and can be Checked and focused */
 
486
NS_IMETHODIMP nsXULRadioButtonAccessible::GetState(PRUint32 *_retval)
 
487
{
 
488
  nsFormControlAccessible::GetState(_retval);
 
489
  PRBool selected = PR_FALSE;   // Radio buttons can be selected
 
490
 
 
491
  nsCOMPtr<nsIDOMXULSelectControlItemElement> radioButton(do_QueryInterface(mDOMNode));
 
492
  if (radioButton) 
 
493
    radioButton->GetSelected(&selected);
 
494
 
 
495
  if (selected) {
 
496
    *_retval |= STATE_CHECKED;
 
497
    // If our parent radio group is focused, then consider this radio button focused
 
498
    nsCOMPtr<nsIDOMNode> parentNode;
 
499
    mDOMNode->GetParentNode(getter_AddRefs(parentNode));
 
500
    if (parentNode) {
 
501
      nsCOMPtr<nsIDOMNode> focusedNode;
 
502
      GetFocusedNode(mDOMNode, getter_AddRefs(focusedNode));
 
503
      if (focusedNode == parentNode)
 
504
        *_retval |= STATE_FOCUSED;
 
505
    }
 
506
  }
 
507
 
 
508
  return NS_OK;
 
509
}
 
510
 
 
511
/**
 
512
  * This gets the parent of the RadioGroup (our grandparent) and sets it 
 
513
  *  as our parent, for future calls. 
 
514
  */
 
515
NS_IMETHODIMP nsXULRadioButtonAccessible::GetParent(nsIAccessible **  aParent)
 
516
{
 
517
  if (! mParent) {
 
518
    nsCOMPtr<nsIAccessible> tempParent;
 
519
    nsAccessible::GetParent(getter_AddRefs(tempParent));
 
520
    if (tempParent)
 
521
      tempParent->GetParent(getter_AddRefs(mParent));
 
522
  }
 
523
  NS_ASSERTION(mParent,"Whoa! This RadioButtonAcc doesn't have a parent! Better find out why.");
 
524
  *aParent = mParent;
 
525
  NS_ADDREF(*aParent);
 
526
  return NS_OK;
 
527
}
 
528
 
 
529
/**
 
530
  * XUL Radio Group
 
531
  *   The Radio Group proxies for the Radio Buttons themselves. The Group gets
 
532
  *   focus whereas the Buttons do not. So we only have an accessible object for
 
533
  *   this for the purpose of getting the proper RadioButton. Need this here to 
 
534
  *   avoid circular reference problems when navigating the accessible tree and
 
535
  *   for getting to the radiobuttons.
 
536
  */
 
537
 
 
538
/** Constructor */
 
539
nsXULRadioGroupAccessible::nsXULRadioGroupAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 
540
nsAccessibleWrap(aNode, aShell)
 
541
 
542
}
 
543
 
 
544
NS_IMETHODIMP nsXULRadioGroupAccessible::GetRole(PRUint32 *_retval)
 
545
{
 
546
  *_retval = ROLE_GROUPING;
 
547
  return NS_OK;
 
548
}
 
549
 
 
550
NS_IMETHODIMP nsXULRadioGroupAccessible::GetState(PRUint32 *_retval)
 
551
{
 
552
  // The radio group is not focusable.
 
553
  // Sometimes the focus controller will report that it is focused.
 
554
  // That means that the actual selected radio button should be considered focused
 
555
  nsAccessible::GetState(_retval);
 
556
  *_retval &= ~(STATE_FOCUSABLE | STATE_FOCUSED);
 
557
  return NS_OK;
 
558
}
 
559
/**
 
560
  * XUL StatusBar: can contain arbitrary HTML content
 
561
  */
 
562
 
 
563
/**
 
564
  * Default Constructor
 
565
  */
 
566
nsXULStatusBarAccessible::nsXULStatusBarAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 
567
nsAccessibleWrap(aNode, aShell)
 
568
 
569
}
 
570
 
 
571
/**
 
572
  * We are a statusbar
 
573
  */
 
574
NS_IMETHODIMP nsXULStatusBarAccessible::GetRole(PRUint32 *_retval)
 
575
{
 
576
  *_retval = ROLE_STATUSBAR;
 
577
  return NS_OK;
 
578
}
 
579
 
 
580
NS_IMETHODIMP nsXULStatusBarAccessible::GetState(PRUint32 *_retval)
 
581
{
 
582
  *_retval = 0;  // no special state flags for status bar
 
583
  return NS_OK;
 
584
}
 
585
 
 
586
/**
 
587
  * XUL ToolBar
 
588
  */
 
589
 
 
590
nsXULToolbarAccessible::nsXULToolbarAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 
591
nsAccessibleWrap(aNode, aShell)
 
592
 
593
}
 
594
 
 
595
NS_IMETHODIMP nsXULToolbarAccessible::GetRole(PRUint32 *_retval)
 
596
{
 
597
  *_retval = ROLE_TOOLBAR;
 
598
  return NS_OK;
 
599
}
 
600
 
 
601
NS_IMETHODIMP nsXULToolbarAccessible::GetState(PRUint32 *_retval)
 
602
{
 
603
  nsAccessible::GetState(_retval);
 
604
  *_retval &= ~STATE_FOCUSABLE;  // toolbar is not focusable
 
605
  return NS_OK;
 
606
}
 
607
 
 
608
/**
 
609
  * XUL Toolbar Separator
 
610
  */
 
611
 
 
612
nsXULToolbarSeparatorAccessible::nsXULToolbarSeparatorAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 
613
nsLeafAccessible(aNode, aShell)
 
614
 
615
}
 
616
 
 
617
NS_IMETHODIMP nsXULToolbarSeparatorAccessible::GetRole(PRUint32 *_retval)
 
618
{
 
619
  *_retval = ROLE_SEPARATOR;
 
620
  return NS_OK;
 
621
}
 
622
 
 
623
NS_IMETHODIMP nsXULToolbarSeparatorAccessible::GetState(PRUint32 *_retval)
 
624
{
 
625
  *_retval = 0;  // no special state flags for toolbar separator
 
626
  return NS_OK;
 
627
}