1 ////////////////////////////////////////////////////
\r
7 #include "resource.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++\\Dock"));
\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
34 switch(LOWORD(wParam))
\r
37 // End the application
\r
38 ::PostMessage(m_hWnd, WM_CLOSE, 0, 0);
\r
40 case IDM_DOCK_DEFAULT:
\r
41 SetRedraw(FALSE); // Suppress drawing to the frame window
\r
42 m_DockView.CloseAllDockers();
\r
43 LoadDefaultDockers();
\r
44 SetRedraw(TRUE); // Re-enable drawing to the frame window
\r
45 RedrawWindow(0, 0, RDW_INVALIDATE|RDW_FRAME|RDW_UPDATENOW|RDW_ALLCHILDREN);
\r
47 case IDM_DOCK_CLOSEALL:
\r
48 m_DockView.CloseAllDockers();
\r
50 case IDW_VIEW_STATUSBAR:
\r
53 case IDW_VIEW_TOOLBAR:
\r
56 case IDM_HELP_ABOUT:
\r
57 // Display the help dialog
\r
65 void CMainFrame::OnCreate()
\r
67 // OnCreate controls the way the frame is created.
\r
68 // Overriding CFrame::Oncreate is optional.
\r
69 // The default for the following variables is TRUE
\r
71 // m_bShowIndicatorStatus = FALSE; // Don't show statusbar indicators
\r
72 // m_bShowMenuStatus = FALSE; // Don't show toolbar or menu status
\r
73 // m_bUseReBar = FALSE; // Don't use rebars
\r
74 // m_bUseThemes = FALSE; // Don't use themes
\r
75 // m_bUseToolBar = FALSE; // Don't use a toolbar
\r
77 // call the base class function
\r
81 void CMainFrame::OnInitialUpdate()
\r
83 m_DockView.SetDockStyle(DS_CLIENTEDGE);
\r
85 // Load dock settings
\r
86 if (!m_DockView.LoadRegistrySettings(GetRegistryKeyName()))
\r
87 LoadDefaultDockers();
\r
89 // PreCreate initially set the window as invisible, so show it now.
\r
93 void CMainFrame::LoadDefaultDockers()
\r
95 // Note: The DockIDs are used for saving/restoring the dockers state in the registry
\r
97 DWORD dwStyle = DS_CLIENTEDGE; // The style added to each docker
\r
99 CDocker* pDockLeft = m_DockView.AddDockedChild(new CDockClasses, DS_DOCKED_LEFT | dwStyle, 200, ID_DOCK_CLASSES1);
\r
100 CDocker* pDockRight = m_DockView.AddDockedChild(new CDockClasses, DS_DOCKED_RIGHT | dwStyle, 200, ID_DOCK_CLASSES2);
\r
101 CDocker* pDockTop = m_DockView.AddDockedChild(new CDockText, DS_DOCKED_TOP | dwStyle, 100, ID_DOCK_TEXT1);
\r
102 CDocker* pDockBottom = m_DockView.AddDockedChild(new CDockText, DS_DOCKED_BOTTOM | dwStyle, 100, ID_DOCK_TEXT2);
\r
104 pDockLeft->AddDockedChild(new CDockFiles, DS_DOCKED_BOTTOM | dwStyle, 150, ID_DOCK_FILES1);
\r
105 pDockRight->AddDockedChild(new CDockFiles, DS_DOCKED_BOTTOM | dwStyle, 150, ID_DOCK_FILES2);
\r
106 pDockTop->AddDockedChild(new CDockSimple, DS_DOCKED_RIGHT | dwStyle, 100, ID_DOCK_SIMPLE1);
\r
107 pDockBottom->AddDockedChild(new CDockSimple, DS_DOCKED_RIGHT | dwStyle, 100, ID_DOCK_SIMPLE2);
\r
110 void CMainFrame::PreCreate(CREATESTRUCT &cs)
\r
112 // Call the base class function first
\r
113 CFrame::PreCreate(cs);
\r
115 // Hide the window initially by removing the WS_VISIBLE style
\r
116 cs.style &= ~WS_VISIBLE;
\r
119 BOOL CMainFrame::SaveRegistrySettings()
\r
121 if (CFrame::SaveRegistrySettings())
\r
122 return m_DockView.SaveRegistrySettings(GetRegistryKeyName());
\r
127 void CMainFrame::SetupToolBar()
\r
129 // Set the Resource IDs for the toolbar buttons
\r
130 AddToolBarButton( IDM_FILE_NEW, FALSE );
\r
131 AddToolBarButton( IDM_FILE_OPEN, FALSE );
\r
132 AddToolBarButton( IDM_FILE_SAVE, FALSE );
\r
134 AddToolBarButton( 0 ); // Separator
\r
135 AddToolBarButton( IDM_EDIT_CUT, FALSE );
\r
136 AddToolBarButton( IDM_EDIT_COPY, FALSE );
\r
137 AddToolBarButton( IDM_EDIT_PASTE, FALSE );
\r
139 AddToolBarButton( 0 ); // Separator
\r
140 AddToolBarButton( IDM_FILE_PRINT, FALSE );
\r
142 AddToolBarButton( 0 ); // Separator
\r
143 AddToolBarButton( IDM_HELP_ABOUT );
\r