home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / statbar.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  5.2 KB  |  184 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. //
  21. // STATBAR.H
  22. //
  23. // DESCRIPTION:
  24. //        This file contains the declaration of the CNetscapeStatusBar
  25. //        class.
  26. //
  27. // CREATED:    03/01/96, 12:11:57        AUTHOR: Scott Jones
  28. //
  29. ///
  30.  
  31.  
  32. #if    !defined(__STATBAR_H__)
  33. #define    __STATBAR_H__
  34.  
  35. #ifndef    __AFXWIN_H__
  36.     #error include 'stdafx.h' before including this    file for PCH
  37. #endif
  38.  
  39. #include "taskbar.h"
  40.  
  41. /****************************************************************************
  42. *
  43. *    Class: CNetscapeStatusBar
  44. *
  45. *    DESCRIPTION:
  46. *        This object encapsulates the functionality of our status bar. We do
  47. *        some special things, like the progress bar and security icon.
  48. *
  49. ****************************************************************************/
  50.  
  51. typedef int EStatBarMode;
  52.  
  53. #define eSBM_INVALID -1
  54. #define eSBM_Simple   0
  55. #define eSBM_Panes    1
  56. #define eSBM_LAST     2 // Derived classes can have modes starting with this enum
  57.  
  58. #define CNetscapeStatusBarBase    CStatusBar
  59.  
  60. class CNetscapeStatusBar : public CNetscapeStatusBarBase
  61. {
  62.    // Must do this so we can use IsKindOf
  63.    DECLARE_DYNAMIC(CNetscapeStatusBar)
  64.     
  65. public:
  66.    CNetscapeStatusBar();
  67.    ~CNetscapeStatusBar();
  68.    BOOL Create( CWnd *pParent, BOOL bSecurityStatus = TRUE, BOOL bTaskbar = TRUE );
  69.  
  70.    BOOL SetIndicators( const UINT* lpIDArray, int nIDCount );
  71.    BOOL ResetPanes( EStatBarMode enStatBarMode, BOOL bForce = FALSE );
  72.    
  73.    void SetPercentDone( const int32 nPercent );
  74.    
  75.    EStatBarMode GetStatBarMode() { return m_enStatBarMode; }
  76.    
  77.    void ShowTaskBar( int iCmdShow );
  78.    
  79.    void StartAnimation();
  80.    void StopAnimation();
  81.  
  82.    BOOL SetTaskBarPaneWidth( int iWidth );
  83.    BOOL SetTaskBarSize( CDockedTaskBar *pTaskBar );
  84.    
  85.  #ifdef _WIN32
  86.    CWnd *SetParent( CWnd *pWndNewParent );
  87.  #endif
  88.  
  89. protected:
  90.     virtual BOOL CreateDefaultPanes();
  91.     virtual void SaveModeState();
  92.     virtual void SetupMode();
  93.    
  94.    virtual BOOL PreTranslateMessage( MSG *pMsg );
  95.    
  96. protected:
  97.    //{{AFX_MSG(CNetscapeStatusBar)
  98.    afx_msg void OnPaint();
  99.    afx_msg void OnDestroy();
  100.    afx_msg void OnSize(UINT nType, int cx, int cy);
  101.    afx_msg void OnLButtonDown( UINT nFlags, CPoint point );   
  102.    //}}AFX_MSG
  103.  
  104. protected:
  105.    void DrawProgressBar();
  106.    void DrawSecureStatus(HDC hdc);
  107.    void DrawSignedStatus(HDC hdc);
  108.    
  109.    // Pulsing vapor trails (aka Cylon) mode methods   
  110. protected:
  111.    void StartPulse();
  112.    void StopPulse();
  113.    void PulsingVaporTrails();
  114.    static void CALLBACK EXPORT PulseTimerProc( HWND, UINT, UINT, DWORD );
  115.  
  116. private:
  117.    class CParentSubclass // Subclasses parent's window
  118.    {
  119.    public:
  120.        CParentSubclass( CWnd *pParent, CNetscapeStatusBar *pStatusBar );
  121.        ~CParentSubclass();
  122.  
  123.    public:
  124.        void SetPrevMode( EStatBarMode enPrevMode ) { m_enPrevMode = enPrevMode; }
  125.        EStatBarMode GetPrevMode() { return m_enPrevMode; }
  126.  
  127.        void StartMonitor();
  128.        void StopMonitor();
  129.        
  130.    public:        
  131.        static LRESULT CALLBACK EXPORT ParentSubclassProc( HWND, UINT, WPARAM, LPARAM );
  132.        static void CALLBACK EXPORT MonitorTimerProc( HWND, UINT, UINT, DWORD );
  133.        
  134.    private:
  135.        CNetscapeStatusBar *   m_pStatusBar;
  136.        CWnd *                 m_pParent;
  137.        WNDPROC                m_pfOldWndProc;
  138.        
  139.        EStatBarMode           m_enPrevMode;
  140.        
  141.        UINT                   m_uTimerId;       
  142.    };
  143.    friend class CParentSubclass;
  144.    friend LRESULT CALLBACK EXPORT CParentSubclass::ParentSubclassProc( HWND, UINT, WPARAM, LPARAM );
  145.    
  146. private:   
  147.    DECLARE_MESSAGE_MAP()
  148.  
  149. public:
  150.    CFrameGlue *m_pProxy2Frame; // Used while serving OLE container; mainly for JavaScript
  151.     
  152. protected:
  153.    int32 m_nDone;         // Percentage for progress
  154.    
  155.    int32 m_iAnimRef;      // Non-zero if animation in progress for parent frame window
  156.    
  157.    UINT  m_uTimerId;
  158.    UINT  m_uVaporPos;
  159.    
  160.    BOOL  m_bTaskbar;
  161.    
  162.    BOOL m_bSecurityStatus;
  163.    
  164.    EStatBarMode m_enStatBarMode;
  165.    
  166.    CNetscapeStatusBar::CParentSubclass *pParentSubclass;
  167.  
  168.    CNSToolTip2 *m_pTooltip;
  169.    
  170.    static HBITMAP sm_hbmpSecure;
  171.    static SIZE sm_sizeSecure;
  172.    static int sm_iRefCount;
  173.  
  174.    // Mode state info for particular pane modes   
  175. private:
  176.    int               m_iStatBarPaneWidth; // eSBM_Panes: save the width of the Taskbar pane
  177.    CDockedTaskBar *  m_pTaskBar; // Set if the task bar needs resizing
  178.    
  179.    UINT *m_anIDSaved; // Save the panes we were displaying
  180.    int m_iSavedCount;
  181. };
  182.  
  183. #endif // __STATBAR_H__
  184.