#include "stdafx.h" #include #include "CfgPropSheet.h" #include ".\cfgpropsheet.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif static UINT BASED_CODE DP5Buttons[] = { ID_FILE_TAB, ID_MCA_TAB, ID_SHAPING_TAB, ID_GAINPZ_TAB, ID_POWER_TAB, ID_MISC_TAB }; ///////////////////////////////////////////////////////////////////////////// // CCfgPropSheet IMPLEMENT_DYNAMIC(CCfgPropSheet, CPropertySheet) CCfgPropSheet::CCfgPropSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage, HBITMAP hbmWatermark, HPALETTE hpalWatermark, HBITMAP hbmHeader) :CPropertySheet(nIDCaption,pParentWnd,iSelectPage,hbmWatermark,hpalWatermark,hbmHeader) { m_bResetPrompt = FALSE; m_bToolTips = FALSE; m_bStatusBar = FALSE; m_bToolBar = FALSE; m_bKillItself = TRUE; m_bModal = TRUE; m_Timer = 0; ActivePage = ID_FILE_TAB; } CCfgPropSheet::CCfgPropSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage, HBITMAP hbmWatermark, HPALETTE hpalWatermark, HBITMAP hbmHeader) :CPropertySheet(pszCaption,pParentWnd,iSelectPage,hbmWatermark,hpalWatermark,hbmHeader) { m_bResetPrompt = FALSE; m_bToolTips = FALSE; m_bStatusBar = FALSE; m_bToolBar = FALSE; m_bKillItself = TRUE; m_bModal = FALSE; m_Timer = 0; ActivePage = ID_FILE_TAB; } BOOL CCfgPropSheet::InitCfgPropSheet(BOOL bToolTips, BOOL bStatusBar, UINT *pIndicators, UINT nIndicators, UINT uiMenu, UINT uiToolBar, DWORD dwToolBarStyle) { if (bToolTips) { EnableToolTips(TRUE); m_bToolTips = TRUE; for (int i = 0; i < GetPageCount(); i++) { GetPage(i)->EnableToolTips(TRUE); } } if (bStatusBar) { if (pIndicators) { if (!m_CSBCtrlStatus.Create(this) || !m_CSBCtrlStatus.SetIndicators(pIndicators,nIndicators )) { TRACE(_T("Failed to create status bar\n")); return FALSE; // fail to create } } else { UINT indicators[] = { ID_SEPARATOR, ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, }; if (!m_CSBCtrlStatus.Create(this) || !m_CSBCtrlStatus.SetIndicators(indicators,4)) { TRACE(_T("Failed to create status bar\n")); return FALSE; // fail to create } } OnSetMessageString(AFX_IDS_IDLEMESSAGE); m_CSBCtrlStatus.SetPaneInfo(0, m_CSBCtrlStatus.GetItemID(0),SBPS_STRETCH, NULL ); m_bStatusBar = TRUE; } if (uiToolBar) { if (m_CSToolBar.CreateEx(this,dwToolBarStyle)) { m_CSToolBar.LoadToolBar(uiToolBar); m_CSToolBar.SetButtons(DP5Buttons,7); m_CSToolBar.SetSizes(CSize(60,60),CSize(24,23)); m_CSToolBar.SetButtonText(0,_T("&General")); m_CSToolBar.SetButtonText(1,_T("&MCA")); m_CSToolBar.SetButtonText(2,_T("&Shaping")); m_CSToolBar.SetButtonText(3,_T("&Gain")); m_CSToolBar.SetButtonText(4,_T("&Power")); m_CSToolBar.SetButtonText(5,_T("M&isc")); //m_CSToolBar.SetButtonText(6,_T("&BootOpt")); //,RGB(255, 255, 255 if (m_bToolTips) m_CSToolBar.EnableToolTips(); m_bToolBar = TRUE; } else { TRACE(_T("Failed to create toolbar bar\n")); return FALSE; } } if (bStatusBar || uiToolBar || uiMenu) { CRect rcClientStart; CRect rcClientNow; GetClientRect(rcClientStart); RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, rcClientNow); CPoint ptOffset(rcClientNow.left - rcClientStart.left,(rcClientNow.top - rcClientStart.top) / 4); CRect rcChild; CWnd* pwndChild = GetWindow(GW_CHILD); while (pwndChild) { pwndChild->GetWindowRect(rcChild); ScreenToClient(rcChild); rcChild.OffsetRect(ptOffset); pwndChild->MoveWindow(rcChild, FALSE); pwndChild = pwndChild->GetNextWindow(); } CRect rcWindow; GetWindowRect(rcWindow); rcWindow.right += rcClientStart.Width() - rcClientNow.Width(); if (bStatusBar) { WINDOWPLACEMENT plc; m_CSBCtrlStatus.GetWindowPlacement(&plc); rcWindow.bottom += (rcClientStart.Height() - rcClientNow.Height()) - (plc.rcNormalPosition.top * 3); } else { rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height() - 7; } MoveWindow(rcWindow, FALSE); RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0); } GetTabControl()->ShowWindow(SW_HIDE); // hide the tab control if (!m_bModal) { m_Timer = (UINT)SetTimer(666, 100, NULL); } return TRUE; } void CCfgPropSheet::AddPage( CCfgPropPage* pPage ) { CPropertySheet::AddPage((CPropertyPage *)pPage); } BEGIN_MESSAGE_MAP(CCfgPropSheet, CPropertySheet) //{{AFX_MSG_MAP(CCfgPropSheet) ON_COMMAND(ID_APP_EXIT, OnTB1) // Begin Tab Controls ON_COMMAND(ID_FILE_TAB, OnFileTab) ON_COMMAND(ID_MCA_TAB, OnMcaTab) ON_COMMAND(ID_SHAPING_TAB, OnShapingTab) ON_COMMAND(ID_GAINPZ_TAB, OnGainPzTab) ON_COMMAND(ID_POWER_TAB, OnPowerTab) ON_COMMAND(ID_MISC_TAB, OnMiscTab) ON_UPDATE_COMMAND_UI(ID_FILE_TAB, OnFileTab2) ON_UPDATE_COMMAND_UI(ID_MCA_TAB, OnMcaTab2) ON_UPDATE_COMMAND_UI(ID_SHAPING_TAB, OnShapingTab2) ON_UPDATE_COMMAND_UI(ID_GAINPZ_TAB, OnGainPzTab2) ON_UPDATE_COMMAND_UI(ID_POWER_TAB, OnPowerTab2) ON_UPDATE_COMMAND_UI(ID_MISC_TAB, OnMiscTab2) // End Tab Controls ON_WM_ENTERIDLE() ON_MESSAGE(WM_POPMESSAGESTRING, OnPopMessageString) ON_MESSAGE(WM_SETMESSAGESTRING, OnSetMessageString) ON_WM_MENUSELECT() ON_UPDATE_COMMAND_UI(ID_INDICATOR_NUM, OnUpdateKeyIndicator) ON_UPDATE_COMMAND_UI(ID_VIEW_STATUS_BAR, OnUpdateStatusBarMenu) ON_COMMAND(ID_VIEW_STATUS_BAR, OnStatusBarCheck) ON_COMMAND(ID_VIEW_TOOLBAR, OnToolBarCheck) ON_UPDATE_COMMAND_UI(ID_VIEW_TOOLBAR, OnUpdateToolBarMenu) ON_WM_MOUSEMOVE() ON_WM_INITMENUPOPUP() ON_MESSAGE(WM_KICKIDLE, OnKickIdle) ON_UPDATE_COMMAND_UI(ID_INDICATOR_CAPS, OnUpdateKeyIndicator) ON_UPDATE_COMMAND_UI(ID_INDICATOR_SCRL, OnUpdateKeyIndicator) //ON_COMMAND(IDOK, OnOK) ON_COMMAND(IDCANCEL, OnCancel) ON_WM_TIMER() //}}AFX_MSG_MAP ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText) ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CCfgPropSheet message handlers void CCfgPropSheet::GetCurrentButtonState() { UINT iButtonID; UINT iButtonStyle; int iButtonImage; CString strState; // If the Toolbar is not based upon the default "AFX_IDW_TOOLBAR" // constant, then replace its use with the valid Toolbar constant. // If the following line is used from the Frame Window remove //"GetParentFrame()->": //CToolBar* pBar = &m_bToolBar; //(CToolBar*)GetParentFrame()->GetDescendantWindow(AFX_IDW_TOOLBAR); // If this code sample is called from an AppWizard generated, // Frame Window member function in Visual C++ 4.0, replace the above // statement with the following. Recall that the CMDIFrameWnd-derived // Frame Window generated by AppWizard has a CToolBar m_wndToolBar // member. //CToolBar* pBar = &m_wndToolBar; //CToolBar* pBar = &m_bToolBar; CToolBar* pBar = &m_CSToolBar; if (pBar != NULL) { // Use the relevant Button ID for the following line: int iButtonIndex = pBar->CommandToIndex(ID_FILE_TAB); pBar->GetButtonInfo(iButtonIndex, iButtonID, iButtonStyle, iButtonImage); // The following code checks for all possible states. // In practice, check only for those states that you need. if (iButtonStyle & TBBS_PRESSED) strState = "Button Down"; else if (iButtonStyle & (TBBS_CHECKED & TBBS_DISABLED)) strState = "Button Down & Unavailable"; else if (iButtonStyle & TBBS_DISABLED) strState = "Button Disabled"; else if (iButtonStyle & TBBS_INDETERMINATE) strState = "Button State Indeterminate"; else if (iButtonStyle & TBBS_CHECKED) strState = "Button Checked"; else strState = "Button Up & Enabled"; AfxMessageBox(strState); } } void CCfgPropSheet::OnFileTab() { ActivePage = ID_FILE_TAB; SetActivePage(0); if (m_bToolBar) { //GetCurrentButtonState(); } } void CCfgPropSheet::OnMcaTab() { ActivePage = ID_MCA_TAB; SetActivePage(1); } void CCfgPropSheet::OnShapingTab() { ActivePage = ID_SHAPING_TAB; SetActivePage(2); } void CCfgPropSheet::OnGainPzTab() { ActivePage = ID_GAINPZ_TAB; SetActivePage(3); } void CCfgPropSheet::OnPowerTab() { ActivePage = ID_POWER_TAB; SetActivePage(4); } void CCfgPropSheet::OnMiscTab() { ActivePage = ID_MISC_TAB; SetActivePage(5); } void CCfgPropSheet::OnSelectTab(UINT NewActivePage, int nPage) { ActivePage = NewActivePage; SetActivePage(nPage); } void CCfgPropSheet::UpdateAll() { ActivePage = ID_FILE_TAB; SetActivePage(0); ActivePage = ID_MCA_TAB; SetActivePage(1); ActivePage = ID_SHAPING_TAB; SetActivePage(2); ActivePage = ID_GAINPZ_TAB; SetActivePage(3); ActivePage = ID_POWER_TAB; SetActivePage(4); ActivePage = ID_MISC_TAB; SetActivePage(5); //ActivePage = ID_BOOTOPT_TAB; //SetActivePage(6); ActivePage = ID_FILE_TAB; SetActivePage(0); GetPage(0)->SetModified(FALSE); GetPage(1)->SetModified(FALSE); GetPage(2)->SetModified(FALSE); GetPage(3)->SetModified(FALSE); GetPage(4)->SetModified(FALSE); GetPage(5)->SetModified(FALSE); } // ==================================== void CCfgPropSheet::OnFileTab2(CCmdUI* pCmdUI) { pCmdUI->Enable(s.HaveConfig); pCmdUI->SetCheck(ActivePage == ID_FILE_TAB); } void CCfgPropSheet::OnMcaTab2(CCmdUI* pCmdUI) { pCmdUI->Enable(s.HaveConfig); pCmdUI->SetCheck(ActivePage == ID_MCA_TAB); } void CCfgPropSheet::OnShapingTab2(CCmdUI* pCmdUI) { if (s.profile->device_type == dppMCA8000D) { pCmdUI->Enable(false); } else { pCmdUI->Enable(s.HaveConfig); } pCmdUI->SetCheck(ActivePage == ID_SHAPING_TAB); } void CCfgPropSheet::OnGainPzTab2(CCmdUI* pCmdUI) { if (s.profile->device_type == dppMCA8000D) { pCmdUI->Enable(false); } else { pCmdUI->Enable(s.HaveConfig); } pCmdUI->SetCheck(ActivePage == ID_GAINPZ_TAB); } void CCfgPropSheet::OnPowerTab2(CCmdUI* pCmdUI) { if (s.profile->device_type == dppMCA8000D) { pCmdUI->Enable(false); } else { pCmdUI->Enable(s.HaveConfig); } pCmdUI->SetCheck(ActivePage == ID_POWER_TAB); } void CCfgPropSheet::OnMiscTab2(CCmdUI* pCmdUI) { if (s.profile->device_type == dppMCA8000D) { pCmdUI->Enable(false); } else { pCmdUI->Enable(s.HaveConfig); } pCmdUI->SetCheck(ActivePage == ID_MISC_TAB); } void CCfgPropSheet::OnTB1() { AfxMessageBox("TB1"); } INT_PTR CCfgPropSheet::DoModal() { m_bKillItself = FALSE; m_bModal = TRUE; return CPropertySheet::DoModal(); } void CCfgPropSheet::PostNcDestroy() { if (!m_bKillItself) { CPropertySheet::PostNcDestroy(); } } void CCfgPropSheet::OnCancel() { if (m_bKillItself) { DestroyWindow(); } else { CCfgPropSheet::EndDialog(IDCANCEL); } } void CCfgPropSheet::OnEnterIdle(UINT nWhy, CWnd* pWho) { CPropertySheet::OnEnterIdle(nWhy, pWho); if (AfxGetApp()->m_pMainWnd != this) { if (m_bStatusBar) m_CSBCtrlStatus.SendMessage(WM_IDLEUPDATECMDUI); if (m_bToolBar) m_CSToolBar.SendMessage(WM_IDLEUPDATECMDUI,TRUE); } if (nWhy != MSGF_MENU || m_nIDTracking == m_nIDLastMessage) { return; } OnSetMessageString(m_nIDTracking); ASSERT(m_nIDTracking == m_nIDLastMessage); } void CCfgPropSheet::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) { CPropertySheet::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu); if (!bSysMenu) { ASSERT(pPopupMenu != NULL); CCmdUI state; state.m_pMenu = pPopupMenu; ASSERT(state.m_pOther == NULL); state.m_nIndexMax = pPopupMenu->GetMenuItemCount(); for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax; state.m_nIndex++) { state.m_nID = pPopupMenu->GetMenuItemID(state.m_nIndex); if (state.m_nID == 0) continue; ASSERT(state.m_pOther == NULL); ASSERT(state.m_pMenu != NULL); if (state.m_nID == (UINT)-1) { state.m_pSubMenu = pPopupMenu->GetSubMenu(state.m_nIndex); if (state.m_pSubMenu == NULL || (state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 || state.m_nID == (UINT)-1) { continue; } state.DoUpdate(this, FALSE); } else { state.m_pSubMenu = NULL; state.DoUpdate(this, state.m_nID < 0xF000); } } } } void CCfgPropSheet::OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu) { CPropertySheet::OnMenuSelect(nItemID, nFlags, hSysMenu); if (nFlags == 0xFFFF) { m_nIDTracking = AFX_IDS_IDLEMESSAGE; OnSetMessageString(m_nIDTracking); ASSERT(m_nIDTracking == m_nIDLastMessage); } else if (nItemID == 0 || nFlags & (MF_SEPARATOR|MF_POPUP|MF_MENUBREAK|MF_MENUBARBREAK)) { m_nIDTracking = 0; } else if (nItemID >= 0xF000 && nItemID < 0xF1F0) { m_nIDTracking = ID_COMMAND_FROM_SC(nItemID); ASSERT(m_nIDTracking >= AFX_IDS_SCFIRST && m_nIDTracking < AFX_IDS_SCFIRST + 31); } else { m_nIDTracking = nItemID; } } void CCfgPropSheet::OnMouseMove(UINT nFlags, CPoint point) { if (m_bResetPrompt) { OnSetMessageString(AFX_IDS_IDLEMESSAGE); m_bResetPrompt = FALSE; } CPropertySheet::OnMouseMove(nFlags, point); } BOOL CCfgPropSheet::OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult) { ASSERT(pNMHDR->code == TTN_NEEDTEXTA || pNMHDR->code == TTN_NEEDTEXTW); if (GetRoutingFrame() != NULL) { return FALSE; } TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR; TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR; TCHAR szFullText[256]; CString strTipText; CString strPromtpText; INT_PTR nID = pNMHDR->idFrom; if (pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) || pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND)) { nID = ((INT_PTR)(WORD)::GetDlgCtrlID((HWND)nID)); } if ((nID != 0) && (nID != ID_VIEW_STATUS_BAR)) { AfxLoadString((UINT)nID, szFullText); AfxExtractSubString(strTipText, szFullText, 1, '\n'); AfxExtractSubString(strPromtpText, szFullText, 0, '\n'); if (!strPromtpText.IsEmpty()) { if (::IsWindow(m_CSBCtrlStatus.m_hWnd)) m_CSBCtrlStatus.SetWindowText(strPromtpText); m_bResetPrompt = TRUE; } } #ifndef _UNICODE if (pNMHDR->code == TTN_NEEDTEXTA) lstrcpyn(pTTTA->szText, strTipText,(sizeof(pTTTA->szText)/sizeof(pTTTA->szText[0]))); else _mbstowcsz(pTTTW->szText, strTipText,(sizeof(pTTTW->szText)/sizeof(pTTTW->szText[0]))); #else if (pNMHDR->code == TTN_NEEDTEXTA) _wcstombsz(pTTTA->szText, strTipText,(sizeof(pTTTA->szText)/sizeof(pTTTA->szText[0]))); else lstrcpyn(pTTTW->szText, strTipText,(sizeof(pTTTW->szText)/sizeof(pTTTW->szText[0]))); #endif *pResult = 0; ::SetWindowPos(pNMHDR->hwndFrom, HWND_TOP, 0, 0, 0, 0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE); return TRUE; } void CCfgPropSheet::OnUpdateToolBarMenu(CCmdUI* pCmdUI) { ASSERT(pCmdUI->m_nID == ID_VIEW_TOOLBAR); pCmdUI->SetCheck(m_CSToolBar.IsWindowVisible()); } void CCfgPropSheet::OnToolBarCheck() { m_CSToolBar.ShowWindow(m_CSToolBar.IsWindowVisible() ? SW_HIDE : SW_SHOWNA); if (m_bToolBar) { CRect crToolBar; CRect rcClientStart; CRect rcClientNow; CRect rcWindow; GetWindowRect(rcWindow); m_CSToolBar.GetWindowRect(crToolBar); ScreenToClient(crToolBar); GetClientRect(rcClientStart); RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, rcClientNow); CPoint ptOffset( rcClientNow.left - rcClientStart.left, rcClientNow.top - rcClientStart.top + m_CSToolBar.IsWindowVisible() ? crToolBar.Height() : -1 * crToolBar.Height()); CRect rcChild; CWnd* pwndChild = GetWindow(GW_CHILD); while (pwndChild) { pwndChild->GetWindowRect(rcChild); ScreenToClient(rcChild); rcChild.OffsetRect(ptOffset); pwndChild->MoveWindow(rcChild, TRUE); if (pwndChild->GetStyle() & WS_VISIBLE) { pwndChild->ShowWindow(SW_HIDE); pwndChild->ShowWindow(SW_SHOW); } pwndChild = pwndChild->GetNextWindow(); } if (m_CSToolBar.IsWindowVisible()) { rcWindow.right += rcClientStart.Width() - rcClientNow.Width(); rcWindow.bottom += crToolBar.Height(); } else { rcWindow.right += rcClientStart.Width() - rcClientNow.Width(); rcWindow.bottom -= crToolBar.Height(); } MoveWindow(rcWindow, TRUE); RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0); } } void CCfgPropSheet::OnUpdateStatusBarMenu(CCmdUI* pCmdUI) { ASSERT(pCmdUI->m_nID == ID_VIEW_STATUS_BAR); pCmdUI->SetCheck(m_CSBCtrlStatus.IsWindowVisible()); } void CCfgPropSheet::OnStatusBarCheck() { m_CSBCtrlStatus.ShowWindow(m_CSBCtrlStatus.IsWindowVisible() ? SW_HIDE : SW_SHOWNA); if (m_bStatusBar) { CRect crStatusBar; CRect rcClientStart; CRect rcClientNow; CRect rcWindow; GetWindowRect(rcWindow); m_CSBCtrlStatus.GetWindowRect(crStatusBar); ScreenToClient(crStatusBar); GetClientRect(rcClientStart); RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, rcClientNow); if (m_CSBCtrlStatus.IsWindowVisible()) { rcWindow.right += rcClientStart.Width() - rcClientNow.Width(); rcWindow.bottom += crStatusBar.Height(); } else { rcWindow.right += rcClientStart.Width() - rcClientNow.Width(); rcWindow.bottom -= crStatusBar.Height(); } MoveWindow(rcWindow, TRUE); } } void CCfgPropSheet::OnUpdateKeyIndicator(CCmdUI* pCmdUI) { UINT nVK; switch (pCmdUI->m_nID) { case ID_INDICATOR_CAPS: nVK = VK_CAPITAL; break; case ID_INDICATOR_NUM: nVK = VK_NUMLOCK; break; case ID_INDICATOR_SCRL: nVK = VK_SCROLL; break; default: TRACE(_T("Warning: OnUpdateKeyIndicator - unknown indicator 0x%04X\n"), pCmdUI->m_nID); pCmdUI->ContinueRouting(); return; } pCmdUI->Enable(::GetKeyState(nVK) & 1); ASSERT(pCmdUI->m_bEnableChanged); } LRESULT CCfgPropSheet::OnSetMessageString(WPARAM wParam, LPARAM lParam) { UINT nIDMsg = (UINT)wParam; CString strMsg; TCHAR szFullText[256]; if (nIDMsg) { if (nIDMsg == AFX_IDS_IDLEMESSAGE) { strMsg.LoadString(AFX_IDS_IDLEMESSAGE); if (m_CSBCtrlStatus.m_hWnd) m_CSBCtrlStatus.SetWindowText(strMsg); } else { if (strMsg.LoadString(nIDMsg) != 0) { CString strTipText; AfxLoadString(nIDMsg, szFullText); UINT i = 0; while (i++ < _tcslen(szFullText)) { if (szFullText[i] == (TCHAR)'\n') { strTipText = CString(szFullText).Left(i); break; } } if (m_CSBCtrlStatus.m_hWnd) m_CSBCtrlStatus.SetWindowText(strTipText); } else { TRACE(_T("Warning: no message line prompt for ID %x%04X\n"), nIDMsg); } } } else { if (m_CSBCtrlStatus.m_hWnd) m_CSBCtrlStatus.SetWindowText(strMsg); } UINT nIDLast = m_nIDLastMessage; m_nIDLastMessage = nIDMsg; m_nIDTracking = nIDMsg; return nIDLast; } LRESULT CCfgPropSheet::OnPopMessageString(WPARAM wParam, LPARAM lParam) { if (m_nFlags & WF_NOPOPMSG) { return 0; } return SendMessage(WM_SETMESSAGESTRING, wParam, lParam); } LRESULT CCfgPropSheet::OnKickIdle(WPARAM, LPARAM lCount) { if (m_bStatusBar) m_CSBCtrlStatus.SendMessage(WM_IDLEUPDATECMDUI); if (m_bToolBar) m_CSToolBar.SendMessage(WM_IDLEUPDATECMDUI,TRUE); return (lCount <= 2); } void CCfgPropSheet::OnTimer(UINT nIDEvent) { if ((AfxGetMainWnd() == this) && (m_Timer != 0) && (!m_bModal)) { KillTimer(666); m_Timer = 0; } else { if (nIDEvent == 666) OnKickIdle(0,0); } CPropertySheet::OnTimer(nIDEvent); } ///////////////////////////////////////////////////////////////////////////// // CCfgPropPage property page IMPLEMENT_DYNCREATE(CCfgPropPage, CPropertyPage) CCfgPropPage::CCfgPropPage() : CPropertyPage() { } CCfgPropPage::CCfgPropPage(UINT nIDTemplate, UINT nIDCaption, UINT nIDHeaderTitle, UINT nIDHeaderSubTitle) : CPropertyPage(nIDTemplate,nIDCaption,nIDHeaderTitle,nIDHeaderSubTitle) { } CCfgPropPage::CCfgPropPage(LPCTSTR lpszTemplateName, UINT nIDCaption, UINT nIDHeaderTitle, UINT nIDHeaderSubTitle) : CPropertyPage(lpszTemplateName,nIDCaption,nIDHeaderTitle,nIDHeaderSubTitle) { } CCfgPropPage::~CCfgPropPage() { } void CCfgPropPage::DoDataExchange(CDataExchange* pDX) { CPropertyPage::DoDataExchange(pDX); //{{AFX_DATA_MAP(CCfgPropPage) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CCfgPropPage, CPropertyPage) //{{AFX_MSG_MAP(CCfgPropPage) ON_WM_MOUSEMOVE() //}}AFX_MSG_MAP ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText) ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText) END_MESSAGE_MAP() BOOL CCfgPropPage::OnToolTipText(UINT i, NMHDR* pNMHDR, LRESULT* pResult) { ASSERT(GetParent()->IsKindOf(RUNTIME_CLASS(CCfgPropSheet))); CCfgPropSheet *pParent = (CCfgPropSheet *)GetParent(); return pParent->OnToolTipText(i,pNMHDR,pResult); } void CCfgPropPage::OnMouseMove(UINT nFlags, CPoint point) { ASSERT(GetParent()->IsKindOf(RUNTIME_CLASS(CCfgPropSheet))); CCfgPropSheet *pParent = (CCfgPropSheet *)GetParent(); pParent->OnMouseMove(nFlags, point); CPropertyPage::OnMouseMove(nFlags, point); }