Back to index

lightning-sunbird  0.9+nobinonly
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes | Friends
CBrowserFrame Class Reference

#include <BrowserFrm.h>

Inheritance diagram for CBrowserFrame:
Inheritance graph
[legend]
Collaboration diagram for CBrowserFrame:
Collaboration graph
[legend]

List of all members.

Classes

class  BrowserFrameGlueObj

Public Member Functions

 CBrowserFrame (PRUint32 chromeMask)
CBrowserImplGetBrowserImpl ()
BOOL CanCutUrlBarSelection ()
void CutUrlBarSelToClipboard ()
BOOL CanCopyUrlBarSelection ()
void CopyUrlBarSelToClipboard ()
BOOL CanPasteToUrlBar ()
void PasteFromClipboardToUrlBar ()
BOOL CanUndoUrlBarEditOp ()
void UndoUrlBarEditOp ()
void SetupFrameChrome ()
virtual BOOL PreCreateWindow (CREATESTRUCT &cs)
virtual BOOL OnCmdMsg (UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo)
virtual ~CBrowserFrame ()
 CBrowserFrame ()
 CBrowserFrame (PRUint32 chromeMask)
CBrowserImplGetBrowserImpl ()
void UpdateSecurityStatus (PRInt32 aState)
void ShowSecurityInfo ()
BOOL CanCutUrlBarSelection ()
void CutUrlBarSelToClipboard ()
BOOL CanCopyUrlBarSelection ()
void CopyUrlBarSelToClipboard ()
BOOL CanPasteToUrlBar ()
void PasteFromClipboardToUrlBar ()
BOOL CanUndoUrlBarEditOp ()
void UndoUrlBarEditOp ()
void SetupFrameChrome ()
void SetEditable (BOOL isEditor)
BOOL GetEditable ()
virtual BOOL PreCreateWindow (CREATESTRUCT &cs)
virtual BOOL OnCmdMsg (UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo)
virtual ~CBrowserFrame ()

Public Attributes

CToolBar m_wndToolBar
CStatusBar m_wndStatusBar
CProgressCtrl m_wndProgressBar
CUrlBar m_wndUrlBar
CReBar m_wndReBar
CBrowserToolTip m_wndTooltip
CBrowserView m_wndBrowserView
PRUint32 m_chromeMask
CMyStatusBar m_wndStatusBar

Protected Member Functions

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 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)

Protected Attributes

CBrowserFrame::BrowserFrameGlueObj m_xBrowserFrameGlueObj

Private Attributes

BOOL mIsEditor

Friends

class BrowserFrameGlueObj

Detailed Description

Definition at line 123 of file BrowserFrm.h.


Constructor & Destructor Documentation

Definition at line 109 of file BrowserFrm.cpp.

{
       // Save the chromeMask off. It'll be used
       // later to determine whether this browser frame
       // will have menubar, toolbar, statusbar etc.

       m_chromeMask = chromeMask;
}

Definition at line 118 of file BrowserFrm.cpp.

{
}

Definition at line 105 of file BrowserFrm.cpp.

virtual CBrowserFrame::~CBrowserFrame ( ) [virtual]

Member Function Documentation

Definition at line 147 of file BrowserFrm.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 160 of file BrowserFrm.h.

Here is the call graph for this function:

Definition at line 145 of file BrowserFrm.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 158 of file BrowserFrm.h.

Here is the call graph for this function:

Definition at line 149 of file BrowserFrm.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 162 of file BrowserFrm.h.

Here is the call graph for this function:

Definition at line 151 of file BrowserFrm.h.

{ return m_wndUrlBar.CanUndoEditOp(); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 164 of file BrowserFrm.h.

{ return m_wndUrlBar.CanUndoEditOp(); }

Here is the call graph for this function:

Definition at line 148 of file BrowserFrm.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 161 of file BrowserFrm.h.

Here is the call graph for this function:

Definition at line 146 of file BrowserFrm.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 159 of file BrowserFrm.h.

Here is the call graph for this function:

Definition at line 132 of file BrowserFrm.h.

Definition at line 141 of file BrowserFrm.h.

Definition at line 193 of file BrowserFrm.h.

{ return mIsEditor; }
void CBrowserFrame::OnActivate ( UINT  nState,
CWnd *  pWndOther,
BOOL  bMinimized 
) [protected]

Definition at line 321 of file BrowserFrm.cpp.

{
       CFrameWnd::OnActivate(nState, pWndOther, bMinimized);
       
    m_wndBrowserView.Activate(nState, pWndOther, bMinimized);
}

Here is the call graph for this function:

afx_msg void CBrowserFrame::OnActivate ( UINT  nState,
CWnd *  pWndOther,
BOOL  bMinimized 
) [protected]
void CBrowserFrame::OnClose ( void  ) [protected]

Definition at line 122 of file BrowserFrm.cpp.

{
       CTestEmbedApp *pApp = (CTestEmbedApp *)AfxGetApp();
       pApp->RemoveFrameFromList(this);

       DestroyWindow();
}

Here is the call graph for this function:

afx_msg void CBrowserFrame::OnClose ( ) [protected]
BOOL CBrowserFrame::OnCmdMsg ( UINT  nID,
int  nCode,
void pExtra,
AFX_CMDHANDLERINFO *  pHandlerInfo 
) [virtual]

Definition at line 281 of file BrowserFrm.cpp.

{
       // 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);
}

Here is the call graph for this function:

virtual BOOL CBrowserFrame::OnCmdMsg ( UINT  nID,
int  nCode,
void pExtra,
AFX_CMDHANDLERINFO *  pHandlerInfo 
) [virtual]
int CBrowserFrame::OnCreate ( LPCREATESTRUCT  lpCreateStruct) [protected]

Definition at line 133 of file BrowserFrm.cpp.

{
       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 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 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();

       // Create the toolbar with Back, Fwd, Stop, etc. buttons..
       if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
              | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
              !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
       {
              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);
       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.Create(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
       }

       // 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);

       // 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()

       SetupFrameChrome(); 

       return 0;
}

Here is the call graph for this function:

afx_msg int CBrowserFrame::OnCreate ( LPCREATESTRUCT  lpCreateStruct) [protected]
void CBrowserFrame::OnSetFocus ( CWnd *  pOldWnd) [protected]

Definition at line 275 of file BrowserFrm.cpp.

{
       // forward focus to the view window
       m_wndBrowserView.SetFocus();
}
afx_msg void CBrowserFrame::OnSetFocus ( CWnd *  pOldWnd) [protected]
void CBrowserFrame::OnSize ( UINT  nType,
int  cx,
int  cy 
) [protected]

Definition at line 293 of file BrowserFrm.cpp.

{
       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;
       m_wndStatusBar.GetItemRect(1, &rc);

       // Move the progress bar into it's correct location
       //
       m_wndProgressBar.MoveWindow(&rc);
}
afx_msg void CBrowserFrame::OnSize ( UINT  nType,
int  cx,
int  cy 
) [protected]

Definition at line 150 of file BrowserFrm.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 163 of file BrowserFrm.h.

Here is the call graph for this function:

BOOL CBrowserFrame::PreCreateWindow ( CREATESTRUCT &  cs) [virtual]

Definition at line 247 of file BrowserFrm.cpp.

{
       if( !CFrameWnd::PreCreateWindow(cs) )
              return FALSE;

       cs.dwExStyle &= ~WS_EX_CLIENTEDGE;

       // Change window style based on the chromeMask

       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;
       }

       cs.lpszClass = AfxRegisterWndClass(0);

       return TRUE;
}
virtual BOOL CBrowserFrame::PreCreateWindow ( CREATESTRUCT &  cs) [virtual]
void CBrowserFrame::SetEditable ( BOOL  isEditor) [inline]

Definition at line 192 of file BrowserFrm.h.

{ mIsEditor = isEditor; }

Here is the caller graph for this function:

Definition at line 232 of file BrowserFrm.cpp.

{
       if(m_chromeMask == nsIWebBrowserChrome::CHROME_ALL)
              return;

       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_STATUSBAR) )
              m_wndStatusBar.ShowWindow(SW_HIDE); // Hide the StatusBar
}

Here is the caller graph for this function:

Definition at line 366 of file BrowserFrm.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 152 of file BrowserFrm.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 165 of file BrowserFrm.h.

Here is the call graph for this function:

Definition at line 343 of file BrowserFrm.cpp.

{
    int iResID = nsIWebProgressListener::STATE_IS_INSECURE;
    
    if(IS_SECURE(aState)){
        iResID = IDR_SECURITY_LOCK;
        m_wndBrowserView.m_SecurityState = CBrowserView::SECURITY_STATE_SECURE;
    }
    else if(aState == nsIWebProgressListener::STATE_IS_INSECURE) {
        iResID = IDR_SECURITY_UNLOCK;
        m_wndBrowserView.m_SecurityState = CBrowserView::SECURITY_STATE_INSECURE;
    }
    else if(aState == nsIWebProgressListener::STATE_IS_BROKEN) {
        iResID = IDR_SECURITY_BROKEN;
        m_wndBrowserView.m_SecurityState = CBrowserView::SECURITY_STATE_BROKEN;
    }

    CStatusBarCtrl& sb = m_wndStatusBar.GetStatusBarCtrl();
    sb.SetIcon(2, //2 is the pane index of the status bar where the lock icon will be shown
        (HICON)::LoadImage(AfxGetResourceHandle(),
        MAKEINTRESOURCE(iResID), IMAGE_ICON, 16,16,0));       
}

Friends And Related Function Documentation

Definition at line 175 of file BrowserFrm.h.


Member Data Documentation

Definition at line 156 of file BrowserFrm.h.

Definition at line 142 of file BrowserFrm.h.

Definition at line 136 of file BrowserFrm.h.

Definition at line 138 of file BrowserFrm.h.

Definition at line 135 of file BrowserFrm.h.

Definition at line 144 of file BrowserFrm.h.

Definition at line 134 of file BrowserFrm.h.

Definition at line 141 of file BrowserFrm.h.

Definition at line 137 of file BrowserFrm.h.

Definition at line 222 of file BrowserFrm.h.


The documentation for this class was generated from the following files: