Follow-on fix for bug 457825. Use sheet principal for agent and user sheets. r=dbaron...
[wine-gecko.git] / embedding / qa / testembed / BrowserFrm.h
blob65894c1d888bdc1907885871d8a6c03b59b4f1ac
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
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
13 * License.
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.
22 * Contributor(s):
23 * Chak Nanga <chak@netscape.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 // BrowserFrm.h : interface of the CBrowserFrame class
41 /////////////////////////////////////////////////////////////////////////////
43 #ifndef _IBROWSERFRM_H
44 #define _IBROWSERFRM_H
46 #if _MSC_VER > 1000
47 #pragma once
48 #endif // _MSC_VER > 1000
50 #include "BrowserView.h"
51 #include "BrowserToolTip.h"
52 #include "IBrowserFrameGlue.h"
53 #include "MostRecentUrls.h"
55 // A simple UrlBar class...
56 class CUrlBar : public CComboBoxEx
58 public:
59 inline void GetEnteredURL(CString& url) {
60 GetEditCtrl()->GetWindowText(url);
62 inline void GetSelectedURL(CString& url) {
63 GetLBText(GetCurSel(), url);
65 inline void SetCurrentURL(LPCTSTR pUrl) {
66 SetWindowText(pUrl);
68 inline void AddURLToList(CString& url, bool bAddToMRUList = true) {
69 COMBOBOXEXITEM ci;
70 ci.mask = CBEIF_TEXT; ci.iItem = -1;
71 ci.pszText = (LPTSTR)(LPCTSTR)url;
72 InsertItem(&ci);
74 if(bAddToMRUList)
75 m_MRUList.AddURL((LPTSTR)(LPCTSTR)url);
77 inline void LoadMRUList() {
78 for (int i=0;i<m_MRUList.GetNumURLs();i++)
80 CString urlStr(_T(m_MRUList.GetURL(i)));
81 AddURLToList(urlStr, false);
84 inline BOOL EditCtrlHasFocus() {
85 return (GetEditCtrl()->m_hWnd == CWnd::GetFocus()->m_hWnd);
87 inline BOOL EditCtrlHasSelection() {
88 int nStartChar = 0, nEndChar = 0;
89 if(EditCtrlHasFocus())
90 GetEditCtrl()->GetSel(nStartChar, nEndChar);
91 return (nEndChar > nStartChar) ? TRUE : FALSE;
93 inline BOOL CanCutToClipboard() {
94 return EditCtrlHasSelection();
96 inline void CutToClipboard() {
97 GetEditCtrl()->Cut();
99 inline BOOL CanCopyToClipboard() {
100 return EditCtrlHasSelection();
102 inline void CopyToClipboard() {
103 GetEditCtrl()->Copy();
105 inline BOOL CanPasteFromClipboard() {
106 return EditCtrlHasFocus();
108 inline void PasteFromClipboard() {
109 GetEditCtrl()->Paste();
111 inline BOOL CanUndoEditOp() {
112 return EditCtrlHasFocus() ? GetEditCtrl()->CanUndo() : FALSE;
114 inline void UndoEditOp() {
115 if(EditCtrlHasFocus())
116 GetEditCtrl()->Undo();
119 protected:
120 CMostRecentUrls m_MRUList;
123 class CBrowserFrame : public CFrameWnd
125 public:
126 CBrowserFrame(PRUint32 chromeMask);
128 protected:
129 DECLARE_DYNAMIC(CBrowserFrame)
131 public:
132 inline CBrowserImpl *GetBrowserImpl() { return m_wndBrowserView.mpBrowserImpl; }
134 CToolBar m_wndToolBar;
135 CStatusBar m_wndStatusBar;
136 CProgressCtrl m_wndProgressBar;
137 CUrlBar m_wndUrlBar;
138 CReBar m_wndReBar;
139 // The view inside which the embedded browser will
140 // be displayed in
141 CBrowserToolTip m_wndTooltip;
142 CBrowserView m_wndBrowserView;
144 // Wrapper functions for UrlBar clipboard operations
145 inline BOOL CanCutUrlBarSelection() { return m_wndUrlBar.CanCutToClipboard(); }
146 inline void CutUrlBarSelToClipboard() { m_wndUrlBar.CutToClipboard(); }
147 inline BOOL CanCopyUrlBarSelection() { return m_wndUrlBar.CanCopyToClipboard(); }
148 inline void CopyUrlBarSelToClipboard() { m_wndUrlBar.CopyToClipboard(); }
149 inline BOOL CanPasteToUrlBar() { return m_wndUrlBar.CanPasteFromClipboard(); }
150 inline void PasteFromClipboardToUrlBar() { m_wndUrlBar.PasteFromClipboard(); }
151 inline BOOL CanUndoUrlBarEditOp() { return m_wndUrlBar.CanUndoEditOp(); }
152 inline void UndoUrlBarEditOp() { m_wndUrlBar.UndoEditOp(); }
154 // This specifies what UI elements this frame will sport
155 // w.r.t. toolbar, statusbar, urlbar etc.
156 PRUint32 m_chromeMask;
158 protected:
160 // This nested class implements the IBrowserFramGlue interface
161 // The Gecko embedding interfaces call on this interface
162 // to update the status bars etc.
164 class BrowserFrameGlueObj : public IBrowserFrameGlue
167 // NS_DECL_BROWSERFRAMEGLUE below is a macro which expands
168 // to the function prototypes of methods in IBrowserFrameGlue
169 // Take a look at IBrowserFrameGlue.h for this macro define
172 NS_DECL_BROWSERFRAMEGLUE
174 } m_xBrowserFrameGlueObj;
175 friend class BrowserFrameGlueObj;
177 public:
178 void SetupFrameChrome();
180 // Overrides
181 // ClassWizard generated virtual function overrides
182 //{{AFX_VIRTUAL(CBrowserFrame)
183 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
184 virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
185 //}}AFX_VIRTUAL
187 // Implementation
188 public:
189 virtual ~CBrowserFrame();
190 #ifdef _DEBUG
191 virtual void AssertValid() const;
192 virtual void Dump(CDumpContext& dc) const;
193 #endif
195 // Generated message map functions
196 protected:
197 //{{AFX_MSG(CBrowserFrame)
198 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
199 afx_msg void OnSetFocus(CWnd *pOldWnd);
200 afx_msg void OnSize(UINT nType, int cx, int cy);
201 afx_msg void OnClose();
202 afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
203 //}}AFX_MSG
204 DECLARE_MESSAGE_MAP()
207 /////////////////////////////////////////////////////////////////////////////
209 //{{AFX_INSERT_LOCATION}}
210 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
212 #endif //_IBROWSERFRM_H