1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Netscape Public License
6
* Version 1.1 (the "License"); you may not use this file except in
7
* compliance with the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/NPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
15
* The Original Code is mozilla.org code.
17
* The Initial Developer of the Original Code is
18
* Netscape Communications Corporation.
19
* Portions created by the Initial Developer are Copyright (C) 1998
20
* the Initial Developer. All Rights Reserved.
23
* Chak Nanga <chak@netscape.com>
26
* Alternatively, the contents of this file may be used under the terms of
27
* either the GNU General Public License Version 2 or later (the "GPL"), or
28
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
* in which case the provisions of the GPL or the LGPL are applicable instead
30
* of those above. If you wish to allow use of your version of this file only
31
* under the terms of either the GPL or the LGPL, and not to allow others to
32
* use your version of this file under the terms of the NPL, indicate your
33
* decision by deleting the provisions above and replace them with the notice
34
* and other provisions required by the GPL or the LGPL. If you do not delete
35
* the provisions above, a recipient may use your version of this file under
36
* the terms of any one of the NPL, the GPL or the LGPL.
38
* ***** END LICENSE BLOCK ***** */
40
// BrowserFrm.h : interface of the CBrowserFrame class
42
/////////////////////////////////////////////////////////////////////////////
44
#ifndef _IBROWSERFRM_H
45
#define _IBROWSERFRM_H
49
#endif // _MSC_VER > 1000
51
#include "BrowserView.h"
52
#include "BrowserToolTip.h"
53
#include "IBrowserFrameGlue.h"
54
#include "MostRecentUrls.h"
56
// A simple UrlBar class...
57
class CUrlBar : public CComboBoxEx
60
inline void GetEnteredURL(CString& url) {
61
GetEditCtrl()->GetWindowText(url);
63
inline void GetSelectedURL(CString& url) {
64
GetLBText(GetCurSel(), url);
66
inline void SetCurrentURL(LPCTSTR pUrl) {
69
inline void AddURLToList(CString& url, bool bAddToMRUList = true) {
71
ci.mask = CBEIF_TEXT; ci.iItem = -1;
72
ci.pszText = (LPTSTR)(LPCTSTR)url;
76
m_MRUList.AddURL((LPTSTR)(LPCTSTR)url);
78
inline void LoadMRUList() {
79
for (int i=0;i<m_MRUList.GetNumURLs();i++)
81
CString urlStr(_T(m_MRUList.GetURL(i)));
82
AddURLToList(urlStr, false);
85
inline BOOL EditCtrlHasFocus() {
86
return (GetEditCtrl()->m_hWnd == CWnd::GetFocus()->m_hWnd);
88
inline BOOL EditCtrlHasSelection() {
89
int nStartChar = 0, nEndChar = 0;
90
if(EditCtrlHasFocus())
91
GetEditCtrl()->GetSel(nStartChar, nEndChar);
92
return (nEndChar > nStartChar) ? TRUE : FALSE;
94
inline BOOL CanCutToClipboard() {
95
return EditCtrlHasSelection();
97
inline void CutToClipboard() {
100
inline BOOL CanCopyToClipboard() {
101
return EditCtrlHasSelection();
103
inline void CopyToClipboard() {
104
GetEditCtrl()->Copy();
106
inline BOOL CanPasteFromClipboard() {
107
return EditCtrlHasFocus();
109
inline void PasteFromClipboard() {
110
GetEditCtrl()->Paste();
112
inline BOOL CanUndoEditOp() {
113
return EditCtrlHasFocus() ? GetEditCtrl()->CanUndo() : FALSE;
115
inline void UndoEditOp() {
116
if(EditCtrlHasFocus())
117
GetEditCtrl()->Undo();
121
CMostRecentUrls m_MRUList;
124
class CBrowserFrame : public CFrameWnd
127
CBrowserFrame(PRUint32 chromeMask);
130
DECLARE_DYNAMIC(CBrowserFrame)
133
inline CBrowserImpl *GetBrowserImpl() { return m_wndBrowserView.mpBrowserImpl; }
135
CToolBar m_wndToolBar;
136
CStatusBar m_wndStatusBar;
137
CProgressCtrl m_wndProgressBar;
140
// The view inside which the embedded browser will
142
CBrowserToolTip m_wndTooltip;
143
CBrowserView m_wndBrowserView;
145
// Wrapper functions for UrlBar clipboard operations
146
inline BOOL CanCutUrlBarSelection() { return m_wndUrlBar.CanCutToClipboard(); }
147
inline void CutUrlBarSelToClipboard() { m_wndUrlBar.CutToClipboard(); }
148
inline BOOL CanCopyUrlBarSelection() { return m_wndUrlBar.CanCopyToClipboard(); }
149
inline void CopyUrlBarSelToClipboard() { m_wndUrlBar.CopyToClipboard(); }
150
inline BOOL CanPasteToUrlBar() { return m_wndUrlBar.CanPasteFromClipboard(); }
151
inline void PasteFromClipboardToUrlBar() { m_wndUrlBar.PasteFromClipboard(); }
152
inline BOOL CanUndoUrlBarEditOp() { return m_wndUrlBar.CanUndoEditOp(); }
153
inline void UndoUrlBarEditOp() { m_wndUrlBar.UndoEditOp(); }
155
// This specifies what UI elements this frame will sport
156
// w.r.t. toolbar, statusbar, urlbar etc.
157
PRUint32 m_chromeMask;
161
// This nested class implements the IBrowserFramGlue interface
162
// The Gecko embedding interfaces call on this interface
163
// to update the status bars etc.
165
class BrowserFrameGlueObj : public IBrowserFrameGlue
168
// NS_DECL_BROWSERFRAMEGLUE below is a macro which expands
169
// to the function prototypes of methods in IBrowserFrameGlue
170
// Take a look at IBrowserFrameGlue.h for this macro define
173
NS_DECL_BROWSERFRAMEGLUE
175
} m_xBrowserFrameGlueObj;
176
friend class BrowserFrameGlueObj;
179
void SetupFrameChrome();
182
// ClassWizard generated virtual function overrides
183
//{{AFX_VIRTUAL(CBrowserFrame)
184
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
185
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
190
virtual ~CBrowserFrame();
192
virtual void AssertValid() const;
193
virtual void Dump(CDumpContext& dc) const;
196
// Generated message map functions
198
//{{AFX_MSG(CBrowserFrame)
199
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
200
afx_msg void OnSetFocus(CWnd *pOldWnd);
201
afx_msg void OnSize(UINT nType, int cx, int cy);
202
afx_msg void OnClose();
203
afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
205
DECLARE_MESSAGE_MAP()
208
/////////////////////////////////////////////////////////////////////////////
210
//{{AFX_INSERT_LOCATION}}
211
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
213
#endif //_IBROWSERFRM_H