Back to index

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

#include <nsEventHandler.h>

List of all members.

Public Member Functions

 nsEventHandler ()
 ~nsEventHandler ()
OSErr HandleNextEvent (EventRecord *aEvt)
OSErr HandleMouseDown ()
OSErr HandleKeyDown ()
OSErr HandleUpdateEvt ()
OSErr HandleActivateEvt ()
OSErr HandleOSEvt ()
OSErr HandleInContent ()
OSErr HandleMenuChoice (SInt32 aChoice)

Private Attributes

EventRecord * mCurrEvent

Detailed Description

Definition at line 47 of file nsEventHandler.h.


Constructor & Destructor Documentation

Definition at line 54 of file nsEventHandler.cpp.

{

}

Definition at line 59 of file nsEventHandler.cpp.

{

}

Member Function Documentation

Definition at line 200 of file nsEventHandler.cpp.

{ 
       return noErr;
}

Here is the caller graph for this function:

Definition at line 214 of file nsEventHandler.cpp.

{ 
       return noErr;
}

Definition at line 137 of file nsEventHandler.cpp.

{ 
       OSErr  err = noErr;
       SInt8  charCode;
       SInt32 menuChoice = 0;
       
       charCode = mCurrEvent->message & charCodeMask;
       if ((mCurrEvent->modifiers & cmdKey) != 0)
       {
              switch (charCode)
              {
                     case 'E':
                     case 'e':
                            menuChoice = rMenuFile;
                            menuChoice <<= 16;
                            menuChoice |= rMenuItemASEncode;
                            break;
                            
                     case 'D':
                     case 'd':
                            menuChoice = rMenuFile;
                            menuChoice <<= 16;
                            menuChoice |= rMenuItemASDecode;
                            break;
                            
                     case 'F':
                     case 'f':
                            menuChoice = rMenuFile;
                            menuChoice <<= 16;
                            menuChoice |= rMenuItemASEncodeFolder;
                            break;
                            
                     case 'O':
                     case 'o':
                            menuChoice = rMenuFile;
                            menuChoice <<= 16;
                            menuChoice |= rMenuItemASDecodeFolder;
                            break;
                            
                     case 'Q':
                     case 'q':
                            menuChoice = rMenuFile;
                            menuChoice <<= 16;
                            menuChoice |= rMenuItemQuit;
                            break;
                            
                     default:
                            menuChoice = 0;
                            break;
              }      
              err = HandleMenuChoice(menuChoice);
       }
       
       return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

OSErr nsEventHandler::HandleMenuChoice ( SInt32  aChoice)

Definition at line 220 of file nsEventHandler.cpp.

{
       OSErr                       err = noErr;
       long                        menuID = HiWord(aChoice);
       long                        menuItem = LoWord(aChoice);
       FSSpec                      file, outFile;
       nsFileSelector              selector;
       
       switch (menuID)
       {
              case rMenuFile:
                     switch (menuItem)
                     {
                            case rMenuItemASEncode:                   /* AS Encode... */
                                   err = selector.SelectFile(&file);
                                   if (err == noErr)
                                   {
                                          if (nsAppleSingleEncoder::HasResourceFork(&file))
                                          {
                                                 nsAppleSingleEncoder encoder;
                                                 err = encoder.Encode(&file);
                                          }
                                   }
                                   break;
                            
                            case rMenuItemASDecode:                   /* AS Decode... */
                                   err = selector.SelectFile(&file);
                                   if (err == noErr)
                                   {
                                          if (nsAppleSingleDecoder::IsAppleSingleFile(&file))
                                          {
                                                 nsAppleSingleDecoder decoder;
                                                 err = decoder.Decode(&file, &outFile);
                                          }
                                   }
                                   break;
                                   
                            case rMenuItemASEncodeFolder:      /* AS Encode Folder... */
                                   err = selector.SelectFolder(&file);
                                   if (err == noErr)
                                   {
                                          nsAppleSingleEncoder encoder;
                                          err = encoder.EncodeFolder(&file);
                                   }
                                   break;
                                   
                            case rMenuItemASDecodeFolder:      /* AS Decode Folder... */
                                   err = selector.SelectFolder(&file);
                                   if (err == noErr)
                                   {
                                          nsAppleSingleDecoder decoder;
                                          err = decoder.DecodeFolder(&file);
                                   }
                                   break;
                                   
                            case rMenuItemQuit:                       /* Quit */
                                   nsASEApp::SetCompletionStatus(true);
                                   break;
                     }
                     break;
              
              case rMenuApple:
                     if (menuItem == rMenuItemAbout)
                            ::Alert(rAboutBox, nil);
                     break;
                     
              default:
                     break;
       }
       
       return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 113 of file nsEventHandler.cpp.

{ 
       OSErr                       err = noErr;
       WindowPtr                   currWindow;
       SInt16                      cntlPartCode;
       SInt32                      menuChoice;
       
       cntlPartCode = FindWindow(mCurrEvent->where, &currWindow);
       switch (cntlPartCode)
       {
              case inMenuBar:
                     menuChoice = MenuSelect(mCurrEvent->where);
                     HandleMenuChoice(menuChoice);
                     ::InvalMenuBar();
                     break;
                     
              default:
                     break;
       }
       
       return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

OSErr nsEventHandler::HandleNextEvent ( EventRecord *  aEvt)

Definition at line 65 of file nsEventHandler.cpp.

{ 
       OSErr err = noErr;
              
       mCurrEvent = aEvt;
       
       switch(aEvt->what)
       {
              case kHighLevelEvent:
                     err = AEProcessAppleEvent(aEvt);
                     if (err != errAEEventNotHandled)
                            break;
                            
              case mouseDown:
                     err = HandleMouseDown();
                     break;
                     
              case mouseUp:
                     break;

              case autoKey:
              case keyDown:
                     err = HandleKeyDown();
                     break;
                     
              case updateEvt:
                     err = HandleUpdateEvt();
                     break;
                     
              case activateEvt:
                     err = HandleActivateEvt();
                     break;
                     
              case osEvt:
                     err = HandleOSEvt();
                     break;
              
              case nullEvent:
                     break;
                     
              default:
                     break;
       }
       
       return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 206 of file nsEventHandler.cpp.

{ 
       ::HiliteMenu(0);
       
       return noErr;
}

Here is the caller graph for this function:

Definition at line 194 of file nsEventHandler.cpp.

{ 
       return noErr;
}

Here is the caller graph for this function:


Member Data Documentation

EventRecord* nsEventHandler::mCurrEvent [private]

Definition at line 64 of file nsEventHandler.h.


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