LRESULT CControlBar::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM) { // handle delay hide/show BOOL bVis = GetStyle() & WS_VISIBLE; UINT swpFlags = 0; if ((m_nStateFlags & delayHide) && bVis) swpFlags = SWP_HIDEWINDOW; else if ((m_nStateFlags & delayShow) && !bVis) swpFlags = SWP_SHOWWINDOW; m_nStateFlags &= ~(delayShow|delayHide); if (swpFlags != 0) { SetWindowPos(NULL, 0, 0, 0, 0, swpFlags| SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE); } // the style must be visible and if it is docked // the dockbar style must also be visible if ((GetStyle() & WS_VISIBLE) && (m_pDockBar == NULL || (m_pDockBar->GetStyle() & WS_VISIBLE))) { CFrameWnd* pTarget = (CFrameWnd*)GetOwner(); if (pTarget == NULL || !pTarget->IsFrameWnd()) pTarget = GetParentFrame(); if (pTarget != NULL) OnUpdateCmdUI(pTarget, (BOOL)wParam); } return 0L; }
void COleClientItem::OnSetMenu(CMenu* pMenuShared, HOLEMENU holemenu, HWND hwndActiveObject) { ASSERT_VALID(this); ASSERT(m_pInPlaceFrame != NULL); ASSERT(m_pInPlaceFrame->m_pFrameWnd != NULL); // don't set the doc is active CFrameWnd* pFrameWnd = m_pInPlaceFrame->m_pFrameWnd; ASSERT_VALID(pFrameWnd); if (m_pInPlaceDoc != NULL && m_pInPlaceDoc->m_pFrameWnd != pFrameWnd->GetActiveFrame()) { return; } // update the menu pFrameWnd->DelayUpdateFrameMenu(pMenuShared->GetSafeHmenu()); // enable/disable the OLE command routing hook ::OleSetMenuDescriptor(holemenu, pFrameWnd->m_hWnd, hwndActiveObject, NULL, NULL); if (m_pInPlaceDoc != NULL) { pFrameWnd = m_pInPlaceDoc->m_pFrameWnd; ASSERT_VALID(pFrameWnd); ::OleSetMenuDescriptor(holemenu, pFrameWnd->m_hWnd, hwndActiveObject, NULL, NULL); } }
void CLayerChooseDlg::OnSelchangeCombo1() { // TODO: Add your control notification handler code here m_CurSelect=m_Combo_Show.GetCurSel(); CFrameWnd *pFrame = (CFrameWnd*)AfxGetApp()->m_pMainWnd; CMapManagerView *pView = (CMapManagerView *) pFrame->GetActiveView(); m_LayerType=pView->GetDocument()->map1->m_parLayers.GetAt(m_CurSelect)->GetLayerType(); switch (m_LayerType) { case 1: m_Edit.SetWindowText("你选择的为点状目标图层"); break; case 3: m_Edit.SetWindowText("你选择的为线状目标图层"); break; case 5: m_Edit.SetWindowText("你选择的为面状目标图层"); break; case 7: m_Edit.SetWindowText("你选择的为注记图层"); break; default : break; } }
int CView::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message) { int nResult = CWnd::OnMouseActivate(pDesktopWnd, nHitTest, message); if (nResult == MA_NOACTIVATE || nResult == MA_NOACTIVATEANDEAT) return nResult; // frame does not want to activate CFrameWnd* pParentFrame = GetParentFrame(); if (pParentFrame != NULL) { // eat it if this will cause activation ASSERT(pParentFrame == pDesktopWnd || pDesktopWnd->IsChild(pParentFrame)); // either re-activate the current view, or set this view to be active CView* pView = pParentFrame->GetActiveView(); HWND hWndFocus = ::GetFocus(); if (pView == this && m_hWnd != hWndFocus && !::IsChild(m_hWnd, hWndFocus)) { // re-activate this view OnActivateView(TRUE, this, this); } else { // activate this view pParentFrame->SetActiveView(this); } } return nResult; }
//------------------------------------------------------------------ // main //------------------------------------------------------------------ void main() { CWinApp* pApp = AfxGetApp(); pApp->InitApplication(); pApp->InitInstance(); pApp->Run(); CMyDoc* pMyDoc = new CMyDoc; CMyView* pMyView = new CMyView; CFrameWnd* pMyFrame = (CFrameWnd*)pApp->m_pMainWnd; // output Message Map construction AFX_MSGMAP* pMessageMap = pMyView->GetMessageMap(); cout << endl << "CMyView Message Map : " << endl; MsgMapPrinting(pMessageMap); pMessageMap = pMyDoc->GetMessageMap(); cout << endl << "CMyDoc Message Map : " << endl; MsgMapPrinting(pMessageMap); pMessageMap = pMyFrame->GetMessageMap(); cout << endl << "CMyFrameWnd Message Map : " << endl; MsgMapPrinting(pMessageMap); pMessageMap = pApp->GetMessageMap(); cout << endl << "CMyWinApp Message Map : " << endl; MsgMapPrinting(pMessageMap); }
void CFrameWnd::ShowControlBar( CControlBar *pBar, BOOL bShow, BOOL bDelay ) /**************************************************************************/ { UNUSED_ALWAYS( bDelay ); ASSERT( pBar != NULL ); if( bShow ) { pBar->ShowWindow( SW_SHOW ); } else { pBar->ShowWindow( SW_HIDE ); } if( pBar->IsFloating() ) { CDockBar *pDockBar = pBar->m_pDockBar; ASSERT( pDockBar != NULL ); CFrameWnd *pFrame = pDockBar->GetParentFrame(); ASSERT( pFrame != NULL ); if( !bShow && pDockBar->GetDockedVisibleCount() == 0 ) { pFrame->ShowWindow( SW_HIDE ); } else if( bShow && pDockBar->GetDockedVisibleCount() == 1 ) { pFrame->ShowWindow( SW_SHOW ); pFrame->UpdateWindow(); } } RecalcLayout(); }
void CPrime95View::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) { CFrameWnd *parent; CSize sz; CPoint pos; int new_scroll_height, new_scroll_width; parent = GetParentFrame(); if (parent != NULL) { if (charHeight == 0) getCharSize (); sz = GetTotalSize (); new_scroll_height = NumLines * charHeight; new_scroll_width = MaxLineSize * charWidth; pos = GetScrollPosition (); pos.y += (new_scroll_height - sz.cy); if (pos.y < 0) pos.y = 0; sz.cx = new_scroll_width; sz.cy = new_scroll_height; SetScrollSizes (MM_TEXT, sz); ScrollToPosition (pos); parent->RecalcLayout (); } CScrollView::OnUpdate (pSender, lHint, pHint); }
void CStagePrefsLighting::OnLightingDefaults() { CFrameWnd *pMainFrame = GetTopLevelFrame(); CStageView *pView = (CStageView *)pMainFrame->GetActiveView(); CStageDoc *pDoc = pView->GetDocument(); pDoc->m_lighting[1] = YO_DEFAULT_LIGHTING_TWO_SIDED; m_twoSide = YO_DEFAULT_LIGHTING_TWO_SIDED; ::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, YO_DEFAULT_LIGHTING_TWO_SIDED); pDoc->m_sunIntensity = YO_DEFAULT_SUN_INTENSITY; m_lightingSunIntensity = YO_DEFAULT_SUN_INTENSITY; m_lightingSunSliderIntensity.SetPos((int)(m_lightingSunIntensity * 100.0)); pDoc->m_sunAzimuth = YO_DEFAULT_SUN_AZIMUTH; m_lightingSunAzimuth = YO_DEFAULT_SUN_AZIMUTH; pDoc->m_sunAltitude = YO_DEFAULT_SUN_ALTITUDE; m_lightingSunAltitude = YO_DEFAULT_SUN_ALTITUDE; UpdateData(FALSE); pView->YoRender(YO_RENDER_LIGHT); pView->YoRender(YO_RENDER_FULL); }
void CStagePrefsLighting::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { CFrameWnd *pMainFrame = GetTopLevelFrame(); CStageView *pView = (CStageView *)pMainFrame->GetActiveView(); CStageDoc *pDoc = pView->GetDocument(); if ((CSliderCtrl *)pScrollBar == &m_lightingSunSliderIntensity) { m_lightingSunIntensity = (float)m_lightingSunSliderIntensity.GetPos() / 100.0f; pDoc->m_sunIntensity = m_lightingSunIntensity; } else { CPropertyPage::OnHScroll(nSBCode, nPos, pScrollBar); } UpdateData(FALSE); if (nSBCode == SB_ENDSCROLL) { pView->YoRender(YO_RENDER_LIGHT); pView->YoRender(YO_RENDER_FULL); } else { pView->YoRender(YO_RENDER_QUICK); } return; }
void CHiddenFrame::HandleEditorNotification(LONG lMessage) { switch (lMessage) { case WM_LBUTTONUP: { // Find last active editor/browser and find or launch new editor from there // 2/17/96 - fixed bug 45611. Was creating disabled editor window when invoked from a // Mail window. We need to look for any active frame, not just Browser frame. // We send a message instead of assuming that it's a generic frame because the // the inplace frame could be the last active frame. CFrameWnd * pFrame = FEU_GetLastActiveFrame(MWContextAny, TRUE); if (pFrame) { pFrame->SendMessage(WM_COMMAND, WPARAM(ID_TOOLS_EDITOR), 0); } else { // there should always be an active frame. ASSERT(FALSE); // FE_CreateNewEditWindow(NULL, NULL); } } break; case WM_RBUTTONUP: case WM_MOUSEMOVE: break; } } // END OF FUNCTION CHiddenFrame::HandleWebNotification()
//**************************************************************************** COleClientItem* CBCGPFrameWnd::GetInPlaceActiveItem () { CFrameWnd* pActiveFrame = GetActiveFrame (); if (pActiveFrame == NULL) { return NULL; } ASSERT_VALID (pActiveFrame); CView* pView = pActiveFrame->GetActiveView (); if (pView == NULL || pView->IsKindOf (RUNTIME_CLASS (CBCGPPrintPreviewView))) { return NULL; } ASSERT_VALID (pView); COleDocument* pDoc = DYNAMIC_DOWNCAST (COleDocument, pView->GetDocument ()); if (pDoc == NULL) { return NULL; } ASSERT_VALID (pDoc); return pDoc->GetInPlaceActiveItem (pView); }
void CHiddenFrame::HandleWebNotification(LONG lMessage) { switch (lMessage) { case WM_LBUTTONUP: { /* CAbstractCX *pCX = FEU_GetLastActiveFrameContext(MWContextAny); CFrameWnd * pFrame = FEU_GetLastActiveFrame(MWContextAny); if (pFrame && IsKindOf(RUNTIME_CLASS(CGenericFrame))) { ((CGenericFrame*)pFrame)->OnToolsWeb(); } else { theApp.m_ViewTmplate->OpenDocumentFile( NULL ); }*/ BOOL bHandledMessage = FALSE; CFrameWnd * pFrame = FEU_GetLastActiveFrame(MWContextAny); if(pFrame) if(pFrame->SendMessage(WM_COMMAND, WPARAM(ID_TOOLS_WEB), 0)) bHandledMessage = TRUE; if(!bHandledMessage) theApp.m_ViewTmplate->OpenDocumentFile( NULL ); } break; case WM_RBUTTONUP: case WM_MOUSEMOVE: break; } } // END OF FUNCTION CHiddenFrame::HandleWebNotification()
void KCDialogSet::OnOk() { // TODO: Add your control notification handler code here UINT nTemp = 0; m_pParHand = (CSprReaderView*)this->GetParent(); // m_pParHand = (CSprReaderView*)AfxGetMainWnd(); UpdateData(true); // 更新窗体上的值到变量 if(!m_Interval.IsEmpty()) g_StructSet.interval = atoi(this->m_Interval.GetBuffer()); if(!m_Zoom.IsEmpty()) g_StructSet.zoom = atoi(this->m_Zoom.GetBuffer()); // // 发送消息给主窗体 CFrameWnd *pFrame; CMDIChildWnd *mWnd; pFrame = (CFrameWnd*)AfxGetApp()->m_pMainWnd; CView *pView = pFrame->GetActiveView(); if(pView != NULL) pView->SendMessage(WM_MY_MESSAGE, 0, 0); // ::SendMessage(GetParent()->GetSafeHwnd(), WM_MY_MESSAGE, 0, 0); // ::SendMessage(AfxGetMainWnd()->m_hWnd, WM_MY_MESSAGE, 0, 0); CDialog::OnOK(); }
* End of Class Event CEsmFindDlg::OnEditPaste() *=========================================================================*/ /*=========================================================================== * * Class CEsmFindDlg Event - LRESULT OnEditRecord (lParam, wParam); * *=========================================================================*/ LRESULT CEsmFindDlg::OnEditRecord (LPARAM lParam, LPARAM wParam) { POSITION ListPos; int ListIndex; esmrecinfo_t* pRecInfo; /* Get the first selected item */ ListPos = m_RecordList.GetFirstSelectedItemPosition(); if (ListPos == NULL) return (0); ListIndex = m_RecordList.GetNextSelectedItem(ListPos); pRecInfo = m_RecordList.GetRecInfo(ListIndex); if (m_pDlgHandler == NULL || pRecInfo == NULL) return (0); /* Check for special case of INFO record type */ if (pRecInfo->pRecord->IsType(MWESM_REC_INFO)) { CEsmInfo* pInfo = (CEsmInfo *) pRecInfo->pRecord; esmrecinfo_t* pNewRecInfo = m_pDlgHandler->GetDocument()->FindRecInfo(pInfo->GetDialParent()); if (pNewRecInfo != NULL) { m_pDlgHandler->EditRecord(pNewRecInfo); CFrameWnd* pWnd = m_pDlgHandler->FindDialog(pNewRecInfo); if (pWnd != NULL) { pWnd->SendMessageToDescendants(ESMDLG_MSG_ONINFOEDIT, (LPARAM) pRecInfo, -1, FALSE); } } } else { m_pDlgHandler->EditRecord(pRecInfo); } return (0); }
void CMUSHclientDoc::SetWorldWindowStatus(short Parameter) { CFrameWnd* pParent = NULL; for(POSITION pos=GetFirstViewPosition();pos!=NULL;) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(CSendView))) { CSendView* pmyView = (CSendView*)pView; pParent = pmyView->GetParentFrame (); break; } } if (pParent) { switch (Parameter) { case 1: pParent->ShowWindow(SW_SHOWMAXIMIZED); break; case 2: pParent->ShowWindow(SW_MINIMIZE); break; case 3: pParent->ShowWindow(SW_RESTORE); break; case 4: pParent->ShowWindow(SW_SHOWNORMAL); break; } // end of switch } // have parent } // end of CMUSHclientDoc::SetWorldWindowStatus
BOOL CSettingsDialog::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class ASSERT(pMsg != NULL); ASSERT_VALID(this); ASSERT(m_hWnd != NULL); // Don't let CDialog process the Escape key. if ((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_ESCAPE)) return TRUE; if (CWnd::PreTranslateMessage(pMsg)) return TRUE; // Don't translate dialog messages when // application is in help mode CFrameWnd* pFrameWnd = GetTopLevelFrame(); if (pFrameWnd != NULL && pFrameWnd->m_bHelpMode) return FALSE; // Ensure the dialog messages will not // eat frame accelerators pFrameWnd = GetParentFrame(); while (pFrameWnd != NULL) { if (pFrameWnd->PreTranslateMessage(pMsg)) return TRUE; pFrameWnd = pFrameWnd->GetParentFrame(); } return PreTranslateInput(pMsg); // return CDialog::PreTranslateMessage(pMsg); }
LRESULT CMainFrame::OnGetTabToolTip(WPARAM /*wp*/, LPARAM lp) { CMFCTabToolTipInfo* pInfo = (CMFCTabToolTipInfo*) lp; ASSERT(pInfo != NULL); if (!pInfo) { return 0; } ASSERT_VALID(pInfo->m_pTabWnd); if (!pInfo->m_pTabWnd->IsMDITab()) { return 0; } CFrameWnd* pFrame = DYNAMIC_DOWNCAST(CFrameWnd, pInfo->m_pTabWnd->GetTabWnd(pInfo->m_nTabIndex)); if (pFrame == NULL) { return 0; } CDocument* pDoc = pFrame->GetActiveDocument(); if (pDoc == NULL) { return 0; } pInfo->m_strText = pDoc->GetPathName(); if(pInfo->m_strText.IsEmpty()) pInfo->m_strText=pDoc->GetTitle(); return 0; }
void CLangModelsDoc::showWindow() { CFrameWnd* pF = getFrame(); ASSERTX(pF); pF->ShowWindow(SW_SHOWNORMAL); getFrame()->GetMDIFrame()->MDIActivate(pF); }
BOOL CFormView::PreTranslateMessage(MSG* pMsg) { ASSERT(pMsg != NULL); ASSERT_VALID(this); ASSERT(m_hWnd != NULL); // allow tooltip messages to be filtered if (CView::PreTranslateMessage(pMsg)) return TRUE; // don't translate dialog messages when in Shift+F1 help mode CFrameWnd* pFrameWnd = GetTopLevelFrame(); if (pFrameWnd != NULL && pFrameWnd->m_bHelpMode) return FALSE; // since 'IsDialogMessage' will eat frame window accelerators, // we call all frame windows' PreTranslateMessage first pFrameWnd = GetParentFrame(); // start with first parent frame while (pFrameWnd != NULL) { // allow owner & frames to translate before IsDialogMessage does if (pFrameWnd->PreTranslateMessage(pMsg)) return TRUE; // try parent frames until there are no parent frames pFrameWnd = pFrameWnd->GetParentFrame(); } // don't call IsDialogMessage if form is empty if (::GetWindow(m_hWnd, GW_CHILD) == NULL) return FALSE; // filter both messages to dialog and from children return PreTranslateInput(pMsg); }
/****************************************************************************** Function Name : vDisplayWarningLineNumber Input(s) : eMESSAGEFROM eMsgFrom, UINT unLineNo Output : - Functionality : Scrolls to the line number spaecified and highlights the same. Member of : CFileView Friend of : - Author(s) : Date Created : ******************************************************************************/ void CFileView::vDisplayWarningLineNumber( eMESSAGEFROM eMsgFrom, UINT unLineNo) { // Get document CFunctionEditorDoc* pomSrcFileDoc = omGetDocument(); // Doc is valid if(pomSrcFileDoc != nullptr) { // Main frame is valid and // function called from COutWnd class if (eMsgFrom == OUTWND) { // Get child window, active may be // "COutWnd" CFrameWnd* pMainFrame = (CFrameWnd*)CWnd::FromHandle(CGlobalObj::sm_hWndMDIParentFrame); CMDIChildWnd* pChild = ( CMDIChildWnd*) pMainFrame->GetActiveFrame(); CString omStrText = ""; BOOL bInLoop = TRUE; do { // Get next window pChild = (CEditFrameWnd*) pChild->GetWindow(GW_HWNDNEXT); if(pChild != nullptr ) { // Get Window caption pChild->GetWindowText(omStrText); // check the title of child window, // if matches, activate my window it if (omStrText == omGetDocument()->GetTitle()) { bInLoop = FALSE; } } else { bInLoop = FALSE; } } while (bInLoop); if (pChild != nullptr) { pChild->MDIActivate(); } } // Update document with the line no pomSrcFileDoc->m_lCurrentWarningLineNum = unLineNo; // Scroll to the line specified vGoToLine( unLineNo ); // refresh the view Invalidate(TRUE); } // end of if(pomSrcFileDoc) }
BOOL CSAPrefsDialog::PreTranslateMessage(MSG* pMsg) { ASSERT(pMsg != NULL); ASSERT_VALID(this); ASSERT(m_hWnd != NULL); // Don't let CDialog process the Escape key. if ((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_ESCAPE)) { return TRUE; } if (CWnd::PreTranslateMessage(pMsg)) return TRUE; // don't translate dialog messages when // application is in help mode CFrameWnd* pFrameWnd = GetTopLevelFrame(); if (pFrameWnd != NULL && pFrameWnd->m_bHelpMode) return FALSE; // ensure the dialog messages will not // eat frame accelerators pFrameWnd = GetParentFrame(); while (pFrameWnd != NULL) { if (pFrameWnd->PreTranslateMessage(pMsg)) return TRUE; pFrameWnd = pFrameWnd->GetParentFrame(); } return PreTranslateInput(pMsg); }
void CChildView::OnCollapse() { if (!IsCollapsed()) { m_expandToolbar = IsToolbarVisible(); m_expandStatusbar = IsStatusbarVisible(); m_expandMagnifier = m_magnifier.IsEnabled(); m_expandScreenInfo = m_dataDisplay.IsEnabled(MeaScreenSection); m_expandToolInfo = m_dataDisplay.IsEnabled(MeaRegionSection); } if (m_expandToolbar) { CFrameWnd *frame = GetParentFrame(); frame->PostMessage(WM_COMMAND, ID_VIEW_TOOLBAR); } if (m_expandStatusbar) { CFrameWnd *frame = GetParentFrame(); frame->PostMessage(WM_COMMAND, ID_VIEW_STATUSBAR); } if (m_expandMagnifier) { OnMagnifier(); } if (m_expandScreenInfo) { OnScreenInfo(); } if (m_expandToolInfo) { OnToolInfo(); } }
void CView::OnDestroy() { CFrameWnd* pFrame = GetParentFrame(); if (pFrame != NULL && pFrame->GetActiveView() == this) pFrame->SetActiveView(NULL); // deactivate during death CWnd::OnDestroy(); }
void CDockBar::RemoveControlBar(CControlBar* pBar, int nPosExclude) { ASSERT_VALID(this); ASSERT(pBar != NULL); int nPos = FindBar(pBar, nPosExclude); ASSERT(nPos > 0); m_arrBars.RemoveAt(nPos); // remove section indicator (NULL) if nothing else in section if (m_arrBars[nPos-1] == NULL && m_arrBars[nPos] == NULL) m_arrBars.RemoveAt(nPos); // get parent frame for recalc layout/frame destroy CFrameWnd* pFrameWnd = GetDockingFrame(); if (m_bFloating && GetDockedVisibleCount() == 0) { if (m_arrBars.GetSize() == 1) pFrameWnd->DestroyWindow(); else pFrameWnd->ShowWindow(SW_HIDE); } else pFrameWnd->DelayRecalcLayout(); }
void CMainFrame::OnFileRuncommand() { CDComDoc* pDoc = NULL; CFrameWnd* pFrame; pFrame = ((CMDIFrameWnd*)AfxGetMainWnd())->MDIGetActive(); if (pFrame) { pDoc = (CDComDoc*)pFrame->GetActiveDocument(); if (pDoc) { if (pDoc->IsRunning() == TRUE) { if (AfxMessageBox("Stop current program?", MB_YESNO) == IDYES) { pDoc->StopRunning(); } return; } } } if (m_runCmdDlg.m_hWnd == 0) { if (m_runCmdDlg.Create(MAKEINTRESOURCE(IDD_COMMAND_DIALOG), this) == 0) { return; } } m_runCmdDlg.ShowWindow(SW_SHOW); }
void CMainFrame::OnViewFullscreen() { if (m_fullscreen) { ModifyStyle(0,WS_CAPTION|WS_THICKFRAME); ShowWindow(SW_SHOWNORMAL); ShowControlBar(&m_wndToolBar, TRUE, FALSE); ShowControlBar(&m_wndCmdBar, TRUE, FALSE); ShowControlBar(&m_wndStatusBar, TRUE, FALSE); } else { ModifyStyle(WS_CAPTION|WS_THICKFRAME,0); ShowWindow(SW_MAXIMIZE); CFrameWnd* pChild = GetActiveFrame(); if (pChild) pChild->ShowWindow(SW_MAXIMIZE); ShowControlBar(&m_wndToolBar, FALSE, FALSE); ShowControlBar(&m_wndCmdBar, FALSE, FALSE); ShowControlBar(&m_wndStatusBar, FALSE, FALSE); } m_fullscreen = !m_fullscreen; }
void CMsgView::OnContextMenu(CWnd *pWnd, CPoint point) { CFrameWnd *pFrame; CMenu menu; CMenu *pPopupMenu; int nStart; int nEnd; UINT uiEnable; // make sure window is active pFrame = GetParentFrame (); ASSERT (pFrame != NULL); if (pFrame != NULL) { pFrame->ActivateFrame (); }; if (!menu.LoadMenu (IDR_COMPILEVW_POPUP)) { return; } pPopupMenu = menu.GetSubMenu (0); ASSERT (pPopupMenu != NULL); if (pPopupMenu == NULL) { return; } GetEditCtrl().GetSel(nStart, nEnd); uiEnable = (nStart == nEnd) ? MF_DISABLED | MF_GRAYED : MF_ENABLED; pPopupMenu->EnableMenuItem(IDM_MSG_COPY, uiEnable); pPopupMenu->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this); }
void CStylePage::OnStyleClicked(UINT /*nCmdID*/) { // The CStylePage property page is used for both the // CModalShapePropSheet and the CModelessShapePropSheet. // Both these versions of the property sheet share a common // feature that they immediately update a shape. In the // case of CModalShapePropSheet, the shape is in the preview // window. In the case of CModelessShapePropSheet, the shape // is the currently selected shape in the view. CPropertySheet* pSheet = STATIC_DOWNCAST(CPropertySheet, GetParent()); CModalShapePropSheet* pModalSheet = DYNAMIC_DOWNCAST(CModalShapePropSheet, pSheet); if (pModalSheet != NULL) { UpdateData(); pModalSheet->UpdateShapePreview(); SetModified(); // enable Apply Now button } CModelessShapePropSheet* pModelessSheet = DYNAMIC_DOWNCAST(CModelessShapePropSheet, pSheet); if (pModelessSheet != NULL) { UpdateData(); CFrameWnd* pFrameWnd = STATIC_DOWNCAST(CFrameWnd, AfxGetMainWnd()); CView* pView = pFrameWnd->GetActiveFrame()->GetActiveView(); pView->SendMessage(WM_USER_CHANGE_OBJECT_PROPERTIES, 0, 0); } }
int CLayerChooseDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDialog::OnCreate(lpCreateStruct) == -1) return -1; CClientDC dc(this); CRect TempRect; TEXTMETRIC metric; int CharHeight,CharX,CharY; CharHeight=-((dc.GetDeviceCaps(LOGPIXELSY)*8/72)); dc.GetTextMetrics(&metric); CharX=metric.tmAveCharWidth; CharY=metric.tmHeight+metric.tmExternalLeading; TempRect.SetRect(CharX*5,CharY*4,CharX*30,CharY*25);//设定Combo的宽度和位置 m_Combo_Show.Create(WS_CHILD|WS_VISIBLE|CBS_DROPDOWNLIST|CBS_SORT|WS_BORDER|WS_VSCROLL,TempRect,this,IDC_COMBO1); CFrameWnd *pFrame = (CFrameWnd*)AfxGetApp()->m_pMainWnd; CMapManagerView *pView = (CMapManagerView *) pFrame->GetActiveView(); CString str; if(pView->m_IsLoadMap) { int LayerNum=pView->GetDocument()->map1->GetLayerNum(); for(int i=0;i<LayerNum;i++) { str=pView->GetDocument()->map1->m_parLayers.GetAt(i)->GetLayerName(); m_Combo_Show.InsertString(i,str); } } return 0; }
//********************************************************************** void CBCGPRibbonCustomizeQATPage::OnOK() { UpdateData (); ASSERT_VALID (m_pRibbonBar); CList<UINT,UINT> lstQACommands; for (int i = 0; i < m_wndQATList.GetCount (); i++) { lstQACommands.AddTail (m_wndQATList.GetCommand (i)->GetID ()); } m_pRibbonBar->OnCancelMode (); m_pRibbonBar->m_QAToolbar.ReplaceCommands (lstQACommands); m_pRibbonBar->SetQuickAccessToolbarOnTop (!m_bQAToolbarOnBottom); m_pRibbonBar->RecalcLayout (); CFrameWnd* pParentFrame = m_pRibbonBar->GetParentFrame (); if (pParentFrame->GetSafeHwnd () != NULL) { pParentFrame->RecalcLayout (); pParentFrame->RedrawWindow (); } CBCGPPropertyPage::OnOK(); }