// SolutionExplorerPane.cpp // // (c)1998-2025 Codejock Software, All Rights Reserved. // // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN // CONSENT OF CODEJOCK SOFTWARE. // // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A // SINGLE COMPUTER. // // CONTACT INFORMATION: // support@codejock.com // http://www.codejock.com // ///////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "GUI_VisualStudio.h" #include "SolutionExplorerPane.h" #ifdef _DEBUG # define new DEBUG_NEW #endif IMPLEMENT_DYNAMIC(CSolutionExplorerPane, CWnd); BEGIN_MESSAGE_MAP(CSolutionExplorerPane, CWnd) ON_WM_CREATE() ON_WM_SIZE() ON_WM_PAINT() ON_WM_SETFOCUS() ON_MESSAGE(WM_XTP_SETCONTROLTHEME, OnSetControlTheme) ON_COMMAND_RANGE(ID_SOLUTIONEXPLORER_PROPERTIES, ID_SOLUTIONEXPLORER_UNHIDEALL, OnEmptyCommand) END_MESSAGE_MAP() CSolutionExplorerPane::CSolutionExplorerPane() { m_pPane = NULL; m_rcMargin = CRect(0, 0, 0, 0); } CSolutionExplorerPane::~CSolutionExplorerPane() { } int CSolutionExplorerPane::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CWnd::OnCreate(lpCreateStruct) == -1) { TRACE(_T("ERROR: Unable to create tree solution explorer pane.\n")); return -1; } if (!m_wndToolBar.CreateToolBar(WS_TABSTOP | WS_VISIBLE | WS_CHILD | CBRS_TOOLTIPS, this)) { TRACE(_T("ERROR: Unable to create toolbar.\n")); return 0; } m_wndToolBar.SetFlags(xtpFlagNoBorders); if (!m_wndToolBar.LoadToolBar(IDR_SOLUTIONEXPLORER_PANE, FALSE)) { TRACE(_T("ERROR: Unable to load toolbar.\n")); return 0; } if (!m_wndSolutionView.Create(_T("SYSTREEVIEW32"), NULL, WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_SHOWSELALWAYS, CRect(0, 0, 0, 0), this, 0xFF)) { TRACE(_T("ERROR: Unable to create tree control.\n")); return 0; } m_wndSolutionView.ModifyStyleEx(0, WS_EX_STATICEDGE); // add the parent item, make it bold HTREEITEM htiParent = m_wndSolutionView.InsertItem( _T("Solution 'ToolkitProDemo': 1 project(s)")); HTREEITEM htiChild; // child item htiChild = m_wndSolutionView.InsertItem(_T("ToolkitProDemo Files"), 1, 1, htiParent); m_wndSolutionView.SetItemState(htiChild, TVIS_BOLD, TVIS_BOLD); // add the children of the parent item HTREEITEM hti = m_wndSolutionView.InsertItem(_T("Source Files"), 2, 3, htiChild); m_wndSolutionView.InsertItem(_T("ChildFrm.cpp"), 4, 4, hti); m_wndSolutionView.InsertItem(_T("MainFrm.cpp"), 4, 4, hti); m_wndSolutionView.InsertItem(_T("StdAfx.cpp"), 4, 4, hti); m_wndSolutionView.InsertItem(_T("ToolkitProDemo.cpp"), 4, 4, hti); m_wndSolutionView.InsertItem(_T("ToolkitProDemo.rc"), 4, 4, hti); m_wndSolutionView.InsertItem(_T("ToolkitProDemoDoc.cpp"), 4, 4, hti); m_wndSolutionView.InsertItem(_T("ToolkitProDemoView.cpp"), 4, 4, hti); hti = m_wndSolutionView.InsertItem(_T("Header Files"), 2, 3, htiChild); m_wndSolutionView.InsertItem(_T("ChildFrm.h"), 5, 5, hti); m_wndSolutionView.InsertItem(_T("MainFrm.h"), 5, 5, hti); m_wndSolutionView.InsertItem(_T("Resource.rc"), 5, 5, hti); m_wndSolutionView.InsertItem(_T("StdAfx.h"), 5, 5, hti); m_wndSolutionView.InsertItem(_T("ToolkitProDemo.h"), 5, 5, hti); m_wndSolutionView.InsertItem(_T("ToolkitProDemoDoc.h"), 5, 5, hti); m_wndSolutionView.InsertItem(_T("ToolkitProDemoView.h"), 5, 5, hti); hti = m_wndSolutionView.InsertItem(_T("Resource Files"), 2, 3, htiChild); m_wndSolutionView.InsertItem(_T("Toolbar.bmp"), 5, 5, hti); m_wndSolutionView.InsertItem(_T("ToolkitProDemo.ico"), 5, 5, hti); m_wndSolutionView.InsertItem(_T("ToolkitProDemo.rc2"), 5, 5, hti); m_wndSolutionView.InsertItem(_T("ToolkitProDemoDoc.ico"), 5, 5, hti); m_wndSolutionView.InsertItem(_T("ReadMe.txt"), 5, 5, htiChild); m_wndSolutionView.InsertItem(_T("External Dependencies"), 2, 3, htiChild); m_wndSolutionView.Expand(htiParent, TVE_EXPAND); m_wndSolutionView.Expand(htiChild, TVE_EXPAND); return 0; } LRESULT CSolutionExplorerPane::OnSetControlTheme(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); XTPControlTheme nTheme = (XTPControlTheme)wParam; BOOL bVS2015Plus = ((nTheme == xtpControlThemeVisualStudio2015) || (nTheme == xtpControlThemeVisualStudio2017) || (nTheme == xtpControlThemeVisualStudio2019) || (nTheme == xtpControlThemeVisualStudio2022)); if (bVS2015Plus) m_rcMargin = CRect(XTP_DPI_X(1), 0, XTP_DPI_X(1), XTP_DPI_Y(1)); else m_rcMargin = CRect(0, 0, 0, 0); m_wndSolutionView.SetTheme(nTheme); BOOL bVS2010Plus = ((nTheme == xtpControlThemeVisualStudio2010) || (nTheme == xtpControlThemeVisualStudio2012Dark) || (nTheme == xtpControlThemeVisualStudio2012Light) || (nTheme == xtpControlThemeVisualStudio2015) || (nTheme == xtpControlThemeVisualStudio2017) || (nTheme == xtpControlThemeVisualStudio2019) || (nTheme == xtpControlThemeVisualStudio2022)); if (bVS2010Plus) { m_wndSolutionView.ModifyStyle(TVS_HASLINES, 0); } else { m_wndSolutionView.ModifyStyle(0, TVS_HASLINES); } m_wndSolutionView.SetExplorerTheme(bVS2010Plus); LoadRasterIcons(); LoadVectorIcons(); return 0; } void CSolutionExplorerPane::OnSize(UINT nType, int cx, int cy) { CWnd::OnSize(nType, cx, cy); if (::IsWindow(m_wndSolutionView)) { XTPPaintTheme nTheme = theApp.GetAppTheme(); CString strThemeSettings = theApp.GetAppThemeSettings(); BOOL bAdjust = ((nTheme == xtpControlThemeVisualStudio2015) || (nTheme == xtpControlThemeVisualStudio2017) || (nTheme == xtpControlThemeVisualStudio2019) || (nTheme == xtpControlThemeVisualStudio2022)); m_wndSolutionView.ModifyStyleEx(bAdjust ? WS_EX_STATICEDGE : 0, bAdjust ? 0 : WS_EX_STATICEDGE); } int x = m_rcMargin.left; int y = m_rcMargin.top; cx -= (x + m_rcMargin.right); cy -= (y + m_rcMargin.bottom); if (::IsWindow(m_wndToolBar)) { CSize sz = m_wndToolBar.CalcDockingLayout(cx, LM_HORZDOCK | LM_HORZ | LM_COMMIT); m_wndToolBar.MoveWindow(x, y, cx, sz.cy); m_wndToolBar.Invalidate(FALSE); y += sz.cy; cy -= sz.cy; } if (::IsWindow(m_wndSolutionView)) { m_wndSolutionView.MoveWindow(x, y, cx, cy); m_wndSolutionView.Invalidate(FALSE); } } void CSolutionExplorerPane::OnPaint() { CPaintDC dc(this); if (!m_rcMargin.IsRectNull()) { CXTPClientRect rClient(this); theApp.GetPaneColorSet()->DrawBorders(&dc, rClient, m_pPane); } } void CSolutionExplorerPane::OnEmptyCommand(UINT nID) { UNREFERENCED_PARAMETER(nID); AfxMessageBox(_T("TODO: Add your command handler")); } void CSolutionExplorerPane::OnSetFocus(CWnd* /*pOldWnd*/) { if (::IsWindow(m_wndSolutionView)) { m_wndSolutionView.SetFocus(); } } void CSolutionExplorerPane::LoadRasterIcons() { CString strThemeSettings = theApp.GetAppThemeSettings(); UINT paneIcons = IDB_SOLUTIONEXPLORER_PANE; UINT treeIcons = IDB_SOLUTIONEXPLORER_TREE; if (0 < strThemeSettings.Find(_T("BLUE"))) { paneIcons = IDB_SOLUTIONEXPLORER_PANE_LIGHT; treeIcons = IDB_SOLUTIONEXPLORER_TREE_LIGHT; } else if (0 < strThemeSettings.Find(_T("BLUEEXTRA"))) { paneIcons = IDB_SOLUTIONEXPLORER_PANE_LIGHT; treeIcons = IDB_SOLUTIONEXPLORER_TREE_LIGHT; } else if (0 < strThemeSettings.Find(_T("DARK"))) { paneIcons = IDB_SOLUTIONEXPLORER_PANE_DARK; treeIcons = IDB_SOLUTIONEXPLORER_TREE_DARK; } else if (0 < strThemeSettings.Find(_T("LIGHT"))) { paneIcons = IDB_SOLUTIONEXPLORER_PANE_LIGHT; treeIcons = IDB_SOLUTIONEXPLORER_TREE_LIGHT; } // pane UINT buttons[] = { ID_SOLUTIONEXPLORER_PROPERTIES, ID_SOLUTIONEXPLORER_ADDNEWFOLDER, ID_SOLUTIONEXPLORER_UNHIDEALL }; XTPImageManager()->SetIcons(paneIcons, buttons, _countof(buttons), CSize(16, 16)); // tree m_ilSolutionView.DeleteImageList(); if (!CreateImageList(m_ilSolutionView, treeIcons)) { TRACE(_T("ERROR: Unable to create tree control.\n")); return; } m_wndSolutionView.SetImageList(&m_ilSolutionView, TVSIL_NORMAL); } void CSolutionExplorerPane::LoadVectorIcons() { // }