Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Protected Attributes
nsBaseDialog Class Reference

Implement Navigator Find Dialog. More...

#include <nsBaseDialog.h>

Inheritance diagram for nsBaseDialog:
Inheritance graph
[legend]
Collaboration diagram for nsBaseDialog:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsBaseDialog (nsBrowserWindow *aBrowserWindow)
virtual ~nsBaseDialog ()
virtual void DoClose ()
virtual void MouseClick (nsIDOMEvent *aMouseEvent, nsIXPBaseWindow *aWindow, PRBool &aStatus)
 Method called when the user clicks the mouse.
virtual void Initialize (nsIXPBaseWindow *aWindow)
 Method called After the URL passed to the dialog box or window has completed loading.
virtual void Destroy (nsIXPBaseWindow *aWindow)
 Method called when dialog box or window is no longer visibleg.

Protected Member Functions

PRBool IsChecked (const nsAString &aName)
PRBool IsChecked (nsIDOMElement *aNode)
void SetChecked (nsIDOMElement *aNode, PRBool aValue)
void SetChecked (const nsAString &aName, PRBool aValue)
void GetText (nsIDOMElement *aNode, nsAString &aStr)
void GetText (const nsAString &aName, nsAString &aStr)
float GetFloat (nsString &aStr)
void SetText (nsIDOMElement *aNode, const nsAString &aValue)
void SetText (const nsAString &aName, const nsAString &aStr)

Protected Attributes

nsBrowserWindowmBrowserWindow
nsIXPBaseWindowmWindow
nsIDOMElementmCancelBtn

Detailed Description

Implement Navigator Find Dialog.

Definition at line 51 of file nsBaseDialog.h.


Constructor & Destructor Documentation

Definition at line 54 of file nsBaseDialog.cpp.

                                                           :
  mBrowserWindow(aBrowserWindow),
  mWindow(nsnull),
  mCancelBtn(nsnull)
{
}

Definition at line 62 of file nsBaseDialog.cpp.


Member Function Documentation

void nsBaseDialog::Destroy ( nsIXPBaseWindow aWindow) [virtual]

Method called when dialog box or window is no longer visibleg.

Parameters:
aWindowthe window which is about to be destroyed

Implements nsIWindowListener.

Reimplemented in nsPrintSetupDialog, nsImageInspectorDialog, nsTableInspectorDialog, and nsFindDialog.

Definition at line 86 of file nsBaseDialog.cpp.

{

  // Unregister event listeners that were registered in the
  // Initialize here. 
  // XXX: Should change code in XPBaseWindow to automatically unregister
  // all event listening, That way this code will not be necessary.
  if (nsnull != mCancelBtn) {
    aWindow->RemoveEventListener(mCancelBtn);
  }
}

Here is the call graph for this function:

void nsBaseDialog::DoClose ( ) [virtual]

Reimplemented in nsPrintSetupDialog, nsFindDialog, nsImageInspectorDialog, and nsTableInspectorDialog.

Definition at line 122 of file nsBaseDialog.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

float nsBaseDialog::GetFloat ( nsString aStr) [protected]

Definition at line 241 of file nsBaseDialog.cpp.

{

  return (float)0.0;
}

Here is the caller graph for this function:

void nsBaseDialog::GetText ( nsIDOMElement aNode,
nsAString &  aStr 
) [protected]

Definition at line 189 of file nsBaseDialog.cpp.

{
  nsIDOMHTMLInputElement * element;
  if (NS_OK == aNode->QueryInterface(kIDOMHTMLInputElementIID, (void**) &element)) {
    element->GetValue(aStr);
    NS_RELEASE(element);
  }
}

Here is the caller graph for this function:

void nsBaseDialog::GetText ( const nsAString &  aName,
nsAString &  aStr 
) [protected]

Definition at line 199 of file nsBaseDialog.cpp.

{
  nsIDOMElement      * node;
  nsIDOMHTMLDocument * doc = nsnull;
  mWindow->GetDocument(doc);
  if (nsnull != doc) {
    if (NS_OK == doc->GetElementById(aName,   &node)) {
      GetText(node, aStr);
      NS_RELEASE(node);
    }
    NS_RELEASE(doc);
  }
}

Here is the call graph for this function:

void nsBaseDialog::Initialize ( nsIXPBaseWindow aWindow) [virtual]

Method called After the URL passed to the dialog box or window has completed loading.

Usually it is used to set place the initial settings in form elements.

Parameters:
aWindowthe window to initialize form element settings for.

Implements nsIWindowListener.

Reimplemented in nsPrintSetupDialog, nsImageInspectorDialog, nsTableInspectorDialog, and nsFindDialog.

Definition at line 68 of file nsBaseDialog.cpp.

{
  mWindow = aWindow;
  NS_ADDREF(mWindow);

  nsIDOMHTMLDocument *doc = nsnull;
  mWindow->GetDocument(doc);
  if (nsnull != doc) {
    doc->GetElementById(NS_LITERAL_STRING("cancel"), &mCancelBtn);
    if (nsnull != mCancelBtn) {
      mWindow->AddEventListener(mCancelBtn);
    }
    NS_RELEASE(doc);
  }
}

Here is the call graph for this function:

PRBool nsBaseDialog::IsChecked ( const nsAString &  aName) [protected]

Definition at line 144 of file nsBaseDialog.cpp.

{
  nsIDOMElement      * node;
  nsIDOMHTMLDocument * doc = nsnull;
  mWindow->GetDocument(doc);
  if (nsnull != doc) {
    if (NS_OK == doc->GetElementById(aName, &node)) {
      PRBool value = IsChecked(node);
      NS_RELEASE(node);
      NS_RELEASE(doc);
      return value;
    }
    NS_RELEASE(doc);
  }
  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsBaseDialog::IsChecked ( nsIDOMElement aNode) [protected]

Definition at line 130 of file nsBaseDialog.cpp.

{
  nsIDOMHTMLInputElement * element;
  if (NS_OK == aNode->QueryInterface(kIDOMHTMLInputElementIID, (void**) &element)) {
    PRBool checked;
    element->GetChecked(&checked);
    NS_RELEASE(element);
    return checked;
  }
  return PR_FALSE;
}
void nsBaseDialog::MouseClick ( nsIDOMEvent aMouseEvent,
nsIXPBaseWindow aWindow,
PRBool aStatus 
) [virtual]

Method called when the user clicks the mouse.

Clicks are only generated when the mouse-up event happens over a widget.

Parameters:
aMouseEventDOM event holding mouse click info.
aWindowWindow which generated the mouse click event

Implements nsIWindowListener.

Reimplemented in nsPrintSetupDialog, nsImageInspectorDialog, nsTableInspectorDialog, and nsFindDialog.

Definition at line 99 of file nsBaseDialog.cpp.

{
   // Event Dispatch. This method should not contain
   // anything but calls to methods. This idea is that this dispatch
   // mechanism may be replaced by JavaScript EventHandlers which call the idl'ed
   // interfaces to perform the same operation that is currently being handled by
   // this C++ code.

  aStatus = PR_FALSE;

  nsCOMPtr<nsIDOMEventTarget> target;
  aMouseEvent->GetTarget(getter_AddRefs(target));
  if (target) {
    nsCOMPtr<nsIDOMElement> node(do_QueryInterface(target));
    if (node.get() == mCancelBtn) {
      DoClose();
      aStatus = PR_TRUE;
    }
  }
}

Here is the call graph for this function:

void nsBaseDialog::SetChecked ( nsIDOMElement aNode,
PRBool  aValue 
) [protected]

Definition at line 163 of file nsBaseDialog.cpp.

{
  nsIDOMHTMLInputElement * element;
  if (NS_OK == aNode->QueryInterface(kIDOMHTMLInputElementIID, (void**) &element)) {
    element->SetChecked(aValue);
    NS_RELEASE(element);
  }
}

Here is the caller graph for this function:

void nsBaseDialog::SetChecked ( const nsAString &  aName,
PRBool  aValue 
) [protected]

Definition at line 174 of file nsBaseDialog.cpp.

{
  nsIDOMElement      * node;
  nsIDOMHTMLDocument * doc = nsnull;
  mWindow->GetDocument(doc);
  if (nsnull != doc) {
    if (NS_OK == doc->GetElementById(aName,   &node)) {
      SetChecked(node, aValue);
      NS_RELEASE(node);
    }
    NS_RELEASE(doc);
  }
}

Here is the call graph for this function:

void nsBaseDialog::SetText ( nsIDOMElement aNode,
const nsAString &  aValue 
) [protected]

Definition at line 215 of file nsBaseDialog.cpp.

{
  nsIDOMHTMLInputElement * element;
  if (NS_OK == aNode->QueryInterface(kIDOMHTMLInputElementIID, (void**) &element)) {
    element->SetValue(aValue);
    NS_RELEASE(element);
  }
}

Here is the caller graph for this function:

void nsBaseDialog::SetText ( const nsAString &  aName,
const nsAString &  aStr 
) [protected]

Definition at line 226 of file nsBaseDialog.cpp.

{
  nsIDOMElement      * node;
  nsIDOMHTMLDocument * doc = nsnull;
  mWindow->GetDocument(doc);
  if (nsnull != doc) {
    if (NS_OK == doc->GetElementById(aName,   &node)) {
      SetText(node, aStr);
      NS_RELEASE(node);
    }
    NS_RELEASE(doc);
  }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 78 of file nsBaseDialog.h.

Definition at line 80 of file nsBaseDialog.h.

Definition at line 79 of file nsBaseDialog.h.


The documentation for this class was generated from the following files: