Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes
CBrowseDlg Class Reference

#include <CBrowseDlg.h>

Collaboration diagram for CBrowseDlg:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { IDD = IDD_CBROWSE_DIALOG }

Public Member Functions

 CBrowseDlg (CWnd *pParent=NULL)
HRESULT CreateWebBrowser ()
HRESULT DestroyWebBrowser ()
HRESULT GetWebBrowser (IWebBrowser **pWebBrowser)
void RunTestSet (TestSet *pTestSet)
TestResult RunTest (Test *pTest)
void UpdateTest (HTREEITEM hItem, TestResult nResult)
void UpdateTestSet (HTREEITEM hItem)
void UpdateURL ()
void OutputString (const TCHAR *szMessage,...)
void ExecOleCommand (const GUID *pguidGroup, DWORD nCmdId)
void OnRefreshDOM ()
void OnRunTest ()
void PopulateTests ()

Public Attributes

CBrowserCtlSiteInstancem_pControlSite
CLSID m_clsid
BOOL m_bUseCustomPopupMenu
BOOL m_bUseCustomDropTarget
CMenu m_menu
BOOL m_bNewWindow
BOOL m_bEditMode
BOOL m_bCanGoBack
BOOL m_bCanGoForward
CButton m_btnStop
CButton m_btnForward
CButton m_btnBack
CComboBox m_cmbURLs
CToolBar m_EditBar
CPropertySheet m_dlgPropSheet
CTabMessages m_TabMessages
CTabTests m_TabTests
CTabDOM m_TabDOM
CImageList m_cImageList

Static Public Attributes

static CBrowseDlgm_pBrowseDlg = NULL

Protected Member Functions

virtual void DoDataExchange (CDataExchange *pDX)
virtual BOOL OnInitDialog ()
afx_msg void OnPaint ()
afx_msg HCURSOR OnQueryDragIcon ()
afx_msg void OnGo ()
afx_msg void OnBackward ()
afx_msg void OnForward ()
afx_msg void OnClose ()
afx_msg void OnDestroy ()
afx_msg void OnSize (UINT nType, int cx, int cy)
afx_msg void OnFileExit ()
afx_msg void OnViewGotoBack ()
afx_msg void OnViewGotoForward ()
afx_msg void OnViewGotoHome ()
afx_msg void OnEditCopy ()
afx_msg void OnEditCut ()
afx_msg void OnEditPaste ()
afx_msg void OnHelpAbout ()
afx_msg void OnUpdateViewGotoBack (CCmdUI *pCmdUI)
afx_msg void OnUpdateViewGotoForward (CCmdUI *pCmdUI)
afx_msg void OnEditSelectAll ()
afx_msg void OnViewRefresh ()
afx_msg void OnViewViewSource ()
afx_msg void OnStop ()
afx_msg void OnFileSaveAs ()
afx_msg void OnFilePrint ()
afx_msg void OnDebugVisible ()
afx_msg void OnUpdateDebugVisible (CCmdUI *pCmdUI)
afx_msg void OnDebugPostDataTest ()
afx_msg void OnReload ()
afx_msg void OnViewEditmode ()
afx_msg void OnViewOpenInNewWindow ()
afx_msg void OnUpdateViewEditmode (CCmdUI *pCmdUI)
afx_msg void OnUpdateViewOpenInNewWindow (CCmdUI *pCmdUI)
afx_msg void OnFilePagesetup ()
afx_msg void OnEditBold ()
afx_msg void OnEditItalic ()
afx_msg void OnEditUnderline ()

Protected Attributes

HICON m_hIcon
CString m_szTestURL
CString m_szTestCGI
DWORD m_dwCookie

Detailed Description

Definition at line 18 of file CBrowseDlg.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
IDD 

Definition at line 49 of file CBrowseDlg.h.


Constructor & Destructor Documentation

CBrowseDlg::CBrowseDlg ( CWnd *  pParent = NULL)

Definition at line 46 of file CBrowseDlg.cpp.

       : CDialog(CBrowseDlg::IDD, pParent)
{
       signal(SIGFPE, fperr);
       double x = 0.0;
       double y = 1.0/x;

       //{{AFX_DATA_INIT(CBrowseDlg)
       //}}AFX_DATA_INIT
       // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
       m_pBrowseDlg = this;
       m_pControlSite = NULL;
       m_clsid = CLSID_NULL;
       m_bUseCustomPopupMenu = FALSE;
       m_bUseCustomDropTarget = FALSE;
    m_bEditMode = FALSE;
    m_bNewWindow = FALSE;
    m_bCanGoBack = FALSE;
    m_bCanGoForward = FALSE;
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 314 of file CBrowseDlg.cpp.

{
       // Get the position of the browser marker
       CRect rcMarker;
       GetDlgItem(IDC_BROWSER_MARKER)->GetWindowRect(&rcMarker);
       ScreenToClient(rcMarker);
       GetDlgItem(IDC_BROWSER_MARKER)->ShowWindow(FALSE);

//     GetDlgItem(IDC_BROWSER_MARKER)->DestroyWindow();

       CBrowserCtlSiteInstance::CreateInstance(&m_pControlSite);
       if (m_pControlSite == NULL)
       {
              OutputString(_T("Error: could not create control site"));
              return E_OUTOFMEMORY;
       }

       CBrowseEventSinkInstance *pEventSink = NULL;
       CBrowseEventSinkInstance::CreateInstance(&pEventSink);
       if (pEventSink == NULL)
       {
              m_pControlSite->Release();
              m_pControlSite = NULL;
              OutputString(_T("Error: could not create event sink"));
              return E_OUTOFMEMORY;
       }
       pEventSink->m_pBrowseDlg = this;

       HRESULT hr;

       PropertyList pl;
       m_pControlSite->AddRef();
       m_pControlSite->m_bUseCustomPopupMenu = m_bUseCustomPopupMenu;
       m_pControlSite->m_bUseCustomDropTarget = m_bUseCustomDropTarget;
       m_pControlSite->Create(m_clsid, pl);
       hr = m_pControlSite->Attach(GetSafeHwnd(), rcMarker, NULL);
       if (hr != S_OK)
       {
              OutputString(_T("Error: Cannot attach to browser control, hr = 0x%08x"), hr);
       }
       else
       {
              OutputString(_T("Sucessfully attached to browser control"));
       }
       
       m_pControlSite->SetPosition(rcMarker);
       hr = m_pControlSite->Advise(pEventSink, DIID_DWebBrowserEvents2, &m_dwCookie);
       if (hr != S_OK)
       {
              OutputString(_T("Error: Cannot subscribe to DIID_DWebBrowserEvents2 events, hr = 0x%08x"), hr);
       }
       else
       {
              OutputString(_T("Sucessfully subscribed to events"));
       }

       CComPtr<IUnknown> spUnkBrowser;
       m_pControlSite->GetControlUnknown(&spUnkBrowser);

       CIPtr(IWebBrowser2) spWebBrowser = spUnkBrowser;
       if (spWebBrowser)
       {
              spWebBrowser->put_RegisterAsDropTarget(VARIANT_TRUE);
       }

       return S_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 383 of file CBrowseDlg.cpp.

{
       if (m_pControlSite)
       {
              m_pControlSite->Unadvise(DIID_DWebBrowserEvents2, m_dwCookie);
              m_pControlSite->Detach();
              m_pControlSite->Release();
              m_pControlSite = NULL;
       }

       return S_OK;
}

Here is the caller graph for this function:

void CBrowseDlg::DoDataExchange ( CDataExchange *  pDX) [protected, virtual]

Definition at line 67 of file CBrowseDlg.cpp.

{
    CDialog::DoDataExchange(pDX);
       //{{AFX_DATA_MAP(CBrowseDlg)
       DDX_Control(pDX, IDC_STOP, m_btnStop);
       DDX_Control(pDX, IDC_FORWARD, m_btnForward);
       DDX_Control(pDX, IDC_BACKWARD, m_btnBack);
       DDX_Control(pDX, IDC_URL, m_cmbURLs);
       //}}AFX_DATA_MAP
}
void CBrowseDlg::ExecOleCommand ( const GUID *  pguidGroup,
DWORD  nCmdId 
)

Definition at line 781 of file CBrowseDlg.cpp.

{
       CComPtr<IUnknown> spUnkBrowser;
       m_pControlSite->GetControlUnknown(&spUnkBrowser);

       CIPtr(IOleCommandTarget) spCommandTarget = spUnkBrowser;
       if (spCommandTarget)
       {
              HRESULT hr = spCommandTarget->Exec(&CGID_MSHTML, nCmdId, 0, NULL, NULL);
              OutputString(_T("Exec(%d), returned %08x"), (int) nCmdId, hr);
       }
       else
       {
              OutputString(_T("Error: Browser does not support IOleCommandTarget"));
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

HRESULT CBrowseDlg::GetWebBrowser ( IWebBrowser **  pWebBrowser)

Definition at line 442 of file CBrowseDlg.cpp.

{
       if (pWebBrowser == NULL)
       {
              return E_INVALIDARG;
       }

       *pWebBrowser = NULL;

       if (m_pControlSite)
       {
              IUnknown *pIUnkBrowser = NULL;
              m_pControlSite->GetControlUnknown(&pIUnkBrowser);
              if (pIUnkBrowser)
              {
                     pIUnkBrowser->QueryInterface(IID_IWebBrowser, (void **) pWebBrowser);
                     pIUnkBrowser->Release();
                     if (*pWebBrowser)
                     {
                            return S_OK;
                     }
              }
       }

       return E_FAIL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CBrowseDlg::OnBackward ( ) [protected]

Definition at line 509 of file CBrowseDlg.cpp.

{
       CComPtr<IWebBrowser> webBrowser;
       if (SUCCEEDED(GetWebBrowser(&webBrowser)))
       {
              webBrowser->GoBack();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CBrowseDlg::OnClose ( void  ) [protected]

Definition at line 768 of file CBrowseDlg.cpp.

{
       DestroyWebBrowser();
       DestroyWindow();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 923 of file CBrowseDlg.cpp.

{
       CComPtr<IWebBrowser> webBrowser;
       if (SUCCEEDED(GetWebBrowser(&webBrowser)))
       {
              CIPtr(IWebBrowser2) cpWebBrowser = webBrowser;

        CComVariant vURL(L"http://www.mozilla.org/htdig-cgi/htsearch");
        const char *szPostData="config=htdig&restrict=&exclude=&words=embedding&method=and&format=builtin-long";

        size_t nSize = strlen(szPostData);
        SAFEARRAY *psa = SafeArrayCreateVector(VT_UI1, 0, nSize);
        
        LPSTR pPostData;
        SafeArrayAccessData(psa, (LPVOID*) &pPostData);
        memcpy(pPostData, szPostData, nSize);
        SafeArrayUnaccessData(psa);

        CComVariant vPostData;
        vPostData.vt = VT_ARRAY | VT_UI1;
        vPostData.parray = psa;

        CComVariant vHeaders(L"Content-Type: application/x-www-form-urlencoded\r\n");

        cpWebBrowser->Navigate2(
            &vURL,
            NULL, // Flags
            NULL, // Target
            &vPostData,
            &vHeaders  // Headers
        );
       }
}

Here is the call graph for this function:

Definition at line 898 of file CBrowseDlg.cpp.

{
    VARIANT_BOOL visible = VARIANT_TRUE;
       CComPtr<IWebBrowser> webBrowser;
       if (SUCCEEDED(GetWebBrowser(&webBrowser)))
       {
              CIPtr(IWebBrowserApp) cpWebBrowser = webBrowser;
        cpWebBrowser->get_Visible(&visible);
        cpWebBrowser->put_Visible(visible == VARIANT_TRUE ? VARIANT_FALSE : VARIANT_TRUE);
       }
}

Here is the call graph for this function:

void CBrowseDlg::OnDestroy ( ) [protected]

Definition at line 775 of file CBrowseDlg.cpp.

{
       CDialog::OnDestroy();
       delete this;  
}
void CBrowseDlg::OnEditBold ( ) [protected]

Definition at line 799 of file CBrowseDlg.cpp.

{
       ExecOleCommand(&CGID_MSHTML, IDM_BOLD);
}

Here is the call graph for this function:

void CBrowseDlg::OnEditCopy ( ) [protected]

Definition at line 853 of file CBrowseDlg.cpp.

{
       ExecOleCommand(NULL, OLECMDID_COPY);
}

Here is the call graph for this function:

void CBrowseDlg::OnEditCut ( ) [protected]

Definition at line 858 of file CBrowseDlg.cpp.

{
       ExecOleCommand(NULL, OLECMDID_CUT);
}

Here is the call graph for this function:

void CBrowseDlg::OnEditItalic ( ) [protected]

Definition at line 804 of file CBrowseDlg.cpp.

{
       ExecOleCommand(&CGID_MSHTML, IDM_ITALIC);
}

Here is the call graph for this function:

void CBrowseDlg::OnEditPaste ( ) [protected]

Definition at line 863 of file CBrowseDlg.cpp.

{
       ExecOleCommand(NULL, OLECMDID_PASTE);
}

Here is the call graph for this function:

Definition at line 868 of file CBrowseDlg.cpp.

{
       ExecOleCommand(NULL, OLECMDID_SELECTALL);
}

Here is the call graph for this function:

Definition at line 809 of file CBrowseDlg.cpp.

{
       ExecOleCommand(&CGID_MSHTML, IDM_UNDERLINE);
}

Here is the call graph for this function:

void CBrowseDlg::OnFileExit ( ) [protected]

Definition at line 814 of file CBrowseDlg.cpp.

{
       OnClose();
}

Here is the call graph for this function:

Definition at line 893 of file CBrowseDlg.cpp.

{
       ExecOleCommand(NULL, OLECMDID_PAGESETUP);
}

Here is the call graph for this function:

void CBrowseDlg::OnFilePrint ( ) [protected]

Definition at line 888 of file CBrowseDlg.cpp.

{
       ExecOleCommand(NULL, OLECMDID_PRINT);
}

Here is the call graph for this function:

void CBrowseDlg::OnFileSaveAs ( ) [protected]

Definition at line 883 of file CBrowseDlg.cpp.

{
       ExecOleCommand(NULL, OLECMDID_SAVEAS);
}

Here is the call graph for this function:

void CBrowseDlg::OnForward ( ) [protected]

Definition at line 518 of file CBrowseDlg.cpp.

{
       CComPtr<IWebBrowser> webBrowser;
       if (SUCCEEDED(GetWebBrowser(&webBrowser)))
       {
              webBrowser->GoForward();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CBrowseDlg::OnGo ( ) [protected]

Definition at line 469 of file CBrowseDlg.cpp.

{
       UpdateData();

       CComPtr<IWebBrowser> webBrowser;
       if (SUCCEEDED(GetWebBrowser(&webBrowser)))
       {
              CString szURL;
              m_cmbURLs.GetWindowText(szURL);
              CComVariant vFlags(m_bNewWindow ? navOpenInNewWindow : 0);
              BSTR bstrURL = szURL.AllocSysString();
              HRESULT hr = webBrowser->Navigate(bstrURL, &vFlags, NULL, NULL, NULL);
        if (FAILED(hr))
        {
            OutputString("Navigate failed (hr=0x%08x)", hr);
        }
              ::SysFreeString(bstrURL);
       }
}

Here is the call graph for this function:

void CBrowseDlg::OnHelpAbout ( ) [protected]

Definition at line 873 of file CBrowseDlg.cpp.

{
       AfxMessageBox(_T("CBrowse - Browser Control Test Harness"));
}
BOOL CBrowseDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 130 of file CBrowseDlg.cpp.

{
       CDialog::OnInitDialog();

       CWinApp *pApp = AfxGetApp();
       m_szTestURL = pApp->GetProfileString(SECTION_TEST, KEY_TESTURL, KEY_TESTURL_DEFAULTVALUE);
       m_szTestCGI = pApp->GetProfileString(SECTION_TEST, KEY_TESTCGI, KEY_TESTCGI_DEFAULTVALUE);

       // Set the icon for this dialog.  The framework does this automatically
       //  when the application's main window is not a dialog
       SetIcon(m_hIcon, TRUE);                   // Set big icon
       SetIcon(m_hIcon, FALSE);           // Set small icon

       CRect rcTabMarker;
       GetDlgItem(IDC_TAB_MARKER)->GetWindowRect(&rcTabMarker);
       ScreenToClient(rcTabMarker);

    m_dlgPropSheet.AddPage(&m_TabMessages);
    m_dlgPropSheet.AddPage(&m_TabTests);
    m_dlgPropSheet.AddPage(&m_TabDOM);

       m_TabMessages.m_pBrowseDlg = this;
       m_TabTests.m_pBrowseDlg = this;
       m_TabDOM.m_pBrowseDlg = this;

    m_dlgPropSheet.Create(this, WS_CHILD | WS_VISIBLE, 0);
    m_dlgPropSheet.ModifyStyleEx (0, WS_EX_CONTROLPARENT);
    m_dlgPropSheet.ModifyStyle( 0, WS_TABSTOP );
    m_dlgPropSheet.SetWindowPos( NULL, rcTabMarker.left-7, rcTabMarker.top-7, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE );

       // Image list
       m_cImageList.Create(16, 16, ILC_COLOR | ILC_MASK, 0, 10);
       m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_CLOSEDFOLDER));
       m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_OPENFOLDER));
       m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_TEST));
       m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_TESTFAILED));
       m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_TESTPASSED));
       m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_TESTPARTIAL));

       // Set up the editor bar
       CRect rcEditBarMarker;
       GetDlgItem(IDC_EDITBAR_MARKER)->GetWindowRect(&rcEditBarMarker);
       ScreenToClient(rcEditBarMarker);
       GetDlgItem(IDC_EDITBAR_MARKER)->DestroyWindow();

       m_EditBar.Create(this);
       m_EditBar.LoadToolBar(IDR_DHTMLEDIT);
       m_EditBar.SetWindowPos(&wndTop, rcEditBarMarker.left, rcEditBarMarker.top,
              rcEditBarMarker.Width(), rcEditBarMarker.Height(), SWP_SHOWWINDOW);

       // Set up some URLs. The first couple are internal
       m_cmbURLs.AddString(m_szTestURL);
       for (int i = 0; i < sizeof(aURLs) / sizeof(aURLs[0]); i++)
       {
              m_cmbURLs.AddString(aURLs[i]);
       }
       m_cmbURLs.SetCurSel(0);

       // Create the contained web browser
       CreateWebBrowser();

       // Load the menu
       m_menu.LoadMenu(IDR_MAIN);
       SetMenu(&m_menu);
       m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);

       return TRUE;  // return TRUE  unless you set the focus to a control
}

Here is the call graph for this function:

void CBrowseDlg::OnPaint ( ) [protected]

Definition at line 204 of file CBrowseDlg.cpp.

{
       if (IsIconic())
       {
              CPaintDC dc(this); // device context for painting

              SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

              // Center icon in client rectangle
              int cxIcon = GetSystemMetrics(SM_CXICON);
              int cyIcon = GetSystemMetrics(SM_CYICON);
              CRect rect;
              GetClientRect(&rect);
              int x = (rect.Width() - cxIcon + 1) / 2;
              int y = (rect.Height() - cyIcon + 1) / 2;

              // Draw the icon
              dc.DrawIcon(x, y, m_hIcon);
       }
       else
       {
              CPaintDC dc(this);

              m_pControlSite->Draw(dc.m_hDC);
       }
}
HCURSOR CBrowseDlg::OnQueryDragIcon ( ) [protected]

Definition at line 233 of file CBrowseDlg.cpp.

{
       return (HCURSOR) m_hIcon;
}

Definition at line 690 of file CBrowseDlg.cpp.

{
       m_TabDOM.m_tcDOM.DeleteAllItems();

       std::stack<_ElementPos> cStack;

       CComPtr<IUnknown> cpUnkPtr;
       m_pControlSite->GetControlUnknown(&cpUnkPtr);
       CIPtr(IWebBrowserApp) cpWebBrowser = cpUnkPtr;
       if (cpWebBrowser == NULL)
       {
              return;
       }

       CIPtr(IDispatch) cpDispDocument;
       cpWebBrowser->get_Document(&cpDispDocument);
       if (cpDispDocument == NULL)
       {
              return;
       }

       // Recurse the DOM, building a tree
       
       CIPtr(IHTMLDocument2) cpDocElement = cpDispDocument;
       
       CIPtr(IHTMLElementCollection) cpColl;
       HRESULT hr = cpDocElement->get_all( &cpColl );

       cStack.push(_ElementPos(NULL, cpColl, 0));
       while (!cStack.empty())
       {
              // Pop next position from stack
              _ElementPos pos = cStack.top();
              cStack.pop();

              // Iterate through elemenets in collection
              LONG nElements = 0;;
              pos.m_cpElementCollection->get_length(&nElements);
              for (int i = pos.m_nIndex; i < nElements; i++ )
              {
                     CComVariant vName(i);
                     CComVariant vIndex;
                     CIPtr(IDispatch) cpDisp;

                     hr = pos.m_cpElementCollection->item( vName, vIndex, &cpDisp );
                     if ( hr != S_OK )
                     {
                            continue;
                     }
                     CIPtr(IHTMLElement) cpElem = cpDisp;
                     if (cpElem == NULL)
                     {
                            continue;
                     }

                     // Get tag name
                     BSTR bstrTagName = NULL;
                     hr = cpElem->get_tagName(&bstrTagName);
                     CString szTagName = bstrTagName;
                     SysFreeString(bstrTagName);

                     // Add an icon to the tree
                     HTREEITEM htiParent = m_TabDOM.m_tcDOM.InsertItem(szTagName, IL_CLOSEDFOLDER, IL_CLOSEDFOLDER, pos.m_htiParent);

                     CIPtr(IDispatch) cpDispColl;
                     hr = cpElem->get_children(&cpDispColl);
                     if (hr == S_OK)
                     {
                            CIPtr(IHTMLElementCollection) cpChildColl = cpDispColl;
                            cStack.push(_ElementPos(pos.m_htiParent, pos.m_cpElementCollection, pos.m_nIndex + 1));
                            cStack.push(_ElementPos(htiParent, cpChildColl, 0));
                            break;
                     }
              }
       }
}
void CBrowseDlg::OnReload ( ) [protected]

Definition at line 499 of file CBrowseDlg.cpp.

{
       CComPtr<IWebBrowser> webBrowser;
       if (SUCCEEDED(GetWebBrowser(&webBrowser)))
       {
              CComVariant vValue(REFRESH_COMPLETELY);
              webBrowser->Refresh2(&vValue);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 642 of file CBrowseDlg.cpp.

{
       HTREEITEM hItem = m_TabTests.m_tcTests.GetNextItem(NULL, TVGN_FIRSTVISIBLE);
       while (hItem)
       {
              UINT nState = m_TabTests.m_tcTests.GetItemState(hItem, TVIS_SELECTED);
              if (!(nState & TVIS_SELECTED))
              {
                     hItem = m_TabTests.m_tcTests.GetNextItem(hItem, TVGN_NEXTVISIBLE);
                     continue;
              }

              if (m_TabTests.m_tcTests.ItemHasChildren(hItem))
              {
                     // Run complete set of tests
                     TestSet *pTestSet = (TestSet *) m_TabTests.m_tcTests.GetItemData(hItem);
                     RunTestSet(pTestSet);
                     UpdateTestSet(hItem);
              }
              else
              {
                     // Find the test
                     Test *pTest = (Test *) m_TabTests.m_tcTests.GetItemData(hItem);
                     TestResult nResult = RunTest(pTest);
                     UpdateTest(hItem, nResult);
              }

              hItem = m_TabTests.m_tcTests.GetNextItem(hItem, TVGN_NEXTVISIBLE);
       }
}

Here is the call graph for this function:

void CBrowseDlg::OnSize ( UINT  nType,
int  cx,
int  cy 
) [protected]

Definition at line 292 of file CBrowseDlg.cpp.

{
       CDialog::OnSize(nType, cx, cy);

       if (m_hWnd == NULL)
       {
              return;
       }

       static CSize sizeOld(-1, -1);
       CSize sizeNew(cx, cy);

       if (sizeOld.cx != -1)
       {
              EnumData data;
              data.pBrowseDlg = this;
              data.sizeDelta = sizeNew - sizeOld;
              ::EnumChildWindows(GetSafeHwnd(), EnumChildProc, (LPARAM) &data);
       }
       sizeOld = sizeNew;
}

Here is the call graph for this function:

void CBrowseDlg::OnStop ( ) [protected]

Definition at line 490 of file CBrowseDlg.cpp.

{
       CComPtr<IWebBrowser> webBrowser;
       if (SUCCEEDED(GetWebBrowser(&webBrowser)))
       {
              webBrowser->Stop();
       }
}

Here is the call graph for this function:

void CBrowseDlg::OnUpdateDebugVisible ( CCmdUI *  pCmdUI) [protected]

Definition at line 910 of file CBrowseDlg.cpp.

{
    VARIANT_BOOL visible = VARIANT_TRUE;
       CComPtr<IWebBrowser> webBrowser;
       if (SUCCEEDED(GetWebBrowser(&webBrowser)))
       {
              CIPtr(IWebBrowserApp) cpWebBrowser = webBrowser;
              cpWebBrowser->get_Visible(&visible);
       }

    pCmdUI->SetCheck(visible == VARIANT_TRUE ? 1 : 0);
}

Here is the call graph for this function:

void CBrowseDlg::OnUpdateViewEditmode ( CCmdUI *  pCmdUI) [protected]

Definition at line 974 of file CBrowseDlg.cpp.

{
    pCmdUI->SetCheck(m_bEditMode ? 1 : 0);
}
void CBrowseDlg::OnUpdateViewGotoBack ( CCmdUI *  pCmdUI) [protected]

Definition at line 834 of file CBrowseDlg.cpp.

{
    pCmdUI->Enable(m_bCanGoBack);
}
void CBrowseDlg::OnUpdateViewGotoForward ( CCmdUI *  pCmdUI) [protected]

Definition at line 839 of file CBrowseDlg.cpp.

{
    pCmdUI->Enable(m_bCanGoForward);
}
void CBrowseDlg::OnUpdateViewOpenInNewWindow ( CCmdUI *  pCmdUI) [protected]

Definition at line 979 of file CBrowseDlg.cpp.

{
    pCmdUI->SetCheck(1); //m_bNewWindow ? 1 : 0);
}

Definition at line 957 of file CBrowseDlg.cpp.

{
    m_bEditMode = m_bEditMode ? FALSE : TRUE;
       DWORD nCmdID = m_bEditMode ? IDM_EDITMODE : IDM_BROWSEMODE;
       ExecOleCommand(&CGID_MSHTML, nCmdID);

//     if (m_pControlSite)
//     {
//            m_pControlSite->SetAmbientUserMode((m_btnEditMode.GetCheck() == 0) ? FALSE : TRUE);
//     }
}

Here is the call graph for this function:

Definition at line 824 of file CBrowseDlg.cpp.

{
       OnBackward();
}

Here is the call graph for this function:

Definition at line 829 of file CBrowseDlg.cpp.

{
       OnForward();
}

Here is the call graph for this function:

Definition at line 844 of file CBrowseDlg.cpp.

{
       CComPtr<IWebBrowser> webBrowser;
       if (SUCCEEDED(GetWebBrowser(&webBrowser)))
       {
              webBrowser->GoHome();
       }
}

Here is the call graph for this function:

Definition at line 969 of file CBrowseDlg.cpp.

Definition at line 819 of file CBrowseDlg.cpp.

{
    OnReload();
}

Here is the call graph for this function:

Definition at line 878 of file CBrowseDlg.cpp.

{
       ExecOleCommand(&CGID_MSHTML, 3);
}

Here is the call graph for this function:

void CBrowseDlg::OutputString ( const TCHAR szMessage,
  ... 
)

Definition at line 593 of file CBrowseDlg.cpp.

{
       if (m_pBrowseDlg == NULL)
       {
              return;
       }

       TCHAR szBuffer[256];

       va_list cArgs;
       va_start(cArgs, szMessage);
       _vstprintf(szBuffer, szMessage, cArgs);
       va_end(cArgs);

       CString szOutput;
       szOutput.Format(_T("%s"), szBuffer);

       m_TabMessages.m_lbMessages.AddString(szOutput);
       m_TabMessages.m_lbMessages.SetTopIndex(m_TabMessages.m_lbMessages.GetCount() - 1);
}

Here is the caller graph for this function:

Definition at line 396 of file CBrowseDlg.cpp.

{
       // Create the test tree
       CTreeCtrl &tc = m_TabTests.m_tcTests;

       tc.SetImageList(&m_cImageList, TVSIL_NORMAL);
       for (int i = 0; i < nTestSets; i++)
       {
              TestSet *pTestSet = &aTestSets[i];
              HTREEITEM hParent = tc.InsertItem(pTestSet->szName, IL_CLOSEDFOLDER, IL_CLOSEDFOLDER);
              m_TabTests.m_tcTests.SetItemData(hParent, (DWORD) pTestSet);

              if (pTestSet->pfnPopulator)
              {
                     pTestSet->pfnPopulator(pTestSet);
              }

              for (int j = 0; j < pTestSet->nTests; j++)
              {
                     Test *pTest = &pTestSet->aTests[j];
                     HTREEITEM hTest = tc.InsertItem(pTest->szName, IL_TEST, IL_TEST, hParent);
                     if (hTest)
                     {
                            tc.SetItemData(hTest, (DWORD) pTest);
                     }
              }
       }
}

Here is the caller graph for this function:

Definition at line 543 of file CBrowseDlg.cpp.

{
       ASSERT(pTest);
       TestResult nResult = trFailed;

       CString szMsg;
       szMsg.Format(_T("Running test \"%s\""), pTest->szName);
       OutputString(szMsg);

       if (pTest && pTest->pfn)
       {
              BrowserInfo cInfo;

              cInfo.pTest = pTest;
              cInfo.clsid = m_clsid;
              cInfo.pControlSite = m_pControlSite;
              cInfo.pIUnknown = NULL;
              cInfo.pBrowseDlg = this;
              cInfo.szTestURL = m_szTestURL;
              cInfo.szTestCGI = m_szTestCGI;
              if (cInfo.pControlSite)
              {
                     cInfo.pControlSite->GetControlUnknown(&cInfo.pIUnknown);
              }
              nResult = pTest->pfn(cInfo);
              pTest->nLastResult = nResult;
              if (cInfo.pIUnknown)
              {
                     cInfo.pIUnknown->Release();
              }
       }

       switch (nResult)
       {
       case trFailed:
              OutputString(_T("Test failed"));
              break;
       case trPassed:
              OutputString(_T("Test passed"));
              break;
       case trPartial:
              OutputString(_T("Test partial"));
              break;
       default:
              break;
       }

       return nResult;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 527 of file CBrowseDlg.cpp.

{
       ASSERT(pTestSet);
       if (pTestSet == NULL)
       {
              return;
       }

       for (int j = 0; j < pTestSet->nTests; j++)
       {
              Test *pTest = &pTestSet->aTests[j];
              RunTest(pTest);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CBrowseDlg::UpdateTest ( HTREEITEM  hItem,
TestResult  nResult 
)

Definition at line 614 of file CBrowseDlg.cpp.

{
       if (nResult == trPassed)
       {
              m_TabTests.m_tcTests.SetItemImage(hItem, IL_TESTPASSED, IL_TESTPASSED);
       }
       else if (nResult == trFailed)
       {
              m_TabTests.m_tcTests.SetItemImage(hItem, IL_TESTFAILED, IL_TESTFAILED);
       }
       else if (nResult == trPartial)
       {
              m_TabTests.m_tcTests.SetItemImage(hItem, IL_TESTPARTIAL, IL_TESTPARTIAL);
       }
}

Here is the caller graph for this function:

void CBrowseDlg::UpdateTestSet ( HTREEITEM  hItem)

Definition at line 630 of file CBrowseDlg.cpp.

{
       // Examine the results
       HTREEITEM hTest = m_TabTests.m_tcTests.GetNextItem(hItem, TVGN_CHILD);
       while (hTest)
       {
              Test *pTest = (Test *) m_TabTests.m_tcTests.GetItemData(hTest);
              UpdateTest(hTest, pTest->nLastResult);
              hTest = m_TabTests.m_tcTests.GetNextItem(hTest, TVGN_NEXT);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 426 of file CBrowseDlg.cpp.

{
    CIPtr(IWebBrowser) spBrowser;

    GetWebBrowser(&spBrowser);
    if (spBrowser)
    {
        USES_CONVERSION;
        BSTR szLocation = NULL;
        spBrowser->get_LocationURL(&szLocation);
        m_cmbURLs.SetWindowText(W2T(szLocation));
        SysFreeString(szLocation);
    }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 29 of file CBrowseDlg.h.

Definition at line 30 of file CBrowseDlg.h.

Definition at line 28 of file CBrowseDlg.h.

Definition at line 27 of file CBrowseDlg.h.

Definition at line 52 of file CBrowseDlg.h.

Definition at line 51 of file CBrowseDlg.h.

Definition at line 50 of file CBrowseDlg.h.

Definition at line 25 of file CBrowseDlg.h.

Definition at line 24 of file CBrowseDlg.h.

Definition at line 61 of file CBrowseDlg.h.

Definition at line 23 of file CBrowseDlg.h.

Definition at line 53 of file CBrowseDlg.h.

Definition at line 57 of file CBrowseDlg.h.

Definition at line 78 of file CBrowseDlg.h.

Definition at line 56 of file CBrowseDlg.h.

HICON CBrowseDlg::m_hIcon [protected]

Definition at line 75 of file CBrowseDlg.h.

Definition at line 26 of file CBrowseDlg.h.

Definition at line 33 of file CBrowseDlg.h.

Definition at line 22 of file CBrowseDlg.h.

CString CBrowseDlg::m_szTestCGI [protected]

Definition at line 77 of file CBrowseDlg.h.

CString CBrowseDlg::m_szTestURL [protected]

Definition at line 76 of file CBrowseDlg.h.

Definition at line 60 of file CBrowseDlg.h.

Definition at line 58 of file CBrowseDlg.h.

Definition at line 59 of file CBrowseDlg.h.


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