Back to index

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

List of all members.

Public Member Functions

 nsTextInputListener ()
 the default constructor
virtual ~nsTextInputListener ()
 the default destructor.
void SetFrame (nsTextControlFrame *aFrame)
 SetEditor gives an address to the editor that will be accessed.
NS_DECL_ISUPPORTS
NS_DECL_NSISELECTIONLISTENER
NS_IMETHOD 
HandleEvent (nsIDOMEvent *aEvent)
 nsIDOMFocusListener interfaces used to propagate focus, blur, and change notifications
NS_IMETHOD Focus (nsIDOMEvent *aEvent)
 Processes a focus event.
NS_IMETHOD Blur (nsIDOMEvent *aEvent)
 Processes a blur event.
NS_IMETHOD KeyDown (nsIDOMEvent *aKeyEvent)
 Processes a key pressed event.
NS_IMETHOD KeyPress (nsIDOMEvent *aKeyEvent)
 Processes a key typed event.
NS_IMETHOD KeyUp (nsIDOMEvent *aKeyEvent)
 Processes a key release event.
void notifySelectionChanged (in nsIDOMDocument doc, in nsISelection sel, in short reason)
void handleEvent (in nsIDOMEvent event)
 This method is called whenever an event occurs of the type for which the EventListener interface was registered.
void EditAction ()
 Called after the editor completes a user action.

Public Attributes

const short NO_REASON = 0
const short DRAG_REASON = 1
const short MOUSEDOWN_REASON = 2
const short MOUSEUP_REASON = 4
const short KEYPRESS_REASON = 8
const short SELECTALL_REASON = 16

Protected Member Functions

nsresult UpdateTextInputCommands (const nsAString &commandsToUpdate)
 NS_HIDDEN_ (nsINativeKeyBindings *) GetKeyBindings()

Protected Attributes

nsTextControlFramemFrame
PRPackedBool mSelectionWasCollapsed
PRPackedBool mKnowSelectionCollapsed
PRPackedBool mHadUndoItems
 Whether we had undo items or not the last time we got EditAction() notification (when this state changes we update undo and redo menus)
PRPackedBool mHadRedoItems
 Whether we had redo items or not the last time we got EditAction() notification (when this state changes we update undo and redo menus)

Detailed Description

Definition at line 150 of file nsTextControlFrame.cpp.


Constructor & Destructor Documentation

the default destructor.

virtual due to the possibility of derivation.

Definition at line 227 of file nsTextControlFrame.cpp.

{
}

Member Function Documentation

Processes a blur event.

Parameters:
aMouseEvent
See also:
nsIDOMEvent.h
Returns:
whether the event was consumed or ignored.
See also:
nsresult

Implements nsIDOMFocusListener.

Definition at line 328 of file nsTextControlFrame.cpp.

{
  if (!mFrame)
    return NS_OK;

  nsCOMPtr<nsIEditor> editor;
  mFrame->GetEditor(getter_AddRefs(editor));
  if (editor) {
    editor->RemoveEditorObserver(this);
  }

  mFrame->SetHasFocus(PR_FALSE);

  return mFrame->CheckFireOnChange();
}

Here is the call graph for this function:

Called after the editor completes a user action.

Here is the caller graph for this function:

Processes a focus event.

Parameters:
aMouseEvent
See also:
nsIDOMEvent.h
Returns:
whether the event was consumed or ignored.
See also:
nsresult

Implements nsIDOMFocusListener.

Definition at line 311 of file nsTextControlFrame.cpp.

{
  if (!mFrame)
    return NS_OK;

  nsCOMPtr<nsIEditor> editor;
  mFrame->GetEditor(getter_AddRefs(editor));
  if (editor) {
    editor->AddEditorObserver(this);
  }

  mFrame->SetHasFocus(PR_TRUE);

  return mFrame->InitFocusedValue();
}

Here is the call graph for this function:

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.

nsIDOMFocusListener interfaces used to propagate focus, blur, and change notifications

See also:
nsIDOMFocusListener

Definition at line 305 of file nsTextControlFrame.cpp.

{
  return NS_OK;
}

Processes a key pressed event.

Parameters:
aKeyEvent
See also:
nsIDOMEvent.h
Returns:
whether the event was consumed or ignored.
See also:
nsresult

Implements nsIDOMKeyListener.

Definition at line 408 of file nsTextControlFrame.cpp.

{
  nsNativeKeyEvent nativeEvent;
  nsINativeKeyBindings *bindings = GetKeyBindings();
  if (bindings && DOMEventToNativeKeyEvent(aKeyEvent, &nativeEvent)) {
    if (bindings->KeyDown(nativeEvent, DoCommandCallback, mFrame)) {
      aKeyEvent->PreventDefault();
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Processes a key typed event.

Parameters:
aKeyEvent
See also:
nsIDOMEvent.h
Returns:
whether the event was consumed or ignored.
See also:
nsresult

Implements nsIDOMKeyListener.

Definition at line 422 of file nsTextControlFrame.cpp.

{
  nsNativeKeyEvent nativeEvent;
  nsINativeKeyBindings *bindings = GetKeyBindings();
  if (bindings && DOMEventToNativeKeyEvent(aKeyEvent, &nativeEvent)) {
    if (bindings->KeyPress(nativeEvent, DoCommandCallback, mFrame)) {
      aKeyEvent->PreventDefault();
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Processes a key release event.

Parameters:
aKeyEvent
See also:
nsIDOMEvent.h
Returns:
whether the event was consumed or ignored.
See also:
nsresult

Implements nsIDOMKeyListener.

Definition at line 436 of file nsTextControlFrame.cpp.

{
  nsNativeKeyEvent nativeEvent;
  nsINativeKeyBindings *bindings = GetKeyBindings();
  if (bindings && DOMEventToNativeKeyEvent(aKeyEvent, &nativeEvent)) {
    if (bindings->KeyUp(nativeEvent, DoCommandCallback, mFrame)) {
      aKeyEvent->PreventDefault();
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

void nsISelectionListener::notifySelectionChanged ( in nsIDOMDocument  doc,
in nsISelection  sel,
in short  reason 
) [inherited]

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

Parameters:
aEditorthe editor this listener calls for editing operations

Definition at line 167 of file nsTextControlFrame.cpp.

{mFrame = aFrame;}

Here is the caller graph for this function:

nsresult nsTextInputListener::UpdateTextInputCommands ( const nsAString &  commandsToUpdate) [protected]

Definition at line 493 of file nsTextControlFrame.cpp.

{
  NS_ENSURE_STATE(mFrame);

  nsIContent* content = mFrame->GetContent();
  NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
  
  nsCOMPtr<nsIDocument> doc = content->GetDocument();
  NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);

  nsCOMPtr<nsIDOMWindowInternal> domWindow = do_QueryInterface(doc->GetScriptGlobalObject());
  NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE);

  return domWindow->UpdateCommands(commandsToUpdate);
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 47 of file nsISelectionListener.idl.

Definition at line 50 of file nsISelectionListener.idl.

Definition at line 197 of file nsTextControlFrame.cpp.

Whether we had redo items or not the last time we got EditAction() notification (when this state changes we update undo and redo menus)

Definition at line 210 of file nsTextControlFrame.cpp.

Whether we had undo items or not the last time we got EditAction() notification (when this state changes we update undo and redo menus)

Definition at line 205 of file nsTextControlFrame.cpp.

Definition at line 200 of file nsTextControlFrame.cpp.

Definition at line 48 of file nsISelectionListener.idl.

Definition at line 49 of file nsISelectionListener.idl.

Definition at line 199 of file nsTextControlFrame.cpp.

const short nsISelectionListener::NO_REASON = 0 [inherited]

Definition at line 46 of file nsISelectionListener.idl.

Definition at line 51 of file nsISelectionListener.idl.


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