home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / genchrom.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  7.7 KB  |  274 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. #ifndef GENCHROM_H
  20. #define GENCHROM_H
  21.  
  22. #include "apichrom.h"
  23. #include "statbar.h"
  24. #include "animbar.h"
  25. #include "urlbar.h"
  26. #include "csttlbr2.h"
  27. #include "toolbar2.h"
  28. #include "usertlbr.h"
  29.  
  30. class CGenericToolBar: public INSToolBar, public INSAnimation {
  31.  
  32. protected:
  33.     CCommandToolbar *m_pCommandToolbar;
  34.     UINT          m_nBitmapID;
  35.     LPUNKNOWN m_pOuterUnk;
  36.     ULONG m_ulRefCount;
  37.  
  38. public:
  39.     CGenericToolBar( LPUNKNOWN pOuterUnk = NULL );
  40.     ~CGenericToolBar();
  41.  
  42. // IUnknown Interface
  43.     STDMETHODIMP            QueryInterface(REFIID,LPVOID *);
  44.     STDMETHODIMP_(ULONG)    AddRef();
  45.     STDMETHODIMP_(ULONG)    Release();
  46.  
  47. // INSToolbar Interface
  48.     virtual int Create( CFrameWnd *pParent, 
  49.                         DWORD dwStyle = WS_CHILD|WS_VISIBLE|CBRS_TOP, 
  50.                         UINT nID = AFX_IDW_TOOLBAR );
  51.  
  52.     virtual void SetSizes( SIZE sizeButton, 
  53.                            SIZE sizeImage );
  54.  
  55.     virtual void SetButtons( const UINT *lpIDArray,
  56.                             int nIDCount, UINT nBitmapID = 0 );
  57.     
  58.     //cmanske: Added functions convenient adding of popup menu styles to specific buttons
  59.     //  and getting rect (used for CDropDownToolbar that appears below button)
  60.     virtual void SetButtonStyle( UINT nIDButtonCommand, DWORD dwButtonStyle );
  61.     virtual void GetButtonRect( UINT nIDButtonCommand, RECT * pRect );
  62.     
  63.     virtual void AddButton( CToolbarButton *pButton, int index = -1 );
  64.  
  65.     virtual void RemoveAllButtons();
  66.  
  67.     virtual CToolbarButton *RemoveButton( int index );
  68.  
  69.     virtual BOOL LoadBitmap( LPCSTR lpszResourceName );
  70.  
  71.     virtual void SetToolbarStyle( int nToolbarStyle );
  72.  
  73.     virtual void Show( BOOL bShow = TRUE );
  74.  
  75.     // should the buttons be the same width or their own size
  76.     virtual void SetButtonsSameWidth(BOOL bSameWidth);
  77.  
  78.     virtual HWND GetHWnd();
  79.  
  80. // INSAnimation Interface
  81.     virtual void StartAnimation();
  82.     virtual void StopAnimation();
  83. };
  84.  
  85. class CModalStatus;
  86.  
  87. class CGenericStatusBar: public INSStatusBar {
  88. protected:
  89.     CNetscapeStatusBar *m_pStatusBar;
  90.     CNetscapeStatusBar *m_pCreatedBar;
  91.  
  92.     LPUNKNOWN m_pOuterUnk;
  93.     ULONG m_ulRefCount;
  94.  
  95.     int m_iProg;
  96.     CString m_csStatus;
  97.  
  98.     BOOL m_bModal;
  99.     CModalStatus *m_pModalStatus;
  100.  
  101. public:
  102.     
  103.     CGenericStatusBar( LPUNKNOWN );
  104.     ~CGenericStatusBar();
  105.  
  106. // IUnknown Interface
  107.     STDMETHODIMP            QueryInterface(REFIID,LPVOID *);
  108.     STDMETHODIMP_(ULONG)    AddRef();
  109.     STDMETHODIMP_(ULONG)    Release();
  110.  
  111. // INSStatusBar Interface
  112.     virtual BOOL Create( CWnd* pParentWnd, 
  113.                         DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_BOTTOM, 
  114.                         UINT nID = AFX_IDW_STATUS_BAR,
  115.                         BOOL bSecurityStatus = TRUE, BOOL bTaskbar = TRUE );
  116.  
  117.     virtual void Attach( CNetscapeStatusBar *pBar );
  118.  
  119.     // Messages
  120.     virtual void SetStatusText(const char * = NULL);
  121.     virtual const char *GetStatusText();
  122.  
  123.     // Progress
  124.     virtual void SetProgress(int = 0);
  125.     virtual int GetProgress();
  126.     virtual void ProgressComplete();
  127.  
  128.     // Create/Remove a modal status window
  129.     virtual void ModalStatus( BOOL bModal, UINT uDelay, char * pszTitle );
  130.  
  131.     virtual void Show( BOOL bShow = TRUE );
  132.  
  133.     virtual HWND GetHWnd();
  134.  
  135.     // "Cylon" mode cues    
  136.     virtual void StartAnimation();
  137.     virtual void StopAnimation();
  138.     
  139.     CNetscapeStatusBar *GetNetscapeStatusBar();
  140. };
  141.  
  142. //Begin JOKI
  143. //    Purpose:    Provide a registry to monitor when a status bar msg. text is changed
  144. class CStatusBarChangeRegistry    {
  145. protected:
  146.     static CPtrList m_Registry;
  147.     POSITION m_rIndex;
  148.  
  149.     CStatusBarChangeRegistry()    {}
  150.     ~CStatusBarChangeRegistry()    {m_Registry.RemoveAt(m_rIndex);    }
  151. };
  152.  
  153. class CStatusBarChangeItem : public CStatusBarChangeRegistry    {    
  154. protected:
  155.     DWORD m_dwWindowID;
  156.  
  157.     CStatusBarChangeItem(DWORD dwWindowID) : CStatusBarChangeRegistry()    {
  158.         m_dwWindowID = dwWindowID;
  159.     }
  160.     
  161.     virtual void StatusChanging(LPCSTR lpStatusMsg) = 0;
  162.  
  163. public:
  164.     DWORD GetWindowID()    {
  165.         return(m_dwWindowID);
  166.     }
  167.  
  168.     static void Changing(DWORD dwWindowID, LPCSTR lpStatusMsg);
  169. };
  170.  
  171. class CDDEStatusBarChangeItem : public CStatusBarChangeItem    {
  172.     CString m_csServiceName;
  173.     CString m_csLastMsgSent;
  174.  
  175. protected:
  176.     CDDEStatusBarChangeItem(CString& csServiceName, DWORD dwWindowID) : CStatusBarChangeItem(dwWindowID)    {
  177.         m_rIndex = m_Registry.AddTail(this);
  178.         m_csServiceName = csServiceName;
  179.     }
  180.  
  181.     //    Must override.
  182.     void StatusChanging(LPCSTR lpStatusMsg);
  183.     
  184. public:
  185.     CString GetServiceName()    {
  186.         return(m_csServiceName);
  187.     }
  188.  
  189.     BOOL IsSameAsLastMsgSent(LPCSTR lpCurMsg);
  190.  
  191.     //    Consider these the constructor, destructor.
  192.     static BOOL DDERegister(CString &csServiceName, DWORD dwWindowID);
  193.     static BOOL DDEUnRegister(CString &csServiceName, DWORD dwWindowID);
  194. };
  195.  
  196. //End JOKI
  197.  
  198. class CGenericChrome: public IChrome {
  199. protected:
  200.     ULONG m_ulRefCount;
  201.     CFrameWnd *m_pParent;
  202.     LPUNKNOWN m_pOuterUnk;
  203.     CGenericToolBar *m_pToolBar;
  204.     CGenericStatusBar *m_pStatusBar;
  205.  
  206.     CString m_csWindowTitle, m_csDocTitle;
  207.  
  208.     BOOL m_bHasStatus;
  209.  
  210.     CCustToolbar *m_pCustToolbar;
  211.     CString m_toolbarName;
  212.     LPNSTOOLBAR m_pMainToolBar;
  213.  
  214. //#ifndef    NO_TAB_NAVIGATION 
  215.     virtual BOOL CGenericChrome::procTabNavigation( UINT nChar, UINT forward, UINT controlKey );
  216.     UINT    m_tabFocusInChrom; 
  217.     enum  { TAB_FOCUS_IN_NULL, TAB_FOCUS_IN_LOCATION_BAR };
  218. //#endif    /* NO_TAB_NAVIGATION  */
  219.  
  220.  
  221. public:
  222.     // IUnknown Interface
  223.     STDMETHODIMP            QueryInterface(REFIID,LPVOID *);
  224.     STDMETHODIMP_(ULONG)    AddRef(void);
  225.     STDMETHODIMP_(ULONG)    Release(void);
  226.    
  227.     virtual void Initialize( CFrameWnd *pWnd );
  228.  
  229. // Menu bar stuff
  230.     virtual void SetMenu( UINT );
  231.  
  232. // General Toolbar functionality
  233.     virtual void ShowToolbar(UINT nToolbarID, BOOL bShow = TRUE);
  234.     virtual BOOL GetToolbarVisible(UINT nToolbarID);
  235.     virtual CWnd *GetToolbar(UINT nToolbarID);
  236.     virtual void SetToolbarFocus(UINT nToolbarID);
  237.     // nPos, bOpen, and bShowing are IN/OUT parameters. Values going in are default values and values
  238.     // coming out are the values from the registry or default if not in the registry.
  239.     virtual void LoadToolbarConfiguration(UINT nToolbarID, CString &csToolbarName, int32 & nPos, BOOL & bOpen, BOOL & bShowing);
  240.     virtual void SaveToolbarConfiguration(UINT nToolbarID, CString &csToolbarName);
  241.     virtual void SetSaveToolbarInfo(BOOL bSaveToolbarInfo);
  242.  
  243. // Animation Stuff
  244.     virtual void StartAnimation();
  245.     virtual void StopAnimation();
  246.  
  247. //    Window Title Stuff
  248.     virtual void SetWindowTitle(const char *);
  249.     virtual void SetDocumentTitle(const char*);
  250.  
  251. //  ToolbarManager Stuff
  252.     virtual int CreateCustomizableToolbar(CString toolbarName, int nMaxToolbars, BOOL bHasAnimation);
  253.     virtual int CreateCustomizableToolbar(UINT nStringID, int nMaxToolbars, BOOL bHasAnimation);
  254.     virtual CString GetCustToolbarString();
  255.     virtual void RenameCustomizableToolbar(UINT nStringID);
  256.     virtual void FinishedAddingBrowserToolbars();
  257.     virtual void SetToolbarStyle( int nToolbarStyle );
  258.     virtual BOOL CustToolbarShowing();
  259.     virtual void ViewCustToolbar(BOOL bShow);
  260.     virtual void Customize();
  261.     virtual CCustToolbar * GetCustomizableToolbar();
  262.  
  263.  
  264. //  MainFrame's Toolbar Stuff
  265.     virtual void ImagesButton(BOOL);
  266.  
  267. // Constructor and Destructor
  268.     CGenericChrome( LPUNKNOWN pOuterUnk );
  269.     virtual ~CGenericChrome();
  270. };
  271.  
  272.  
  273. #endif
  274.