1 ////////////////////////////////////////////////////
\r
5 #include "resource.h"
\r
6 #include "ContainerApp.h"
\r
10 // Definitions for the CMainFrame class
\r
11 CMainFrame::CMainFrame()
\r
13 // Constructor for CMainFrame. Its called after CFrame's constructor
\r
15 //Set m_DockView as the view window of the frame
\r
16 SetView(m_DockView);
\r
18 // Set the registry key name, and load the initial window position
\r
19 // Use a registry key name like "CompanyName\\Application"
\r
20 LoadRegistrySettings(_T("Win32++\\DockContainer"));
\r
23 CMainFrame::~CMainFrame()
\r
25 // Destructor for CMainFrame.
\r
28 BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
\r
30 UNREFERENCED_PARAMETER(lParam);
\r
32 // OnCommand responds to menu and and toolbar input
\r
33 switch(LOWORD(wParam))
\r
36 // End the application
\r
37 ::PostMessage(m_hWnd, WM_CLOSE, 0, 0);
\r
39 case IDM_DOCK_DEFAULT:
\r
40 m_DockView.CloseAllDockers();
\r
41 LoadDefaultDockers();
\r
43 case IDM_DOCK_CLOSEALL:
\r
44 m_DockView.CloseAllDockers();
\r
46 case IDW_VIEW_STATUSBAR:
\r
49 case IDW_VIEW_TOOLBAR:
\r
52 case IDM_HELP_ABOUT:
\r
53 // Display the help dialog
\r
61 void CMainFrame::OnCreate()
\r
63 // OnCreate controls the way the frame is created.
\r
64 // Overriding CFrame::Oncreate is optional.
\r
65 // The default for the following variables is TRUE
\r
67 // m_bShowIndicatorStatus = FALSE; // Don't show statusbar indicators
\r
68 // m_bShowMenuStatus = FALSE; // Don't show toolbar or menu status
\r
69 // m_bUseReBar = FALSE; // Don't use rebars
\r
70 // m_bUseThemes = FALSE; // Don't use themes
\r
71 // m_bUseToolBar = FALSE; // Don't use a toolbar
\r
73 // call the base class function
\r
77 void CMainFrame::OnInitialUpdate()
\r
79 m_DockView.SetDockStyle(DS_CLIENTEDGE);
\r
81 // Load dock settings
\r
82 if (!m_DockView.LoadRegistrySettings(GetRegistryKeyName()))
\r
83 LoadDefaultDockers();
\r
85 // PreCreate initially set the window as invisible, so show it now.
\r
89 void CMainFrame::LoadDefaultDockers()
\r
91 // Note: The DockIDs are used for saving/restoring the dockers state in the registry
\r
93 DWORD dwStyle = DS_CLIENTEDGE; // The style added to each docker
\r
95 // Add the parent dockers
\r
96 CDocker* pDockRight = m_DockView.AddDockedChild(new CDockClasses, DS_DOCKED_RIGHT | dwStyle, 200, ID_DOCK_CLASSES1);
\r
97 CDocker* pDockBottom = m_DockView.AddDockedChild(new CDockText, DS_DOCKED_BOTTOM | dwStyle, 100, ID_DOCK_TEXT1);
\r
99 // Add the remaining dockers
\r
100 pDockRight->AddDockedChild(new CDockFiles, DS_DOCKED_CONTAINER | dwStyle, 200, ID_DOCK_FILES1);
\r
101 pDockRight->AddDockedChild(new CDockClasses, DS_DOCKED_CONTAINER | dwStyle, 200, ID_DOCK_CLASSES2);
\r
102 pDockRight->AddDockedChild(new CDockFiles, DS_DOCKED_CONTAINER | dwStyle, 200, ID_DOCK_FILES2);
\r
104 pDockBottom->AddDockedChild(new CDockOutput, DS_DOCKED_CONTAINER | dwStyle, 100, ID_DOCK_OUTPUT1);
\r
105 pDockBottom->AddDockedChild(new CDockText, DS_DOCKED_CONTAINER | dwStyle, 100, ID_DOCK_TEXT2);
\r
106 pDockBottom->AddDockedChild(new CDockOutput, DS_DOCKED_CONTAINER | dwStyle, 100, ID_DOCK_OUTPUT2);
\r
109 void CMainFrame::PreCreate(CREATESTRUCT &cs)
\r
111 // Call the base class function first
\r
112 CFrame::PreCreate(cs);
\r
114 // Hide the window initially by removing the WS_VISIBLE style
\r
115 cs.style &= ~WS_VISIBLE;
\r
118 BOOL CMainFrame::SaveRegistrySettings()
\r
120 if (CFrame::SaveRegistrySettings())
\r
121 return m_DockView.SaveRegistrySettings(GetRegistryKeyName());
\r
126 void CMainFrame::SetupToolBar()
\r
128 // Set the Resource IDs for the toolbar buttons
\r
129 AddToolBarButton( IDM_FILE_NEW, FALSE );
\r
130 AddToolBarButton( IDM_FILE_OPEN, FALSE );
\r
131 AddToolBarButton( IDM_FILE_SAVE, FALSE );
\r
133 AddToolBarButton( 0 ); // Separator
\r
134 AddToolBarButton( IDM_EDIT_CUT, FALSE );
\r
135 AddToolBarButton( IDM_EDIT_COPY, FALSE );
\r
136 AddToolBarButton( IDM_EDIT_PASTE, FALSE );
\r
138 AddToolBarButton( 0 ); // Separator
\r
139 AddToolBarButton( IDM_FILE_PRINT, FALSE );
\r
141 AddToolBarButton( 0 ); // Separator
\r
142 AddToolBarButton( IDM_HELP_ABOUT );
\r