Back to index

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

editor Implementation of the TextListener interface More...

#include <nsEditorEventListeners.h>

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

List of all members.

Public Member Functions

 nsTextEditorTextListener ()
 default constructor
virtual ~nsTextEditorTextListener ()
 default destructor
void SetEditor (nsIEditor *aEditor)
 SetEditor gives an address to the editor that will be accessed.
NS_DECL_ISUPPORTS NS_IMETHOD HandleEvent (nsIDOMEvent *aEvent)
NS_IMETHOD HandleText (nsIDOMEvent *aTextEvent)
void handleEvent (in nsIDOMEvent event)
 This method is called whenever an event occurs of the type for which the EventListener interface was registered.

Protected Attributes

nsIEditormEditor
PRBool mCommitText
PRBool mInTransaction

Detailed Description

editor Implementation of the TextListener interface

Definition at line 96 of file nsEditorEventListeners.h.


Constructor & Destructor Documentation

default constructor

Definition at line 408 of file nsEditorEventListeners.cpp.

default destructor

Definition at line 415 of file nsEditorEventListeners.cpp.

{
}

Member Function Documentation

This method is called whenever an event occurs of the type for which the EventListener interface was registered.

Parameters:
evtThe Event contains contextual information about the event. It also contains the stopPropagation and preventDefault methods which are used in determining the event's flow and default action.

Definition at line 420 of file nsEditorEventListeners.cpp.

{
#ifdef DEBUG_IME
   printf("nsTextEditorTextListener::HandleEvent\n");
#endif
  return NS_OK;
}

Implements nsIDOMTextListener.

Definition at line 431 of file nsEditorEventListeners.cpp.

{
#ifdef DEBUG_IME
   printf("nsTextEditorTextListener::HandleText\n");
#endif
   nsCOMPtr<nsIPrivateTextEvent> textEvent = do_QueryInterface(aTextEvent);
   if (!textEvent) {
      //non-ui event passed in.  bad things.
      return NS_OK;
   }

   nsAutoString            composedText;
   nsresult                result;
   nsIPrivateTextRangeList *textRangeList;
   nsTextEventReply        *textEventReply;

   textEvent->GetText(composedText);
   textEvent->GetInputRange(&textRangeList);
   textEvent->GetEventReply(&textEventReply);
   textRangeList->AddRef();
   nsCOMPtr<nsIEditorIMESupport> imeEditor = do_QueryInterface(mEditor, &result);
   if (imeEditor) {
     PRUint32 flags;
     // if we are readonly or disabled, then do nothing.
     if (NS_SUCCEEDED(mEditor->GetFlags(&flags))) {
       if (flags & nsIPlaintextEditor::eEditorReadonlyMask || 
           flags & nsIPlaintextEditor::eEditorDisabledMask) {
#if DEBUG_IME
         printf("nsTextEditorTextListener::HandleText,  Readonly or Disabled\n");
#endif
         return NS_OK;
       }
     }
     result = imeEditor->SetCompositionString(composedText,textRangeList,textEventReply);
   }
   return result;
}

Here is the call graph for this function:

SetEditor gives an address to the editor that will be accessed.

Parameters:
aEditorthe editor this listener calls for editing operations

Definition at line 109 of file nsEditorEventListeners.h.

{mEditor = aEditor;}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 121 of file nsEditorEventListeners.h.

Definition at line 120 of file nsEditorEventListeners.h.

Definition at line 122 of file nsEditorEventListeners.h.


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