Add CBrowserTooltip class and support for tooltips. Detab files. b=144880 r=chak@netscape.com sr=alecf@netscape.com

This commit is contained in:
locka%iol.ie 2003-01-17 00:40:45 +00:00
Родитель c1b68cde32
Коммит a3425b0dc7
28 изменённых файлов: 1752 добавлений и 1453 удалений

Просмотреть файл

@ -483,3 +483,16 @@ void CBrowserFrame::BrowserFrameGlueObj::UpdateSecurityStatus(PRInt32 aState)
pThis->UpdateSecurityStatus(aState);
}
void CBrowserFrame::BrowserFrameGlueObj::ShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
pThis->m_wndTooltip.SetTipText(CString(aTipText));
pThis->m_wndTooltip.Show(&pThis->m_wndBrowserView, aXCoords, aYCoords);
}
void CBrowserFrame::BrowserFrameGlueObj::HideTooltip()
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
pThis->m_wndTooltip.Hide();
}

Просмотреть файл

@ -83,20 +83,20 @@ static char THIS_FILE[] = __FILE__;
IMPLEMENT_DYNAMIC(CBrowserFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CBrowserFrame, CFrameWnd)
//{{AFX_MSG_MAP(CBrowserFrame)
ON_WM_CREATE()
ON_WM_SETFOCUS()
ON_WM_SIZE()
ON_WM_CLOSE()
ON_WM_ACTIVATE()
//}}AFX_MSG_MAP
//{{AFX_MSG_MAP(CBrowserFrame)
ON_WM_CREATE()
ON_WM_SETFOCUS()
ON_WM_SIZE()
ON_WM_CLOSE()
ON_WM_ACTIVATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // For the Status line
ID_SEPARATOR, // For the Progress Bar
ID_SEPARATOR, // For the padlock image
ID_SEPARATOR, // For the Status line
ID_SEPARATOR, // For the Progress Bar
ID_SEPARATOR, // For the padlock image
};
/////////////////////////////////////////////////////////////////////////////
@ -104,17 +104,17 @@ static UINT indicators[] =
CBrowserFrame::CBrowserFrame()
{
mIsEditor = FALSE;
mIsEditor = FALSE;
}
CBrowserFrame::CBrowserFrame(PRUint32 chromeMask)
{
// Save the chromeMask off. It'll be used
// later to determine whether this browser frame
// will have menubar, toolbar, statusbar etc.
// Save the chromeMask off. It'll be used
// later to determine whether this browser frame
// will have menubar, toolbar, statusbar etc.
m_chromeMask = chromeMask;
mIsEditor = FALSE;
m_chromeMask = chromeMask;
mIsEditor = FALSE;
}
CBrowserFrame::~CBrowserFrame()
@ -123,10 +123,10 @@ CBrowserFrame::~CBrowserFrame()
void CBrowserFrame::OnClose()
{
CMfcEmbedApp *pApp = (CMfcEmbedApp *)AfxGetApp();
pApp->RemoveFrameFromList(this);
CMfcEmbedApp *pApp = (CMfcEmbedApp *)AfxGetApp();
pApp->RemoveFrameFromList(this);
DestroyWindow();
DestroyWindow();
}
// This is where the UrlBar, ToolBar, StatusBar, ProgressBar
@ -134,38 +134,38 @@ void CBrowserFrame::OnClose()
//
int CBrowserFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// Pass "this" to the View for later callbacks
// and/or access to any public data members, if needed
//
m_wndBrowserView.SetBrowserFrame(this);
// Pass "this" to the View for later callbacks
// and/or access to any public data members, if needed
//
m_wndBrowserView.SetBrowserFrame(this);
// Pass on the BrowserFrameGlue also to the View which
// it will use during the Init() process after creation
// of the BrowserImpl obj. Essentially, the View object
// hooks up the Embedded browser's callbacks to the BrowserFrame
// via this BrowserFrameGlue object
m_wndBrowserView.SetBrowserFrameGlue((PBROWSERFRAMEGLUE)&m_xBrowserFrameGlueObj);
// Pass on the BrowserFrameGlue also to the View which
// it will use during the Init() process after creation
// of the BrowserImpl obj. Essentially, the View object
// hooks up the Embedded browser's callbacks to the BrowserFrame
// via this BrowserFrameGlue object
m_wndBrowserView.SetBrowserFrameGlue((PBROWSERFRAMEGLUE)&m_xBrowserFrameGlueObj);
// create a view to occupy the client area of the frame
// This will be the view in which the embedded browser will
// be displayed in
//
if (!m_wndBrowserView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
{
TRACE0("Failed to create view window\n");
return -1;
}
// create a view to occupy the client area of the frame
// This will be the view in which the embedded browser will
// be displayed in
//
if (!m_wndBrowserView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
{
TRACE0("Failed to create view window\n");
return -1;
}
// create the URL bar (essentially a ComboBoxEx object)
if (!m_wndUrlBar.Create(CBS_DROPDOWN | WS_CHILD, CRect(0, 0, 200, 150), this, ID_URL_BAR))
{
TRACE0("Failed to create URL Bar\n");
return -1; // fail to create
}
// create the URL bar (essentially a ComboBoxEx object)
if (!m_wndUrlBar.Create(CBS_DROPDOWN | WS_CHILD, CRect(0, 0, 200, 150), this, ID_URL_BAR))
{
TRACE0("Failed to create URL Bar\n");
return -1; // fail to create
}
// Load the Most Recently Used(MRU) Urls into the UrlBar
m_wndUrlBar.LoadMRUList();
@ -175,128 +175,131 @@ int CBrowserFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
// Create the toolbar with Back, Fwd, Stop, etc. buttons..
// or
// Create a toolbar with the Editor toolbar buttons - Bold, Italic etc.
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(resID))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(resID))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
// Create a ReBar window to which the toolbar and UrlBar
// will be added
if (!m_wndReBar.Create(this))
{
TRACE0("Failed to create ReBar\n");
return -1; // fail to create
}
//Add the ToolBar and UrlBar windows to the rebar
m_wndReBar.AddBar(&m_wndToolBar);
// Create a ReBar window to which the toolbar and UrlBar
// will be added
if (!m_wndReBar.Create(this))
{
TRACE0("Failed to create ReBar\n");
return -1; // fail to create
}
//Add the ToolBar and UrlBar windows to the rebar
m_wndReBar.AddBar(&m_wndToolBar);
if (!mIsEditor)
m_wndReBar.AddBar(&m_wndUrlBar, "Enter URL:");
if (!mIsEditor)
m_wndReBar.AddBar(&m_wndUrlBar, "Enter URL:");
// Create the status bar with two panes - one pane for actual status
// text msgs. and the other for the progress control
if (!m_wndStatusBar.CreateEx(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// Create the status bar with two panes - one pane for actual status
// text msgs. and the other for the progress control
if (!m_wndStatusBar.CreateEx(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// Create the progress bar as a child of the status bar.
// Note that the ItemRect which we'll get at this stage
// is bogus since the status bar panes are not fully
// positioned yet i.e. we'll be passing in an invalid rect
// to the Create function below
// The actual positioning of the progress bar will be done
// in response to OnSize()
RECT rc;
m_wndStatusBar.GetItemRect (1, &rc);
if (!m_wndProgressBar.Create(WS_CHILD|WS_VISIBLE|PBS_SMOOTH, rc, &m_wndStatusBar, ID_PROG_BAR))
{
TRACE0("Failed to create progress bar\n");
return -1; // fail to create
}
// Create the progress bar as a child of the status bar.
// Note that the ItemRect which we'll get at this stage
// is bogus since the status bar panes are not fully
// positioned yet i.e. we'll be passing in an invalid rect
// to the Create function below
// The actual positioning of the progress bar will be done
// in response to OnSize()
RECT rc;
m_wndStatusBar.GetItemRect (1, &rc);
if (!m_wndProgressBar.Create(WS_CHILD|WS_VISIBLE|PBS_SMOOTH, rc, &m_wndStatusBar, ID_PROG_BAR))
{
TRACE0("Failed to create progress bar\n");
return -1; // fail to create
}
// The third pane(i.e. at index 2) of the status bar will have
// the security lock icon displayed in it. Set up it's size(16)
// and style(no border)so that the padlock icons can be properly drawn
m_wndStatusBar.SetPaneInfo(2, -1, SBPS_NORMAL|SBPS_NOBORDERS, 16);
// The third pane(i.e. at index 2) of the status bar will have
// the security lock icon displayed in it. Set up it's size(16)
// and style(no border)so that the padlock icons can be properly drawn
m_wndStatusBar.SetPaneInfo(2, -1, SBPS_NORMAL|SBPS_NOBORDERS, 16);
// Also, set the padlock icon to be the insecure icon to begin with
UpdateSecurityStatus(nsIWebProgressListener::STATE_IS_INSECURE);
// Create a tooltip window. (the MFC tooltip is not really suitable)
m_wndTooltip.Create(CWnd::GetDesktopWindow());
// Based on the "chromeMask" we were supplied during construction
// hide any requested UI elements - statusbar, menubar etc...
// Note that the window styles (WM_RESIZE etc) are set inside
// of PreCreateWindow()
// Also, set the padlock icon to be the insecure icon to begin with
UpdateSecurityStatus(nsIWebProgressListener::STATE_IS_INSECURE);
SetupFrameChrome();
// Based on the "chromeMask" we were supplied during construction
// hide any requested UI elements - statusbar, menubar etc...
// Note that the window styles (WM_RESIZE etc) are set inside
// of PreCreateWindow()
return 0;
SetupFrameChrome();
return 0;
}
void CBrowserFrame::SetupFrameChrome()
{
if(m_chromeMask == nsIWebBrowserChrome::CHROME_ALL)
return;
if(m_chromeMask == nsIWebBrowserChrome::CHROME_ALL)
return;
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_MENUBAR) )
SetMenu(NULL); // Hide the MenuBar
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_MENUBAR) )
SetMenu(NULL); // Hide the MenuBar
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_TOOLBAR) )
m_wndReBar.ShowWindow(SW_HIDE); // Hide the ToolBar
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_TOOLBAR) )
m_wndReBar.ShowWindow(SW_HIDE); // Hide the ToolBar
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_STATUSBAR) )
m_wndStatusBar.ShowWindow(SW_HIDE); // Hide the StatusBar
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_STATUSBAR) )
m_wndStatusBar.ShowWindow(SW_HIDE); // Hide the StatusBar
}
BOOL CBrowserFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
// Change window style based on the chromeMask
// Change window style based on the chromeMask
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_TITLEBAR) )
cs.style &= ~WS_CAPTION; // No caption
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_TITLEBAR) )
cs.style &= ~WS_CAPTION; // No caption
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) )
{
// Can't resize this window
cs.style &= ~WS_SIZEBOX;
cs.style &= ~WS_THICKFRAME;
cs.style &= ~WS_MINIMIZEBOX;
cs.style &= ~WS_MAXIMIZEBOX;
}
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) )
{
// Can't resize this window
cs.style &= ~WS_SIZEBOX;
cs.style &= ~WS_THICKFRAME;
cs.style &= ~WS_MINIMIZEBOX;
cs.style &= ~WS_MAXIMIZEBOX;
}
cs.lpszClass = AfxRegisterWndClass(0);
cs.lpszClass = AfxRegisterWndClass(0);
return TRUE;
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CBrowserFrame message handlers
void CBrowserFrame::OnSetFocus(CWnd* pOldWnd)
{
// forward focus to the view window
m_wndBrowserView.SetFocus();
// forward focus to the view window
m_wndBrowserView.SetFocus();
}
BOOL CBrowserFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
// let the view have first crack at the command
if (m_wndBrowserView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
// let the view have first crack at the command
if (m_wndBrowserView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
// otherwise, do default handling
return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
// otherwise, do default handling
return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
// Needed to properly position/resize the progress bar
@ -304,7 +307,7 @@ BOOL CBrowserFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERIN
void CBrowserFrame::OnSize(UINT nType, int cx, int cy)
{
CFrameWnd::OnSize(nType, cx, cy);
// Get the ItemRect of the status bar's Pane 1
// That's where the progress bar will be located
RECT rc;
@ -318,12 +321,12 @@ void CBrowserFrame::OnSize(UINT nType, int cx, int cy)
#ifdef _DEBUG
void CBrowserFrame::AssertValid() const
{
CFrameWnd::AssertValid();
CFrameWnd::AssertValid();
}
void CBrowserFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
@ -331,8 +334,8 @@ void CBrowserFrame::Dump(CDumpContext& dc) const
void CBrowserFrame::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
CFrameWnd::OnActivate(nState, pWndOther, bMinimized);
CFrameWnd::OnActivate(nState, pWndOther, bMinimized);
m_wndBrowserView.Activate(nState, pWndOther, bMinimized);
}
@ -375,9 +378,9 @@ CMyStatusBar::~CMyStatusBar()
}
BEGIN_MESSAGE_MAP(CMyStatusBar, CStatusBar)
//{{AFX_MSG_MAP(CMyStatusBar)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
//{{AFX_MSG_MAP(CMyStatusBar)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CMyStatusBar::OnLButtonDown(UINT nFlags, CPoint point)
@ -394,6 +397,6 @@ void CMyStatusBar::OnLButtonDown(UINT nFlags, CPoint point)
if(pFrame != NULL)
pFrame->ShowSecurityInfo();
}
CStatusBar::OnLButtonDown(nFlags, point);
CStatusBar::OnLButtonDown(nFlags, point);
}

Просмотреть файл

@ -41,6 +41,7 @@
#endif // _MSC_VER > 1000
#include "BrowserView.h"
#include "BrowserToolTip.h"
#include "IBrowserFrameGlue.h"
#include "MostRecentUrls.h"
@ -48,24 +49,24 @@
class CUrlBar : public CComboBoxEx
{
public:
inline void GetEnteredURL(CString& url) {
GetEditCtrl()->GetWindowText(url);
}
inline void GetSelectedURL(CString& url) {
GetLBText(GetCurSel(), url);
}
inline void SetCurrentURL(LPCTSTR pUrl) {
SetWindowText(pUrl);
}
inline void AddURLToList(CString& url, bool bAddToMRUList = true) {
COMBOBOXEXITEM ci;
ci.mask = CBEIF_TEXT; ci.iItem = -1;
ci.pszText = (LPTSTR)(LPCTSTR)url;
InsertItem(&ci);
inline void GetEnteredURL(CString& url) {
GetEditCtrl()->GetWindowText(url);
}
inline void GetSelectedURL(CString& url) {
GetLBText(GetCurSel(), url);
}
inline void SetCurrentURL(LPCTSTR pUrl) {
SetWindowText(pUrl);
}
inline void AddURLToList(CString& url, bool bAddToMRUList = true) {
COMBOBOXEXITEM ci;
ci.mask = CBEIF_TEXT; ci.iItem = -1;
ci.pszText = (LPTSTR)(LPCTSTR)url;
InsertItem(&ci);
if(bAddToMRUList)
m_MRUList.AddURL((LPTSTR)(LPCTSTR)url);
}
}
inline void LoadMRUList() {
for (int i=0;i<m_MRUList.GetNumURLs();i++)
{
@ -116,38 +117,40 @@ protected:
class CMyStatusBar : public CStatusBar
{
public:
CMyStatusBar();
virtual ~CMyStatusBar();
CMyStatusBar();
virtual ~CMyStatusBar();
protected:
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
DECLARE_MESSAGE_MAP()
DECLARE_MESSAGE_MAP()
};
class CBrowserFrame : public CFrameWnd
{
{
public:
CBrowserFrame();
CBrowserFrame(PRUint32 chromeMask);
CBrowserFrame();
CBrowserFrame(PRUint32 chromeMask);
protected:
DECLARE_DYNAMIC(CBrowserFrame)
DECLARE_DYNAMIC(CBrowserFrame)
public:
inline CBrowserImpl *GetBrowserImpl() { return m_wndBrowserView.mpBrowserImpl; }
inline CBrowserImpl *GetBrowserImpl() { return m_wndBrowserView.mpBrowserImpl; }
CToolBar m_wndToolBar;
CMyStatusBar m_wndStatusBar;
CProgressCtrl m_wndProgressBar;
CUrlBar m_wndUrlBar;
CReBar m_wndReBar;
// The view inside which the embedded browser will
// be displayed in
CBrowserView m_wndBrowserView;
CToolBar m_wndToolBar;
CMyStatusBar m_wndStatusBar;
CProgressCtrl m_wndProgressBar;
CUrlBar m_wndUrlBar;
CReBar m_wndReBar;
CBrowserToolTip m_wndTooltip;
void UpdateSecurityStatus(PRInt32 aState);
void ShowSecurityInfo();
// The view inside which the embedded browser will
// be displayed in
CBrowserView m_wndBrowserView;
void UpdateSecurityStatus(PRInt32 aState);
void ShowSecurityInfo();
// Wrapper functions for UrlBar clipboard operations
inline BOOL CanCutUrlBarSelection() { return m_wndUrlBar.CanCutToClipboard(); }
@ -159,62 +162,62 @@ public:
inline BOOL CanUndoUrlBarEditOp() { return m_wndUrlBar.CanUndoEditOp(); }
inline void UndoUrlBarEditOp() { m_wndUrlBar.UndoEditOp(); }
// This specifies what UI elements this frame will sport
// w.r.t. toolbar, statusbar, urlbar etc.
PRUint32 m_chromeMask;
// This specifies what UI elements this frame will sport
// w.r.t. toolbar, statusbar, urlbar etc.
PRUint32 m_chromeMask;
protected:
//
// This nested class implements the IBrowserFramGlue interface
// The Gecko embedding interfaces call on this interface
// to update the status bars etc.
//
class BrowserFrameGlueObj : public IBrowserFrameGlue
{
//
// NS_DECL_BROWSERFRAMEGLUE below is a macro which expands
// to the function prototypes of methods in IBrowserFrameGlue
// Take a look at IBrowserFrameGlue.h for this macro define
//
//
// This nested class implements the IBrowserFramGlue interface
// The Gecko embedding interfaces call on this interface
// to update the status bars etc.
//
class BrowserFrameGlueObj : public IBrowserFrameGlue
{
//
// NS_DECL_BROWSERFRAMEGLUE below is a macro which expands
// to the function prototypes of methods in IBrowserFrameGlue
// Take a look at IBrowserFrameGlue.h for this macro define
//
NS_DECL_BROWSERFRAMEGLUE
NS_DECL_BROWSERFRAMEGLUE
} m_xBrowserFrameGlueObj;
friend class BrowserFrameGlueObj;
} m_xBrowserFrameGlueObj;
friend class BrowserFrameGlueObj;
public:
void SetupFrameChrome();
void SetupFrameChrome();
void SetEditable(BOOL isEditor) { mIsEditor = isEditor; }
BOOL GetEditable() { return mIsEditor; }
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBrowserFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
//}}AFX_VIRTUAL
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBrowserFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CBrowserFrame();
virtual ~CBrowserFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
//{{AFX_MSG(CBrowserFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSetFocus(CWnd *pOldWnd);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnClose();
afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
//{{AFX_MSG(CBrowserFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSetFocus(CWnd *pOldWnd);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnClose();
afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
BOOL mIsEditor;
BOOL mIsEditor;
};
/////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -46,14 +46,14 @@
// to avoid cluttering this one and to demonstrate other embedding
// principles. For example, nsIPrompt is implemented in a separate DLL.
//
// nsIWebBrowserChrome - This is a required interface to be implemented
// by embeddors
// nsIWebBrowserChrome - This is a required interface to be implemented
// by embeddors
//
// nsIEmbeddingSiteWindow - This is a required interface to be implemented
// by embedders
// - SetTitle() gets called after a document
// load giving us the chance to update our
// titlebar
// nsIEmbeddingSiteWindow - This is a required interface to be implemented
// by embedders
// - SetTitle() gets called after a document
// load giving us the chance to update our
// titlebar
//
// Some points to note...
//
@ -64,8 +64,8 @@
// to indicate progress when a page is being loaded
//
// Next suggested file(s) to look at :
// Any of the BrowserImpl*.cpp files for other interface
// implementation details
// Any of the BrowserImpl*.cpp files for other interface
// implementation details
//
#ifdef _WINDOWS
@ -92,11 +92,11 @@ CBrowserImpl::~CBrowserImpl()
NS_METHOD CBrowserImpl::Init(PBROWSERFRAMEGLUE pBrowserFrameGlue,
nsIWebBrowser* aWebBrowser)
{
m_pBrowserFrameGlue = pBrowserFrameGlue;
SetWebBrowser(aWebBrowser);
m_pBrowserFrameGlue = pBrowserFrameGlue;
SetWebBrowser(aWebBrowser);
return NS_OK;
return NS_OK;
}
//*****************************************************************************
@ -115,6 +115,7 @@ NS_INTERFACE_MAP_BEGIN(CBrowserImpl)
NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow2)
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
NS_INTERFACE_MAP_ENTRY(nsIContextMenuListener2)
NS_INTERFACE_MAP_ENTRY(nsITooltipListener)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_END
@ -124,14 +125,14 @@ NS_INTERFACE_MAP_END
NS_IMETHODIMP CBrowserImpl::GetInterface(const nsIID &aIID, void** aInstancePtr)
{
if(aIID.Equals(NS_GET_IID(nsIDOMWindow)))
{
if (mWebBrowser)
return mWebBrowser->GetContentDOMWindow((nsIDOMWindow **) aInstancePtr);
return NS_ERROR_NOT_INITIALIZED;
}
if(aIID.Equals(NS_GET_IID(nsIDOMWindow)))
{
if (mWebBrowser)
return mWebBrowser->GetContentDOMWindow((nsIDOMWindow **) aInstancePtr);
return NS_ERROR_NOT_INITIALIZED;
}
return QueryInterface(aIID, aInstancePtr);
return QueryInterface(aIID, aInstancePtr);
}
//*****************************************************************************
@ -142,12 +143,12 @@ NS_IMETHODIMP CBrowserImpl::GetInterface(const nsIID &aIID, void** aInstancePtr)
//
NS_IMETHODIMP CBrowserImpl::SetStatus(PRUint32 aType, const PRUnichar* aStatus)
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->UpdateStatusBarText(aStatus);
m_pBrowserFrameGlue->UpdateStatusBarText(aStatus);
return NS_OK;
return NS_OK;
}
NS_IMETHODIMP CBrowserImpl::GetWebBrowser(nsIWebBrowser** aWebBrowser)
@ -187,27 +188,27 @@ NS_IMETHODIMP CBrowserImpl::SetChromeFlags(PRUint32 aChromeMask)
//
NS_IMETHODIMP CBrowserImpl::DestroyBrowserWindow()
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->DestroyBrowserFrame();
m_pBrowserFrameGlue->DestroyBrowserFrame();
return NS_OK;
return NS_OK;
}
// Gets called in response to set the size of a window
// Ex: In response to a JavaScript Window.Open() call of
// the form
//
// window.open("http://www.mozilla.org", "theWin", "width=200, height=400");
// window.open("http://www.mozilla.org", "theWin", "width=200, height=400");
//
// First the CreateBrowserWindow() call will be made followed by a
// call to this method to resize the window
//
NS_IMETHODIMP CBrowserImpl::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
HWND w = m_pBrowserFrameGlue->GetBrowserFrameNativeWnd();
@ -224,9 +225,9 @@ NS_IMETHODIMP CBrowserImpl::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
rcNewFrame.right += rcFrame.Width() - rcClient.Width();
rcNewFrame.bottom += rcFrame.Height() - rcClient.Height();
m_pBrowserFrameGlue->SetBrowserFrameSize(rcNewFrame.Width(), rcNewFrame.Height());
m_pBrowserFrameGlue->SetBrowserFrameSize(rcNewFrame.Width(), rcNewFrame.Height());
return NS_OK;
return NS_OK;
}
NS_IMETHODIMP CBrowserImpl::ShowAsModal(void)
@ -267,25 +268,25 @@ NS_IMETHODIMP CBrowserImpl::FocusPrevElement()
NS_IMETHODIMP CBrowserImpl::SetDimensions(PRUint32 aFlags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION &&
(aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER ||
aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER))
{
m_pBrowserFrameGlue->SetBrowserFramePositionAndSize(x, y, cx, cy, PR_TRUE);
m_pBrowserFrameGlue->SetBrowserFramePositionAndSize(x, y, cx, cy, PR_TRUE);
}
else
{
if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION)
{
m_pBrowserFrameGlue->SetBrowserFramePosition(x, y);
m_pBrowserFrameGlue->SetBrowserFramePosition(x, y);
}
if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER ||
aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)
{
m_pBrowserFrameGlue->SetBrowserFrameSize(cx, cy);
m_pBrowserFrameGlue->SetBrowserFrameSize(cx, cy);
}
}
@ -294,17 +295,17 @@ NS_IMETHODIMP CBrowserImpl::SetDimensions(PRUint32 aFlags, PRInt32 x, PRInt32 y,
NS_IMETHODIMP CBrowserImpl::GetDimensions(PRUint32 aFlags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy)
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION)
{
m_pBrowserFrameGlue->GetBrowserFramePosition(x, y);
m_pBrowserFrameGlue->GetBrowserFramePosition(x, y);
}
if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER ||
aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)
{
m_pBrowserFrameGlue->GetBrowserFrameSize(cx, cy);
m_pBrowserFrameGlue->GetBrowserFrameSize(cx, cy);
}
return NS_OK;
@ -325,42 +326,42 @@ NS_IMETHODIMP CBrowserImpl::GetSiteWindow(void** aSiteWindow)
NS_IMETHODIMP CBrowserImpl::SetFocus()
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->SetFocus();
m_pBrowserFrameGlue->SetFocus();
return NS_OK;
return NS_OK;
}
NS_IMETHODIMP CBrowserImpl::GetTitle(PRUnichar** aTitle)
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->GetBrowserFrameTitle(aTitle);
return NS_OK;
m_pBrowserFrameGlue->GetBrowserFrameTitle(aTitle);
return NS_OK;
}
NS_IMETHODIMP CBrowserImpl::SetTitle(const PRUnichar* aTitle)
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->SetBrowserFrameTitle(aTitle);
return NS_OK;
m_pBrowserFrameGlue->SetBrowserFrameTitle(aTitle);
return NS_OK;
}
NS_IMETHODIMP CBrowserImpl::GetVisibility(PRBool *aVisibility)
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->GetBrowserFrameVisibility(aVisibility);
return NS_OK;
return NS_OK;
}
NS_IMETHODIMP CBrowserImpl::SetVisibility(PRBool aVisibility)
@ -381,3 +382,30 @@ NS_IMETHODIMP CBrowserImpl::Blur()
{
return NS_OK;
}
//*****************************************************************************
// CBrowserImpl::nsITooltipListener
//*****************************************************************************
/* void onShowTooltip (in long aXCoords, in long aYCoords, in wstring aTipText); */
NS_IMETHODIMP CBrowserImpl::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText)
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->ShowTooltip(aXCoords, aYCoords, aTipText);
return NS_OK;
}
/* void onHideTooltip (); */
NS_IMETHODIMP CBrowserImpl::OnHideTooltip()
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->HideTooltip();
return NS_OK;
}

Просмотреть файл

@ -42,6 +42,7 @@ class CBrowserImpl : public nsIInterfaceRequestor,
public nsIEmbeddingSiteWindow2,
public nsIWebProgressListener,
public nsIContextMenuListener2,
public nsITooltipListener,
public nsSupportsWeakReference
{
public:
@ -58,6 +59,7 @@ public:
NS_DECL_NSIEMBEDDINGSITEWINDOW2
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSICONTEXTMENULISTENER2
NS_DECL_NSITOOLTIPLISTENER
protected:

Просмотреть файл

@ -41,8 +41,8 @@
NS_IMETHODIMP CBrowserImpl::OnShowContextMenu(PRUint32 aContextFlags, nsIContextMenuInfo *aInfo)
{
if(m_pBrowserFrameGlue)
m_pBrowserFrameGlue->ShowContextMenu(aContextFlags, aInfo);
if(m_pBrowserFrameGlue)
m_pBrowserFrameGlue->ShowContextMenu(aContextFlags, aInfo);
return NS_OK;
return NS_OK;
}

Просмотреть файл

@ -52,25 +52,25 @@
NS_IMETHODIMP
CBrowserImpl::Alert(const PRUnichar *dialogTitle, const PRUnichar *text)
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->Alert(dialogTitle, text);
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->Alert(dialogTitle, text);
return NS_OK;
return NS_OK;
}
// Invoked in the case of a JS confirm() method invocation
NS_IMETHODIMP
CBrowserImpl::Confirm(const PRUnichar *dialogTitle,
const PRUnichar *text, PRBool *retval)
const PRUnichar *text, PRBool *retval)
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->Confirm(dialogTitle, text, retval);
m_pBrowserFrameGlue->Confirm(dialogTitle, text, retval);
return NS_OK;
return NS_OK;
}
NS_IMETHODIMP
@ -79,12 +79,12 @@ CBrowserImpl::Prompt(const PRUnichar *dialogTitle, const PRUnichar *text,
const PRUnichar *checkMsg, PRBool *checkValue,
PRBool *_retval)
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->Prompt(dialogTitle, text, promptText, checkMsg, checkValue, _retval);
m_pBrowserFrameGlue->Prompt(dialogTitle, text, promptText, checkMsg, checkValue, _retval);
return NS_OK;
return NS_OK;
}
NS_IMETHODIMP
@ -93,11 +93,11 @@ CBrowserImpl::PromptPassword(const PRUnichar *dialogTitle, const PRUnichar *text
const PRUnichar *checkMsg, PRBool *checkValue,
PRBool *_retval)
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->PromptPassword(dialogTitle, text, password,
checkMsg, checkValue, _retval);
m_pBrowserFrameGlue->PromptPassword(dialogTitle, text, password,
checkMsg, checkValue, _retval);
return NS_OK;
}
@ -108,33 +108,33 @@ CBrowserImpl::PromptUsernameAndPassword(const PRUnichar *dialogTitle, const PRUn
const PRUnichar *checkMsg, PRBool *checkValue,
PRBool *_retval)
{
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->PromptUserNamePassword(dialogTitle, text,
username, password,
checkMsg, checkValue,
_retval);
m_pBrowserFrameGlue->PromptUserNamePassword(dialogTitle, text,
username, password,
checkMsg, checkValue,
_retval);
return NS_OK;
}
NS_IMETHODIMP
CBrowserImpl::AlertCheck(const PRUnichar *dialogTitle,
const PRUnichar *text,
const PRUnichar *checkMsg,
PRBool *checkValue)
const PRUnichar *text,
const PRUnichar *checkMsg,
PRBool *checkValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
CBrowserImpl::ConfirmCheck(const PRUnichar *dialogTitle,
const PRUnichar *text,
const PRUnichar *checkMsg,
PRBool *checkValue, PRBool *retval)
const PRUnichar *text,
const PRUnichar *checkMsg,
PRBool *checkValue, PRBool *retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
@ -149,9 +149,9 @@ CBrowserImpl::ConfirmEx(const PRUnichar *dialogTitle, const PRUnichar *text,
NS_IMETHODIMP
CBrowserImpl::Select(const PRUnichar *dialogTitle,
const PRUnichar *text, PRUint32 count,
const PRUnichar **selectList,
PRInt32 *outSelection, PRBool *retval)
const PRUnichar *text, PRUint32 count,
const PRUnichar **selectList,
PRInt32 *outSelection, PRBool *retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -0,0 +1,147 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: Mozilla-sample-code 1.0
*
* Copyright (c) 2002 Netscape Communications Corporation and
* other contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this Mozilla sample software and associated documentation files
* (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Contributor(s):
* Adam Lock <adamlock@netscape.com>
*
* ***** END LICENSE BLOCK ***** */
#include "stdafx.h"
#include "BrowserToolTip.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBrowserToolTip
CBrowserToolTip::CBrowserToolTip()
{
}
CBrowserToolTip::~CBrowserToolTip()
{
}
BEGIN_MESSAGE_MAP(CBrowserToolTip, CWnd)
//{{AFX_MSG_MAP(CBrowserToolTip)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CBrowserToolTip::Create(CWnd *pParentWnd)
{
return CWnd::CreateEx(WS_EX_TOOLWINDOW,
AfxRegisterWndClass(CS_SAVEBITS, NULL, GetSysColorBrush(COLOR_INFOBK), NULL),
_T("ToolTip"), WS_POPUP | WS_BORDER, 0, 0, 1, 1, pParentWnd->GetSafeHwnd(), NULL);
}
/////////////////////////////////////////////////////////////////////////////
// CBrowserToolTip message handlers
void CBrowserToolTip::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rcClient;
GetClientRect(&rcClient);
// Draw tip text
int oldBkMode = dc.SetBkMode(TRANSPARENT);
COLORREF oldTextColor = dc.SetTextColor(GetSysColor(COLOR_INFOTEXT));
HGDIOBJ oldFont = dc.SelectObject(GetStockObject(DEFAULT_GUI_FONT));
dc.DrawText(m_szTipText, -1, rcClient, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
dc.SetBkMode(oldBkMode);
dc.SetTextColor(oldTextColor);
dc.SelectObject(oldFont);
}
BOOL CBrowserToolTip::PreCreateWindow(CREATESTRUCT& cs)
{
return CWnd::PreCreateWindow(cs);
}
void CBrowserToolTip::SetTipText(const CString &szTipText)
{
m_szTipText = szTipText;
}
void CBrowserToolTip::Show(CWnd *pOverWnd, long left, long top)
{
// Calculate the client window size
CRect rcNewClient(0,0,0,0);
CDC *pdc = GetDC();
HGDIOBJ oldFont = pdc->SelectObject(GetStockObject(DEFAULT_GUI_FONT));
rcNewClient.bottom = pdc->DrawText(m_szTipText, -1, rcNewClient,
DT_SINGLELINE | DT_VCENTER | DT_CENTER | DT_CALCRECT);
pdc->SelectObject(oldFont);
ReleaseDC(pdc);
rcNewClient.right += 8;
rcNewClient.bottom += 8;
// Adjust the tooltip to new size
AdjustWindowRectEx(rcNewClient, GetWindowLong(m_hWnd, GWL_STYLE), FALSE, GetWindowLong(m_hWnd, GWL_EXSTYLE));
// Adjust the left, top position of the tooltip
CPoint ptTip(left, top);
pOverWnd->ClientToScreen(&ptTip);
// Make sure tip is below cursor
POINT ptCursor;
GetCursorPos(&ptCursor);
long cyCursor = GetSystemMetrics(SM_CYCURSOR);
if (ptTip.y < ptCursor.y + cyCursor)
ptTip.y = ptCursor.y + cyCursor;
// Make sure tip is fully visible
RECT rcScreen;
GetDesktopWindow()->GetClientRect(&rcScreen);
if (ptTip.x < 0)
ptTip.x = 0;
else if (ptTip.x + rcNewClient.Width() > rcScreen.right)
ptTip.x = rcScreen.right - rcNewClient.Width();
if (ptTip.y < 0)
ptTip.y = 0;
else if (ptTip.y + rcNewClient.Height() > rcScreen.bottom)
ptTip.y = rcScreen.bottom - rcNewClient.Height();
// Position and show the tip
SetWindowPos(&CWnd::wndTop, ptTip.x, ptTip.y, rcNewClient.Width(), rcNewClient.Height(),
SWP_NOACTIVATE | SWP_SHOWWINDOW);
}
void CBrowserToolTip::Hide()
{
ShowWindow(SW_HIDE);
}

Просмотреть файл

@ -0,0 +1,87 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: Mozilla-sample-code 1.0
*
* Copyright (c) 2002 Netscape Communications Corporation and
* other contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this Mozilla sample software and associated documentation files
* (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Contributor(s):
* Adam Lock <adamlock@netscape.com>
*
* ***** END LICENSE BLOCK ***** */
#if !defined(AFX_BROWSERTOOLTIP_H__13240069_1816_403C_A79D_306FD710B75A__INCLUDED_)
#define AFX_BROWSERTOOLTIP_H__13240069_1816_403C_A79D_306FD710B75A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// BrowserToolTip.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CBrowserToolTip window
class CBrowserToolTip : public CWnd
{
// Construction
public:
CBrowserToolTip();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBrowserToolTip)
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
CString m_szTipText;
// Implementation
public:
virtual ~CBrowserToolTip();
BOOL Create(CWnd *pParentWnd);
void SetTipText(const CString &szTipText);
void Show(CWnd *pOverWnd, long left, long top);
void Hide();
// Generated message map functions
protected:
//{{AFX_MSG(CBrowserToolTip)
afx_msg void OnPaint();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_BROWSERTOOLTIP_H__13240069_1816_403C_A79D_306FD710B75A__INCLUDED_)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -38,7 +38,7 @@
#define _BROWSERVIEW_H
#if _MSC_VER > 1000
#pragma once
#pragma once
#endif
#include "IBrowserFrameGlue.h"
@ -55,59 +55,59 @@ class CPrintProgressDialog;
class CBrowserView : public CWnd
{
public:
CBrowserView();
virtual ~CBrowserView();
CBrowserView();
virtual ~CBrowserView();
// Some helper methods
HRESULT CreateBrowser();
HRESULT DestroyBrowser();
void OpenURL(const char* pUrl);
void OpenURL(const PRUnichar* pUrl);
CBrowserFrame* CreateNewBrowserFrame(PRUint32 chromeMask = nsIWebBrowserChrome::CHROME_ALL,
PRInt32 x = -1, PRInt32 y = -1,
PRInt32 cx = -1, PRInt32 cy = -1,
PRBool bShowWindow = PR_TRUE);
void OpenURLInNewWindow(const PRUnichar* pUrl);
void LoadHomePage();
// Some helper methods
HRESULT CreateBrowser();
HRESULT DestroyBrowser();
void OpenURL(const char* pUrl);
void OpenURL(const PRUnichar* pUrl);
CBrowserFrame* CreateNewBrowserFrame(PRUint32 chromeMask = nsIWebBrowserChrome::CHROME_ALL,
PRInt32 x = -1, PRInt32 y = -1,
PRInt32 cx = -1, PRInt32 cy = -1,
PRBool bShowWindow = PR_TRUE);
void OpenURLInNewWindow(const PRUnichar* pUrl);
void LoadHomePage();
void GetBrowserWindowTitle(nsCString& title);
// Called by the CBrowserFrame after it creates the view
// Essentially a back pointer to the BrowserFrame
void SetBrowserFrame(CBrowserFrame* pBrowserFrame);
CBrowserFrame* mpBrowserFrame;
void GetBrowserWindowTitle(nsCString& title);
// Called by the CBrowserFrame after it creates the view
// Essentially a back pointer to the BrowserFrame
void SetBrowserFrame(CBrowserFrame* pBrowserFrame);
CBrowserFrame* mpBrowserFrame;
// Called by the CBrowserFrame after it creates the view
// The view passes this on to the embedded Browser's Impl
// obj
void SetBrowserFrameGlue(PBROWSERFRAMEGLUE pBrowserFrameGlue);
PBROWSERFRAMEGLUE mpBrowserFrameGlue;
// Called by the CBrowserFrame after it creates the view
// The view passes this on to the embedded Browser's Impl
// obj
void SetBrowserFrameGlue(PBROWSERFRAMEGLUE pBrowserFrameGlue);
PBROWSERFRAMEGLUE mpBrowserFrameGlue;
// Pointer to the object which implements
// the inerfaces required by Mozilla embedders
//
CBrowserImpl* mpBrowserImpl;
// Pointer to the object which implements
// the inerfaces required by Mozilla embedders
//
CBrowserImpl* mpBrowserImpl;
// Mozilla interfaces
//
nsCOMPtr<nsIWebBrowser> mWebBrowser;
nsCOMPtr<nsIBaseWindow> mBaseWindow;
nsCOMPtr<nsIWebNavigation> mWebNav;
// Mozilla interfaces
//
nsCOMPtr<nsIWebBrowser> mWebBrowser;
nsCOMPtr<nsIBaseWindow> mBaseWindow;
nsCOMPtr<nsIWebNavigation> mWebNav;
void UpdateBusyState(PRBool aBusy);
PRBool mbDocumentLoading;
void UpdateBusyState(PRBool aBusy);
PRBool mbDocumentLoading;
void SetCtxMenuLinkUrl(nsAutoString& strLinkUrl);
nsAutoString mCtxMenuLinkUrl;
void SetCtxMenuLinkUrl(nsAutoString& strLinkUrl);
nsAutoString mCtxMenuLinkUrl;
void SetCtxMenuImageSrc(nsAutoString& strImgSrc);
nsAutoString mCtxMenuImgSrc;
void SetCtxMenuImageSrc(nsAutoString& strImgSrc);
nsAutoString mCtxMenuImgSrc;
void SetCurrentFrameURL(nsAutoString& strCurrentFrameURL);
nsString mCtxMenuCurrentFrameURL;
void SetCurrentFrameURL(nsAutoString& strCurrentFrameURL);
nsString mCtxMenuCurrentFrameURL;
inline void ClearFindDialog() { m_pFindDlg = NULL; }
CFindDialog* m_pFindDlg;
inline void ClearFindDialog() { m_pFindDlg = NULL; }
CFindDialog* m_pFindDlg;
CPrintProgressDialog* m_pPrintProgressDlg;
// When set to TRUE...
// indicates that the clipboard operation needs to be
@ -134,70 +134,70 @@ public:
BOOL ViewContentContainsFrames();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBrowserView)
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBrowserView)
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Generated message map functions
// Generated message map functions
protected:
nsCOMPtr<nsIPrintSettings> m_PrintSettings;
nsCOMPtr<nsIPrintSettings> m_PrintSettings;
BOOL m_InPrintPreview;
//{{AFX_MSG(CBrowserView)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy();
afx_msg void OnSize( UINT, int, int );
// UrlBar command handlers
//
afx_msg void OnUrlSelectedInUrlBar();
afx_msg void OnNewUrlEnteredInUrlBar();
//{{AFX_MSG(CBrowserView)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy();
afx_msg void OnSize( UINT, int, int );
// UrlBar command handlers
//
afx_msg void OnUrlSelectedInUrlBar();
afx_msg void OnNewUrlEnteredInUrlBar();
// ToolBar/Menu command handlers
//
afx_msg void OnFileOpen();
afx_msg void OnFileSaveAs();
afx_msg void OnViewSource();
afx_msg void OnViewInfo();
afx_msg void OnNavBack();
afx_msg void OnNavForward();
afx_msg void OnNavHome();
afx_msg void OnNavReload();
afx_msg void OnNavStop();
afx_msg void OnCut();
afx_msg void OnCopy();
afx_msg void OnPaste();
// ToolBar/Menu command handlers
//
afx_msg void OnFileOpen();
afx_msg void OnFileSaveAs();
afx_msg void OnViewSource();
afx_msg void OnViewInfo();
afx_msg void OnNavBack();
afx_msg void OnNavForward();
afx_msg void OnNavHome();
afx_msg void OnNavReload();
afx_msg void OnNavStop();
afx_msg void OnCut();
afx_msg void OnCopy();
afx_msg void OnPaste();
afx_msg void OnUndoUrlBarEditOp();
afx_msg void OnSelectAll();
afx_msg void OnSelectNone();
afx_msg void OnCopyLinkLocation();
afx_msg void OnOpenLinkInNewWindow();
afx_msg void OnViewImageInNewWindow();
afx_msg void OnSaveLinkAs();
afx_msg void OnSaveImageAs();
afx_msg void OnShowFindDlg();
afx_msg void OnFilePrint();
afx_msg void OnFilePrintPreview();
afx_msg void OnFilePrintSetup();
afx_msg void OnUpdateFilePrint(CCmdUI* pCmdUI);
afx_msg void OnUpdatePrintSetup(CCmdUI* pCmdUI);
afx_msg LRESULT OnFindMsg(WPARAM wParam, LPARAM lParam);
afx_msg void OnViewFrameSource();
afx_msg void OnOpenFrameInNewWindow();
afx_msg void OnSelectAll();
afx_msg void OnSelectNone();
afx_msg void OnCopyLinkLocation();
afx_msg void OnOpenLinkInNewWindow();
afx_msg void OnViewImageInNewWindow();
afx_msg void OnSaveLinkAs();
afx_msg void OnSaveImageAs();
afx_msg void OnShowFindDlg();
afx_msg void OnFilePrint();
afx_msg void OnFilePrintPreview();
afx_msg void OnFilePrintSetup();
afx_msg void OnUpdateFilePrint(CCmdUI* pCmdUI);
afx_msg void OnUpdatePrintSetup(CCmdUI* pCmdUI);
afx_msg LRESULT OnFindMsg(WPARAM wParam, LPARAM lParam);
afx_msg void OnViewFrameSource();
afx_msg void OnOpenFrameInNewWindow();
// Handlers to keep the toolbar/menu items up to date
//
afx_msg void OnUpdateNavBack(CCmdUI* pCmdUI);
afx_msg void OnUpdateNavForward(CCmdUI* pCmdUI);
afx_msg void OnUpdateNavStop(CCmdUI* pCmdUI);
afx_msg void OnUpdateCut(CCmdUI* pCmdUI);
afx_msg void OnUpdateCopy(CCmdUI* pCmdUI);
afx_msg void OnUpdatePaste(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Handlers to keep the toolbar/menu items up to date
//
afx_msg void OnUpdateNavBack(CCmdUI* pCmdUI);
afx_msg void OnUpdateNavForward(CCmdUI* pCmdUI);
afx_msg void OnUpdateNavStop(CCmdUI* pCmdUI);
afx_msg void OnUpdateCut(CCmdUI* pCmdUI);
afx_msg void OnUpdateCopy(CCmdUI* pCmdUI);
afx_msg void OnUpdatePaste(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif //_BROWSERVIEW_H

Просмотреть файл

@ -47,77 +47,77 @@
//
//--------------------------------------------------------------------------//
// CFindDialog Stuff
// CFindDialog Stuff
//--------------------------------------------------------------------------//
CFindDialog::CFindDialog(CString& csSearchStr, PRBool bMatchCase,
PRBool bMatchWholeWord, PRBool bWrapAround,
PRBool bSearchBackwards, CBrowserView* pOwner)
: CFindReplaceDialog()
PRBool bMatchWholeWord, PRBool bWrapAround,
PRBool bSearchBackwards, CBrowserView* pOwner)
: CFindReplaceDialog()
{
// Save these initial settings off in member vars
// We'll use these to initialize the controls
// in InitDialog()
m_csSearchStr = csSearchStr;
m_bMatchCase = bMatchCase;
m_bMatchWholeWord = bMatchWholeWord;
m_bWrapAround = bWrapAround;
m_bSearchBackwards = bSearchBackwards;
m_pOwner = pOwner;
// Save these initial settings off in member vars
// We'll use these to initialize the controls
// in InitDialog()
m_csSearchStr = csSearchStr;
m_bMatchCase = bMatchCase;
m_bMatchWholeWord = bMatchWholeWord;
m_bWrapAround = bWrapAround;
m_bSearchBackwards = bSearchBackwards;
m_pOwner = pOwner;
// Set up to load our customized Find dialog template
// rather than the default one MFC provides
m_fr.Flags |= FR_ENABLETEMPLATE;
m_fr.hInstance = AfxGetInstanceHandle();
m_fr.lpTemplateName = MAKEINTRESOURCE(IDD_FINDDLG);
// Set up to load our customized Find dialog template
// rather than the default one MFC provides
m_fr.Flags |= FR_ENABLETEMPLATE;
m_fr.hInstance = AfxGetInstanceHandle();
m_fr.lpTemplateName = MAKEINTRESOURCE(IDD_FINDDLG);
}
BOOL CFindDialog::OnInitDialog()
{
CFindReplaceDialog::OnInitDialog();
CFindReplaceDialog::OnInitDialog();
CEdit* pEdit = (CEdit *)GetDlgItem(IDC_FIND_EDIT);
if(pEdit)
pEdit->SetWindowText(m_csSearchStr);
CEdit* pEdit = (CEdit *)GetDlgItem(IDC_FIND_EDIT);
if(pEdit)
pEdit->SetWindowText(m_csSearchStr);
CButton* pChk = (CButton *)GetDlgItem(IDC_MATCH_CASE);
if(pChk)
pChk->SetCheck(m_bMatchCase);
CButton* pChk = (CButton *)GetDlgItem(IDC_MATCH_CASE);
if(pChk)
pChk->SetCheck(m_bMatchCase);
pChk = (CButton *)GetDlgItem(IDC_MATCH_WHOLE_WORD);
if(pChk)
pChk->SetCheck(m_bMatchWholeWord);
pChk = (CButton *)GetDlgItem(IDC_MATCH_WHOLE_WORD);
if(pChk)
pChk->SetCheck(m_bMatchWholeWord);
pChk = (CButton *)GetDlgItem(IDC_WRAP_AROUND);
if(pChk)
pChk->SetCheck(m_bWrapAround);
pChk = (CButton *)GetDlgItem(IDC_WRAP_AROUND);
if(pChk)
pChk->SetCheck(m_bWrapAround);
pChk = (CButton *)GetDlgItem(IDC_SEARCH_BACKWARDS);
if(pChk)
pChk->SetCheck(m_bSearchBackwards);
pChk = (CButton *)GetDlgItem(IDC_SEARCH_BACKWARDS);
if(pChk)
pChk->SetCheck(m_bSearchBackwards);
return TRUE;
return TRUE;
}
void CFindDialog::PostNcDestroy()
void CFindDialog::PostNcDestroy()
{
// Let the owner know we're gone
if(m_pOwner != NULL)
m_pOwner->ClearFindDialog();
// Let the owner know we're gone
if(m_pOwner != NULL)
m_pOwner->ClearFindDialog();
CFindReplaceDialog::PostNcDestroy();
CFindReplaceDialog::PostNcDestroy();
}
BOOL CFindDialog::WrapAround()
{
CButton* pChk = (CButton *)GetDlgItem(IDC_WRAP_AROUND);
CButton* pChk = (CButton *)GetDlgItem(IDC_WRAP_AROUND);
return pChk ? pChk->GetCheck() : FALSE;
return pChk ? pChk->GetCheck() : FALSE;
}
BOOL CFindDialog::SearchBackwards()
{
CButton* pChk = (CButton *)GetDlgItem(IDC_SEARCH_BACKWARDS);
CButton* pChk = (CButton *)GetDlgItem(IDC_SEARCH_BACKWARDS);
return pChk ? pChk->GetCheck() : FALSE;
return pChk ? pChk->GetCheck() : FALSE;
}

Просмотреть файл

@ -44,26 +44,26 @@
class CBrowserView;
class CFindDialog : public CFindReplaceDialog
class CFindDialog : public CFindReplaceDialog
{
public:
CFindDialog(CString& csSearchStr, PRBool bMatchCase,
PRBool bMatchWholeWord, PRBool bWrapAround,
PRBool bSearchBackwards, CBrowserView* pOwner);
BOOL WrapAround();
BOOL SearchBackwards();
CFindDialog(CString& csSearchStr, PRBool bMatchCase,
PRBool bMatchWholeWord, PRBool bWrapAround,
PRBool bSearchBackwards, CBrowserView* pOwner);
BOOL WrapAround();
BOOL SearchBackwards();
private:
CString m_csSearchStr;
PRBool m_bMatchCase;
PRBool m_bMatchWholeWord;
PRBool m_bWrapAround;
PRBool m_bSearchBackwards;
CBrowserView* m_pOwner;
CString m_csSearchStr;
PRBool m_bMatchCase;
PRBool m_bMatchWholeWord;
PRBool m_bWrapAround;
PRBool m_bSearchBackwards;
CBrowserView* m_pOwner;
protected:
virtual BOOL OnInitDialog();
virtual void PostNcDestroy();
virtual BOOL OnInitDialog();
virtual void PostNcDestroy();
};
#endif //_DIALOG_H_

Просмотреть файл

@ -65,9 +65,9 @@
#define COLOR_BLACK "#000000"
//fonts
#define FONT_ARIAL "Helvetica, Arial, sans-serif"
#define FONT_TIMES "Times New Roman, Times, serif"
#define FONT_COURIER "Courier New, Courier, monospace"
#define FONT_ARIAL "Helvetica, Arial, sans-serif"
#define FONT_TIMES "Times New Roman, Times, serif"
#define FONT_COURIER "Courier New, Courier, monospace"
//align
#define ALIGN_LEFT "left"
@ -76,47 +76,47 @@
//value
#define STATE_EMPTY ""
#define STATE_EMPTY ""
IMPLEMENT_DYNAMIC(CEditorFrame, CBrowserFrame)
BEGIN_MESSAGE_MAP(CEditorFrame, CBrowserFrame)
//{{AFX_MSG_MAP(CEditorFrame)
//{{AFX_MSG_MAP(CEditorFrame)
ON_COMMAND(ID_BOLD, OnBold)
ON_UPDATE_COMMAND_UI(ID_BOLD, OnUpdateBold)
ON_COMMAND(ID_ITALICS, OnItalics)
ON_UPDATE_COMMAND_UI(ID_ITALICS, OnUpdateItalics)
ON_COMMAND(ID_UNDERLINE, OnUnderline)
ON_UPDATE_COMMAND_UI(ID_UNDERLINE, OnUpdateUnderline)
ON_COMMAND(ID_INDENT, OnIndent)
ON_UPDATE_COMMAND_UI(ID_INDENT, OnUpdateIndent)
ON_COMMAND(ID_OUTDENT, OnOutdent)
ON_UPDATE_COMMAND_UI(ID_OUTDENT, OnUpdateOutdent)
ON_COMMAND(ID_FONTRED, OnFontred)
ON_UPDATE_COMMAND_UI(ID_FONTRED, OnUpdateFontred)
ON_COMMAND(ID_FONTBLACK, OnFontblack)
ON_UPDATE_COMMAND_UI(ID_FONTBLACK, OnUpdateFontblack)
ON_COMMAND(ID_BGCOLOR, OnBgcolor)
ON_UPDATE_COMMAND_UI(ID_BGCOLOR, OnUpdateBgcolor)
ON_COMMAND(ID_NOBGCOLOR, OnNobgcolor)
ON_UPDATE_COMMAND_UI(ID_NOBGCOLOR, OnUpdateNobgcolor)
ON_COMMAND(ID_FONTSIZEINCREASE, OnFontsizeincrease)
ON_COMMAND(ID_FONTSIZEDECREASE, OnFontsizedecrease)
ON_COMMAND(ID_ARIAL, OnArial)
ON_COMMAND(ID_TIMES, OnTimes)
ON_COMMAND(ID_COURIER, OnCourier)
ON_COMMAND(ID_ALIGNLEFT, OnAlignleft)
ON_UPDATE_COMMAND_UI(ID_ALIGNLEFT, OnUpdateAlignleft)
ON_COMMAND(ID_ALIGNRIGHT, OnAlignright)
ON_UPDATE_COMMAND_UI(ID_ALIGNRIGHT, OnUpdateAlignright)
ON_COMMAND(ID_ALIGNCENTER, OnAligncenter)
ON_UPDATE_COMMAND_UI(ID_ALIGNCENTER, OnUpdateAligncenter)
ON_COMMAND(ID_INSERTLINK, OnInsertlink)
ON_COMMAND(ID_EDITOR_UNDO, OnEditUndo)
ON_COMMAND(ID_EDITOR_REDO, OnEditRedo)
ON_UPDATE_COMMAND_UI(ID_EDITOR_REDO, OnUpdateEditRedo)
ON_UPDATE_COMMAND_UI(ID_EDITOR_UNDO, OnUpdateEditUndo)
//}}AFX_MSG_MAP
ON_COMMAND(ID_INDENT, OnIndent)
ON_UPDATE_COMMAND_UI(ID_INDENT, OnUpdateIndent)
ON_COMMAND(ID_OUTDENT, OnOutdent)
ON_UPDATE_COMMAND_UI(ID_OUTDENT, OnUpdateOutdent)
ON_COMMAND(ID_FONTRED, OnFontred)
ON_UPDATE_COMMAND_UI(ID_FONTRED, OnUpdateFontred)
ON_COMMAND(ID_FONTBLACK, OnFontblack)
ON_UPDATE_COMMAND_UI(ID_FONTBLACK, OnUpdateFontblack)
ON_COMMAND(ID_BGCOLOR, OnBgcolor)
ON_UPDATE_COMMAND_UI(ID_BGCOLOR, OnUpdateBgcolor)
ON_COMMAND(ID_NOBGCOLOR, OnNobgcolor)
ON_UPDATE_COMMAND_UI(ID_NOBGCOLOR, OnUpdateNobgcolor)
ON_COMMAND(ID_FONTSIZEINCREASE, OnFontsizeincrease)
ON_COMMAND(ID_FONTSIZEDECREASE, OnFontsizedecrease)
ON_COMMAND(ID_ARIAL, OnArial)
ON_COMMAND(ID_TIMES, OnTimes)
ON_COMMAND(ID_COURIER, OnCourier)
ON_COMMAND(ID_ALIGNLEFT, OnAlignleft)
ON_UPDATE_COMMAND_UI(ID_ALIGNLEFT, OnUpdateAlignleft)
ON_COMMAND(ID_ALIGNRIGHT, OnAlignright)
ON_UPDATE_COMMAND_UI(ID_ALIGNRIGHT, OnUpdateAlignright)
ON_COMMAND(ID_ALIGNCENTER, OnAligncenter)
ON_UPDATE_COMMAND_UI(ID_ALIGNCENTER, OnUpdateAligncenter)
ON_COMMAND(ID_INSERTLINK, OnInsertlink)
ON_COMMAND(ID_EDITOR_UNDO, OnEditUndo)
ON_COMMAND(ID_EDITOR_REDO, OnEditRedo)
ON_UPDATE_COMMAND_UI(ID_EDITOR_REDO, OnUpdateEditRedo)
ON_UPDATE_COMMAND_UI(ID_EDITOR_UNDO, OnUpdateEditUndo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CEditorFrame::CEditorFrame(PRUint32 chromeMask)
@ -179,13 +179,13 @@ CEditorFrame::MakeCommandParams(const char *aCommand,nsICommandParams **aParams)
{
nsresult rv;
nsCOMPtr<nsICommandParams> params = do_CreateInstance(NS_COMMAND_PARAMS_CONTRACTID,&rv);
if (NS_FAILED(rv))
return rv;
if (!params)
return NS_ERROR_FAILURE;
*aParams = params;
NS_ADDREF(*aParams);
return rv;
if (NS_FAILED(rv))
return rv;
if (!params)
return NS_ERROR_FAILURE;
*aParams = params;
NS_ADDREF(*aParams);
return rv;
}
@ -205,11 +205,11 @@ CEditorFrame::ExecuteStyleCommand(const char *aCommand)
//
void CEditorFrame::UpdateStyleToolBarBtn(const char *aCommand, CCmdUI* pCmdUI)
{
nsCOMPtr<nsICommandParams> params;
nsCOMPtr<nsICommandParams> params;
nsresult rv;
rv = MakeCommandParams(aCommand,getter_AddRefs(params));
if (NS_FAILED(rv) || !params)
return;
rv = MakeCommandParams(aCommand,getter_AddRefs(params));
if (NS_FAILED(rv) || !params)
return;
rv = GetCommandState(aCommand,params);
if (NS_SUCCEEDED(rv))
{
@ -292,26 +292,26 @@ CEditorFrame::ExecuteNoParam(const char *aCommand)
void CEditorFrame::OnIndent()
{
// TODO: Add your command handler code here
ExecuteNoParam(INDENT_COMMAND);
// TODO: Add your command handler code here
ExecuteNoParam(INDENT_COMMAND);
}
void CEditorFrame::OnUpdateIndent(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
}
void CEditorFrame::OnOutdent()
{
// TODO: Add your command handler code here
ExecuteNoParam(OUTDENT_COMMAND);
// TODO: Add your command handler code here
ExecuteNoParam(OUTDENT_COMMAND);
}
void CEditorFrame::OnUpdateOutdent(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
}
NS_METHOD
@ -352,94 +352,94 @@ CEditorFrame::GetAttributeParamValue(const char *aCommand, nsCString &aValue)
void CEditorFrame::OnFontred()
{
// TODO: Add your command handler code here
ExecuteAttribParam(FONTCOLOR_COMMAND,COLOR_RED);
// TODO: Add your command handler code here
ExecuteAttribParam(FONTCOLOR_COMMAND,COLOR_RED);
}
void CEditorFrame::OnUpdateFontred(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
}
void CEditorFrame::OnFontblack()
{
// TODO: Add your command handler code here
ExecuteAttribParam(FONTCOLOR_COMMAND,COLOR_BLACK);
// TODO: Add your command handler code here
ExecuteAttribParam(FONTCOLOR_COMMAND,COLOR_BLACK);
}
void CEditorFrame::OnUpdateFontblack(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
}
void CEditorFrame::OnBgcolor()
{
// TODO: Add your command handler code here
ExecuteAttribParam(BACKGROUNDCOLOR_COMMAND,COLOR_RED);
// TODO: Add your command handler code here
ExecuteAttribParam(BACKGROUNDCOLOR_COMMAND,COLOR_RED);
}
void CEditorFrame::OnUpdateBgcolor(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
}
void CEditorFrame::OnNobgcolor()
{
// TODO: Add your command handler code here
ExecuteAttribParam(BACKGROUNDCOLOR_COMMAND,STATE_EMPTY);
// TODO: Add your command handler code here
ExecuteAttribParam(BACKGROUNDCOLOR_COMMAND,STATE_EMPTY);
}
void CEditorFrame::OnUpdateNobgcolor(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
}
void CEditorFrame::OnFontsizeincrease()
{
// TODO: Add your command handler code here
ExecuteNoParam(INCREASEFONT_COMMAND);
// TODO: Add your command handler code here
ExecuteNoParam(INCREASEFONT_COMMAND);
}
void CEditorFrame::OnFontsizedecrease()
{
// TODO: Add your command handler code here
ExecuteNoParam(DECREASEFONT_COMMAND);
// TODO: Add your command handler code here
ExecuteNoParam(DECREASEFONT_COMMAND);
}
void CEditorFrame::OnArial()
{
// TODO: Add your command handler code here
ExecuteAttribParam(FONTFACE_COMMAND,FONT_ARIAL);
// TODO: Add your command handler code here
ExecuteAttribParam(FONTFACE_COMMAND,FONT_ARIAL);
}
void CEditorFrame::OnTimes()
{
// TODO: Add your command handler code here
ExecuteAttribParam(FONTFACE_COMMAND,FONT_TIMES);
// TODO: Add your command handler code here
ExecuteAttribParam(FONTFACE_COMMAND,FONT_TIMES);
}
void CEditorFrame::OnCourier()
{
// TODO: Add your command handler code here
ExecuteAttribParam(FONTFACE_COMMAND,FONT_COURIER);
// TODO: Add your command handler code here
ExecuteAttribParam(FONTFACE_COMMAND,FONT_COURIER);
}
void CEditorFrame::OnAlignleft()
{
// TODO: Add your command handler code here
ExecuteAttribParam(ALIGN_COMMAND,ALIGN_LEFT);
// TODO: Add your command handler code here
ExecuteAttribParam(ALIGN_COMMAND,ALIGN_LEFT);
}
void CEditorFrame::OnUpdateAlignleft(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
nsCAutoString tValue;
nsresult rv = GetAttributeParamValue(ALIGN_COMMAND,tValue);
@ -454,15 +454,15 @@ void CEditorFrame::OnUpdateAlignleft(CCmdUI* pCmdUI)
void CEditorFrame::OnAlignright()
{
// TODO: Add your command handler code here
ExecuteAttribParam(ALIGN_COMMAND,ALIGN_RIGHT);
// TODO: Add your command handler code here
ExecuteAttribParam(ALIGN_COMMAND,ALIGN_RIGHT);
}
void CEditorFrame::OnUpdateAlignright(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
nsCAutoString tValue;
nsresult rv = GetAttributeParamValue(ALIGN_COMMAND,tValue);
if (NS_SUCCEEDED(rv))
@ -476,15 +476,15 @@ void CEditorFrame::OnUpdateAlignright(CCmdUI* pCmdUI)
void CEditorFrame::OnAligncenter()
{
// TODO: Add your command handler code here
ExecuteAttribParam(ALIGN_COMMAND,ALIGN_CENTER);
// TODO: Add your command handler code here
ExecuteAttribParam(ALIGN_COMMAND,ALIGN_CENTER);
}
void CEditorFrame::OnUpdateAligncenter(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
nsCAutoString tValue;
nsresult rv = GetAttributeParamValue(ALIGN_COMMAND,tValue);
if (NS_SUCCEEDED(rv))
@ -498,25 +498,25 @@ void CEditorFrame::OnUpdateAligncenter(CCmdUI* pCmdUI)
void CEditorFrame::OnInsertlink()
{
// TODO: Add your command handler code here
// TODO: Add your command handler code here
}
void CEditorFrame::OnEditUndo()
{
// TODO: Add your command handler code here
ExecuteNoParam(UNDO_COMMAND);
// TODO: Add your command handler code here
ExecuteNoParam(UNDO_COMMAND);
}
void CEditorFrame::OnEditRedo()
{
// TODO: Add your command handler code here
ExecuteNoParam(REDO_COMMAND);
// TODO: Add your command handler code here
ExecuteNoParam(REDO_COMMAND);
}
void CEditorFrame::OnUpdateEditRedo(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
nsresult rv;
nsCOMPtr<nsICommandParams> params;
rv = MakeCommandParams(REDO_COMMAND,getter_AddRefs(params));
@ -535,12 +535,12 @@ void CEditorFrame::OnUpdateEditRedo(CCmdUI* pCmdUI)
return;
}
}
pCmdUI->Enable(FALSE);
pCmdUI->Enable(FALSE);
}
void CEditorFrame::OnUpdateEditUndo(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// TODO: Add your command update UI handler code here
nsresult rv;
nsCOMPtr<nsICommandParams> params;
rv = MakeCommandParams(UNDO_COMMAND,getter_AddRefs(params));
@ -559,5 +559,5 @@ void CEditorFrame::OnUpdateEditUndo(CCmdUI* pCmdUI)
return;
}
}
pCmdUI->Enable(FALSE);
pCmdUI->Enable(FALSE);
}

Просмотреть файл

@ -38,9 +38,9 @@
#include "nsICommandManager.h"
#include "nsIScriptGlobalObject.h"
#include "nsISimpleEnumerator.h"
class CEditorFrame : public CBrowserFrame
{
{
public:
CEditorFrame(PRUint32 chromeMask);
virtual ~CEditorFrame();
@ -57,42 +57,42 @@ public:
// Generated message map functions
protected:
//{{AFX_MSG(CEditorFrame)
//{{AFX_MSG(CEditorFrame)
afx_msg void OnBold();
afx_msg void OnUpdateBold(CCmdUI* pCmdUI);
afx_msg void OnItalics();
afx_msg void OnUpdateItalics(CCmdUI* pCmdUI);
afx_msg void OnUnderline();
afx_msg void OnUpdateUnderline(CCmdUI* pCmdUI);
afx_msg void OnIndent();
afx_msg void OnUpdateIndent(CCmdUI* pCmdUI);
afx_msg void OnOutdent();
afx_msg void OnUpdateOutdent(CCmdUI* pCmdUI);
afx_msg void OnFontred();
afx_msg void OnUpdateFontred(CCmdUI* pCmdUI);
afx_msg void OnFontblack();
afx_msg void OnUpdateFontblack(CCmdUI* pCmdUI);
afx_msg void OnBgcolor();
afx_msg void OnUpdateBgcolor(CCmdUI* pCmdUI);
afx_msg void OnNobgcolor();
afx_msg void OnUpdateNobgcolor(CCmdUI* pCmdUI);
afx_msg void OnFontsizeincrease();
afx_msg void OnFontsizedecrease();
afx_msg void OnArial();
afx_msg void OnTimes();
afx_msg void OnCourier();
afx_msg void OnAlignleft();
afx_msg void OnUpdateAlignleft(CCmdUI* pCmdUI);
afx_msg void OnAlignright();
afx_msg void OnUpdateAlignright(CCmdUI* pCmdUI);
afx_msg void OnAligncenter();
afx_msg void OnUpdateAligncenter(CCmdUI* pCmdUI);
afx_msg void OnInsertlink();
afx_msg void OnEditUndo();
afx_msg void OnEditRedo();
afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI);
afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
//}}AFX_MSG
afx_msg void OnIndent();
afx_msg void OnUpdateIndent(CCmdUI* pCmdUI);
afx_msg void OnOutdent();
afx_msg void OnUpdateOutdent(CCmdUI* pCmdUI);
afx_msg void OnFontred();
afx_msg void OnUpdateFontred(CCmdUI* pCmdUI);
afx_msg void OnFontblack();
afx_msg void OnUpdateFontblack(CCmdUI* pCmdUI);
afx_msg void OnBgcolor();
afx_msg void OnUpdateBgcolor(CCmdUI* pCmdUI);
afx_msg void OnNobgcolor();
afx_msg void OnUpdateNobgcolor(CCmdUI* pCmdUI);
afx_msg void OnFontsizeincrease();
afx_msg void OnFontsizedecrease();
afx_msg void OnArial();
afx_msg void OnTimes();
afx_msg void OnCourier();
afx_msg void OnAlignleft();
afx_msg void OnUpdateAlignleft(CCmdUI* pCmdUI);
afx_msg void OnAlignright();
afx_msg void OnUpdateAlignright(CCmdUI* pCmdUI);
afx_msg void OnAligncenter();
afx_msg void OnUpdateAligncenter(CCmdUI* pCmdUI);
afx_msg void OnInsertlink();
afx_msg void OnEditUndo();
afx_msg void OnEditRedo();
afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI);
afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

Просмотреть файл

@ -45,62 +45,68 @@
#define _IBROWSERFRAMEGLUE_H
struct IBrowserFrameGlue {
// Progress Related Methods
virtual void UpdateStatusBarText(const PRUnichar *aMessage) = 0;
virtual void UpdateProgress(PRInt32 aCurrent, PRInt32 aMax) = 0;
virtual void UpdateBusyState(PRBool aBusy) = 0;
virtual void UpdateCurrentURI(nsIURI *aLocation) = 0;
virtual void UpdateSecurityStatus(PRInt32 aState) = 0;
// Progress Related Methods
virtual void UpdateStatusBarText(const PRUnichar *aMessage) = 0;
virtual void UpdateProgress(PRInt32 aCurrent, PRInt32 aMax) = 0;
virtual void UpdateBusyState(PRBool aBusy) = 0;
virtual void UpdateCurrentURI(nsIURI *aLocation) = 0;
virtual void UpdateSecurityStatus(PRInt32 aState) = 0;
// BrowserFrame Related Methods
virtual PRBool CreateNewBrowserFrame(PRUint32 chromeMask,
PRInt32 x, PRInt32 y,
PRInt32 cx, PRInt32 cy,
nsIWebBrowser ** aWebBrowser) = 0;
virtual void DestroyBrowserFrame() = 0;
virtual void GetBrowserFrameTitle(PRUnichar **aTitle) = 0;
virtual void SetBrowserFrameTitle(const PRUnichar *aTitle) = 0;
virtual void GetBrowserFramePosition(PRInt32 *aX, PRInt32 *aY) = 0;
virtual void SetBrowserFramePosition(PRInt32 aX, PRInt32 aY) = 0;
virtual void GetBrowserFrameSize(PRInt32 *aCX, PRInt32 *aCY) = 0;
virtual void SetBrowserFrameSize(PRInt32 aCX, PRInt32 aCY) = 0;
virtual void GetBrowserFramePositionAndSize(PRInt32 *aX, PRInt32 *aY, PRInt32 *aCX, PRInt32 *aCY) = 0;
virtual void SetBrowserFramePositionAndSize(PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY, PRBool fRepaint) = 0;
virtual void ShowBrowserFrame(PRBool aShow) = 0;
virtual void SetFocus() = 0;
virtual void FocusAvailable(PRBool *aFocusAvail) = 0;
virtual void GetBrowserFrameVisibility(PRBool *aVisible) = 0;
// BrowserFrame Related Methods
virtual PRBool CreateNewBrowserFrame(PRUint32 chromeMask,
PRInt32 x, PRInt32 y,
PRInt32 cx, PRInt32 cy,
nsIWebBrowser ** aWebBrowser) = 0;
virtual void DestroyBrowserFrame() = 0;
virtual void GetBrowserFrameTitle(PRUnichar **aTitle) = 0;
virtual void SetBrowserFrameTitle(const PRUnichar *aTitle) = 0;
virtual void GetBrowserFramePosition(PRInt32 *aX, PRInt32 *aY) = 0;
virtual void SetBrowserFramePosition(PRInt32 aX, PRInt32 aY) = 0;
virtual void GetBrowserFrameSize(PRInt32 *aCX, PRInt32 *aCY) = 0;
virtual void SetBrowserFrameSize(PRInt32 aCX, PRInt32 aCY) = 0;
virtual void GetBrowserFramePositionAndSize(PRInt32 *aX, PRInt32 *aY, PRInt32 *aCX, PRInt32 *aCY) = 0;
virtual void SetBrowserFramePositionAndSize(PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY, PRBool fRepaint) = 0;
virtual void ShowBrowserFrame(PRBool aShow) = 0;
virtual void SetFocus() = 0;
virtual void FocusAvailable(PRBool *aFocusAvail) = 0;
virtual void GetBrowserFrameVisibility(PRBool *aVisible) = 0;
// ContextMenu Related Methods
virtual void ShowContextMenu(PRUint32 aContextFlags, nsIContextMenuInfo *aInfo) = 0;
// ContextMenu Related Methods
virtual void ShowContextMenu(PRUint32 aContextFlags, nsIContextMenuInfo *aInfo) = 0;
virtual HWND GetBrowserFrameNativeWnd() = 0;
// Tooltip methods
virtual void ShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText) = 0;
virtual void HideTooltip() = 0;
virtual HWND GetBrowserFrameNativeWnd() = 0;
};
#define NS_DECL_BROWSERFRAMEGLUE \
public: \
virtual void UpdateStatusBarText(const PRUnichar *aMessage); \
virtual void UpdateProgress(PRInt32 aCurrent, PRInt32 aMax); \
virtual void UpdateBusyState(PRBool aBusy); \
virtual void UpdateCurrentURI(nsIURI *aLocation); \
virtual void UpdateSecurityStatus(PRInt32 aState); \
virtual PRBool CreateNewBrowserFrame(PRUint32 chromeMask, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy, nsIWebBrowser** aWebBrowser); \
virtual void DestroyBrowserFrame(); \
virtual void GetBrowserFrameTitle(PRUnichar **aTitle); \
virtual void SetBrowserFrameTitle(const PRUnichar *aTitle); \
virtual void GetBrowserFramePosition(PRInt32 *aX, PRInt32 *aY); \
virtual void SetBrowserFramePosition(PRInt32 aX, PRInt32 aY); \
virtual void GetBrowserFrameSize(PRInt32 *aCX, PRInt32 *aCY); \
virtual void SetBrowserFrameSize(PRInt32 aCX, PRInt32 aCY); \
virtual void GetBrowserFramePositionAndSize(PRInt32 *aX, PRInt32 *aY, PRInt32 *aCX, PRInt32 *aCY); \
virtual void SetBrowserFramePositionAndSize(PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY, PRBool fRepaint); \
virtual void ShowBrowserFrame(PRBool aShow); \
virtual void SetFocus(); \
virtual void FocusAvailable(PRBool *aFocusAvail); \
virtual void GetBrowserFrameVisibility(PRBool *aVisible); \
virtual void ShowContextMenu(PRUint32 aContextFlags, nsIContextMenuInfo *aInfo); \
virtual HWND GetBrowserFrameNativeWnd();
#define NS_DECL_BROWSERFRAMEGLUE \
public: \
virtual void UpdateStatusBarText(const PRUnichar *aMessage); \
virtual void UpdateProgress(PRInt32 aCurrent, PRInt32 aMax); \
virtual void UpdateBusyState(PRBool aBusy); \
virtual void UpdateCurrentURI(nsIURI *aLocation); \
virtual void UpdateSecurityStatus(PRInt32 aState); \
virtual PRBool CreateNewBrowserFrame(PRUint32 chromeMask, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy, nsIWebBrowser** aWebBrowser); \
virtual void DestroyBrowserFrame(); \
virtual void GetBrowserFrameTitle(PRUnichar **aTitle); \
virtual void SetBrowserFrameTitle(const PRUnichar *aTitle); \
virtual void GetBrowserFramePosition(PRInt32 *aX, PRInt32 *aY); \
virtual void SetBrowserFramePosition(PRInt32 aX, PRInt32 aY); \
virtual void GetBrowserFrameSize(PRInt32 *aCX, PRInt32 *aCY); \
virtual void SetBrowserFrameSize(PRInt32 aCX, PRInt32 aCY); \
virtual void GetBrowserFramePositionAndSize(PRInt32 *aX, PRInt32 *aY, PRInt32 *aCX, PRInt32 *aCY); \
virtual void SetBrowserFramePositionAndSize(PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY, PRBool fRepaint); \
virtual void ShowBrowserFrame(PRBool aShow); \
virtual void SetFocus(); \
virtual void FocusAvailable(PRBool *aFocusAvail); \
virtual void GetBrowserFrameVisibility(PRBool *aVisible); \
virtual void ShowContextMenu(PRUint32 aContextFlags, nsIContextMenuInfo *aInfo); \
virtual void ShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText); \
virtual void HideTooltip(); \
virtual HWND GetBrowserFrameNativeWnd();
typedef IBrowserFrameGlue *PBROWSERFRAMEGLUE;
#endif //_IBROWSERFRAMEGLUE_H

Просмотреть файл

@ -80,6 +80,7 @@ CPPSRCS = \
BrowserImpl.cpp \
BrowserImplWebPrgrsLstnr.cpp \
BrowserImplCtxMenuLstnr.cpp \
BrowserToolTip.cpp \
Dialogs.cpp \
ProfileMgr.cpp \
ProfilesDlg.cpp \

Просмотреть файл

@ -187,15 +187,15 @@ private:
BEGIN_MESSAGE_MAP(CMfcEmbedApp, CWinApp)
//{{AFX_MSG_MAP(CMfcEmbedApp)
ON_COMMAND(ID_NEW_BROWSER, OnNewBrowser)
ON_COMMAND(ID_NEW_EDITORWINDOW, OnNewEditor)
ON_COMMAND(ID_MANAGE_PROFILES, OnManageProfiles)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
//{{AFX_MSG_MAP(CMfcEmbedApp)
ON_COMMAND(ID_NEW_BROWSER, OnNewBrowser)
ON_COMMAND(ID_NEW_EDITORWINDOW, OnNewEditor)
ON_COMMAND(ID_MANAGE_PROFILES, OnManageProfiles)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_EDIT_PREFERENCES, OnEditPreferences)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CMfcEmbedApp::CMfcEmbedApp() :
@ -362,27 +362,27 @@ BOOL CMfcEmbedApp::InitInstance()
CMfcEmbedCommandLine cmdLine(*this);
ParseCommandLine(cmdLine);
Enable3dControls();
Enable3dControls();
//
// 1. Determine the name of the dir from which the GRE based app is being run
// from [It's OK to do this even if you're not running in an GRE env]
//
// 2. Create an nsILocalFile out of it which will passed in to NS_InitEmbedding()
//
// Please see http://www.mozilla.org/projects/embedding/MRE.html
// for more info. on GRE
//
// 1. Determine the name of the dir from which the GRE based app is being run
// from [It's OK to do this even if you're not running in an GRE env]
//
// 2. Create an nsILocalFile out of it which will passed in to NS_InitEmbedding()
//
// Please see http://www.mozilla.org/projects/embedding/MRE.html
// for more info. on GRE
char curDir[_MAX_PATH+1];
::GetCurrentDirectory(_MAX_PATH, curDir);
nsresult rv;
nsCOMPtr<nsILocalFile> mreAppDir;
rv = NS_NewNativeLocalFile(nsDependentCString(curDir), TRUE, getter_AddRefs(mreAppDir));
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to create mreAppDir localfile");
char curDir[_MAX_PATH+1];
::GetCurrentDirectory(_MAX_PATH, curDir);
nsresult rv;
nsCOMPtr<nsILocalFile> mreAppDir;
rv = NS_NewNativeLocalFile(nsDependentCString(curDir), TRUE, getter_AddRefs(mreAppDir));
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to create mreAppDir localfile");
// Take a look at
// http://www.mozilla.org/projects/xpcom/file_locations.html
// for more info on File Locations
// Take a look at
// http://www.mozilla.org/projects/xpcom/file_locations.html
// for more info on File Locations
winEmbedFileLocProvider *provider = new winEmbedFileLocProvider("MfcEmbed");
if(!provider)
@ -413,81 +413,81 @@ BOOL CMfcEmbedApp::InitInstance()
return FALSE;
}
if(!InitializeProfiles())
{
if(!InitializeProfiles())
{
ASSERT(FALSE);
NS_TermEmbedding();
return FALSE;
}
return FALSE;
}
if(!CreateHiddenWindow())
{
{
ASSERT(FALSE);
NS_TermEmbedding();
return FALSE;
}
return FALSE;
}
// Create the first browser frame window
OnNewBrowser();
// Create the first browser frame window
OnNewBrowser();
return TRUE;
return TRUE;
}
CBrowserFrame* CMfcEmbedApp::CreateNewBrowserFrame(PRUint32 chromeMask,
PRInt32 x, PRInt32 y,
PRInt32 cx, PRInt32 cy,
PRBool bShowWindow,
PRBool bIsEditor
)
PRInt32 x, PRInt32 y,
PRInt32 cx, PRInt32 cy,
PRBool bShowWindow,
PRBool bIsEditor
)
{
UINT resId = bIsEditor ? IDR_EDITOR : IDR_MAINFRAME;
UINT resId = bIsEditor ? IDR_EDITOR : IDR_MAINFRAME;
// Setup a CRect with the requested window dimensions
CRect winSize(x, y, cx, cy);
// Setup a CRect with the requested window dimensions
CRect winSize(x, y, cx, cy);
// Use the Windows default if all are specified as -1
if(x == -1 && y == -1 && cx == -1 && cy == -1)
winSize = CFrameWnd::rectDefault;
// Use the Windows default if all are specified as -1
if(x == -1 && y == -1 && cx == -1 && cy == -1)
winSize = CFrameWnd::rectDefault;
// Load the window title from the string resource table
CString strTitle;
strTitle.LoadString(IDR_MAINFRAME);
// Load the window title from the string resource table
CString strTitle;
strTitle.LoadString(IDR_MAINFRAME);
// Now, create the browser frame
CBrowserFrame* pFrame = bIsEditor ? ( new CEditorFrame(chromeMask) ) :
( new CBrowserFrame(chromeMask) );
pFrame->SetEditable(bIsEditor);
// Now, create the browser frame
CBrowserFrame* pFrame = bIsEditor ? ( new CEditorFrame(chromeMask) ) :
( new CBrowserFrame(chromeMask) );
pFrame->SetEditable(bIsEditor);
if (!pFrame->Create(NULL, strTitle, WS_OVERLAPPEDWINDOW,
winSize, NULL, MAKEINTRESOURCE(resId), 0L, NULL))
{
return NULL;
}
if (!pFrame->Create(NULL, strTitle, WS_OVERLAPPEDWINDOW,
winSize, NULL, MAKEINTRESOURCE(resId), 0L, NULL))
{
return NULL;
}
// load accelerator resource
pFrame->LoadAccelTable(MAKEINTRESOURCE(IDR_MAINFRAME));
// load accelerator resource
pFrame->LoadAccelTable(MAKEINTRESOURCE(IDR_MAINFRAME));
// Show the window...
if(bShowWindow)
{
pFrame->ShowWindow(SW_SHOW);
pFrame->UpdateWindow();
}
// Show the window...
if(bShowWindow)
{
pFrame->ShowWindow(SW_SHOW);
pFrame->UpdateWindow();
}
// Add to the list of BrowserFrame windows
m_FrameWndLst.AddHead(pFrame);
// Add to the list of BrowserFrame windows
m_FrameWndLst.AddHead(pFrame);
return pFrame;
return pFrame;
}
void CMfcEmbedApp::OnNewBrowser()
{
CBrowserFrame *pBrowserFrame = CreateNewBrowserFrame();
CBrowserFrame *pBrowserFrame = CreateNewBrowserFrame();
//Load the HomePage into the browser view
if(pBrowserFrame && (GetStartupPageMode() == 1))
pBrowserFrame->m_wndBrowserView.LoadHomePage();
//Load the HomePage into the browser view
if(pBrowserFrame && (GetStartupPageMode() == 1))
pBrowserFrame->m_wndBrowserView.LoadHomePage();
}
void CMfcEmbedApp::OnNewEditor()
@ -513,55 +513,55 @@ void CMfcEmbedApp::OnNewEditor()
//
void CMfcEmbedApp::RemoveFrameFromList(CBrowserFrame* pFrm, BOOL bCloseAppOnLastFrame/*= TRUE*/)
{
POSITION pos = m_FrameWndLst.Find(pFrm);
m_FrameWndLst.RemoveAt(pos);
POSITION pos = m_FrameWndLst.Find(pFrm);
m_FrameWndLst.RemoveAt(pos);
// Send a WM_QUIT msg. to the hidden window if we've
// just closed the last browserframe window and
// if the bCloseAppOnLastFrame is TRUE. This be FALSE
// only in the case we're switching profiles
// Without this the hidden window will stick around
// i.e. the app will never die even after all the
// visible windows are gone.
if(m_FrameWndLst.GetCount() == 0 && bCloseAppOnLastFrame)
m_pMainWnd->PostMessage(WM_QUIT);
// Send a WM_QUIT msg. to the hidden window if we've
// just closed the last browserframe window and
// if the bCloseAppOnLastFrame is TRUE. This be FALSE
// only in the case we're switching profiles
// Without this the hidden window will stick around
// i.e. the app will never die even after all the
// visible windows are gone.
if(m_FrameWndLst.GetCount() == 0 && bCloseAppOnLastFrame)
m_pMainWnd->PostMessage(WM_QUIT);
}
int CMfcEmbedApp::ExitInstance()
{
// When File/Exit is chosen and if the user
// has opened multiple browser windows shut all
// of them down properly before exiting the app
// When File/Exit is chosen and if the user
// has opened multiple browser windows shut all
// of them down properly before exiting the app
CBrowserFrame* pBrowserFrame = NULL;
CBrowserFrame* pBrowserFrame = NULL;
POSITION pos = m_FrameWndLst.GetHeadPosition();
while( pos != NULL )
{
pBrowserFrame = (CBrowserFrame *) m_FrameWndLst.GetNext(pos);
if(pBrowserFrame)
{
pBrowserFrame->ShowWindow(false);
pBrowserFrame->DestroyWindow();
}
}
m_FrameWndLst.RemoveAll();
POSITION pos = m_FrameWndLst.GetHeadPosition();
while( pos != NULL )
{
pBrowserFrame = (CBrowserFrame *) m_FrameWndLst.GetNext(pos);
if(pBrowserFrame)
{
pBrowserFrame->ShowWindow(false);
pBrowserFrame->DestroyWindow();
}
}
m_FrameWndLst.RemoveAll();
if (m_pMainWnd)
m_pMainWnd->DestroyWindow();
delete m_ProfileMgr;
NS_TermEmbedding();
NS_TermEmbedding();
return 1;
return 1;
}
BOOL CMfcEmbedApp::OnIdle(LONG lCount)
{
CWinApp::OnIdle(lCount);
CWinApp::OnIdle(lCount);
return FALSE;
return FALSE;
}
void CMfcEmbedApp::OnManageProfiles()
@ -593,7 +593,7 @@ void CMfcEmbedApp::OnEditPreferences()
rv = prefs->SavePrefFile(nsnull);
}
else
NS_ASSERTION(PR_FALSE, "Could not get preferences service");
NS_ASSERTION(PR_FALSE, "Could not get preferences service");
}
}
@ -603,7 +603,7 @@ BOOL CMfcEmbedApp::InitializeProfiles()
if (!m_ProfileMgr)
return FALSE;
nsresult rv;
nsresult rv;
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1", &rv);
observerService->AddObserver(this, "profile-approve-change", PR_TRUE);
@ -612,7 +612,7 @@ BOOL CMfcEmbedApp::InitializeProfiles()
m_ProfileMgr->StartUp();
return TRUE;
return TRUE;
}
// When the profile switch happens, all open browser windows need to be
@ -622,31 +622,31 @@ BOOL CMfcEmbedApp::InitializeProfiles()
// switches
BOOL CMfcEmbedApp::CreateHiddenWindow()
{
CFrameWnd *hiddenWnd = new CFrameWnd;
if(!hiddenWnd)
return FALSE;
CFrameWnd *hiddenWnd = new CFrameWnd;
if(!hiddenWnd)
return FALSE;
RECT bounds = { -10010, -10010, -10000, -10000 };
hiddenWnd->Create(NULL, "main", WS_DISABLED, bounds, NULL, NULL, 0, NULL);
m_pMainWnd = hiddenWnd;
return TRUE;
return TRUE;
}
nsresult CMfcEmbedApp::InitializePrefs()
{
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv)) {
// We are using the default prefs from mozilla. If you were
// disributing your own, this would be done simply by editing
// the default pref files.
PRBool inited;
rv = prefs->GetBoolPref("mfcbrowser.prefs_inited", &inited);
if (NS_FAILED(rv) || !inited)
{
// We are using the default prefs from mozilla. If you were
// disributing your own, this would be done simply by editing
// the default pref files.
PRBool inited;
rv = prefs->GetBoolPref("mfcbrowser.prefs_inited", &inited);
if (NS_FAILED(rv) || !inited)
{
m_iStartupPage = 1;
m_strHomePage = "http://www.mozilla.org/projects/embedding";
@ -671,10 +671,10 @@ nsresult CMfcEmbedApp::InitializePrefs()
if(pBuf)
m_strHomePage = pBuf;
}
}
else
NS_ASSERTION(PR_FALSE, "Could not get preferences service");
}
else
NS_ASSERTION(PR_FALSE, "Could not get preferences service");
return rv;
}
@ -731,21 +731,21 @@ NS_IMETHODIMP CMfcEmbedApp::Observe(nsISupports *aSubject, const char *aTopic, c
// Close all open windows. Alternatively, we could just call CBrowserWindow::Stop()
// on each. Either way, we have to stop all network activity on this phase.
POSITION pos = m_FrameWndLst.GetHeadPosition();
while( pos != NULL )
{
CBrowserFrame *pBrowserFrame = (CBrowserFrame *) m_FrameWndLst.GetNext(pos);
if(pBrowserFrame)
{
pBrowserFrame->ShowWindow(false);
POSITION pos = m_FrameWndLst.GetHeadPosition();
while( pos != NULL )
{
CBrowserFrame *pBrowserFrame = (CBrowserFrame *) m_FrameWndLst.GetNext(pos);
if(pBrowserFrame)
{
pBrowserFrame->ShowWindow(false);
// Passing in FALSE below so that we do not
// kill the main app during a profile switch
RemoveFrameFromList(pBrowserFrame, FALSE);
// Passing in FALSE below so that we do not
// kill the main app during a profile switch
RemoveFrameFromList(pBrowserFrame, FALSE);
pBrowserFrame->DestroyWindow();
}
}
pBrowserFrame->DestroyWindow();
}
}
}
else if (nsCRT::strcmp(aTopic, "profile-after-change") == 0)
{
@ -783,15 +783,15 @@ NS_IMETHODIMP CMfcEmbedApp::CreateChromeWindow(nsIWebBrowserChrome *parent,
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
CAboutDlg();
enum { IDD = IDD_ABOUTBOX };
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
protected:
DECLARE_MESSAGE_MAP()
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
@ -800,7 +800,7 @@ CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
@ -809,6 +809,6 @@ END_MESSAGE_MAP()
// Show the AboutDlg
void CMfcEmbedApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}

Просмотреть файл

@ -40,7 +40,7 @@
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
@ -59,31 +59,31 @@ class CMfcEmbedApp : public CWinApp,
public nsSupportsWeakReference
{
public:
CMfcEmbedApp();
CMfcEmbedApp();
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
NS_DECL_NSIWINDOWCREATOR
CBrowserFrame* CreateNewBrowserFrame(PRUint32 chromeMask = nsIWebBrowserChrome::CHROME_ALL,
PRInt32 x = -1, PRInt32 y = -1,
PRInt32 cx = -1, PRInt32 cy = -1, PRBool bShowWindow = PR_TRUE,
PRBool bIsEditor=PR_FALSE);
void RemoveFrameFromList(CBrowserFrame* pFrm, BOOL bCloseAppOnLastFrame = TRUE);
CBrowserFrame* CreateNewBrowserFrame(PRUint32 chromeMask = nsIWebBrowserChrome::CHROME_ALL,
PRInt32 x = -1, PRInt32 y = -1,
PRInt32 cx = -1, PRInt32 cy = -1, PRBool bShowWindow = PR_TRUE,
PRBool bIsEditor=PR_FALSE);
void RemoveFrameFromList(CBrowserFrame* pFrm, BOOL bCloseAppOnLastFrame = TRUE);
void ShowDebugConsole();
nsresult OverrideComponents();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMfcEmbedApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
virtual BOOL OnIdle(LONG lCount);
//}}AFX_VIRTUAL
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMfcEmbedApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
virtual BOOL OnIdle(LONG lCount);
//}}AFX_VIRTUAL
CObList m_FrameWndLst;
CObList m_FrameWndLst;
BOOL m_bChrome;
CString m_strHomePage;
@ -100,20 +100,20 @@ public:
// Implementation
public:
//{{AFX_MSG(CMfcEmbedApp)
afx_msg void OnAppAbout();
afx_msg void OnNewBrowser();
afx_msg void OnNewEditor();
//{{AFX_MSG(CMfcEmbedApp)
afx_msg void OnAppAbout();
afx_msg void OnNewBrowser();
afx_msg void OnNewEditor();
afx_msg void OnManageProfiles();
afx_msg void OnEditPreferences();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
BOOL InitializeProfiles();
BOOL CreateHiddenWindow();
BOOL InitializeProfiles();
BOOL CreateHiddenWindow();
nsresult InitializePrefs();
nsresult InitializeWindowCreator();

Просмотреть файл

@ -50,21 +50,21 @@
CMostRecentUrls::CMostRecentUrls() :
mNumURLs(0)
{
for (int i=0;i<MAX_URLS;i++) {
mURLs[i] = NULL;
}
for (int i=0;i<MAX_URLS;i++) {
mURLs[i] = NULL;
}
FILE * fd = GetFD("r");
if (fd) {
char line[512];
while (fgets(line, 512, fd)) {
if (strlen(line) > 1) {
line[strlen(line)-1] = 0;
mURLs[mNumURLs++] = _strdup(line);
}
}
fclose(fd);
}
FILE * fd = GetFD("r");
if (fd) {
char line[512];
while (fgets(line, 512, fd)) {
if (strlen(line) > 1) {
line[strlen(line)-1] = 0;
mURLs[mNumURLs++] = _strdup(line);
}
}
fclose(fd);
}
}
@ -110,33 +110,33 @@ char * CMostRecentUrls::GetURL(int aInx)
void CMostRecentUrls::AddURL(const char * aURL)
{
TCHAR szTemp[512];
strcpy(szTemp, aURL);
TCHAR szTemp[512];
strcpy(szTemp, aURL);
// check to see if an existing url matches the one passed in
for (int i=0; i<MAX_URLS-1; i++)
{
// check to see if an existing url matches the one passed in
for (int i=0; i<MAX_URLS-1; i++)
{
if(mURLs[i])
{
if(strcmpi(mURLs[i], szTemp) == 0)
break;
}
}
}
// if there was a match "i" will point to matching url entry
// if not i will be MAX_URLS-1
// move all url entries before this one down
for (; i>0; i--)
{
for (; i>0; i--)
{
if(mURLs[i])
free(mURLs[i]);
if(mURLs[i-1])
mURLs[i] = _strdup(mURLs[i-1]);
}
}
// place this url at the top
// place this url at the top
if(mURLs[0])
free(mURLs[0]);
mURLs[0] = _strdup(szTemp);

Просмотреть файл

@ -44,7 +44,7 @@ static char THIS_FILE[] = __FILE__;
IMPLEMENT_DYNAMIC(CPreferences, CPropertySheet)
CPreferences::CPreferences(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
AddPage(&m_startupPage);
}
@ -54,22 +54,22 @@ CPreferences::~CPreferences()
}
BEGIN_MESSAGE_MAP(CPreferences, CPropertySheet)
//{{AFX_MSG_MAP(CPreferences)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
//{{AFX_MSG_MAP(CPreferences)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CPreferences::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
BOOL bResult = CPropertySheet::OnInitDialog();
// Hide the Apply button
CWnd* pApplyButton = GetDlgItem(ID_APPLY_NOW);
ASSERT(pApplyButton);
pApplyButton->ShowWindow(SW_HIDE);
return bResult;
return bResult;
}
@ -80,10 +80,10 @@ IMPLEMENT_DYNCREATE(CStartupPrefsPage, CPropertyPage)
CStartupPrefsPage::CStartupPrefsPage() : CPropertyPage(CStartupPrefsPage::IDD)
{
//{{AFX_DATA_INIT(CStartupPrefsPage)
m_strHomePage = _T("");
m_iStartupPage = -1;
//}}AFX_DATA_INIT
//{{AFX_DATA_INIT(CStartupPrefsPage)
m_strHomePage = _T("");
m_iStartupPage = -1;
//}}AFX_DATA_INIT
}
CStartupPrefsPage::~CStartupPrefsPage()
@ -92,16 +92,16 @@ CStartupPrefsPage::~CStartupPrefsPage()
void CStartupPrefsPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CStartupPrefsPage)
DDX_Control(pDX, IDC_EDIT_HOMEPAGE, m_HomePage);
DDX_Text(pDX, IDC_EDIT_HOMEPAGE, m_strHomePage);
DDX_Radio(pDX, IDC_RADIO_BLANK_PAGE, m_iStartupPage);
//}}AFX_DATA_MAP
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CStartupPrefsPage)
DDX_Control(pDX, IDC_EDIT_HOMEPAGE, m_HomePage);
DDX_Text(pDX, IDC_EDIT_HOMEPAGE, m_strHomePage);
DDX_Radio(pDX, IDC_RADIO_BLANK_PAGE, m_iStartupPage);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CStartupPrefsPage, CPropertyPage)
//{{AFX_MSG_MAP(CStartupPrefsPage)
//}}AFX_MSG_MAP
//{{AFX_MSG_MAP(CStartupPrefsPage)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

Просмотреть файл

@ -44,35 +44,35 @@
class CStartupPrefsPage : public CPropertyPage
{
DECLARE_DYNCREATE(CStartupPrefsPage)
DECLARE_DYNCREATE(CStartupPrefsPage)
// Construction
public:
CStartupPrefsPage();
~CStartupPrefsPage();
CStartupPrefsPage();
~CStartupPrefsPage();
// Dialog Data
//{{AFX_DATA(CStartupPrefsPage)
enum { IDD = IDD_PREFS_START_PAGE };
CEdit m_HomePage;
CString m_strHomePage;
int m_iStartupPage;
//}}AFX_DATA
//{{AFX_DATA(CStartupPrefsPage)
enum { IDD = IDD_PREFS_START_PAGE };
CEdit m_HomePage;
CString m_strHomePage;
int m_iStartupPage;
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CStartupPrefsPage)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CStartupPrefsPage)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CStartupPrefsPage)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Generated message map functions
//{{AFX_MSG(CStartupPrefsPage)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
@ -81,11 +81,11 @@ protected:
class CPreferences : public CPropertySheet
{
DECLARE_DYNAMIC(CPreferences)
DECLARE_DYNAMIC(CPreferences)
// Construction
public:
CPreferences(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
CPreferences(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
// Attributes
public:
@ -95,22 +95,22 @@ public:
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPreferences)
public:
virtual BOOL OnInitDialog();
//}}AFX_VIRTUAL
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPreferences)
public:
virtual BOOL OnInitDialog();
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CPreferences();
virtual ~CPreferences();
// Generated message map functions
// Generated message map functions
protected:
//{{AFX_MSG(CPreferences)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
//{{AFX_MSG(CPreferences)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}

Просмотреть файл

@ -82,22 +82,22 @@ static void ValidateProfileName(const CString& profileName, CDataExchange* pDX)
CNewProfileDlg::CNewProfileDlg(CWnd* pParent /*=NULL*/)
: CDialog(CNewProfileDlg::IDD, pParent)
: CDialog(CNewProfileDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CNewProfileDlg)
m_LocaleIndex = -1;
m_Name = _T("");
//}}AFX_DATA_INIT
//{{AFX_DATA_INIT(CNewProfileDlg)
m_LocaleIndex = -1;
m_Name = _T("");
//}}AFX_DATA_INIT
}
void CNewProfileDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNewProfileDlg)
DDX_CBIndex(pDX, IDC_LOCALE_COMBO, m_LocaleIndex);
DDX_Text(pDX, IDC_NEW_PROF_NAME, m_Name);
//}}AFX_DATA_MAP
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNewProfileDlg)
DDX_CBIndex(pDX, IDC_LOCALE_COMBO, m_LocaleIndex);
DDX_Text(pDX, IDC_NEW_PROF_NAME, m_Name);
//}}AFX_DATA_MAP
pDX->PrepareEditCtrl(IDC_NEW_PROF_NAME);
if (pDX->m_bSaveAndValidate)
@ -108,9 +108,9 @@ void CNewProfileDlg::DoDataExchange(CDataExchange* pDX)
BEGIN_MESSAGE_MAP(CNewProfileDlg, CDialog)
//{{AFX_MSG_MAP(CNewProfileDlg)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
//{{AFX_MSG_MAP(CNewProfileDlg)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
@ -122,20 +122,20 @@ END_MESSAGE_MAP()
CRenameProfileDlg::CRenameProfileDlg(CWnd* pParent /*=NULL*/)
: CDialog(CRenameProfileDlg::IDD, pParent)
: CDialog(CRenameProfileDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CRenameProfileDlg)
m_NewName = _T("");
//}}AFX_DATA_INIT
//{{AFX_DATA_INIT(CRenameProfileDlg)
m_NewName = _T("");
//}}AFX_DATA_INIT
}
void CRenameProfileDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRenameProfileDlg)
DDX_Text(pDX, IDC_NEW_NAME, m_NewName);
//}}AFX_DATA_MAP
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRenameProfileDlg)
DDX_Text(pDX, IDC_NEW_NAME, m_NewName);
//}}AFX_DATA_MAP
pDX->PrepareEditCtrl(IDC_NEW_NAME);
if (pDX->m_bSaveAndValidate)
@ -146,9 +146,9 @@ void CRenameProfileDlg::DoDataExchange(CDataExchange* pDX)
BEGIN_MESSAGE_MAP(CRenameProfileDlg, CDialog)
//{{AFX_MSG_MAP(CRenameProfileDlg)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
//{{AFX_MSG_MAP(CRenameProfileDlg)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
@ -160,22 +160,22 @@ END_MESSAGE_MAP()
CProfilesDlg::CProfilesDlg(CWnd* pParent /*=NULL*/)
: CDialog(CProfilesDlg::IDD, pParent)
: CDialog(CProfilesDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CProfilesDlg)
//{{AFX_DATA_INIT(CProfilesDlg)
m_bAtStartUp = FALSE;
m_bAskAtStartUp = FALSE;
//}}AFX_DATA_INIT
m_bAskAtStartUp = FALSE;
//}}AFX_DATA_INIT
}
void CProfilesDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CProfilesDlg)
DDX_Control(pDX, IDC_LIST1, m_ProfileList);
DDX_Check(pDX, IDC_CHECK_ASK_AT_START, m_bAskAtStartUp);
//}}AFX_DATA_MAP
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CProfilesDlg)
DDX_Control(pDX, IDC_LIST1, m_ProfileList);
DDX_Check(pDX, IDC_CHECK_ASK_AT_START, m_bAskAtStartUp);
//}}AFX_DATA_MAP
if (pDX->m_bSaveAndValidate)
{
@ -193,12 +193,12 @@ void CProfilesDlg::DoDataExchange(CDataExchange* pDX)
BEGIN_MESSAGE_MAP(CProfilesDlg, CDialog)
//{{AFX_MSG_MAP(CProfilesDlg)
ON_BN_CLICKED(IDC_PROF_NEW, OnNewProfile)
ON_BN_CLICKED(IDC_PROF_RENAME, OnRenameProfile)
ON_BN_CLICKED(IDC_PROF_DELETE, OnDeleteProfile)
ON_LBN_DBLCLK(IDC_LIST1, OnDblclkProfile)
//}}AFX_MSG_MAP
//{{AFX_MSG_MAP(CProfilesDlg)
ON_BN_CLICKED(IDC_PROF_NEW, OnNewProfile)
ON_BN_CLICKED(IDC_PROF_RENAME, OnRenameProfile)
ON_BN_CLICKED(IDC_PROF_DELETE, OnDeleteProfile)
ON_LBN_DBLCLK(IDC_LIST1, OnDblclkProfile)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
@ -208,8 +208,8 @@ BOOL CProfilesDlg::OnInitDialog()
{
USES_CONVERSION;
CDialog::OnInitDialog();
CDialog::OnInitDialog();
nsCAutoString cStr;
nsXPIDLString curProfileName;
@ -238,14 +238,14 @@ BOOL CProfilesDlg::OnInitDialog()
{
GetDlgItem(IDCANCEL)->EnableWindow(FALSE);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CProfilesDlg::OnNewProfile()
{
CNewProfileDlg dialog;
CNewProfileDlg dialog;
if (dialog.DoModal() == IDOK)
{
@ -258,7 +258,7 @@ void CProfilesDlg::OnNewProfile()
{
USES_CONVERSION;
rv = profileService->CreateNewProfile(T2W(dialog.m_Name), nsnull, nsnull, PR_FALSE);
rv = profileService->CreateNewProfile(T2W(dialog.m_Name), nsnull, nsnull, PR_FALSE);
ASSERT(NS_SUCCEEDED(rv));
if (NS_SUCCEEDED(rv))
{
@ -272,7 +272,7 @@ void CProfilesDlg::OnNewProfile()
void CProfilesDlg::OnRenameProfile()
{
CRenameProfileDlg dialog;
CRenameProfileDlg dialog;
int itemIndex = m_ProfileList.GetCurSel();
ASSERT(itemIndex != LB_ERR);
@ -295,7 +295,7 @@ void CProfilesDlg::OnRenameProfile()
rv = profileService->RenameProfile(T2W(dialog.m_CurrentName), T2W(dialog.m_NewName));
ASSERT(NS_SUCCEEDED(rv));
}
}
}
}
void CProfilesDlg::OnDeleteProfile()
@ -324,7 +324,7 @@ void CProfilesDlg::OnDeleteProfile()
if (itemCount == 0)
GetDlgItem(IDOK)->EnableWindow(FALSE);
}
}
}
}
void CProfilesDlg::OnDblclkProfile()

Просмотреть файл

@ -43,31 +43,31 @@ class CNewProfileDlg : public CDialog
{
// Construction
public:
CNewProfileDlg(CWnd* pParent = NULL); // standard constructor
CNewProfileDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CNewProfileDlg)
enum { IDD = IDD_PROFILE_NEW };
int m_LocaleIndex;
CString m_Name;
//}}AFX_DATA
//{{AFX_DATA(CNewProfileDlg)
enum { IDD = IDD_PROFILE_NEW };
int m_LocaleIndex;
CString m_Name;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNewProfileDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNewProfileDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CNewProfileDlg)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Generated message map functions
//{{AFX_MSG(CNewProfileDlg)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
@ -77,31 +77,31 @@ class CRenameProfileDlg : public CDialog
{
// Construction
public:
CRenameProfileDlg(CWnd* pParent = NULL); // standard constructor
CRenameProfileDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CRenameProfileDlg)
enum { IDD = IDD_PROFILE_RENAME };
CString m_NewName;
//}}AFX_DATA
//{{AFX_DATA(CRenameProfileDlg)
enum { IDD = IDD_PROFILE_RENAME };
CString m_NewName;
//}}AFX_DATA
CString m_CurrentName;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRenameProfileDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRenameProfileDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CRenameProfileDlg)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Generated message map functions
//{{AFX_MSG(CRenameProfileDlg)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
@ -111,37 +111,37 @@ class CProfilesDlg : public CDialog
{
// Construction
public:
CProfilesDlg(CWnd* pParent = NULL); // standard constructor
CProfilesDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CProfilesDlg)
enum { IDD = IDD_PROFILES };
CListBox m_ProfileList;
//{{AFX_DATA(CProfilesDlg)
enum { IDD = IDD_PROFILES };
CListBox m_ProfileList;
BOOL m_bAtStartUp;
BOOL m_bAskAtStartUp;
//}}AFX_DATA
BOOL m_bAskAtStartUp;
//}}AFX_DATA
nsAutoString m_SelectedProfile;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CProfilesDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CProfilesDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CProfilesDlg)
virtual BOOL OnInitDialog();
afx_msg void OnNewProfile();
afx_msg void OnRenameProfile();
afx_msg void OnDeleteProfile();
afx_msg void OnDblclkProfile();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Generated message map functions
//{{AFX_MSG(CProfilesDlg)
virtual BOOL OnInitDialog();
afx_msg void OnNewProfile();
afx_msg void OnRenameProfile();
afx_msg void OnDeleteProfile();
afx_msg void OnDblclkProfile();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}

Просмотреть файл

@ -41,7 +41,7 @@
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
//
// These headers are very evil, as they will define DEBUG if _DEBUG is
@ -58,10 +58,10 @@
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#include <afxpriv.h> // Needed for MFC MBCS/Unicode Conversion Macros
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#include <afxpriv.h> // Needed for MFC MBCS/Unicode Conversion Macros
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
@ -93,6 +93,7 @@
#include "nsIClipboardCommands.h"
#include "nsIWebBrowserPersist.h"
#include "nsIContextMenuListener2.h"
#include "nsITooltipListener.h"
#include "nsIDOMNode.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMHTMLImageElement.h"
@ -101,7 +102,7 @@
#include "nsIDOMHTMLFrameSetElement.h"
#include "nsReadableUtils.h"
#include "nsIPrompt.h"
#include "nsEmbedAPI.h"
#include "nsEmbedAPI.h"
#include "nsISHistory.h"
#include "nsISHEntry.h"
#include "nsIPref.h"

Просмотреть файл

@ -110,6 +110,10 @@ SOURCE=.\BrowserImplWebPrgrsLstnr.cpp
# End Source File
# Begin Source File
SOURCE=.\BrowserToolTip.cpp
# End Source File
# Begin Source File
SOURCE=.\BrowserView.cpp
# End Source File
# Begin Source File
@ -174,6 +178,10 @@ SOURCE=.\BrowserImpl.h
# End Source File
# Begin Source File
SOURCE=.\BrowserToolTip.h
# End Source File
# Begin Source File
SOURCE=.\BrowserView.h
# End Source File
# Begin Source File

Просмотреть файл

@ -84,12 +84,12 @@ NS_IMPL_ISUPPORTS1(winEmbedFileLocProvider, nsIDirectoryServiceProvider)
NS_IMETHODIMP
winEmbedFileLocProvider::GetFile(const char *prop, PRBool *persistant, nsIFile **_retval)
{
nsCOMPtr<nsILocalFile> localFile;
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsILocalFile> localFile;
nsresult rv = NS_ERROR_FAILURE;
*_retval = nsnull;
*persistant = PR_TRUE;
*_retval = nsnull;
*persistant = PR_TRUE;
if (nsCRT::strcmp(prop, NS_APP_APPLICATION_REGISTRY_DIR) == 0)
{
rv = GetProductDirectory(getter_AddRefs(localFile));
@ -173,10 +173,10 @@ winEmbedFileLocProvider::GetFile(const char *prop, PRBool *persistant, nsIFile *
rv = localFile->AppendRelativeNativePath(COMPONENTS_DIR_NAME);
}
if (localFile && NS_SUCCEEDED(rv))
return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)_retval);
return rv;
if (localFile && NS_SUCCEEDED(rv))
return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)_retval);
return rv;
}
// Get the location of the GRE version we're compatible with from
@ -245,7 +245,7 @@ NS_METHOD winEmbedFileLocProvider::GetGreDirectory(nsILocalFile **aLocalFile)
if(pGreDir)
{
nsCOMPtr<nsILocalFile> tempLocal;
rv = NS_NewNativeLocalFile(nsDependentCString(pGreDir), TRUE, getter_AddRefs(tempLocal));
rv = NS_NewNativeLocalFile(nsDependentCString(pGreDir), TRUE, getter_AddRefs(tempLocal));
if (tempLocal)
{

Просмотреть файл

@ -41,24 +41,24 @@ class nsIFile;
class winEmbedFileLocProvider : public nsIDirectoryServiceProvider
{
public:
// productDirName is the name (not path) of the dir
// in which the application registry and profiles live.
winEmbedFileLocProvider(const char* productDirName);
// productDirName is the name (not path) of the dir
// in which the application registry and profiles live.
winEmbedFileLocProvider(const char* productDirName);
NS_DECL_ISUPPORTS
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
NS_DECL_ISUPPORTS
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
static char * GetGreLocationFromRegistry();
static char * GetGreLocationFromRegistry();
protected:
virtual ~winEmbedFileLocProvider();
virtual ~winEmbedFileLocProvider();
NS_METHOD CloneMozBinDirectory(nsILocalFile **aLocalFile);
NS_METHOD GetProductDirectory(nsILocalFile **aLocalFile);
NS_METHOD GetDefaultUserProfileRoot(nsILocalFile **aLocalFile);
NS_METHOD GetGreDirectory(nsILocalFile **aLocalFile);
NS_METHOD CloneMozBinDirectory(nsILocalFile **aLocalFile);
NS_METHOD GetProductDirectory(nsILocalFile **aLocalFile);
NS_METHOD GetDefaultUserProfileRoot(nsILocalFile **aLocalFile);
NS_METHOD GetGreDirectory(nsILocalFile **aLocalFile);
char mProductDirName[256];
nsCOMPtr<nsILocalFile> mMozBinDirectory;
char mProductDirName[256];
nsCOMPtr<nsILocalFile> mMozBinDirectory;
};