本文整理汇总了C++中DYNAMIC_DOWNCAST函数的典型用法代码示例。如果您正苦于以下问题:C++ DYNAMIC_DOWNCAST函数的具体用法?C++ DYNAMIC_DOWNCAST怎么用?C++ DYNAMIC_DOWNCAST使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DYNAMIC_DOWNCAST函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AfxGetMainFrame
CView* CStaticDoc::GetActiveView( )
{
CMainFrame * pMainFrame = AfxGetMainFrame();
if( pMainFrame )
{
CChildFrame * pChildFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() );
if( pChildFrame )
{
CView * pView = pChildFrame->GetActiveView();
if( pView && this == pView->GetDocument() )
return pView;
}
}
return NULL;
}
示例2: ASSERT_VALID
//--------------------------------------------------------------------------------------//
void CBCGPDragFrameImpl::Init (CWnd* pDraggedWnd)
{
ASSERT_VALID (pDraggedWnd);
m_pDraggedWnd = pDraggedWnd;
CWnd* pDockSite = NULL;
if (m_pDraggedWnd->IsKindOf (RUNTIME_CLASS (CBCGPMiniFrameWnd)))
{
CBCGPMiniFrameWnd* pMiniFrame = DYNAMIC_DOWNCAST (CBCGPMiniFrameWnd, m_pDraggedWnd);
pDockSite = pMiniFrame->GetParent ();
}
else if (m_pDraggedWnd->IsKindOf (RUNTIME_CLASS (CBCGPControlBar)))
{
CBCGPControlBar* pBar =
DYNAMIC_DOWNCAST (CBCGPControlBar, m_pDraggedWnd);
ASSERT_VALID (pBar);
CBCGPMiniFrameWnd* pParentMiniFrame = pBar->GetParentMiniFrame ();
if (pParentMiniFrame != NULL)
{
pDockSite = pParentMiniFrame->GetParent ();
}
else
{
pDockSite = pBar->GetDockSite ();
}
}
m_pDockManager = globalUtils.GetDockManager (pDockSite);
if (globalUtils.m_bDialogApp)
{
return;
}
ASSERT(m_pDockManager != NULL);
}
示例3: GetTopLevelFrame
void CBCGPMSOffice2007DemoView::OnZoomSlider()
{
CBCGPRibbonStatusBar* pStatusBar = ((CMainFrame*) GetTopLevelFrame ())->GetRibbonStatusBar ();
CBCGPRibbonSlider* pSlider = DYNAMIC_DOWNCAST (
CBCGPRibbonSlider,
pStatusBar->FindElement (ID_STATUSBAR_ZOOM_SLIDER));
ASSERT_VALID (pSlider);
int nPos = pSlider->GetPos ();
CBCGPRibbonStatusBarPane* pZoom = DYNAMIC_DOWNCAST (
CBCGPRibbonStatusBarPane,
pStatusBar->FindElement (ID_STATUSBAR_ZOOM));
ASSERT_VALID (pZoom);
CString strZoom;
strZoom.Format (_T("%d%%"), nPos);
pZoom->SetText (strZoom);
pZoom->Redraw ();
SendMessage(EM_SETZOOM, nPos, 100);
}
示例4: DYNAMIC_DOWNCAST
COXTabSkin* COXSkinnedSpinCtrl::GetTabSkin()
{
// Check if the app is derived from COXSkinnedApp
COXSkinnedApp* pSkinnedApp = DYNAMIC_DOWNCAST(COXSkinnedApp, AfxGetApp());
if (pSkinnedApp != NULL && pSkinnedApp->GetCurrentSkin() != NULL)
return pSkinnedApp->GetCurrentSkin()->GetTabSkin();
else
{
// Create a classic skin for this class if not created already
if (m_pTabSkin == NULL)
m_pTabSkin = new COXTabSkinClassic();
return m_pTabSkin;
}
}
示例5: DYNAMIC_DOWNCAST
//******************************************************************************
void CBCGPDragFrameImpl::PlaceTabPreDocking (CWnd* pCBarToPlaceOn)
{
CBCGPBaseTabbedBar* pTabbedBar =
DYNAMIC_DOWNCAST (CBCGPBaseTabbedBar, pCBarToPlaceOn);
if (pTabbedBar != NULL &&
(pTabbedBar->GetVisibleTabsNum () > 1 && pTabbedBar->IsHideSingleTab () ||
pTabbedBar->GetVisibleTabsNum () > 0 && !pTabbedBar->IsHideSingleTab ()))
{
m_pTargetBar = pTabbedBar;
PlaceTabPreDocking (pTabbedBar, TRUE);
return;
}
else if (m_nInsertedTabID == -1)
{
CBCGPDockingControlBar* pDockingControlBar = DYNAMIC_DOWNCAST (CBCGPDockingControlBar, pCBarToPlaceOn);
if (pDockingControlBar != NULL)
{
DrawFrameTab (pDockingControlBar, FALSE);
m_pTargetBar = pDockingControlBar;
m_pOldTargetBar = pDockingControlBar;
m_nInsertedTabID = 1;
}
}
}
示例6: AfxGetMainWnd
CStatusBar* CProgressBar::GetStatusBar()
{
if (m_pStatusBar)
{
return m_pStatusBar;
}
else
{
CWnd *pMainWnd = AfxGetMainWnd();
if (!pMainWnd)
return NULL;
// If main window is a frame window, use normal methods...
if (pMainWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd)))
{
CWnd* pMessageBar = ((CFrameWnd*)pMainWnd)->GetMessageBar();
return DYNAMIC_DOWNCAST(CStatusBar, pMessageBar);
}
// otherwise traverse children to try and find the status bar...
else
return DYNAMIC_DOWNCAST(CStatusBar,
pMainWnd->GetDescendantWindow(AFX_IDW_STATUS_BAR));
}
}
示例7: ASSERT_VALID
//***********************************************************************************
void CBCGPVisualManagerVS2005::OnFillHighlightedArea (CDC* pDC, CRect rect,
CBrush* pBrush, CBCGPToolbarButton* pButton)
{
if (pButton != NULL &&
(m_CurrAppTheme == WinXpTheme_Blue || m_CurrAppTheme == WinXpTheme_Olive))
{
ASSERT_VALID (pButton);
CBCGPToolbarMenuButton* pMenuButton =
DYNAMIC_DOWNCAST (CBCGPToolbarMenuButton, pButton);
BOOL bIsPopupMenu = pMenuButton != NULL &&
pMenuButton->GetParentWnd () != NULL &&
pMenuButton->GetParentWnd ()->IsKindOf (RUNTIME_CLASS (CBCGPPopupMenuBar));
if (bIsPopupMenu &&
(pButton->m_nStyle & TBBS_CHECKED) &&
pBrush == &m_brHighlightDn)
{
if (CBCGPToolBarImages::m_bIsDrawOnGlass)
{
CBCGPDrawManager dm (*pDC);
dm.DrawRect (rect, m_clrBarBkgnd, (COLORREF)-1);
}
else
{
pDC->FillRect (rect, &m_brMenuItemCheckedHighlight);
}
return;
}
if (pMenuButton != NULL && !bIsPopupMenu && pMenuButton->IsDroppedDown ())
{
if (CBCGPToolBarImages::m_bIsDrawOnGlass)
{
CBCGPDrawManager dm (*pDC);
dm.DrawRect (rect, m_clrBarBkgnd, (COLORREF)-1);
}
else
{
pDC->FillRect (rect, &m_brMenuButtonDroppedDown);
}
return;
}
}
CBCGPVisualManager2003::OnFillHighlightedArea (pDC, rect, pBrush, pButton);
}
示例8: DYNAMIC_DOWNCAST
BOOL CPackagesPage::OnSetActive()
{
CTeXSetupWizard *sheet = DYNAMIC_DOWNCAST(CTeXSetupWizard, GetParent());
if (sheet != 0) {
if (m_pageNext != 0) {
sheet->RemovePage(m_pageNext);
m_pageNext = 0;
}
sheet->SetWizardButtons (PSWIZB_BACK | PSWIZB_NEXT);
switch (g_eInstallType) {
case INSTALL_FULL:
// FIXME: Selection based on current / default scheme.
SelectDefault(g_vSourceTPM);
break;
case INSTALL_MAINTENANCE:
// If some package was given select it and jump to the next dialog
if (! g_sPackage.IsEmpty()) {
TPM *tpm = PackageLookup(g_sPackage);
if (tpm != 0) {
tpm->Select();
}
else {
theLog("Warning: `--add-package=%s' required, but package not found!\n",
g_sPackage);
}
}
break;
case INSTALL_UNINSTALL:
break;
}
}
m_cPackages.UpdateStateImage(m_cPackages.GetRootItem());
m_bInstallDocumentation = g_bInstallDocumentation;
m_bInstallSource = g_bInstallSource;
UpdateData(FALSE);
int nRet = CPropertyPage::OnSetActive();
if (g_bQuickInstall) {
// sheet->PressButton(PSBTN_NEXT);
GdiFlush();
PostMessage(WM_NEXTPAGE);
}
return nRet;
}
示例9: DYNAMIC_DOWNCAST
CBCGPOleCntrFrameWnd::~CBCGPOleCntrFrameWnd()
{
POSITION pos = NULL;
for (pos = m_dockManager.m_lstMiniFrames.GetHeadPosition (); pos != NULL;)
{
CBCGPMiniFrameWnd* pNextFrame = DYNAMIC_DOWNCAST (CBCGPMiniFrameWnd,
m_dockManager.m_lstMiniFrames.GetNext (pos));
if (pNextFrame != NULL)
{
pNextFrame->DestroyWindow ();
}
}
CList<HWND, HWND> lstChildren;
CWnd* pNextWnd = GetTopWindow ();
while (pNextWnd != NULL)
{
lstChildren.AddTail (pNextWnd->m_hWnd);
pNextWnd = pNextWnd->GetNextWindow ();
}
for (pos = lstChildren.GetHeadPosition (); pos != NULL;)
{
HWND hwndNext = lstChildren.GetNext (pos);
if (IsWindow (hwndNext) && ::GetParent (hwndNext) == m_hWnd)
{
::DestroyWindow (hwndNext);
}
}
const CObList& list = CBCGPToolBar::GetAllToolbars ();
CObList& gAllToolbars = const_cast<CObList&>(list);
for (pos = gAllToolbars.GetHeadPosition (); pos != NULL;)
{
POSITION posSave = pos;
CBCGPToolBar* pToolBar = (CBCGPToolBar*) gAllToolbars.GetNext (pos);
ASSERT (pToolBar != NULL);
if (CWnd::FromHandlePermanent (pToolBar->m_hWnd) == NULL)
{
gAllToolbars.RemoveAt (posSave);
}
}
}
示例10: DYNAMIC_DOWNCAST
void CMainFrame::OnTerrainBrushSize2Spin( NMHDR* pNMHDR, LRESULT* pResult )
{
NMXTPUPDOWN* tagNMCONTROL = (NMXTPUPDOWN*)pNMHDR;
CXTPControlEdit* pControl = DYNAMIC_DOWNCAST(CXTPControlEdit, tagNMCONTROL->pControl);
if (pControl)
{
String strHeight = Utility::UnicodeToEngine(pControl->GetEditText());
float height = Ogre::StringConverter::parseReal(strHeight) + tagNMCONTROL->iDelta;
ManipulatorSystem.GetTerrain().SetSquareBrushHeight(height);
std::wstring strNewHeight = Utility::EngineToUnicode(Ogre::StringConverter::toString(height));
pControl->SetEditText(strNewHeight.c_str());
}
*pResult = 1;
}
示例11: CreateWidgets
void CGUIEditor::CreateDocView(UINT xRes, UINT yRes)
{
CreateWidgets();
CGUIEditorDoc *createDoc;
// create blank document, with frame
createDoc = DYNAMIC_DOWNCAST(CGUIEditorDoc, m_DocTemplate->OpenDocumentFile(NULL));
createDoc->SetToolbar(&m_TabBar);
createDoc->NewGUISystem(xRes, yRes);
SIZEDATA sd;
sd.m_fXSize = (float)xRes;
sd.m_fYSize = (float)yRes;
static DWORD msgHash_SetSize = CHashString(_T("SetSize")).GetUniqueID();
m_ToolBox->SendMessage(msgHash_SetSize, sizeof(SIZEDATA), &sd, &CHashString(_T("WorkingCanvas")), &CHashString(_T("CGUIBackground")));
}
示例12: DYNAMIC_DOWNCAST
void CUIControler::updateTestAtRibbonCombo( CTest* pTest )
{
CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
CMFCRibbonComboBox* pAnalyseTestsCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox,pMainFrame->GetRibbonBar()->FindByID(WM_ANALYSIS_TEST_SELECT));
DWORD_PTR dwPtr=(DWORD_PTR)pTest;
pAnalyseTestsCombo->DeleteItem(dwPtr);
CString dispName=CCommonUtilities::toMFCString(pTest->getName())+_T("[")+\
CCommonUtilities::toMFCString(pTest->getDescription())+_T("]");
pAnalyseTestsCombo->AddItem(CCommonUtilities::toMFCString(dispName),(DWORD_PTR)pTest);
}
示例13: DYNAMIC_DOWNCAST
void CMainFrame::SetAddress(LPCTSTR lpszUrl)
{
// This is called when the browser has completely loaded the new location,
// so make sure the text in the address bar is up to date and stop the
// animation.
CBCGPToolbarComboBoxButton* pAdress = DYNAMIC_DOWNCAST (CBCGPToolbarComboBoxButton,
m_wndAddressBar.GetButton (m_wndAddressBar.CommandToIndex (IDC_ADDRESS)));
if (pAdress != NULL)
{
ASSERT_VALID (pAdress);
pAdress->SetText (lpszUrl);
}
// m_wndAnimate.Stop();
}
示例14: DYNAMIC_DOWNCAST
BOOL CBCGPIE7DemoApp::SaveAllModified()
{
if (!CWinApp::SaveAllModified ())
{
return FALSE;
}
CBCGPMDIFrameWnd* pMainFrame =
DYNAMIC_DOWNCAST (CBCGPMDIFrameWnd, m_pMainWnd);
if (pMainFrame != NULL)
{
pMainFrame->SaveMDIState (GetRegSectionPath ());
}
return TRUE;
}
示例15: ASSERT_VALID
//****************************************************************************************
void CBCGPToolBox::OnActivatePage (int /*nPage*/)
{
ASSERT_VALID (this);
CBCGPOutlookWnd* pOlWnd = DYNAMIC_DOWNCAST (CBCGPOutlookWnd, GetTabWnd ());
ASSERT_VALID (pOlWnd);
CBCGPToolBoxPage* pPage = GetPage (GetActivePage ());
if (pPage == NULL)
{
ASSERT (FALSE);
return;
}
pOlWnd->EnableScrollButtons (TRUE, pPage->m_nVertScrollOffset > 0, pPage->m_nVertScrollSize > 0);
}