home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CSpinningN.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.2 KB  |  114 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. //    CSpinningN.h
  21. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  22.  
  23. #pragma once
  24.  
  25. #include <LPane.h>
  26. #include <LListener.h>
  27. #include <LPeriodical.h>
  28.  
  29. #include "CPatternButton.h"
  30.  
  31. const Int16 kMaxSpinStages         =    40;
  32.  
  33. class CSpinningN :
  34.         public CPatternButton,
  35.         public LListener,
  36.         protected LPeriodical
  37. {
  38.     public:
  39.         enum {
  40.             class_ID            = 'SpnN',
  41.             kAdornmentPaneID    = 'Adrn',
  42.             kFillPaneID            = 'Fill'
  43.         };
  44.         
  45.                             CSpinningN(LStream* inStream);
  46.  
  47.         virtual    void        ListenToMessage(
  48.                                 MessageT            inMessage,
  49.                                 void*                ioParam);
  50.  
  51.         virtual void        AdaptToSuperFrameSize(
  52.                                 Int32                inSurrWidthDelta,
  53.                                 Int32                inSurrHeightDelta,
  54.                                 Boolean             inRefresh);
  55.         static short&        AnimResFile() { return mAnimResFile; }
  56.         
  57.         virtual    void        StopSpinningNow(void);
  58.  
  59.         virtual Boolean        ChangeMode(Int8 newMode, SDimension16& outDimensionDeltas);
  60.         
  61.     protected:
  62.  
  63.         virtual    void        SpendTime(
  64.                                 const EventRecord&    inMacEvent);
  65.  
  66.         virtual    void        StartRepeating(void);
  67.         virtual    void        StopRepeating(void);
  68.  
  69.     
  70.         virtual void        FinishCreateSelf(void);
  71.         virtual void        DrawSelf(void);
  72.  
  73.         virtual void        DrawButtonGraphic(void);
  74.         virtual void        DrawButtonContent(void);
  75.         virtual void        DrawSelfDisabled(void);
  76.         
  77.             //    We redraw on Activate/Deactivate/Enable/Disable in order to play well
  78.             //    with the darn CBevelView stuff.
  79.         virtual void        ActivateSelf()        { Draw(nil); }
  80.         virtual void        DeactivateSelf()    { Draw(nil); }
  81.         virtual void        EnableSelf()        { Draw(nil); }
  82.         virtual void        DisableSelf()        { Draw(nil); }
  83.         
  84.         virtual void        CalcAnimationMode(void);
  85.         virtual    void        RepositionSelf(SDimension16* inNewToolbarSize = NULL);
  86.  
  87.         void                GetLargeIconFrameSize(SDimension16& outFrameSize);
  88.         void                GetSmallIconFrameSize(SDimension16& outFrameSize);
  89.  
  90.         Int32                mIconCount;
  91.         ResIDT                mGraphicID;
  92.         Rect                 mCachedIconFrame;
  93.         
  94.         Int32                 mLastSpinTicks;        // Last time icon was spun.
  95.         Int16                mSpinCounter;        // 0             == not spinning
  96.                                                 // 1..num icons == spin stage
  97.         
  98.         Boolean                mIsCoBranded;
  99.  
  100.         Boolean                mHasLargeCoBrand;
  101.         Int32                mLargeSeqCount;
  102.  
  103.         Boolean                mHasSmallCoBrand;
  104.         Int32                mSmallSeqCount;
  105.         static short        mAnimResFile;
  106.         
  107.         Int32                mRefCount;
  108.         
  109.         Boolean                mFinishedCreatingSelf;
  110.         
  111.         LPane*                mAdornment;
  112.         LPane*                mFill;
  113. };
  114.