home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / mac / UserInterface / UCustomizePopUp.cp < prev    next >
Encoding:
Text File  |  1998-04-08  |  2.3 KB  |  72 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19.  
  20. #include "prtypes.h"
  21. #include "UCustomizePopUp.h"
  22.  
  23. MenuDefUPP* UCustomizePopUp::fOrigMenuDefUPP = NULL;
  24. MenuDefUPP UCustomizePopUp::fMyMenuDefUPP = NULL;
  25. LCustomizeMenu* UCustomizePopUp::fCustomize = NULL;
  26.  
  27. long UCustomizePopUp::PopUpMenuSelect(MenuHandle menu, LCustomizeMenu* subclass, short top, short left, short popUpItem)
  28. {
  29.     long result;
  30.     fOrigMenuDefUPP = (MenuDefUPP*)(*menu)->menuProc;
  31.     fCustomize = subclass;
  32.     if(UCustomizePopUp::fMyMenuDefUPP == NULL)
  33.     {
  34.         UCustomizePopUp::fMyMenuDefUPP = NewMenuDefProc(UCustomizePopUp::MDEF);
  35.     }
  36.     (*menu)->menuProc = (char**) &UCustomizePopUp::fMyMenuDefUPP;
  37.     
  38.     result = ::PopUpMenuSelect(menu, top, left, popUpItem);
  39.     
  40.     (*menu)->menuProc = (char**)fOrigMenuDefUPP;
  41.     fCustomize = NULL;
  42.     return result;
  43. }
  44.  
  45. pascal void UCustomizePopUp::MDEF(short message, MenuHandle menu, Rect *rect, Point hitPt, short *item)
  46. {
  47.   // restore the application's A5, so that we can access global
  48.   // variables.
  49.       long savedA5 = ::SetCurrentA5() ;    
  50.     switch(message)
  51.     {
  52.         case mDrawMsg:
  53.             UCustomizePopUp::fCustomize->Draw    (menu, UCustomizePopUp::fOrigMenuDefUPP, rect, hitPt, item);
  54.             break;
  55.         case mChooseMsg:
  56.             UCustomizePopUp::fCustomize->Choose    (menu, UCustomizePopUp::fOrigMenuDefUPP, rect, hitPt, item);
  57.             break;
  58.         case mSizeMsg:
  59.             UCustomizePopUp::fCustomize->Size    (menu, UCustomizePopUp::fOrigMenuDefUPP, rect, hitPt, item);
  60.             break;
  61.         case mPopUpMsg:
  62.             UCustomizePopUp::fCustomize->PopUp    (menu, UCustomizePopUp::fOrigMenuDefUPP, rect, hitPt, item);
  63.             break;
  64.         default:
  65.             Assert_(FALSE);
  66.             break;
  67.     }
  68.   ::SetA5 (savedA5) ;
  69. }
  70.  
  71.  
  72.