Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
nsMacEventDispatchHandler Class Reference

#include <nsMacEventHandler.h>

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

List of all members.

Public Member Functions

 nsMacEventDispatchHandler ()
virtual ~nsMacEventDispatchHandler ()
void DispatchGuiEvent (nsWindow *aWidget, PRUint32 aEventType)
void DispatchSizeModeEvent (nsWindow *aWidget, nsSizeMode aMode)
void SetFocus (nsWindow *aFocusedWidget)
void SetActivated (nsWindow *aActiveWidget)
nsWindowGetActive ()
void SetDeactivated (nsWindow *aActiveWidget)
void SetWidgetHit (nsWindow *aWidgetHit)
void SetWidgetPointed (nsWindow *aWidgetPointed)
nsWindowGetWidgetHit ()
nsWindowGetWidgetPointed ()
virtual void NotifyDelete (void *aDeletedObject)

Private Attributes

nsWindowmActiveWidget
nsWindowmWidgetHit
nsWindowmWidgetPointed

Detailed Description

Definition at line 58 of file nsMacEventHandler.h.


Constructor & Destructor Documentation

Definition at line 84 of file nsMacEventHandler.cpp.

{
       mActiveWidget = nsnull;
       mWidgetHit           = nsnull;
       mWidgetPointed       = nsnull;
#if TRACK_MOUSE_LOC
  mLastGlobalMouseLoc.h = mLastGlobalMouseLoc.v = 0;
#endif
}

Definition at line 98 of file nsMacEventHandler.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 123 of file nsMacEventHandler.cpp.

{
       NS_ASSERTION(aWidget,"attempted to dispatch gui event to null widget");
       if (!aWidget)
              return;

       nsGUIEvent guiEvent(PR_TRUE, aEventType, aWidget);
       guiEvent.time = PR_IntervalNow();
       aWidget->DispatchWindowEvent(guiEvent);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 137 of file nsMacEventHandler.cpp.

{
       NS_ASSERTION(aWidget,"attempted to dispatch gui event to null widget");
       if (!aWidget)
              return;

       nsSizeModeEvent event(PR_TRUE, NS_SIZEMODE, aWidget);
       event.time = PR_IntervalNow();
       event.mSizeMode = aMode;
       aWidget->DispatchWindowEvent(event);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 70 of file nsMacEventHandler.h.

{return(mActiveWidget);}

Here is the caller graph for this function:

Definition at line 76 of file nsMacEventHandler.h.

{return(mWidgetHit);}

Here is the caller graph for this function:

Definition at line 77 of file nsMacEventHandler.h.

{return(mWidgetPointed);}

Here is the caller graph for this function:

void nsMacEventDispatchHandler::NotifyDelete ( void aDeletedObject) [virtual]

Implements nsDeleteObserver.

Definition at line 303 of file nsMacEventHandler.cpp.

{
       if (mActiveWidget == aDeletedObject)
              mActiveWidget = nsnull;
       
       if (mWidgetHit == aDeletedObject)
              mWidgetHit = nsnull;

       if (mWidgetPointed == aDeletedObject)
              mWidgetPointed = nsnull;

}

Definition at line 182 of file nsMacEventHandler.cpp.

{
  //printf("nsMacEventDispatcher::SetActivated \n");
  
       if (aActivatedWidget == mActiveWidget) {
              //printf("already the active widget. Bailing!\n");
              return;
       }

  if(aActivatedWidget) {
    nsWindowType wtype;
    aActivatedWidget->GetWindowType(wtype);
    if ( eWindowType_popup == wtype ) {
      //printf("nsMacEventDispatcher::SetActivated type popup, bail\n");
      return;
    }
  }
  
       // tell the old widget it is not focused
       if (mActiveWidget)
       {
              mActiveWidget->ResetInputState();
              mActiveWidget->RemoveDeleteObserver(this);
              //printf("nsMacEventDispatchHandler::SetActivated sends NS_LOSTFOCUS\n");
              DispatchGuiEvent(mActiveWidget, NS_LOSTFOCUS);
       }

       mActiveWidget = aActivatedWidget;

       // let the new one know it got activation
       if (mActiveWidget)
       {
              mActiveWidget->AddDeleteObserver(this);
              //printf("nsMacEventDispatcher::SetActivated sends NS_GOTFOCUS\n");
              DispatchGuiEvent(mActiveWidget, NS_GOTFOCUS);
              
              //printf("nsMacEventDispatchHandler::SetActivated sends NS_ACTIVATE\n");
              DispatchGuiEvent(mActiveWidget, NS_ACTIVATE);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 227 of file nsMacEventHandler.cpp.

{
    //printf("nsMacEventDispatchHandler::SetDeactivated\n");
    if(aDeactivatedWidget) {
      nsWindowType wtype;
      aDeactivatedWidget->GetWindowType(wtype);
      if ( eWindowType_popup == wtype ) {
        //printf("nsMacEventDispatchHandler::SetDeactivated type popup, bail\n");
        return;
      }
    }
      
    // If the deactivated toplevel window contains mActiveWidget, then
    // clear out mActiveWidget.

    if (mActiveWidget) {
      nsCOMPtr<nsIWidget> curWin = do_QueryInterface(NS_STATIC_CAST(nsIWidget*, mActiveWidget));
      for (;;) {
        nsCOMPtr<nsIWidget> parent = dont_AddRef(curWin->GetParent());
        if (!parent)
          break;
        curWin = parent;
      }

      if (NS_STATIC_CAST(nsWindow*, NS_STATIC_CAST(nsIWidget*, curWin)) == aDeactivatedWidget) {
        //printf("   nsMacEventDispatchHandler::SetDeactivated sends NS_DEACTIVATE\n");
        mActiveWidget->RemoveDeleteObserver(this);
        mActiveWidget = nsnull;
      }
    }

    DispatchGuiEvent(aDeactivatedWidget, NS_DEACTIVATE);       
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 152 of file nsMacEventHandler.cpp.

{
    // This short circut lives inside of nsEventStateManager now
       if (aFocusedWidget == mActiveWidget)
              return;
              
       // tell the old widget it is not focused
       if (mActiveWidget)
       {
              mActiveWidget->ResetInputState();
              mActiveWidget->RemoveDeleteObserver(this);
              //printf("nsMacEventDispatcher::SetFocus sends NS_LOSTFOCUS\n");
              DispatchGuiEvent(mActiveWidget, NS_LOSTFOCUS);
       }

       mActiveWidget = aFocusedWidget;

       // let the new one know it got the focus
       if (mActiveWidget)
       {
              mActiveWidget->AddDeleteObserver(this);
              //printf("nsMacEventDispatcher::SetFocus sends NS_GOTFOCUS\n");
              DispatchGuiEvent(mActiveWidget, NS_GOTFOCUS);
       }
}

Here is the call graph for this function:

Definition at line 264 of file nsMacEventHandler.cpp.

{
       if (aWidgetHit == mWidgetHit)
              return;

       if (mWidgetHit)
         if (! mWidgetHit->RemoveDeleteObserver(this))
              NS_WARNING("nsMacFocusHandler wasn't in the WidgetHit observer list");

       mWidgetHit = aWidgetHit;

       if (mWidgetHit)
         mWidgetHit->AddDeleteObserver(this);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 283 of file nsMacEventHandler.cpp.

{
       if (aWidgetPointed == mWidgetPointed) {
              return;
    }
       
       if (mWidgetPointed) 
         if (! mWidgetPointed->RemoveDeleteObserver(this)) 
              NS_WARNING("nsMacFocusHandler wasn't in the WidgetPointed observer list");
    
       mWidgetPointed = aWidgetPointed;
    
       if (mWidgetPointed)
         mWidgetPointed->AddDeleteObserver(this);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 89 of file nsMacEventHandler.h.

Definition at line 90 of file nsMacEventHandler.h.

Definition at line 91 of file nsMacEventHandler.h.


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