home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CProxyPane.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.6 KB  |  148 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. //    CProxyPane.h
  21. //
  22. // ===========================================================================
  23.  
  24. #ifndef CProxyPane_H
  25. #define CProxyPane_H
  26. #pragma once
  27.  
  28. // Includes
  29.  
  30. #include <LGAIconSuite.h>
  31. #include <LListener.h>
  32. #include <LDragAndDrop.h>
  33.  
  34. #include "CProxyCaption.h"
  35. #include "MPaneEnablerPolicy.h"
  36.  
  37. // Forward declarations
  38.  
  39. class LView;
  40. class CNetscapeWindow;
  41.  
  42. //
  43. // Class declaration
  44. //
  45.  
  46. class CProxyPane
  47. :    public LGAIconSuite
  48. ,    public LListener
  49. ,    public LDragAndDrop
  50. ,    public MPaneEnablerPolicy
  51. {
  52. public:
  53.     enum {
  54.         class_ID = 'Bpxy',
  55.         
  56.         kProxyViewID            = 'Bpxv',
  57.         kProxyPaneID            = CProxyPane::class_ID,
  58.         kProxyTitleCaptionID = CProxyCaption::class_ID,
  59.  
  60.         kProxyIconNormalID        = 15313,
  61.         kProxyIconMouseOverID    = 15314
  62.         
  63.     };
  64.  
  65.     typedef LGAIconSuite super;
  66.                             
  67.                             CProxyPane(
  68.                                     LStream*        inStream);
  69.     virtual                  ~CProxyPane();
  70.  
  71.     virtual void            ListenToMessage(
  72.                                     MessageT        inMessage,
  73.                                     void*            ioParam);
  74.                                     
  75.     virtual void            DoDragSendData(
  76.                                     FlavorType        inFlavor,
  77.                                     ItemReference    inItemRef,
  78.                                     DragReference    inDragRef);
  79.                                         
  80.     virtual void            Click(
  81.                                     SMouseDownEvent&        inMouseDown);
  82.  
  83.     virtual void            MouseEnter(
  84.                                     Point                inPortPt,
  85.                                     const EventRecord&    inMacEvent);
  86.     virtual void            MouseLeave();
  87.     
  88.     void                    SetIconIDs(ResIDT inNormalID, ResIDT inMouseOverID)
  89.                                 {    mProxyIconNormalID = inNormalID;
  90.                                     mProxyIconMouseOverID = inMouseOverID;
  91.                                     SetIconResourceID(inNormalID);
  92.                                     Refresh(); }
  93.     virtual void            HandleEnablingPolicy(); // required as a MPaneEnablerPolicy
  94.  
  95. protected:
  96.  
  97.     virtual void            FinishCreateSelf();
  98.  
  99.     virtual void            ActivateSelf();
  100.     virtual void            DeactivateSelf();
  101.                         
  102.     virtual void            ClickSelf(
  103.                                     const SMouseDownEvent&    inMouseDown);
  104.  
  105.     virtual void            ToggleIcon(
  106.                                     ResIDT            inResID);
  107.  
  108.     CNetscapeWindow*        mWindow;
  109.     LView*                    mProxyView;
  110.     LCaption*                mIconText;
  111.     
  112.     DragSendDataUPP         mSendDataUPP;
  113.     Boolean                    mMouseInFrame;
  114.     ResIDT                    mProxyIconNormalID;
  115.     ResIDT                    mProxyIconMouseOverID;
  116.  
  117.  
  118.     virtual void            ToggleIconSelected(
  119.                                     Boolean            inIconIsSelected);                                    
  120.     
  121.     // Stack-based helper class to handle toggling selected state of icon.
  122.  
  123.     class StToggleIconSelected
  124.     {
  125.     public:
  126.         StToggleIconSelected(CProxyPane& inProxyPane, Boolean inSelected)
  127.             :    mProxyPane(inProxyPane),
  128.                 mSelectedState(inSelected)
  129.         {
  130.             mProxyPane.ToggleIconSelected(mSelectedState);
  131.         }
  132.         
  133.         ~StToggleIconSelected()
  134.         {
  135.             mProxyPane.ToggleIconSelected(!mSelectedState);
  136.         }
  137.         
  138.     protected:
  139.         CProxyPane&                mProxyPane;
  140.         Boolean                    mSelectedState;
  141.     };
  142.     
  143.     friend class CProxyPane::StToggleIconSelected;
  144. };
  145.  
  146.  
  147. #endif
  148.