home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / urlbar.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  5.4 KB  |  185 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. // CURLBar dialog
  21.  
  22. #include "toolbar2.h"
  23. #include "dropmenu.h"
  24.  
  25. #ifndef URLBAR_H
  26. #define URLBAR_H
  27.  
  28. class CEditWnd : public CGenericEdit
  29. {
  30. protected:
  31.     UINT m_idTimer;
  32.     BOOL m_bRestart;
  33.     char * m_pComplete;
  34.     BOOL m_Scroll;
  35.     CWnd* m_pBar;
  36.  
  37. public:
  38.     CEditWnd(CWnd* bar) { m_pBar = bar; m_idTimer = 0; m_bRestart = TRUE; m_pComplete = NULL; m_Scroll = FALSE; }
  39.     ~CEditWnd();
  40.     void UrlCompletion(void);
  41.     void DrawCompletion(CString & cs, char * pszResult);
  42.     virtual BOOL PreTranslateMessage ( MSG * msg );
  43.     virtual LRESULT DefWindowProc( UINT message, WPARAM wParam, LPARAM lParam );
  44.     virtual afx_msg void OnTimer( UINT  nIDEvent );
  45.     DECLARE_MESSAGE_MAP();
  46. };
  47.  
  48. class CPageProxyWindow : public CWnd
  49. {
  50. private:
  51.     BOOL            m_bEraseBackground;
  52.     BOOL            m_bDraggingURL;
  53.     BOOL            m_bDragIconHit;
  54.     BOOL            m_bDragStatusHint;
  55.     LPMWCONTEXT        m_pIMWContext;
  56.     CPoint            m_cpLBDown;
  57.     UINT            m_hFocusTimer;
  58.  
  59.     CNSToolTip2  m_ToolTip;
  60.  
  61.     CBitmap*        m_pBitmap;
  62.     HICON            m_hIcon;
  63.  
  64. public:
  65.     CPageProxyWindow();
  66.     ~CPageProxyWindow();
  67.     BOOL Create(CWnd *pParent);
  68.     void SetContext(LPUNKNOWN pUnk);
  69.  
  70. protected:
  71.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  72.  
  73.     // Generated message map functions
  74.     //{{AFX_MSG(CPageProxyWindow)
  75.     afx_msg void OnPaint();
  76.     afx_msg void OnShowWindow( BOOL bShow, UINT nStatus );
  77.     afx_msg BOOL OnEraseBkgnd( CDC* pDC );
  78.     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  79.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  80.     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  81.     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  82.     virtual afx_msg void OnTimer( UINT  nIDEvent );
  83.     afx_msg int OnMouseActivate( CWnd *, UINT, UINT );
  84.     //}}AFX_MSG
  85.     DECLARE_MESSAGE_MAP()
  86.  
  87.  
  88. };
  89.  
  90. class CProxySurroundWnd : public CWnd
  91. {
  92. public:
  93.     BOOL Create(CWnd *pParent);
  94.  
  95.     afx_msg void OnPaint();
  96.  
  97.     DECLARE_MESSAGE_MAP()
  98. };
  99.  
  100. #define CURLBarBase    CDialogBar
  101.  
  102. class CURLBar : public CURLBarBase
  103. {
  104.     DECLARE_DYNCREATE(CURLBar)
  105.  
  106. protected:
  107.     BOOL                m_bEraseBackground;
  108.     LPUNKNOWN           m_pUnkTabCtrl;
  109.     //CLM: Bitmap target drag current URL (bookmark format)
  110.     CWnd                * m_pDragURL;
  111.     LPMWCONTEXT              m_pIMWContext;
  112.     int                   m_iViewType;
  113.     int                      m_nTextStatus; // TRUE if 'location' is displayed as the text else FALSE
  114.     int                      m_DragIconY;         //CLM: Icon for dragging URL of current doc
  115.     int                      m_DragIconX;
  116.     BOOL                  m_bDraggingURL;      // For drag/drop initiation
  117.     BOOL                  m_bDragIconHit;
  118.     BOOL                  m_bDragStatusHint;
  119.     CPoint                m_cpLBDown;
  120.     int                   m_lastSelection;
  121.     HFONT                m_pFont;   // font for URL bar
  122.     CDropMenu            * m_pDropMenu;
  123.     CPageProxyWindow    * m_pPageProxy;
  124.     CProxySurroundWnd    * m_pProxySurround;
  125.     HBRUSH                  m_hBackgroundBrush;
  126.     int                      m_nBoxHeight;
  127.     
  128. public:
  129. // Dialog Data
  130.     enum { IDD = IDD_URLTITLEBAR };
  131.  
  132. // XXX This should really have accessor fuctions
  133.     BOOL                  m_bAddToDropList;
  134.     CEditWnd*              m_pBox;
  135.  
  136. // Construction
  137.     CURLBar();  // standard constructor
  138.     ~CURLBar(); 
  139.  
  140.     void SetContext(LPUNKNOWN pUnk);
  141.     LPMWCONTEXT GetContext() const { return m_pIMWContext; }
  142.  
  143.     void UpdateFields( const char * msg);
  144.     
  145. // Implementation
  146. protected:
  147.     void ProcessEnterKey();
  148.     
  149.     // Overrides
  150.     virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam );
  151.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  152.  
  153. protected:
  154.     // Generated message map functions
  155.     //{{AFX_MSG(CURLBar)
  156.     afx_msg void OnEditCopy();
  157.     afx_msg void OnEditCut();
  158.     afx_msg void OnEditPaste();
  159.     afx_msg void OnEditUndo();
  160.     afx_msg void OnEditChange();
  161.     afx_msg void OnSelChange();
  162.     afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
  163.     afx_msg void OnUpdateEditCut(CCmdUI* pCmdUI);
  164.     afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI);
  165.     afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
  166.     afx_msg void OnSize(UINT nType, int cx, int cy);
  167.     afx_msg int  OnCreate(LPCREATESTRUCT lpCreateStruct);
  168.     afx_msg void OnClose();
  169.     afx_msg void OnDestroy( );
  170.     afx_msg void OnPaint();
  171.     afx_msg void OnShowWindow( BOOL bShow, UINT nStatus );
  172.     afx_msg BOOL OnEraseBkgnd( CDC* pDC );
  173.     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  174.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  175.     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  176.     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  177.     afx_msg HBRUSH OnCtlColor( CDC*, CWnd*, UINT );
  178.     afx_msg void OnPaletteChanged( CWnd* pFocusWnd );
  179.  
  180.     //}}AFX_MSG
  181.     DECLARE_MESSAGE_MAP()
  182. };
  183.  
  184. #endif // URLBAR_H
  185.