Back to index

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

Implement Navigator Find Dialog. More...

#include <nsFindDialog.h>

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

List of all members.

Public Member Functions

 nsFindDialog (nsBrowserWindow *aBrowserWindow)
virtual ~nsFindDialog ()
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.
virtual void DoClose ()
virtual void DoFind ()

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

nsIDOMElementmFindBtn
nsIDOMElementmUpRB
nsIDOMElementmDwnRB
nsIDOMElementmMatchCaseCB
PRBool mSearchDown
nsBrowserWindowmBrowserWindow
nsIXPBaseWindowmWindow
nsIDOMElementmCancelBtn

Detailed Description

Implement Navigator Find Dialog.

Definition at line 47 of file nsFindDialog.h.


Constructor & Destructor Documentation

Definition at line 54 of file nsFindDialog.cpp.

                                                           :
  nsBaseDialog(aBrowserWindow),
  mFindBtn(nsnull),
  mSearchDown(PR_TRUE)
{
}

Definition at line 62 of file nsFindDialog.cpp.

{
}

Member Function Documentation

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

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

Parameters:
aWindowthe window which is about to be destroyed

Reimplemented from nsBaseDialog.

Definition at line 113 of file nsFindDialog.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.
  aWindow->RemoveEventListener(mFindBtn);
}

Here is the call graph for this function:

void nsFindDialog::DoClose ( ) [virtual]

Reimplemented from nsBaseDialog.

Definition at line 157 of file nsFindDialog.cpp.

Here is the call graph for this function:

void nsFindDialog::DoFind ( ) [virtual]

Definition at line 124 of file nsFindDialog.cpp.

{
  // Now we have the content tree, lets find the 
  // widgets holding the info.

  nsIDOMElement * textNode = nsnull;
  nsIDOMHTMLDocument *doc = nsnull;
  mWindow->GetDocument(doc);
  if (nsnull != doc) {
    if (NS_OK == doc->GetElementById(NS_LITERAL_STRING("query"), &textNode)) {
      nsIDOMHTMLInputElement * element;
      if (NS_OK == textNode->QueryInterface(kIDOMHTMLInputElementIID, (void**) &element)) {
        nsString str;
        PRBool foundIt = PR_FALSE;
        element->GetValue(str);
        PRBool searchDown = IsChecked(mDwnRB);
        PRBool matchcase  = IsChecked(mMatchCaseCB);

        mBrowserWindow->FindNext(str, matchcase, searchDown, foundIt);
        if (foundIt) {
          mBrowserWindow->ForceRefresh();
        }

        NS_RELEASE(element);
      }
      NS_RELEASE(textNode);
    }
    NS_RELEASE(doc);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

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, inherited]

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, inherited]

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 nsFindDialog::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.

Reimplemented from nsBaseDialog.

Definition at line 67 of file nsFindDialog.cpp.

{
  nsBaseDialog::Initialize(aWindow);

  nsIDOMHTMLDocument *doc = nsnull;
  mWindow->GetDocument(doc);
  if (nsnull != doc) {
    doc->GetElementById(NS_LITERAL_STRING("find"),       &mFindBtn);
    doc->GetElementById(NS_LITERAL_STRING("searchup"),   &mUpRB);
    doc->GetElementById(NS_LITERAL_STRING("searchdown"), &mDwnRB);
    doc->GetElementById(NS_LITERAL_STRING("matchcase"),  &mMatchCaseCB);

    // XXX: Register event listening on each dom element. We should change this so
    // all DOM events are automatically passed through.
    aWindow->AddEventListener(mFindBtn);
    aWindow->AddEventListener(mUpRB);
    aWindow->AddEventListener(mDwnRB);

    SetChecked(mMatchCaseCB, PR_FALSE);
    NS_RELEASE(doc);
  }
}

Here is the call graph for this function:

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

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, inherited]

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 nsFindDialog::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

Reimplemented from nsBaseDialog.

Definition at line 91 of file nsFindDialog.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.

  nsBaseDialog::MouseClick(aMouseEvent, aWindow, aStatus);
  if (!aStatus) { // is not consumed
    nsCOMPtr<nsIDOMEventTarget> target;
    aMouseEvent->GetTarget(getter_AddRefs(target));
    if (target) {
      nsCOMPtr<nsIDOMElement> node(do_QueryInterface(target));
      if (node.get() == mFindBtn) {
        DoFind();
      }
    }
  }
}

Here is the call graph for this function:

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

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, inherited]

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, inherited]

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, inherited]

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.

nsIDOMElement* nsBaseDialog::mCancelBtn [protected, inherited]

Definition at line 80 of file nsBaseDialog.h.

Definition at line 68 of file nsFindDialog.h.

Definition at line 66 of file nsFindDialog.h.

Definition at line 69 of file nsFindDialog.h.

Definition at line 71 of file nsFindDialog.h.

Definition at line 67 of file nsFindDialog.h.

nsIXPBaseWindow* nsBaseDialog::mWindow [protected, inherited]

Definition at line 79 of file nsBaseDialog.h.


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