// FireTabCtrl.cpp : Implementation of CFireTabCtrl // // This is a part of the Active Template Library. // Copyright (C) 1996-1998 Microsoft Corporation // All rights reserved. // // This source code is only intended as a supplement to the // Active Template Library Reference and related // electronic documentation provided with the library. // See these sources for detailed information regarding the // Active Template Library product. #include "stdafx.h" #include "ATLFire.h" #include "FireTabCtrl.h" ///////////////////////////////////////////////////////////////////////////// // CFireTabCtrl STDMETHODIMP CFireTabCtrl::InterfaceSupportsErrorInfo(REFIID riid) { static const IID* arr[] = { &IID_IFireTabCtrl, }; for (int i=0;iright - prcPos->left; int cy = prcPos->bottom - prcPos->top; // Here's where we cache away the size of the window // for the fire bitmap display. rcSize is used in // CFireWnd::CreateBitmap() m_Display.rcSize.cx = cx - 12; m_Display.rcSize.cy = cy - 40; // We'll set the window sizes if the tab control has a window if( ::IsWindow(m_ctlSysTabControl32.m_hWnd) ) { ::SetWindowPos(m_ctlSysTabControl32.m_hWnd, NULL, 0, 0, cx, cy, SWP_NOZORDER | SWP_NOACTIVATE); ::SetWindowPos(m_Display.m_hWnd, NULL, 5, 30, cx - 12, cy - 40, SWP_NOZORDER | SWP_NOACTIVATE); } return 0; } STDMETHODIMP CFireTabCtrl::GetViewStatus(DWORD* pdwStatus) { ATLTRACE(_T("IViewObjectExImpl::GetViewStatus\n")); *pdwStatus = VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE; return S_OK; } STDMETHODIMP CFireTabCtrl::get_Decay(long * pVal) { *pVal = m_Display.m_nDecay; return S_OK; } STDMETHODIMP CFireTabCtrl::put_Decay(long newVal) { if( newVal < 1 || newVal > 100 ) { Error(_T("Please insert a number between 1 and 100")); return DISP_E_EXCEPTION; } m_Display.m_nDecay = newVal; return S_OK; } STDMETHODIMP CFireTabCtrl::get_Flammability(long * pVal) { *pVal = m_Display.m_nFlammability; return S_OK; } STDMETHODIMP CFireTabCtrl::put_Flammability(long newVal) { if( newVal < 1 || newVal > 399 ) { Error(_T("Please insert a number between 1 and 399")); return DISP_E_EXCEPTION; } m_Display.m_nFlammability = newVal; return S_OK; } STDMETHODIMP CFireTabCtrl::get_MaxHeat(long * pVal) { *pVal = m_Display.m_nMaxHeat; return S_OK; } STDMETHODIMP CFireTabCtrl::put_MaxHeat(long newVal) { if( newVal < 0 || newVal > 223 ) { Error( _T("Please insert a number between 0 and 223")); return DISP_E_EXCEPTION; } m_Display.m_nMaxHeat = newVal; return S_OK; } STDMETHODIMP CFireTabCtrl::get_SpreadRate(long * pVal) { *pVal = m_Display.m_nSpreadRate; return S_OK; } STDMETHODIMP CFireTabCtrl::put_SpreadRate(long newVal) { if( newVal < 1 || newVal > 100 ) { Error(_T("Please insert a number between 1 and 100")); return DISP_E_EXCEPTION; } m_Display.m_nSpreadRate = newVal; return S_OK; } STDMETHODIMP CFireTabCtrl::get_Size(long * pVal) { *pVal = m_Display.m_nSize; return S_OK; } STDMETHODIMP CFireTabCtrl::put_Size(long newVal) { if( m_Display.bmSize.cx != 0) { int maxWidth = m_Display.bmSize.cx - 1; if( newVal < 1 || newVal > maxWidth ) { _TCHAR buf[128]; wsprintf(buf,_T("Please insert a number between 1 and %d (bitmap width)"), maxWidth); Error(buf); return DISP_E_EXCEPTION; } } m_Display.m_nSize = newVal; return S_OK; } STDMETHODIMP CFireTabCtrl::get_Smoothness(long * pVal) { *pVal = m_Display.m_nSmoothness; return S_OK; } STDMETHODIMP CFireTabCtrl::put_Smoothness(long newVal) { if( newVal < 0 || newVal > 5 ) { Error(_T("Please insert a number between 0 and 5")); return DISP_E_EXCEPTION; } m_Display.m_nSmoothness = newVal; return S_OK; } STDMETHODIMP CFireTabCtrl::get_Distribution(long * pVal) { *pVal = m_Display.m_nDistribution; return S_OK; } STDMETHODIMP CFireTabCtrl::put_Distribution(long newVal) { if( newVal < 0 || newVal > 10 ) { Error(_T("Please insert a number between 0 and 10")); return DISP_E_EXCEPTION; } m_Display.m_nDistribution = newVal; return S_OK; } STDMETHODIMP CFireTabCtrl::get_Chaos(long * pVal) { *pVal = m_Display.m_nChaos; return S_OK; } STDMETHODIMP CFireTabCtrl::put_Chaos(long newVal) { if( newVal < 1 || newVal > 100 ) { Error(_T("Please insert a number between 1 and 100")); return DISP_E_EXCEPTION; } m_Display.m_nChaos = newVal; return S_OK; } STDMETHODIMP CFireTabCtrl::get_StartTab(long * pVal) { *pVal = m_Display.m_curColor; return S_OK; } STDMETHODIMP CFireTabCtrl::put_StartTab(long newVal) { ATLTRACE(_T("CFireTabCtrl::put_StartTab()\n")); if( newVal < 0 || newVal > 2 ) { Error(_T("Please insert a number between 0 and 2")); return DISP_E_EXCEPTION; } m_Display.m_curColor = newVal; return S_OK; } STDMETHODIMP CFireTabCtrl::AboutBox() { CAboutBox dlg; dlg.DoModal(); return S_OK; } LRESULT CAboutBox::OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { EndDialog(wID); return 0; }