void CMainFrame::OnViewToolBar(UINT uNotifyCode, int nID, CWindow wndCtl) { static BOOL bVisible = TRUE; // initially visible bVisible = !bVisible; CReBarCtrl rebar = m_hWndToolBar; int nBandIndex = rebar.IdToIndex(ATL_IDW_BAND_FIRST + 1); // toolbar is 2nd added band rebar.ShowBand(nBandIndex, bVisible); UISetCheck(ID_VIEW_TOOLBAR, bVisible); UpdateLayout(); }
LRESULT CMainFrame::OnViewToolBar(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { static BOOL bVisible = TRUE; // initially visible bVisible = !bVisible; CReBarCtrl rebar = m_hWndToolBar; int nBandIndex = rebar.IdToIndex(ATL_IDW_BAND_FIRST + 1); // toolbar is 2nd added band rebar.ShowBand(nBandIndex, bVisible); UISetCheck(ID_VIEW_TOOLBAR, bVisible); UpdateLayout(); return 0; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); CReBarCtrl bar = m_hWndToolBar; int nBandIndex = bar.IdToIndex(ATL_IDW_BAND_FIRST + 1); // toolbar is 2nd added band bar.ShowBand(nBandIndex, FALSE); ::ShowWindow(m_hWndStatusBar, SW_HIDE); UpdateLayout(); m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 0); UISetCheck(ID_VIEW_STATUS_BAR, 0); UISetCheck(ID_VIEW_SHOWBALLVECTORS, m_simcontrol.GetShowVectors()); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); m_simcontrol.SetView(&m_view); m_simcontrol.Init(); SetTimer(TIMER_FRAME, 10); return 0; }