Added some dynamic window resizing

This commit is contained in:
locka%iol.ie 1999-06-08 19:29:52 +00:00
parent a5de3b4554
commit baf23294a1
10 changed files with 109 additions and 11 deletions

View File

@ -108,7 +108,7 @@ BOOL CBrowseDlg::OnInitDialog()
CRect rcTabMarker;
GetDlgItem(IDC_TAB_MARKER)->GetWindowRect(&rcTabMarker);
ScreenToClient(rcTabMarker);
GetDlgItem(IDC_TAB_MARKER)->DestroyWindow();
// GetDlgItem(IDC_TAB_MARKER)->DestroyWindow();
m_dlgPropSheet.AddPage(&m_TabMessages);
m_dlgPropSheet.AddPage(&m_TabTests);
@ -194,16 +194,66 @@ struct EnumData
BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
{
EnumData *pData = (EnumData *) lParam;
CBrowseDlg *pThis =pData->pBrowseDlg;
switch (::GetDlgCtrlID(hwnd))
{
case IDC_BROWSER_MARKER:
{
CWnd *pMarker = pThis->GetDlgItem(IDC_BROWSER_MARKER);
CRect rcMarker;
pMarker->GetWindowRect(&rcMarker);
pThis->ScreenToClient(rcMarker);
rcMarker.right += pData->sizeDelta.cx;
rcMarker.bottom += pData->sizeDelta.cy;
if (rcMarker.Width() > 10 && rcMarker.Height() > 10)
{
pMarker->SetWindowPos(&CWnd::wndBottom, 0, 0, rcMarker.Width(), rcMarker.Height(),
SWP_NOMOVE | SWP_NOACTIVATE | SWP_HIDEWINDOW);
pThis->m_pControlSite->SetPosition(rcMarker);
}
}
break;
case IDC_TAB_MARKER:
{
CWnd *pMarker = pThis->GetDlgItem(IDC_TAB_MARKER);
CRect rcMarker;
pMarker->GetWindowRect(&rcMarker);
pThis->ScreenToClient(rcMarker);
rcMarker.top += pData->sizeDelta.cy;
if (rcMarker.top > 70)
{
pMarker->SetWindowPos(&CWnd::wndBottom, rcMarker.left, rcMarker.top, 0, 0,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_HIDEWINDOW);
pThis->m_dlgPropSheet.SetWindowPos(NULL, rcMarker.left - 7, rcMarker.top - 7, 0, 0,
SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOACTIVATE);
}
}
}
return TRUE;
}
void CBrowseDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
EnumData data;
data.pBrowseDlg = this;
data.sizeDelta = CSize(cx, cy);
::EnumChildWindows(GetSafeHwnd(), EnumChildProc, (LPARAM) &data);
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;
}
HRESULT CBrowseDlg::CreateWebBrowser()
@ -212,8 +262,9 @@ HRESULT CBrowseDlg::CreateWebBrowser()
CRect rcMarker;
GetDlgItem(IDC_BROWSER_MARKER)->GetWindowRect(&rcMarker);
ScreenToClient(rcMarker);
GetDlgItem(IDC_BROWSER_MARKER)->ShowWindow(FALSE);
GetDlgItem(IDC_BROWSER_MARKER)->DestroyWindow();
// GetDlgItem(IDC_BROWSER_MARKER)->DestroyWindow();
CControlSiteInstance::CreateInstance(&m_pControlSite);
if (m_pControlSite == NULL)

View File

@ -49,10 +49,19 @@ HRESULT STDMETHODCALLTYPE CControlEventSink:: Invoke(
USES_CONVERSION;
CString szText(OLE2T(pDispParams->rgvarg[0].bstrVal));
szEvent.Format(_T("StatusTextChange: \"%s\""), szText);
m_pBrowseDlg->m_TabMessages.m_szStatus = szText;
m_pBrowseDlg->m_TabMessages.UpdateData(FALSE);
}
break;
case 0x6c:
szEvent = _T("ProgressChange");
{
LONG nProgress = pDispParams->rgvarg[1].lVal;
LONG nProgressMax = pDispParams->rgvarg[0].lVal;
szEvent.Format("ProgressChange(%d of %d)", nProgress, nProgressMax);
CProgressCtrl &pc = m_pBrowseDlg->m_TabMessages.m_pcProgress;
pc.SetRange(0, nProgressMax);
pc.SetPos(nProgress);
}
break;
case 0x69:
szEvent = _T("CommandStateChange");

View File

@ -86,6 +86,7 @@ BOOL CPickerDlg::OnInitDialog()
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPickerDlg::OnOk()
{
UpdateData();

View File

@ -24,10 +24,12 @@ CTabDOM::CTabDOM() : CPropertyPage(CTabDOM::IDD, CTabDOM::IDD)
//}}AFX_DATA_INIT
}
CTabDOM::~CTabDOM()
{
}
void CTabDOM::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
@ -54,6 +56,7 @@ void CTabDOM::OnRefreshDOM()
}
}
BOOL CTabDOM::OnInitDialog()
{
CPropertyPage::OnInitDialog();

View File

@ -19,19 +19,23 @@ IMPLEMENT_DYNCREATE(CTabMessages, CPropertyPage)
CTabMessages::CTabMessages() : CPropertyPage(CTabMessages::IDD, CTabMessages::IDD)
{
//{{AFX_DATA_INIT(CTabMessages)
// NOTE: the ClassWizard will add member initialization here
m_szStatus = _T("");
//}}AFX_DATA_INIT
}
CTabMessages::~CTabMessages()
{
}
void CTabMessages::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTabMessages)
DDX_Control(pDX, IDC_PROGRESS, m_pcProgress);
DDX_Control(pDX, IDC_OUTPUT, m_lbMessages);
DDX_Text(pDX, IDC_STATUS, m_szStatus);
//}}AFX_DATA_MAP
}

View File

@ -26,7 +26,9 @@ public:
// Dialog Data
//{{AFX_DATA(CTabMessages)
enum { IDD = IDD_TAB_MESSAGES };
CProgressCtrl m_pcProgress;
CListBox m_lbMessages;
CString m_szStatus;
//}}AFX_DATA

View File

@ -24,10 +24,12 @@ CTabTests::CTabTests() : CPropertyPage(CTabTests::IDD, CTabTests::IDD)
//}}AFX_DATA_INIT
}
CTabTests::~CTabTests()
{
}
void CTabTests::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
@ -55,6 +57,7 @@ void CTabTests::OnRunTest()
m_pBrowseDlg->OnRunTest();
}
void CTabTests::OnSelchangedTestlist(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
@ -99,6 +102,7 @@ void CTabTests::OnDblclkTestlist(NMHDR* pNMHDR, LRESULT* pResult)
*pResult = 0;
}
BOOL CTabTests::OnInitDialog()
{
CPropertyPage::OnInitDialog();

View File

@ -40,6 +40,7 @@ void BrowserInfo::OutputString(const TCHAR *szMessage, ...)
pBrowseDlg->OutputString(szOutput);
}
HRESULT BrowserInfo::GetWebBrowser(IWebBrowserApp **pWebBrowser)
{
if (pIUnknown == NULL)
@ -49,6 +50,7 @@ HRESULT BrowserInfo::GetWebBrowser(IWebBrowserApp **pWebBrowser)
return pIUnknown->QueryInterface(IID_IWebBrowserApp, (void **) pWebBrowser);
}
HRESULT BrowserInfo::GetDocument(IHTMLDocument2 **pDocument)
{
CIPtr(IWebBrowserApp) cpWebBrowser;
@ -74,6 +76,8 @@ struct InterfaceInfo
const IID *piid;
const TCHAR *szName;
};
static InterfaceInfo aDocIIDs[] =
{
{ &IID_IOleCommandTarget, _T("IOleCommandTarget") },
@ -112,6 +116,7 @@ TestResult __cdecl tstDocument(BrowserInfo &cInfo)
return trPassed;
}
TestResult __cdecl tstCollectionEnum(BrowserInfo &cInfo)
{
CIPtr(IHTMLDocument2) cpDocElement;
@ -154,6 +159,7 @@ TestResult __cdecl tstCollectionEnum(BrowserInfo &cInfo)
return trPassed;
}
void tstDrillerLevel(BrowserInfo &cInfo, IHTMLElementCollection *pCollection, int nLevel)
{
if (pCollection == NULL)
@ -248,6 +254,7 @@ void tstDrillerLevel(BrowserInfo &cInfo, IHTMLElementCollection *pCollection, in
cInfo.OutputString(_T("%sEnd collection"), szIndent);
}
TestResult __cdecl tstDriller(BrowserInfo &cInfo)
{
CIPtr(IHTMLDocument2) cpDocElement;
@ -268,12 +275,14 @@ TestResult __cdecl tstDriller(BrowserInfo &cInfo)
return trPassed;
}
TestResult __cdecl tstTesters(BrowserInfo &cInfo)
{
cInfo.OutputString("Test architecture is reasonably sane!");
return trPassed;
}
TestResult __cdecl tstControlActive(BrowserInfo &cInfo)
{
CControlSiteInstance *pControlSite = cInfo.pControlSite;
@ -292,6 +301,7 @@ TestResult __cdecl tstControlActive(BrowserInfo &cInfo)
return trPassed;
}
TestResult __cdecl tstIWebBrowser(BrowserInfo &cInfo)
{
if (cInfo.pIUnknown == NULL)
@ -310,6 +320,7 @@ TestResult __cdecl tstIWebBrowser(BrowserInfo &cInfo)
return trFailed;
}
TestResult __cdecl tstIWebBrowser2(BrowserInfo &cInfo)
{
if (cInfo.pIUnknown == NULL)
@ -346,11 +357,13 @@ TestResult __cdecl tstIWebBrowserApp(BrowserInfo &cInfo)
return trFailed;
}
TestResult __cdecl tstNavigate2(BrowserInfo &cInfo)
{
return trFailed;
}
TestResult __cdecl tstScriptTest(BrowserInfo &cInfo)
{
cInfo.nResult = trFailed;
@ -382,6 +395,7 @@ TestResult __cdecl tstScriptTest(BrowserInfo &cInfo)
return cInfo.nResult;
}
Test aScripts[] =
{
{ _T("Script test"), _T("Test that the scripting engine is sane"), tstScriptTest }
@ -439,11 +453,13 @@ Test aBasic[] =
{ _T("IWebBrowserApp"), _T("Test if control has an IWebBrowserApp interface"), tstIWebBrowserApp, trNotRun }
};
Test aBrowsing[] =
{
{ _T("IWebBrowser2::Navigate2"), _T("Test if browser can navigate to the test URL"), NULL }
};
Test aDHTML[] =
{
{ _T("IWebBrowser::get_Document"), _T("Test if browser has a top level element"), tstDocument },
@ -451,11 +467,13 @@ Test aDHTML[] =
{ _T("Parse DOM"), _T("Parse the document DOM"), tstDriller }
};
Test aOther[] =
{
{ _T("Print Page"), _T("Print the test URL page"), NULL }
};
TestSet aTestSets[] =
{
{ _T("Basic"), _T("Basic sanity tests"), 5, aBasic, NULL },
@ -465,4 +483,5 @@ TestSet aTestSets[] =
{ _T("Scripts"), _T("Script tests"), 0, NULL, ScriptSetPopulator }
};
int nTestSets = sizeof(aTestSets) / sizeof(aTestSets[0]);

View File

@ -240,8 +240,11 @@ IDD_TAB_MESSAGES DIALOG DISCARDABLE 0, 0, 275, 75
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
BEGIN
LISTBOX IDC_OUTPUT,5,5,265,65,LBS_SORT | LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_OUTPUT,5,5,265,50,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_TABSTOP
LTEXT "Static",IDC_STATUS,5,59,197,11,SS_SUNKEN
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,
205,59,65,11
END
IDD_TAB_TESTS DIALOG DISCARDABLE 0, 0, 275, 75

View File

@ -34,6 +34,8 @@
#define IDC_NEWWINDOW 1014
#define IDC_OUTPUT 1016
#define IDC_TAB_MARKER 1017
#define IDC_STATUS 1019
#define IDC_PROGRESS 1020
// Next default values for new objects
//
@ -41,7 +43,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 138
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1019
#define _APS_NEXT_CONTROL_VALUE 1021
#define _APS_NEXT_SYMED_VALUE 106
#endif
#endif