int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndToolBar.Create(this) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } if( !CreateStyleBar() ) { TRACE0("Failed to create brush toolbar\n"); return -1; // fail to create } if( !CreateGroupBar() ) { TRACE0("Failed to create group toolbar\n"); return -1; // fail to create } // CHANGE! 04/03/97 John Moore if( !CreateTabBar() ) { TRACE0("Failed to create tab bar\n"); return -1; } // End of CHANGE if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } UINT pane_id; UINT pane_style; int pane_width; m_wndStatusBar.GetPaneInfo( ID_SLOCK_PANE, pane_id, pane_style, pane_width ); m_wndStatusBar.SetPaneInfo( ID_SLOCK_PANE, pane_id, pane_style, 40); m_wndStatusBar.GetPaneInfo( ID_SELINFO_PANE, pane_id, pane_style, pane_width ); m_wndStatusBar.SetPaneInfo( ID_SELINFO_PANE, pane_id, pane_style, 200); m_wndStatusBar.GetPaneInfo( ID_WORLDPOS_PANE, pane_id, pane_style, pane_width ); m_wndStatusBar.SetPaneInfo( ID_WORLDPOS_PANE, pane_id, pane_style, 100); m_wndStatusBar.GetPaneInfo( ID_CURSORINFO_PANE, pane_id, pane_style, pane_width ); m_wndStatusBar.SetPaneInfo( ID_CURSORINFO_PANE, pane_id, pane_style, 100); m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndBrushToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndGroupBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndToolBar.SetWindowText( "General" ) ; m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); m_wndBrushToolBar.SetWindowText( "Mode" ) ; m_wndBrushToolBar.EnableDocking(CBRS_ALIGN_ANY); m_wndGroupBar.SetWindowText( "Group" ) ; m_wndGroupBar.EnableDocking(CBRS_ALIGN_ANY); m_wndTabBar.SetWindowText( "Command Panel" ) ; m_wndTabBar.EnableDocking( CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT ); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndTabBar, AFX_IDW_DOCKBAR_RIGHT); DockControlBar(&m_wndToolBar, AFX_IDW_DOCKBAR_TOP ); DockControlBarLeftOf(&m_wndBrushToolBar, &m_wndToolBar ); DockControlBarLeftOf(&m_wndGroupBar, &m_wndBrushToolBar ); m_CB_FUSION_BRUSH_FORMAT = RegisterClipboardFormat( "FUSIONBRUSHDATA" ); m_CB_FUSION_ENTITY_FORMAT = RegisterClipboardFormat( "FUSIONENTITYDATA" ); LoadBarState( "DESKTOP" ) ; return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; // enable Office 2007 look: CBCGPVisualManager2007::SetStyle (CBCGPVisualManager2007::VS2007_LunaBlue); CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPVisualManager2007)); CBCGPToolBar::EnableQuickCustomization (); // TODO: Define your own basic commands. Be sure, that each pulldown // menu have at least one basic command. if (!m_wndMenuBar.Create (this)) { TRACE0("Failed to create menubar\n"); return -1; // fail to create } m_wndMenuBar.SetBarStyle(m_wndMenuBar.GetBarStyle() | CBRS_SIZE_DYNAMIC); CClientDC dc (this); BOOL bIsHighColor = dc.GetDeviceCaps (BITSPIXEL) > 8; UINT uiToolbarHotID = bIsHighColor ? IDB_MAINFRAME_HC : 0; if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME, 0, 0, FALSE, 0, 0, uiToolbarHotID)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } uiToolbarHotID = bIsHighColor ? IDB_GANTT_HC : 0; if (!m_wndGanttToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1, 1, 1, 1), AFX_IDW_DIALOGBAR) || !m_wndGanttToolBar.LoadToolBar(IDR_GANTT, 0, 0, FALSE, 0, 0, uiToolbarHotID)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } CBCGPToolBar::AddToolBarForImageCollection (IDR_GANTT_DUMMY, bIsHighColor ? IDB_GANTT_DUMMY_HC : 0); if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } OnAppLook (m_nAppLook); CString strMainToolbarTitle; strMainToolbarTitle.LoadString (IDS_MAIN_TOOLBAR); m_wndToolBar.SetWindowText (strMainToolbarTitle); m_wndGanttToolBar.SetWindowText (_T("Gantt")); m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); m_wndGanttToolBar.EnableDocking(CBRS_ALIGN_ANY); //------------------------------------------------------------------ // Outlook bar will be created at left, so temporary disable docking // at the left side: //------------------------------------------------------------------ EnableDocking (CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM | CBRS_ALIGN_RIGHT); //---------------------------------------------------- // Outlook bar is created and docking on the left side // should be allowed. //---------------------------------------------------- EnableDocking (CBRS_ALIGN_LEFT); DockControlBar(&m_wndMenuBar); DockControlBar(&m_wndToolBar); DockControlBar(&m_wndGanttToolBar); DockControlBarLeftOf (&m_wndToolBar, &m_wndGanttToolBar); m_wndToolBar.EnableCustomizeButton (TRUE, ID_VIEW_CUSTOMIZE, _T("Customize...")); m_wndGanttToolBar.EnableCustomizeButton (TRUE, ID_VIEW_CUSTOMIZE, _T("Customize...")); return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; // main toolbar if (!m_wndToolBar.Create(this) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create main toolbar!\n"); return -1; // fail to create main toolbar } m_wndToolBar.SetWindowText(STR_TOOLBAR_MAIN); // edit mode bar if (!m_wndEditModeBar.Create(this, IDD_BAR_EDITMODE, CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR)) { TRACE0("Failed to create edit mode bar!\n"); return -1; // fail to create edit mode bar } m_wndEditModeBar.SetWindowText(STR_TOOLBAR_EDITMODE); // view mode bar if (!m_wndViewModeBar.Create(this, IDD_BAR_VIEWMODE, CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR)) { TRACE0("Failed to create view mode bar!\n"); return -1; // fail to create view mode bar } m_wndViewModeBar.SetWindowText(STR_TOOLBAR_VIEWMODE); // zoom bar if (!m_wndZoomBar.Create(this) || !m_wndZoomBar.LoadToolBar(IDR_ZOOMBAR)) { TRACE0("Failed to create zoom bar!\n"); return -1; // fail to create zoom bar } m_wndZoomBar.SetWindowText(STR_TOOLBAR_ZOOM); // toolbars bar if (!m_wndToolBarsBar.Create(this) || !m_wndToolBarsBar.LoadToolBar(IDR_TOOLBARS)) { TRACE0("Failed to create toolbars bar!\n"); return -1; // fail to create toolbars bar } m_wndToolBarsBar.SetWindowText(STR_TOOLBAR_TOOLBARS); // status bar if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar!\n"); return -1; // fail to create status bar } m_wndStatusBar.SetPaneStyle(0, SBPS_NORMAL); // tilepoints edit bar if (!m_wndTilesEditBar.Create(this, IDD_BAR_TILE, CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR)) { TRACE0("Failed to create tilepoints edit bar!\n"); return -1; // fail to create } m_wndTilesEditBar.SetWindowText(STR_TOOLBAR_TILEPOINT); // tilepoints toolbar if (!m_wndTilesEditToolBar.Create(this) || !m_wndTilesEditToolBar.LoadToolBar(IDR_TILESBAR)) { TRACE0("Failed to create tilepoints toolbar!\n"); return -1; // fail to create } m_wndTilesEditToolBar.SetWindowText(STR_TOOLBAR_TILETOOLS); // doodads edit bar if (!m_wndDoodsEditBar.Create(this, IDD_BAR_DOODADS, CBRS_ALIGN_RIGHT, AFX_IDW_DIALOGBAR)) { TRACE0("Failed to create doodads edit bar!\n"); return -1; // fail to create } m_wndDoodsEditBar.SetWindowText(STR_TOOLBAR_DOODAD); // doodads toolbar if (!m_wndDoodadsEditToolBar.Create(this) || !m_wndDoodadsEditToolBar.LoadToolBar(IDR_DOODADSBAR)) { TRACE0("Failed to create doodads toolbar!\n"); return -1; // fail to create } m_wndDoodadsEditToolBar.SetWindowText(STR_TOOLBAR_DOODTOOLS); // units edit bar if (!m_wndUnitsEditBar.Create(this, IDD_BAR_UNITS, CBRS_ALIGN_RIGHT, AFX_IDW_DIALOGBAR)) { TRACE0("Failed to create units edit bar!\n"); return -1; // fail to create } m_wndUnitsEditBar.SetWindowText(STR_TOOLBAR_UNIT); // path toolbar if (!m_wndPathEditBar.Create(this, IDD_BAR_PATHING, CBRS_ALIGN_RIGHT, AFX_IDW_DIALOGBAR)) { TRACE0("Failed to create path bar!\n"); return -1; // fail to create } m_wndPathEditBar.SetWindowText(STR_TOOLBAR_PATHTOOLS); // shadows toolbar if (!m_wndShadowsEditBar.Create(this) || !m_wndShadowsEditBar.LoadToolBar(IDR_SHADOWSBAR)) { TRACE0("Failed to create shadows toolbar!\n"); return -1; // fail to create } m_wndShadowsEditBar.SetWindowText(STR_TOOLBAR_SHADOWTOOLS); m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndEditModeBar.SetBarStyle(m_wndEditModeBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndViewModeBar.SetBarStyle(m_wndViewModeBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndZoomBar.SetBarStyle(m_wndZoomBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndToolBarsBar.SetBarStyle(m_wndToolBarsBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndTilesEditBar.SetBarStyle(m_wndTilesEditBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndDoodsEditBar.SetBarStyle(m_wndDoodsEditBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndUnitsEditBar.SetBarStyle(m_wndUnitsEditBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndPathEditBar.SetBarStyle(m_wndPathEditBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndTilesEditToolBar.SetBarStyle(m_wndPathEditBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndDoodadsEditToolBar.SetBarStyle(m_wndPathEditBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndShadowsEditBar.SetBarStyle(m_wndShadowsEditBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); m_wndEditModeBar.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM); m_wndViewModeBar.EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT); m_wndZoomBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBarsBar.EnableDocking(CBRS_ALIGN_ANY); m_wndTilesEditBar.EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT); m_wndDoodsEditBar.EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT); m_wndUnitsEditBar.EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT); m_wndPathEditBar.EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT); m_wndTilesEditToolBar.EnableDocking(CBRS_ALIGN_ANY); m_wndDoodadsEditToolBar.EnableDocking(CBRS_ALIGN_ANY); m_wndShadowsEditBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar, AFX_IDW_DOCKBAR_TOP); DockControlBarLeftOf((CToolBar*)&m_wndEditModeBar, &m_wndToolBar); DockControlBarLeftOf(&m_wndToolBarsBar, (CToolBar*)&m_wndEditModeBar); DockControlBarLeftOf(&m_wndZoomBar, &m_wndToolBarsBar); DockControlBar(&m_wndViewModeBar, AFX_IDW_DOCKBAR_RIGHT); DockControlBar(&m_wndTilesEditBar, AFX_IDW_DOCKBAR_RIGHT); // FloatControlBar(&m_wndTilesEditBar,CPoint(600, 100), CBRS_ALIGN_BOTTOM | CBRS_ALIGN_RIGHT ); DockControlBar(&m_wndTilesEditToolBar, AFX_IDW_DOCKBAR_LEFT); DockControlBar(&m_wndDoodadsEditToolBar, AFX_IDW_DOCKBAR_LEFT); FloatControlBar(&m_wndDoodsEditBar,CPoint(608, 100), CBRS_ALIGN_BOTTOM | CBRS_ALIGN_RIGHT ); FloatControlBar(&m_wndShadowsEditBar,CPoint(616, 100), CBRS_ALIGN_BOTTOM | CBRS_ALIGN_RIGHT ); FloatControlBar(&m_wndPathEditBar,CPoint(624, 100), CBRS_ALIGN_BOTTOM | CBRS_ALIGN_RIGHT ); FloatControlBar(&m_wndUnitsEditBar,CPoint(632, 100), CBRS_ALIGN_BOTTOM | CBRS_ALIGN_RIGHT ); ShowControlBar(&m_wndDoodsEditBar, false, false); ShowControlBar(&m_wndUnitsEditBar, false, false); ShowControlBar(&m_wndPathEditBar, false, false); ShowControlBar(&m_wndShadowsEditBar, false, false); ShowControlBar(&m_wndDoodadsEditToolBar, false, false); //set displayed mode to the default mode m_wndEditModeBar.UpdateEditMode(MODE_DEFAULT); // m_wndViewModeBar.UpdateEditMode(MODE_DEFAULT); //init TilePoint Edit toolbar m_wndTilesEditBar.InitDilaogBar(); m_wndDoodsEditBar.InitDialogBar(); m_wndPathEditBar.InitDialogBar(); SetPositionText(""); return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; // enable Office XP look: CBCGVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGVisualManagerXP)); // Load toolbar user images: if (!m_UserImages.Load (_T(".\\UserImages.bmp"))) { TRACE(_T("Failed to load user images\n")); ASSERT (FALSE); } else { CBCGToolBar::SetUserImages (&m_UserImages); } CBCGToolBar::EnableQuickCustomization (); EnableMDITabs (); if (!m_wndMenuBar.Create (this)) { TRACE0("Failed to create menubar\n"); return -1; // fail to create } m_wndMenuBar.SetBarStyle(m_wndMenuBar.GetBarStyle() | CBRS_SIZE_DYNAMIC); if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } if (!m_wndWorkSpace.Create (_T("Sprite"), this, CSize (228, 150), TRUE /* Has gripper */, ID_VIEW_WORKSPACE, WS_CHILD | WS_VISIBLE | CBRS_LEFT)) { TRACE0("Failed to create workspace bar\n"); return -1; // fail to create } if (!m_wndProperty.Create (_T("Properties"), this, CSize (228, 200), TRUE /* Has gripper */, ID_VIEW_PROPERTY, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM)) { TRACE0("Failed to create property bar\n"); return -1; // fail to create } if (!m_wndOutput.Create (_T("Output"), this, CSize (150, 150), TRUE /* Has gripper */, ID_VIEW_OUTPUT, WS_CHILD | CBRS_BOTTOM)) { TRACE0("Failed to create output bar\n"); return -1; // fail to create } CString strMainToolbarTitle; strMainToolbarTitle.LoadString (IDS_MAIN_TOOLBAR); m_wndToolBar.SetWindowText (strMainToolbarTitle); // TODO: Delete these three lines if you don't want the toolbar to // be dockable m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); m_wndWorkSpace.EnableDocking(CBRS_ALIGN_ANY); m_wndProperty.EnableDocking(CBRS_ALIGN_ANY); m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndMenuBar); DockControlBar(&m_wndToolBar); DockControlBar(&m_wndWorkSpace); DockControlBarLeftOf(&m_wndProperty, &m_wndWorkSpace); DockControlBar(&m_wndOutput); // Allow user-defined toolbars operations: InitUserToobars (NULL, uiFirstUserToolBarId, uiLastUserToolBarId); // Enable windows manager: EnableWindowsDialog (ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE); return 0; }