зеркало из https://github.com/mozilla/pjs.git
Docked and popup windows can now co-exist.
This commit is contained in:
Родитель
aa29139e37
Коммит
7cedf4de91
|
@ -206,11 +206,28 @@ void CNSNavFrame::UnhookFromButton()
|
|||
m_pButton->SetDepressed(FALSE);
|
||||
m_pButton->Invalidate();
|
||||
CRDFToolbarHolder* pHolder = (CRDFToolbarHolder*)(m_pButton->GetParent()->GetParent()->GetParent());
|
||||
pHolder->SetCurrentButton(NULL);
|
||||
if (pHolder->GetCurrentButton(HT_POPUP_WINDOW) == m_pButton)
|
||||
pHolder->SetCurrentButton(NULL, HT_POPUP_WINDOW);
|
||||
else if (pHolder->GetCurrentButton(HT_DOCKED_WINDOW) == m_pButton)
|
||||
pHolder->SetCurrentButton(NULL, HT_DOCKED_WINDOW);
|
||||
|
||||
m_pButton = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CNSNavFrame::MovePopupToDocked()
|
||||
{
|
||||
if (m_pButton)
|
||||
{
|
||||
CRDFToolbarHolder* pHolder = (CRDFToolbarHolder*)(m_pButton->GetParent()->GetParent()->GetParent());
|
||||
if (pHolder->GetCurrentButton(HT_POPUP_WINDOW) == m_pButton)
|
||||
{
|
||||
pHolder->SetCurrentButton(NULL, HT_POPUP_WINDOW);
|
||||
pHolder->SetCurrentButton(m_pButton, HT_DOCKED_WINDOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CNSNavFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
|
||||
{
|
||||
m_nsContent = CRDFContentView::DisplayRDFTreeFromResource(this, 0, 0, 100, 100, m_Node, pContext);
|
||||
|
@ -550,6 +567,7 @@ void CNSNavFrame::DockFrame(CNSGenFrame* pParent, short dockStyle)
|
|||
if (pFrame)
|
||||
{ // if the parent frame has a docked frame, then destroy it.
|
||||
pFrame->DeleteNavCenter();
|
||||
pFrame->UnhookFromButton();
|
||||
}
|
||||
nsModifyStyle( GetSafeHwnd(), GWL_STYLE, WS_OVERLAPPEDWINDOW, WS_CHILD);
|
||||
nsModifyStyle( GetSafeHwnd(), GWL_EXSTYLE, WS_EX_CLIENTEDGE, 0);
|
||||
|
@ -569,6 +587,9 @@ void CNSNavFrame::DockFrame(CNSGenFrame* pParent, short dockStyle)
|
|||
// Notify HT of our new state.
|
||||
HT_SetTreeStateForButton(HT_TopNode(HT_GetSelectedView(GetHTPane())), HT_DOCKED_WINDOW);
|
||||
HT_SetWindowType(GetHTPane(), HT_DOCKED_WINDOW);
|
||||
|
||||
// If are the popup button, then do the adjustment.
|
||||
MovePopupToDocked();
|
||||
|
||||
CRect rect = m_dockingDragRect;
|
||||
|
||||
|
|
|
@ -1,173 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
// navfram.h : interface of the CNSNavFrame class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef NAVFRAM
|
||||
#define NAVFRAM
|
||||
#include "navbar.h"
|
||||
#include "genframe.h"
|
||||
#include "dragbar.h"
|
||||
#include "rdfliner.h"
|
||||
|
||||
// Window Control IDs for NavCenter.
|
||||
// Improves findability.
|
||||
#define NC_IDW(ID) (AFX_IDW_PANE_LAST - (ID))
|
||||
#define NC_IDW_MISCVIEW NC_IDW(0)
|
||||
#define NC_IDW_SELECTOR NC_IDW(1)
|
||||
#define NC_IDW_OUTLINER NC_IDW(2)
|
||||
#define NC_IDW_HTMLPANE NC_IDW(3)
|
||||
#define NC_IDW_DRAGEDGE NC_IDW(5)
|
||||
#define NC_IDW_NAVMENU NC_IDW(6)
|
||||
|
||||
#ifdef XP_WIN32
|
||||
#define EXPAND_STEP 10
|
||||
#else
|
||||
#define EXPAND_STEP 1
|
||||
#endif
|
||||
|
||||
#define DRAGWIDTH 3
|
||||
#define STARTX 0
|
||||
#define STARTY 0
|
||||
#define MIN_CATEGORY_WIDTH 32
|
||||
#define MIN_CATEGORY_HEIGHT 32
|
||||
#define CX_BORDER 2
|
||||
#define CY_BORDER 2
|
||||
#define NAVFRAME_WIDTH 300
|
||||
#define NAVFRAME_HEIGHT 480
|
||||
#define DOCKSTYLE_FLOATING 0
|
||||
#define DOCKSTYLE_DOCKEDLEFT 1
|
||||
#define DOCKSTYLE_POPUP 2
|
||||
|
||||
// This is a CFrameWnd window that knows how to dock and float. This
|
||||
// frame comtains 2 panes. The left pane is for the selector. The right pane is to
|
||||
// display the content for the selector.
|
||||
static CString gPrefDockPercentage = "browser.navcenter.docked.tree.width";
|
||||
static CString gPrefFloatRect = "browser.navcenter.floating.rect";
|
||||
|
||||
BOOL nsModifyStyle(HWND hWnd, int nStyleOffset,DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0);
|
||||
|
||||
class CRDFContentView;
|
||||
|
||||
class CNSNavFrame : public CFrameWnd
|
||||
{
|
||||
friend class CDragBar;
|
||||
public: // create from serialization only
|
||||
CNSNavFrame();
|
||||
DECLARE_DYNCREATE(CNSNavFrame)
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CNSNavFrame)
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CNSNavFrame();
|
||||
CRDFContentView* GetContentView() {return m_nsContent;}
|
||||
void SetContentView(CRDFContentView* v) { m_nsContent = v; }
|
||||
|
||||
// Add new view to this frame.
|
||||
//void AddViewContext(const char* pUrl, const char* pTitle, CView* pView, CPaneCX* htmlPane = NULL);
|
||||
|
||||
// if pParentFrame == NULL, means we want to create the window as a floating window.
|
||||
// otherwise we want to create a window that is docked in this frame.
|
||||
void CreateNewNavCenter(CNSGenFrame* pParentFrame = NULL, BOOL useViewType = FALSE, HT_ViewType viewType = HT_VIEW_BOOKMARK);
|
||||
void DeleteNavCenter();
|
||||
|
||||
static CNSNavFrame* CreateFramedRDFViewFromResource(CWnd* pParent, int xPos, int yPos,
|
||||
int width, int height,
|
||||
HT_Resource node);
|
||||
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
virtual void StartDrag(CPoint pt, BOOL mapDesktop = TRUE);
|
||||
void Move(CPoint pt); // called when mouse has moved
|
||||
void EndDrag(CPoint pt); // drop
|
||||
void InitLoop();
|
||||
void CancelLoop(short dockStyle);
|
||||
void DrawFocusRect(short dockStyle, BOOL bRemoveRect = FALSE);
|
||||
BOOL Track();
|
||||
short CanDock(CPoint pt, BOOL mapDesktop = FALSE);
|
||||
void ForceFloat(BOOL show = TRUE);
|
||||
int32 GetDockStyle() { return m_dwOverDockStyle;}
|
||||
void SetDockStyle(int32 d) { m_dwOverDockStyle = d; }
|
||||
|
||||
void ComputeDockingSizes();
|
||||
void UpdateTitleBar(HT_View pView);
|
||||
|
||||
CRect GetFloatRect() { return m_rectFloat; }
|
||||
|
||||
public:
|
||||
HT_Pane GetHTPane();
|
||||
|
||||
void SetHTNode(HT_Resource node) { m_Node = node; }
|
||||
void SetRDFButton(CRDFToolbarButton* pButton) { m_pButton = pButton; }
|
||||
CRDFToolbarButton* GetRDFButton() { return m_pButton; }
|
||||
|
||||
void UnhookFromButton();
|
||||
|
||||
protected: // control bar embedded members
|
||||
BOOL m_bDragging; // TRUE if we are dragging this FRAME
|
||||
BOOL m_bDitherLast; //
|
||||
int32 m_dwOverDockStyle; // The orientation
|
||||
|
||||
CRect m_rectLast;
|
||||
CSize m_sizeLast;
|
||||
CPoint m_ptLast; // last mouse position during drag
|
||||
CDC* m_pDC; // where to draw during drag
|
||||
CDragBar* m_DragWnd; // the resize bar, when this frame is docked.
|
||||
HT_Resource m_Node; // the top node of the view.
|
||||
CRDFToolbarButton* m_pButton; // A pointer to the button this view points to.
|
||||
// NULL if window is floating.
|
||||
// All of these rects are in the Desktop window's coordinates.
|
||||
|
||||
CRect m_rectDrag; // bounding rect when this frame is floating
|
||||
CRect m_rectFloat;
|
||||
CRect m_dockingDragRect; // the bounding rect inside the parent frame.
|
||||
CRect m_parentRect;
|
||||
|
||||
int m_DockWidth, m_DockHeight, m_DockSize; // Used to determine docking sizes.
|
||||
int m_nXOffset, m_nYOffset;
|
||||
|
||||
CRDFContentView *m_nsContent; // the content pane.
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
void CNSNavFrame::CalcClientArea(RECT* lpRectClient, CNSGenFrame * pParentFrame = NULL);
|
||||
void CNSNavFrame::DockFrame(CNSGenFrame* pParent, short dockStyle);
|
||||
//{{AFX_MSG(CNSNavFrame)
|
||||
virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnClose( );
|
||||
afx_msg LRESULT OnSizeParent(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg void OnNcLButtonDown( UINT nHitTest, CPoint point );
|
||||
afx_msg void OnMouseMove(UINT nHitTest, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nHitTest, CPoint point);
|
||||
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
afx_msg void OnSize( UINT nType, int cx, int cy );
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif
|
|
@ -900,12 +900,15 @@ void CRDFToolbarButton::FillInMenu(HT_Resource theNode)
|
|||
*/
|
||||
|
||||
CRDFToolbarHolder* pHolder = (CRDFToolbarHolder*)(GetParent()->GetParent()->GetParent());
|
||||
CRDFToolbarButton* pOldButton = pHolder->GetCurrentButton();
|
||||
int state = HT_GetTreeStateForButton(theNode);
|
||||
CRDFToolbarButton* pOldButton = pHolder->GetCurrentButton(state);
|
||||
|
||||
if (pOldButton != NULL)
|
||||
{
|
||||
pOldButton->GetTreeView()->DeleteNavCenter();
|
||||
}
|
||||
pHolder->SetCurrentButton(NULL);
|
||||
|
||||
pHolder->SetCurrentButton(NULL, state);
|
||||
|
||||
if (!m_bDepressed && pOldButton != this)
|
||||
{
|
||||
|
@ -916,7 +919,7 @@ void CRDFToolbarButton::FillInMenu(HT_Resource theNode)
|
|||
{
|
||||
SetDepressed(TRUE);
|
||||
m_pTreeView->SetRDFButton(this);
|
||||
pHolder->SetCurrentButton(this);
|
||||
pHolder->SetCurrentButton(this, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2637,7 +2640,8 @@ CRDFToolbarHolder::CRDFToolbarHolder(int maxToolbars, CFrameWnd* pParentWindow)
|
|||
:CCustToolbar(maxToolbars)
|
||||
{
|
||||
m_pCachedParentWindow = pParentWindow;
|
||||
m_pCurrentButton = NULL;
|
||||
m_pCurrentPopupButton = NULL;
|
||||
m_pCurrentDockedButton = NULL;
|
||||
}
|
||||
|
||||
CRDFToolbarHolder::~CRDFToolbarHolder()
|
||||
|
|
|
@ -367,14 +367,26 @@ class CRDFToolbarHolder : public CCustToolbar
|
|||
protected:
|
||||
HT_Pane m_ToolbarPane;
|
||||
CFrameWnd* m_pCachedParentWindow;
|
||||
CRDFToolbarButton* m_pCurrentButton;
|
||||
CRDFToolbarButton* m_pCurrentDockedButton;
|
||||
CRDFToolbarButton* m_pCurrentPopupButton;
|
||||
|
||||
public:
|
||||
CRDFToolbarHolder(int maxToolbars, CFrameWnd* pParent);
|
||||
virtual ~CRDFToolbarHolder();
|
||||
|
||||
CRDFToolbarButton* GetCurrentButton() { return m_pCurrentButton; }
|
||||
void SetCurrentButton(CRDFToolbarButton* button) { m_pCurrentButton = button; }
|
||||
CRDFToolbarButton* GetCurrentButton(int state)
|
||||
{
|
||||
if (state == HT_POPUP_WINDOW)
|
||||
return m_pCurrentPopupButton;
|
||||
else return m_pCurrentDockedButton;
|
||||
}
|
||||
|
||||
void SetCurrentButton(CRDFToolbarButton* button, int state)
|
||||
{
|
||||
if (state == HT_POPUP_WINDOW)
|
||||
m_pCurrentPopupButton = button;
|
||||
else m_pCurrentDockedButton = button;
|
||||
}
|
||||
|
||||
HT_Pane GetHTPane() { return m_ToolbarPane; }
|
||||
void SetHTPane(HT_Pane p) { m_ToolbarPane = p; }
|
||||
|
|
Загрузка…
Ссылка в новой задаче