Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Protected Attributes
nsAutoWindowStateHelper Class Reference
Collaboration diagram for nsAutoWindowStateHelper:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsAutoWindowStateHelper (nsIDOMWindow *aWindow)
 ~nsAutoWindowStateHelper ()
PRBool DefaultEnabled ()

Protected Member Functions

PRBool DispatchCustomEvent (const char *aEventName)

Protected Attributes

nsIDOMWindowmWindow
PRBool mDefaultEnabled

Detailed Description

Definition at line 133 of file nsPrompt.cpp.


Constructor & Destructor Documentation

Definition at line 151 of file nsPrompt.cpp.

  : mWindow(aWindow),
    mDefaultEnabled(DispatchCustomEvent("DOMWillOpenModalDialog"))
{
  nsCOMPtr<nsPIDOMWindow_MOZILLA_1_8_BRANCH> window =
    do_QueryInterface(aWindow);

  if (window) {
    window->EnterModalState();
  }
}

Here is the call graph for this function:

Definition at line 163 of file nsPrompt.cpp.

{
  nsCOMPtr<nsPIDOMWindow_MOZILLA_1_8_BRANCH> window =
    do_QueryInterface(mWindow);

  if (window) {
    window->LeaveModalState();
  }

  if (mDefaultEnabled) {
    DispatchCustomEvent("DOMModalDialogClosed");
  }
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 139 of file nsPrompt.cpp.

  {
    return mDefaultEnabled;
  }
PRBool nsAutoWindowStateHelper::DispatchCustomEvent ( const char *  aEventName) [protected]

Definition at line 178 of file nsPrompt.cpp.

{
  if (!mWindow) {
    return PR_TRUE;
  }

#ifdef DEBUG
  {
    nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mWindow));

    NS_ASSERTION(window->GetExtantDocument() != nsnull,
                 "nsPrompt used too early on window object!");
  }
#endif

  nsCOMPtr<nsIDOMDocument> domdoc;
  mWindow->GetDocument(getter_AddRefs(domdoc));

  nsCOMPtr<nsIDOMDocumentEvent> docevent(do_QueryInterface(domdoc));
  nsCOMPtr<nsIDOMEvent> event;

  PRBool defaultActionEnabled = PR_TRUE;

  if (docevent) {
    docevent->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));

    nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
    if (privateEvent) {
      event->InitEvent(NS_ConvertASCIItoUTF16(aEventName), PR_TRUE, PR_TRUE);

      privateEvent->SetTrusted(PR_TRUE);

      nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mWindow));

      target->DispatchEvent(event, &defaultActionEnabled);
    }
  }

  return defaultActionEnabled;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 148 of file nsPrompt.cpp.

Definition at line 147 of file nsPrompt.cpp.


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