Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
nsIRadioVisitor.h File Reference
#include "nsISupports.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  nsIRadioVisitor
 This interface is used for the text control frame to store its value away into the content. More...

Defines

#define NS_IRADIOVISITOR_IID

Functions

nsresult NS_GetRadioSetCheckedChangedVisitor (PRBool aCheckedChanged, nsIRadioVisitor **aVisitor)
 This visitor sets CheckedChanged on all elements it finds.
nsresult NS_GetRadioGetCheckedChangedVisitor (PRBool *aCheckedChanged, nsIFormControl *aExcludeElement, nsIRadioVisitor **aVisitor)
 This visitor will take the boolean you're pointing at and put aCheckedChanged into it.

Define Documentation

Value:
{ 0xd3494bd2, 0x1dd1, 0x11b2, \
  { 0xbe, 0x86, 0xb5, 0x08, 0xc8, 0x71, 0xd7, 0xc5 } }

Definition at line 46 of file nsIRadioVisitor.h.


Function Documentation

nsresult NS_GetRadioGetCheckedChangedVisitor ( PRBool aCheckedChanged,
nsIFormControl aExcludeElement,
nsIRadioVisitor **  aVisitor 
)

This visitor will take the boolean you're pointing at and put aCheckedChanged into it.

If the visitor is never called, aCheckedChanged will of course not change.

Parameters:
aVisitorthe visitor (out param)
aCheckedChangedthe boolean to put CheckedChanged into
aExcludeElementthe element

Definition at line 3113 of file nsHTMLInputElement.cpp.

{
  *aVisitor = new nsRadioGetCheckedChangedVisitor(aCheckedChanged,
                                                  aExcludeElement);
  if (!*aVisitor) {
    return NS_ERROR_OUT_OF_MEMORY;
  }
  NS_ADDREF(*aVisitor);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_GetRadioSetCheckedChangedVisitor ( PRBool  aCheckedChanged,
nsIRadioVisitor **  aVisitor 
)

This visitor sets CheckedChanged on all elements it finds.

Parameters:
aVisitorthe visitor (out param)
aCheckedChangedthe value of CheckedChanged to set on all elements

Definition at line 3058 of file nsHTMLInputElement.cpp.

{
  //
  // These are static so that we don't have to keep creating new visitors for
  // such an ordinary process all the time.  There are only two possibilities
  // for this visitor: set to true, and set to false.
  //
  static nsIRadioVisitor* sVisitorTrue = nsnull;
  static nsIRadioVisitor* sVisitorFalse = nsnull;

  //
  // Get the visitor that sets them to true
  //
  if (aCheckedChanged) {
    if (!sVisitorTrue) {
      sVisitorTrue = new nsRadioSetCheckedChangedVisitor(PR_TRUE);
      if (!sVisitorTrue) {
        return NS_ERROR_OUT_OF_MEMORY;
      }
      NS_ADDREF(sVisitorTrue);
      nsresult rv =
        nsContentUtils::ReleasePtrOnShutdown((nsISupports**)&sVisitorTrue);
      if (NS_FAILED(rv)) {
        NS_RELEASE(sVisitorTrue);
        return rv;
      }
    }
    *aVisitor = sVisitorTrue;
  }
  //
  // Get the visitor that sets them to false
  //
  else {
    if (!sVisitorFalse) {
      sVisitorFalse = new nsRadioSetCheckedChangedVisitor(PR_FALSE);
      if (!sVisitorFalse) {
        return NS_ERROR_OUT_OF_MEMORY;
      }
      NS_ADDREF(sVisitorFalse);
      nsresult rv =
        nsContentUtils::ReleasePtrOnShutdown((nsISupports**)&sVisitorFalse);
      if (NS_FAILED(rv)) {
        NS_RELEASE(sVisitorFalse);
        return rv;
      }
    }
    *aVisitor = sVisitorFalse;
  }

  NS_ADDREF(*aVisitor);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function: