frame.cpp
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:19k
- // [!output MAIN_FRAME_IMPL] : implementation of the [!output MAIN_FRAME_CLASS] class
- //
- #include "stdafx.h"
- #include "[!output APP_HEADER]"
- #include "[!output MAIN_FRAME_HEADER]"
- [!if PROJECT_STYLE_EXPLORER]
- [!if APP_TYPE_SDI || APP_TYPE_MTLD]
- #include "[!output TREE_VIEW_HEADER]"
- #include "[!output VIEW_HEADER]"
- [!endif]
- [!endif]
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #endif
- // [!output MAIN_FRAME_CLASS]
- [!if APP_TYPE_MDI || !DOCVIEW]
- IMPLEMENT_DYNAMIC([!output MAIN_FRAME_CLASS], [!output MAIN_FRAME_BASE_CLASS])
- [!else]
- IMPLEMENT_DYNCREATE([!output MAIN_FRAME_CLASS], [!output MAIN_FRAME_BASE_CLASS])
- [!endif]
- BEGIN_MESSAGE_MAP([!output MAIN_FRAME_CLASS], [!output MAIN_FRAME_BASE_CLASS])
- [!if DOCKING_TOOLBAR || STATUS_BAR]
- ON_WM_CREATE()
- [!else]
- [!if APP_TYPE_SDI && !DOCVIEW]
- ON_WM_CREATE()
- [!endif]
- [!endif]
- [!if APP_TYPE_SDI]
- [!if !DOCVIEW]
- ON_WM_SETFOCUS()
- [!endif]
- [!endif]
- [!if APP_TYPE_MTLD]
- ON_COMMAND(ID_FILE_CLOSE, &[!output MAIN_FRAME_CLASS]::OnFileClose)
- [!endif]
- ON_WM_CLOSE()
- [!if MDITABS]
- ON_WM_DESTROY()
- [!endif]
- [!if CONTEXT_HELP]
- // Global help commands
- ON_COMMAND(ID_HELP_FINDER, &[!output MAIN_FRAME_BASE_CLASS]::OnHelpFinder)
- ON_COMMAND(ID_HELP, &[!output MAIN_FRAME_BASE_CLASS]::OnHelp)
- ON_COMMAND(ID_CONTEXT_HELP, &[!output MAIN_FRAME_BASE_CLASS]::OnContextHelp)
- ON_COMMAND(ID_DEFAULT_HELP, &[!output MAIN_FRAME_BASE_CLASS]::OnHelpFinder)
- [!endif]
- [!if PROJECT_STYLE_EXPLORER]
- [!if APP_TYPE_SDI || APP_TYPE_MTLD]
- [!if LIST_VIEW]
- ON_UPDATE_COMMAND_UI_RANGE(AFX_ID_VIEW_MINIMUM, AFX_ID_VIEW_MAXIMUM, &[!output MAIN_FRAME_CLASS]::OnUpdateViewStyles)
- ON_COMMAND_RANGE(AFX_ID_VIEW_MINIMUM, AFX_ID_VIEW_MAXIMUM, &[!output MAIN_FRAME_CLASS]::OnViewStyle)
- [!endif]
- [!endif]
- [!endif]
- [!if CUSTOMIZE]
- ON_COMMAND(XTP_ID_CUSTOMIZE, OnCustomize)
- [!if CUSTOMIZE_CUSTOM]
- ON_XTP_CREATECONTROL()
- [!endif]
- [!endif]
- [!if DOCK_PANE]
- ON_MESSAGE(XTPWM_DOCKINGPANE_NOTIFY, OnDockingPaneNotify)
- [!endif]
- END_MESSAGE_MAP()
- [!if STATUS_BAR]
- static UINT indicators[] =
- {
- ID_SEPARATOR, // status line indicator
- [!if DO_KANA]
- ID_INDICATOR_KANA,
- [!endif]
- ID_INDICATOR_CAPS,
- ID_INDICATOR_NUM,
- ID_INDICATOR_SCRL,
- };
- [!endif]
- [!if INTELLIGENT_MENUS]
- static UINT uHideCmds[] =
- {
- [!if APP_TYPE_MDI]
- ID_WINDOW_CASCADE,
- [!endif]
- ID_FILE_PRINT,
- ID_FILE_PRINT_PREVIEW,
- };
- [!endif]
- // [!output MAIN_FRAME_CLASS] construction/destruction
- [!output MAIN_FRAME_CLASS]::[!output MAIN_FRAME_CLASS]()
- {
- [!if ACCESSIBILITY]
- EnableActiveAccessibility();
- [!endif]
- // TODO: add member initialization code here
- }
- [!output MAIN_FRAME_CLASS]::~[!output MAIN_FRAME_CLASS]()
- {
- }
- [!if DOCKING_TOOLBAR || STATUS_BAR]
- int [!output MAIN_FRAME_CLASS]::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if ([!output MAIN_FRAME_BASE_CLASS]::OnCreate(lpCreateStruct) == -1)
- return -1;
- [!if APP_TYPE_SDI]
- [!if !DOCVIEW]
- // create a view to occupy the client area of the frame
- if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
- CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
- {
- TRACE0("Failed to create view windown");
- return -1;
- }
- [!endif]
- [!endif]
- [!if DOCKING_TOOLBAR]
- [!if TOOLBAR_STYLE_REBAR]
- if (!m_wndDlgBar.Create(this, IDR_MAINFRAME,
- CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR))
- {
- TRACE0("Failed to create dialogbarn");
- return -1; // fail to create
- }
- if (!m_wndReBar.Create(this) ||
- !m_wndReBar.AddBar(&m_wndDlgBar))
- {
- TRACE0("Failed to create rebarn");
- return -1; // fail to create
- }
- [!if CONTAINER || CONTAINER_SERVER]
- m_wndReBar.SetBarStyle(m_wndReBar.GetBarStyle() & ~CBRS_HIDE_INPLACE);
- [!endif]
- [!endif]
- [!endif]
- [!if STATUS_BAR]
- if (!m_wndStatusBar.Create(this) ||
- !m_wndStatusBar.SetIndicators(indicators,
- sizeof(indicators)/sizeof(UINT)))
- {
- TRACE0("Failed to create status barn");
- return -1; // fail to create
- }
- [!endif]
- [!if DOCKING_TOOLBAR]
- [!if TOOLBAR_STYLE_REBAR]
- [!if MINI_SERVER || FULL_SERVER || CONTAINER_SERVER]
- m_wndDlgBar.SetBarStyle(m_wndDlgBar.GetBarStyle() |
- CBRS_TOOLTIPS | CBRS_FLYBY);
- [!endif]
- [!else]
- // Initialize the command bars
- if (!InitCommandBars())
- return -1;
- // Get a pointer to the command bars object.
- CXTPCommandBars* pCommandBars = GetCommandBars();
- if(pCommandBars == NULL)
- {
- TRACE0("Failed to create command bars object.n");
- return -1; // fail to create
- }
- [!if MENUBAR]
- // Add the menu bar
- CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(
- [!if CUSTOMIZE_STATIC]
- _T("Menu Bar"), IDR_[!output SAFE_DOC_TYPE_NAME]TYPE);
- [!else]
- _T("Menu Bar"), IDR_MAINFRAME);
- [!endif]
- if(pMenuBar == NULL)
- {
- TRACE0("Failed to create menu bar.n");
- return -1; // fail to create
- }
- [!if !MDITABS]
- [!if APP_TYPE_MDI]
- pMenuBar->SetFlags(xtpFlagAddMDISysPopup);
- [!endif]
- [!else]
- pMenuBar->SetFlags(xtpFlagHideMinimizeBox | xtpFlagHideMaximizeBox);
- [!endif]
- [!if CUSTOMIZE_STATIC]
- pMenuBar->SetFlags(xtpFlagIgnoreSetMenuMessage);
- [!endif]
- [!endif]
- // Create ToolBar
- CXTPToolBar* pToolBar = (CXTPToolBar*)
- pCommandBars->Add(_T("Standard"), xtpBarTop);
- if (!pToolBar || !pToolBar->LoadToolBar(IDR_MAINFRAME))
- {
- TRACE0("Failed to create toolbarn");
- return -1;
- }
- [!endif]
- [!endif]
- [!if THEME_OFFICEXP]
- // Set Office XP Theme
- CXTPPaintManager::SetTheme(xtpThemeOfficeXP);
- [!endif]
- [!if THEME_OFFICE2000]
- // Set Office 2000 Theme
- CXTPPaintManager::SetTheme(xtpThemeOffice2000);
- [!endif]
- [!if THEME_OFFICE2003]
- // Set Office 2003 Theme
- [!if DISABLELUNACOLORS]
- XTPColorManager()->DisableLunaColors(TRUE);
- [!endif]
- CXTPPaintManager::SetTheme(xtpThemeOffice2003);
- [!endif]
- [!if THEME_NATIVEWINXP]
- // Set Windows XP Theme
- CXTPPaintManager::SetTheme(xtpThemeNativeWinXP);
- [!endif]
- [!if INTELLIGENT_MENUS]
- // Hide array of commands
- pCommandBars->HideCommands(uHideCmds, _countof(uHideCmds));
- // Set "Always Show Full Menus" option to the FALSE
- pCommandBars->GetCommandBarsOptions()->bAlwaysShowFullMenus = FALSE;
- [!endif]
- [!if CUSTOMIZE]
- pCommandBars->GetShortcutManager()->SetAccelerators(IDR_MAINFRAME);
- [!endif]
- // Load the previous state for toolbars and menus.
- LoadCommandBars(_T("CommandBars"));
- [!if !CUSTOMIZE]
- pCommandBars->GetCommandBarsOptions()->bShowExpandButtonAlways = FALSE;
- [!endif]
- [!if MDITABS]
- VERIFY(m_MTIClientWnd.Attach(this));
- [!endif]
- [!if DOCK_PANE]
- // Initialize the docking pane manager and set the
- // initial them for the docking panes. Do this only after all
- // control bars objects have been created and docked.
- m_paneManager.InstallDockingPanes(this);
- [!if THEME_OFFICEXP]
- // Set Visual Studio .NET / Office XP Theme
- m_paneManager.SetTheme(xtpPaneThemeOffice);
- [!endif]
- [!if THEME_OFFICE2000]
- // Set Office 2000 Theme
- m_paneManager.SetTheme(xtpPaneThemeDefault);
- [!endif]
- [!if THEME_OFFICE2003]
- // Set Office 2003 Theme
- m_paneManager.SetTheme(xtpPaneThemeOffice2003);
- [!endif]
- [!if THEME_NATIVEWINXP]
- // Set Windows XP Theme
- m_paneManager.SetTheme(xtpPaneThemeNativeWinXP);
- [!endif]
- // Create docking panes.
- CXTPDockingPane* pwndPane1 = m_paneManager.CreatePane(
- IDR_PANE_OPTIONS, CRect(0, 0,200, 120), xtpPaneDockLeft);
- CXTPDockingPane* pwndPane2 = m_paneManager.CreatePane(
- IDR_PANE_PROPERTIES, CRect(0, 0,200, 120), xtpPaneDockBottom, pwndPane1);
- // Set the icons for the docking pane tabs.
- int nIDIcons[] = {IDR_PANE_OPTIONS, IDR_PANE_PROPERTIES};
- m_paneManager.SetIcons(IDB_BITMAP_ICONS, nIDIcons,
- _countof(nIDIcons), RGB(0, 255, 0));
- // Load the previous state for docking panes.
- CXTPDockingPaneLayout layoutNormal(&m_paneManager);
- if (layoutNormal.Load(_T("NormalLayout")))
- {
- m_paneManager.SetLayout(&layoutNormal);
- }
- [!endif]
- return 0;
- }
- [!else]
- [!if APP_TYPE_SDI && !DOCVIEW]
- int [!output MAIN_FRAME_CLASS]::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if ([!output MAIN_FRAME_BASE_CLASS]::OnCreate(lpCreateStruct) == -1)
- return -1;
- // create a view to occupy the client area of the frame
- if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
- CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
- {
- TRACE0("Failed to create view windown");
- return -1;
- }
- return 0;
- }
- [!endif]
- [!endif]
- [!if SPLITTER || PROJECT_STYLE_EXPLORER]
- [!if APP_TYPE_SDI || APP_TYPE_MTLD]
- BOOL [!output MAIN_FRAME_CLASS]::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
- CCreateContext* pContext)
- {
- [!if PROJECT_STYLE_EXPLORER]
- // create splitter window
- if (!m_wndSplitter.CreateStatic(this, 1, 2))
- return FALSE;
- if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS([!output TREE_VIEW_CLASS]), CSize(100, 100), pContext) ||
- !m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS([!output VIEW_CLASS]), CSize(100, 100), pContext))
- {
- m_wndSplitter.DestroyWindow();
- return FALSE;
- }
- return TRUE;
- [!else]
- [!if HTML_VIEW || HTML_EDITVIEW]
- return m_wndSplitter.Create(this,
- 2, 2, // TODO: adjust the number of rows, columns
- CSize(10, 10), // TODO: adjust the minimum pane size
- pContext, WS_CHILD | WS_VISIBLE | SPLS_DYNAMIC_SPLIT);
- [!else]
- return m_wndSplitter.Create(this,
- 2, 2, // TODO: adjust the number of rows, columns
- CSize(10, 10), // TODO: adjust the minimum pane size
- pContext);
- [!endif]
- [!endif]
- }
- [!endif]
- [!endif]
- BOOL [!output MAIN_FRAME_CLASS]::PreCreateWindow(CREATESTRUCT& cs)
- {
- if( ![!output MAIN_FRAME_BASE_CLASS]::PreCreateWindow(cs) )
- return FALSE;
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- [!if !MAIN_FRAME_DEFAULT_STYLES]
- cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
- [!output MAIN_FRAME_STYLE_FLAGS];
- [!endif]
- [!if APP_TYPE_SDI]
- [!if !DOCVIEW]
- cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
- cs.lpszClass = AfxRegisterWndClass(0);
- [!endif]
- [!if DOCK_PANE]
- cs.style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
- [!endif]
- [!endif]
- return TRUE;
- }
- // [!output MAIN_FRAME_CLASS] diagnostics
- #ifdef _DEBUG
- void [!output MAIN_FRAME_CLASS]::AssertValid() const
- {
- [!output MAIN_FRAME_BASE_CLASS]::AssertValid();
- }
- void [!output MAIN_FRAME_CLASS]::Dump(CDumpContext& dc) const
- {
- [!output MAIN_FRAME_BASE_CLASS]::Dump(dc);
- }
- #endif //_DEBUG
- // [!output MAIN_FRAME_CLASS] message handlers
- [!if APP_TYPE_SDI]
- [!if !DOCVIEW]
- void [!output MAIN_FRAME_CLASS]::OnSetFocus(CWnd* /*pOldWnd*/)
- {
- // forward focus to the view window
- m_wndView.SetFocus();
- }
- BOOL [!output MAIN_FRAME_CLASS]::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
- {
- // let the view have first crack at the command
- if (m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
- return TRUE;
- // otherwise, do default handling
- return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
- }
- [!endif]
- [!endif]
- [!if APP_TYPE_SDI || APP_TYPE_MTLD]
- [!if PROJECT_STYLE_EXPLORER]
- [!if LIST_VIEW]
- [!output VIEW_CLASS]* [!output MAIN_FRAME_CLASS]::GetRightPane()
- {
- CWnd* pWnd = m_wndSplitter.GetPane(0, 1);
- [!output VIEW_CLASS]* pView = DYNAMIC_DOWNCAST([!output VIEW_CLASS], pWnd);
- return pView;
- }
- void [!output MAIN_FRAME_CLASS]::OnUpdateViewStyles(CCmdUI* pCmdUI)
- {
- // TODO: customize or extend this code to handle choices on the View menu
- [!output VIEW_CLASS]* pView = GetRightPane();
- // if the right-hand pane hasn't been created or isn't a view,
- // disable commands in our range
- if (pView == NULL)
- pCmdUI->Enable(FALSE);
- else
- {
- DWORD dwStyle = pView->GetStyle() & LVS_TYPEMASK;
- // if the command is ID_VIEW_LINEUP, only enable command
- // when we're in LVS_ICON or LVS_SMALLICON mode
- if (pCmdUI->m_nID == ID_VIEW_LINEUP)
- {
- if (dwStyle == LVS_ICON || dwStyle == LVS_SMALLICON)
- pCmdUI->Enable();
- else
- pCmdUI->Enable(FALSE);
- }
- else
- {
- // otherwise, use dots to reflect the style of the view
- pCmdUI->Enable();
- BOOL bChecked = FALSE;
- switch (pCmdUI->m_nID)
- {
- case ID_VIEW_DETAILS:
- bChecked = (dwStyle == LVS_REPORT);
- break;
- case ID_VIEW_SMALLICON:
- bChecked = (dwStyle == LVS_SMALLICON);
- break;
- case ID_VIEW_LARGEICON:
- bChecked = (dwStyle == LVS_ICON);
- break;
- case ID_VIEW_LIST:
- bChecked = (dwStyle == LVS_LIST);
- break;
- default:
- bChecked = FALSE;
- break;
- }
- pCmdUI->SetRadio(bChecked ? 1 : 0);
- }
- }
- }
- void [!output MAIN_FRAME_CLASS]::OnViewStyle(UINT nCommandID)
- {
- // TODO: customize or extend this code to handle choices on the View menu
- [!output VIEW_CLASS]* pView = GetRightPane();
- // if the right-hand pane has been created and is a [!output VIEW_CLASS],
- // process the menu commands...
- if (pView != NULL)
- {
- DWORD dwStyle = -1;
- switch (nCommandID)
- {
- case ID_VIEW_LINEUP:
- {
- // ask the list control to snap to grid
- CListCtrl& refListCtrl = pView->GetListCtrl();
- refListCtrl.Arrange(LVA_SNAPTOGRID);
- }
- break;
- // other commands change the style on the list control
- case ID_VIEW_DETAILS:
- dwStyle = LVS_REPORT;
- break;
- case ID_VIEW_SMALLICON:
- dwStyle = LVS_SMALLICON;
- break;
- case ID_VIEW_LARGEICON:
- dwStyle = LVS_ICON;
- break;
- case ID_VIEW_LIST:
- dwStyle = LVS_LIST;
- break;
- }
- // change the style; window will repaint automatically
- if (dwStyle != -1)
- pView->ModifyStyle(LVS_TYPEMASK, dwStyle);
- }
- }
- [!endif]
- [!endif]
- [!endif]
- [!if APP_TYPE_MTLD]
- BOOL [!output MAIN_FRAME_CLASS]::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext)
- {
- // base class does the real work
- if (!CFrameWnd::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext))
- {
- return FALSE;
- }
- CWinApp* pApp = AfxGetApp();
- if (pApp->m_pMainWnd == NULL)
- pApp->m_pMainWnd = this;
- // replace Exit option on File menu with Close for secondary windows
- if (AfxGetApp()->m_pMainWnd != this)
- {
- // Find the File/Exit control nested deep in the command bar hierarchy
- CXTPControl *pAppExitControl = GetCommandBars()->FindControl(xtpControlButton, ID_APP_EXIT, TRUE, TRUE);
-
- // If File/Exit was found, change its name/behavior to File/Close
- if (pAppExitControl)
- {
- // Change its ID and caption to that of File/Close
- pAppExitControl->SetID(ID_FILE_CLOSE);
- pAppExitControl->SetCaption(_T("&Close"));
- }
- }
- return TRUE;
- }
- void [!output MAIN_FRAME_CLASS]::OnFileClose()
- {
- DestroyWindow();
- }
- [!endif]
- void [!output MAIN_FRAME_CLASS]::OnClose()
- {
- [!if !DOCVIEW && APP_TYPE_MTLD]
- [!output APP_CLASS] *pApp = reinterpret_cast<[!output APP_CLASS]*>(AfxGetApp());
- // main window is being closed so cleanup
- if (pApp->m_pMainWnd == this)
- {
- for (int iCntr=0; iCntr < pApp->m_aryFrames.GetSize(); iCntr++)
- {
- HWND hFrame = pApp->m_aryFrames.GetAt(iCntr);
- if (::IsWindow(hFrame))
- ::SendMessage(hFrame, WM_CLOSE, 0, 0);
- }
- }
- [!endif]
- // Save the current state for toolbars and menus.
- SaveCommandBars(_T("CommandBars"));
- [!if DOCK_PANE]
- // Save the current state for docking panes.
- CXTPDockingPaneLayout layoutNormal(&m_paneManager);
- m_paneManager.GetLayout(&layoutNormal);
- layoutNormal.Save(_T("NormalLayout"));
- [!endif]
- [!output MAIN_FRAME_BASE_CLASS]::OnClose();
- }
- [!if CUSTOMIZE]
- void [!output MAIN_FRAME_CLASS]::OnCustomize()
- {
- // Get a pointer to the command bars object.
- CXTPCommandBars* pCommandBars = GetCommandBars();
- if(pCommandBars != NULL)
- {
- // Instanciate the customize dialog object.
- CXTPCustomizeSheet dlg(pCommandBars);
- // Add the keyboard page to the customize dialog.
- CXTPCustomizeKeyboardPage pageKeyboard(&dlg);
- dlg.AddPage(&pageKeyboard);
- [!if !APP_TYPE_MDI || CUSTOMIZE_CUSTOM]
- pageKeyboard.AddCategories(IDR_MAINFRAME);
- [!else]
- pageKeyboard.AddCategories(IDR_[!output SAFE_DOC_TYPE_NAME]TYPE);
- [!endif]
- // Add the options page to the customize dialog.
- CXTPCustomizeOptionsPage pageOptions(&dlg);
- dlg.AddPage(&pageOptions);
- // Add the commands page to the customize dialog.
- CXTPCustomizeCommandsPage* pCommands = dlg.GetCommandsPage();
- [!if !APP_TYPE_MDI || CUSTOMIZE_CUSTOM]
- pCommands->AddCategories(IDR_MAINFRAME);
- [!else]
- pCommands->AddCategories(IDR_[!output SAFE_DOC_TYPE_NAME]TYPE);
- [!endif]
- // Use the command bar manager to initialize the
- // customize dialog.
- pCommands->InsertAllCommandsCategory();
- [!if !APP_TYPE_MDI || CUSTOMIZE_CUSTOM]
- pCommands->InsertBuiltInMenus(IDR_MAINFRAME);
- [!else]
- pCommands->InsertBuiltInMenus(IDR_[!output SAFE_DOC_TYPE_NAME]TYPE);
- [!endif]
- pCommands->InsertNewMenuCategory();
- // Dispaly the dialog.
- dlg.DoModal();
- }
- }
- [!if CUSTOMIZE_CUSTOM]
- int [!output MAIN_FRAME_CLASS]::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl)
- {
- CXTPMenuBar* pMenuBar = DYNAMIC_DOWNCAST(CXTPMenuBar, lpCreateControl->pCommandBar);
- if (pMenuBar)
- {
- ASSERT(lpCreateControl->pMenu);
- CMenu* pPopupMenu = lpCreateControl->pMenu->GetSubMenu(lpCreateControl->nIndex);
- if (lpCreateControl->strCaption == _T("&Window"))
- {
- CXTPControlPopup* pControlPopup = CXTPControlPopup::CreateControlPopup(xtpControlPopup);
- // Exclude only IDR_MAINFRAME template
- pControlPopup->ExcludeDocTemplate(IDR_MAINFRAME);
- pControlPopup->SetCommandBar(pPopupMenu);
- lpCreateControl->pControl = pControlPopup;
- return TRUE;
- }
- if (lpCreateControl->strCaption == _T("&Edit"))
- {
- CXTPControlPopup* pControlPopup = CXTPControlPopup::CreateControlPopup(xtpControlPopup);
- // Present only in IDR_RRRTYPE template
- pControlPopup->AssignDocTemplate(IDR_[!output SAFE_DOC_TYPE_NAME]TYPE);
- pControlPopup->SetCommandBar(pPopupMenu);
- lpCreateControl->pControl = pControlPopup;
- return TRUE;
- }
- }
- return FALSE;
- }
- [!endif]
- [!endif]
- [!if DOCK_PANE]
- LRESULT [!output MAIN_FRAME_CLASS]::OnDockingPaneNotify(WPARAM wParam, LPARAM lParam)
- {
- if (wParam == XTP_DPN_SHOWWINDOW)
- {
- CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;
- if (!pPane->IsValid())
- {
- switch (pPane->GetID())
- {
- case IDR_PANE_PROPERTIES:
- {
- if (m_wndProperties.GetSafeHwnd() == 0)
- {
- m_wndProperties.Create(WS_CHILD|
- ES_AUTOVSCROLL|ES_MULTILINE,
- CRect(0, 0, 0, 0), this, 0);
- }
- pPane->Attach(&m_wndProperties);
- break;
- }
- case IDR_PANE_OPTIONS:
- {
- if (m_wndOptions.GetSafeHwnd() == 0)
- {
- m_wndOptions.Create(_T("nnOptions"),
- WS_CHILD|WS_CLIPCHILDREN|
- WS_CLIPSIBLINGS|SS_CENTER,
- CRect(0, 0, 0, 0), this, 0);
- }
- pPane->Attach(&m_wndOptions);
- break;
- }
- }
- }
- return TRUE;
- }
- return FALSE;
- }
- [!endif]
- [!if MDITABS]
- void [!output MAIN_FRAME_CLASS]::OnDestroy()
- {
- [!output MAIN_FRAME_BASE_CLASS]::OnDestroy();
- m_MTIClientWnd.Detach();
- }
- [!endif]