home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / navfram.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  5.7 KB  |  158 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. // navfram.h : interface of the CNSNavFrame class
  20. //
  21. /////////////////////////////////////////////////////////////////////////////
  22. #ifndef NAVFRAM
  23. #define NAVFRAM
  24. #include "navbar.h"
  25. #include "navcntr.h"
  26. #include "navcontv.h"
  27. #include "genframe.h"
  28. #include "dragbar.h"   
  29.  
  30. #ifdef XP_WIN32
  31. #define EXPAND_STEP            10
  32. #else
  33. #define EXPAND_STEP            1
  34. #endif
  35.  
  36. #define DRAGWIDTH            3
  37. #define STARTX                0
  38. #define STARTY                0
  39. #define MIN_CATEGORY_WIDTH 32
  40. #define MIN_CATEGORY_HEIGHT 32
  41. #define CX_BORDER 2
  42. #define CY_BORDER 2
  43. #define NAVFRAME_WIDTH 300
  44. #define NAVFRAME_HEIGHT 480
  45. #define DOCKSTYLE_FLOATING        0
  46. #define DOCKSTYLE_VERTLEFT        1
  47. #define DOCKSTYLE_VERTRIGHT        2
  48. #define DOCKSTYLE_HORZTOP        3
  49. #define DOCKSTYLE_HORZBOTTOM    4
  50.  
  51. // This is a CFrameWnd window that knows how to dock and float.  This 
  52. // frame comtains 2 panes.  The left pane is for the selector.  The right pane is to
  53. // display the content for the selector.
  54. static CString gPrefDockOrientation = "browser.navcenter.dockstyle";
  55. static CString gPrefDockPercentage = "browser.navcenter.docked.tree.width";
  56. static CString gPrefFloatRect = "browser.navcenter.floating.rect";
  57. static CString gPrefSelectorVisible = "browser.navcenter.docked.selector.visible";
  58.  
  59. BOOL nsModifyStyle(HWND hWnd, int nStyleOffset,DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0);
  60.  
  61. class CNSNavFrame : public CFrameWnd
  62. {
  63. friend class CDragBar;
  64. public: // create from serialization only
  65.     CNSNavFrame();
  66.     DECLARE_DYNCREATE(CNSNavFrame)
  67.     // ClassWizard generated virtual function overrides
  68.     //{{AFX_VIRTUAL(CNSNavFrame)
  69.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  70.     //}}AFX_VIRTUAL
  71.  
  72. // Implementation
  73. public:
  74.     virtual ~CNSNavFrame();
  75.     CContentView* GetContentView()    {return m_nsContent;}
  76.     // Add new view to this frame.
  77.     //void AddViewContext(const char* pUrl, const char* pTitle, CView* pView, CPaneCX* htmlPane = NULL);
  78.  
  79.     // if pParentFrame == NULL, means we want to create the window as a floating window.
  80.     // otherwise we want to create a window that is docked in this frame.
  81.     void CreateNewNavCenter(CNSGenFrame* pParentFrame = NULL, BOOL useViewType = FALSE, HT_ViewType viewType = HT_VIEW_BOOKMARK);
  82.     void DeleteNavCenter();
  83.  
  84. #ifdef _DEBUG
  85.     virtual void AssertValid() const;
  86.     virtual void Dump(CDumpContext& dc) const;
  87. #endif
  88.     virtual void StartDrag(CPoint pt, BOOL mapDesktop = TRUE);
  89.     void Move(CPoint pt);       // called when mouse has moved
  90.     void EndDrag(CPoint pt);             // drop
  91.     void InitLoop();
  92.     void CancelLoop(short dockStyle);
  93.     void DrawFocusRect(short dockStyle, BOOL bRemoveRect = FALSE);
  94.     BOOL Track();
  95.     short CanDock(CPoint pt, BOOL mapDesktop = FALSE);
  96.     void ForceFloat(BOOL show = TRUE);
  97.     int32 GetDockStyle() { return m_dwOverDockStyle;}
  98.     void ExpandWindow();
  99.     void CollapseWindow();
  100.  
  101.     void ComputeDockingSizes();
  102.     void UpdateTitleBar(HT_View pView);
  103.  
  104. public:
  105.     HT_Pane GetHTPane();
  106.     CNavMenuBar* GetNavMenuBar() { return m_pNavMenu; }
  107.     BOOL IsTreeVisible() { return m_pSelector->IsTreeVisible(); }
  108.  
  109. protected:  // control bar embedded members
  110.     friend class CSelector;
  111.     BOOL        m_bDragging;        // TRUE if we are dragging this FRAME
  112.     BOOL        m_bDitherLast;        // 
  113.     int32        m_dwOverDockStyle;    // The orientation 
  114.     
  115.     CRect        m_rectLast;
  116.     CSize        m_sizeLast;
  117.     CPoint        m_ptLast;            // last mouse position during drag
  118.     CDC*        m_pDC;                 // where to draw during drag
  119.     CDragBar*    m_DragWnd;            // the resize bar, when this frame is docked.
  120.     
  121.     // All of these rects are in the Desktop window's coordinates.
  122.  
  123.     CRect m_rectDrag;                // bounding rect when this frame is floating
  124.     CRect m_rectFloat;
  125.     CRect m_dockingDragRect;        // the bounding rect inside the parent frame.
  126.     CRect m_parentRect;
  127.  
  128.     int m_DockWidth, m_DockHeight, m_DockSize;  // Used to determine docking sizes.
  129.     int m_nXOffset, m_nYOffset;
  130.  
  131.     CSelector* m_pSelector;        // the selector pane.
  132.     CContentView *m_nsContent;    // the content pane.
  133.     CNavMenuBar* m_pNavMenu;    // the embedded menu bar.
  134.  
  135. // Generated message map functions
  136. protected:
  137.     void CNSNavFrame::CalcClientArea(RECT* lpRectClient, CNSGenFrame * pParentFrame = NULL);
  138.     void CNSNavFrame::DockFrame(CNSGenFrame* pParent, short dockStyle);
  139.     afx_msg void OnPaint();
  140.     //{{AFX_MSG(CNSNavFrame)
  141.     virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
  142.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  143.     afx_msg void OnClose( );
  144.     afx_msg LRESULT OnSizeParent(WPARAM wParam, LPARAM lParam);
  145.     afx_msg void OnNcLButtonDown( UINT nHitTest, CPoint point );
  146.     afx_msg void OnMouseMove(UINT nHitTest, CPoint point);
  147.     afx_msg void OnLButtonUp(UINT nHitTest, CPoint point);
  148.  
  149.         // NOTE - the ClassWizard will add and remove member functions here.
  150.         //    DO NOT EDIT what you see in these blocks of generated code!
  151.     afx_msg void OnSize( UINT nType, int cx, int cy );
  152.     //}}AFX_MSG
  153.     DECLARE_MESSAGE_MAP()
  154. };
  155.  
  156. /////////////////////////////////////////////////////////////////////////////
  157. #endif
  158.