Add fluent icons for treeview
ref #14959 Close #15532 Signed-off-by: ozone10 <positronix10@gmail.com>
|
@ -370,6 +370,26 @@ IDI_PROJECT_FILEINVALID ICON "icons/standard/panels/treeview/proj
|
||||||
IDI_FB_ROOTOPEN ICON "icons/standard/panels/treeview/fb_root_open.ico"
|
IDI_FB_ROOTOPEN ICON "icons/standard/panels/treeview/fb_root_open.ico"
|
||||||
IDI_FB_ROOTCLOSE ICON "icons/standard/panels/treeview/fb_root_close.ico"
|
IDI_FB_ROOTCLOSE ICON "icons/standard/panels/treeview/fb_root_close.ico"
|
||||||
|
|
||||||
|
IDI_PROJECT_WORKSPACE_DM ICON "icons/dark/panels/treeview/project_work_space.ico"
|
||||||
|
IDI_PROJECT_WORKSPACEDIRTY_DM ICON "icons/dark/panels/treeview/project_work_space_dirty.ico"
|
||||||
|
IDI_PROJECT_PROJECT_DM ICON "icons/dark/panels/treeview/project_root.ico"
|
||||||
|
IDI_PROJECT_FOLDEROPEN_DM ICON "icons/dark/panels/treeview/project_folder_open.ico"
|
||||||
|
IDI_PROJECT_FOLDERCLOSE_DM ICON "icons/dark/panels/treeview/project_folder_close.ico"
|
||||||
|
IDI_PROJECT_FILE_DM ICON "icons/dark/panels/treeview/project_file.ico"
|
||||||
|
IDI_PROJECT_FILEINVALID_DM ICON "icons/dark/panels/treeview/project_file_invalid.ico"
|
||||||
|
IDI_FB_ROOTOPEN_DM ICON "icons/dark/panels/treeview/fb_root_open.ico"
|
||||||
|
IDI_FB_ROOTCLOSE_DM ICON "icons/dark/panels/treeview/fb_root_close.ico"
|
||||||
|
|
||||||
|
IDI_PROJECT_WORKSPACE2 ICON "icons/light/panels/treeview/project_work_space.ico"
|
||||||
|
IDI_PROJECT_WORKSPACEDIRTY2 ICON "icons/light/panels/treeview/project_work_space_dirty.ico"
|
||||||
|
IDI_PROJECT_PROJECT2 ICON "icons/light/panels/treeview/project_root.ico"
|
||||||
|
IDI_PROJECT_FOLDEROPEN2 ICON "icons/light/panels/treeview/project_folder_open.ico"
|
||||||
|
IDI_PROJECT_FOLDERCLOSE2 ICON "icons/light/panels/treeview/project_folder_close.ico"
|
||||||
|
IDI_PROJECT_FILE2 ICON "icons/light/panels/treeview/project_file.ico"
|
||||||
|
IDI_PROJECT_FILEINVALID2 ICON "icons/light/panels/treeview/project_file_invalid.ico"
|
||||||
|
IDI_FB_ROOTOPEN2 ICON "icons/light/panels/treeview/fb_root_open.ico"
|
||||||
|
IDI_FB_ROOTCLOSE2 ICON "icons/light/panels/treeview/fb_root_close.ico"
|
||||||
|
|
||||||
IDI_FB_SELECTCURRENTFILE ICON "icons/standard/panels/toolbar/fb_select_current_file.ico"
|
IDI_FB_SELECTCURRENTFILE ICON "icons/standard/panels/toolbar/fb_select_current_file.ico"
|
||||||
IDI_FB_FOLDALL ICON "icons/standard/panels/toolbar/fb_fold_all.ico"
|
IDI_FB_FOLDALL ICON "icons/standard/panels/toolbar/fb_fold_all.ico"
|
||||||
IDI_FB_EXPANDALL ICON "icons/standard/panels/toolbar/fb_expand_all.ico"
|
IDI_FB_EXPANDALL ICON "icons/standard/panels/toolbar/fb_expand_all.ico"
|
||||||
|
@ -381,6 +401,12 @@ IDI_FB_EXPANDALL_DM ICON "icons/dark/panels/toolbar/fb_expand
|
||||||
IDI_FUNCLIST_NODE ICON "icons/standard/panels/treeview/funcList_node.ico"
|
IDI_FUNCLIST_NODE ICON "icons/standard/panels/treeview/funcList_node.ico"
|
||||||
IDI_FUNCLIST_LEAF ICON "icons/standard/panels/treeview/funcList_leaf.ico"
|
IDI_FUNCLIST_LEAF ICON "icons/standard/panels/treeview/funcList_leaf.ico"
|
||||||
|
|
||||||
|
IDI_FUNCLIST_NODE_DM ICON "icons/dark/panels/treeview/funcList_node.ico"
|
||||||
|
IDI_FUNCLIST_LEAF_DM ICON "icons/dark/panels/treeview/funcList_leaf.ico"
|
||||||
|
|
||||||
|
IDI_FUNCLIST_NODE2 ICON "icons/light/panels/treeview/funcList_node.ico"
|
||||||
|
IDI_FUNCLIST_LEAF2 ICON "icons/light/panels/treeview/funcList_leaf.ico"
|
||||||
|
|
||||||
IDI_FUNCLIST_SORTBUTTON ICON "icons/standard/panels/toolbar/funclstSort.ico"
|
IDI_FUNCLIST_SORTBUTTON ICON "icons/standard/panels/toolbar/funclstSort.ico"
|
||||||
IDI_FUNCLIST_RELOADBUTTON ICON "icons/standard/panels/toolbar/funclstReload.ico"
|
IDI_FUNCLIST_RELOADBUTTON ICON "icons/standard/panels/toolbar/funclstReload.ico"
|
||||||
IDI_FUNCLIST_PREFERENCEBUTTON ICON "icons/standard/panels/toolbar/funclstPreferences.ico"
|
IDI_FUNCLIST_PREFERENCEBUTTON ICON "icons/standard/panels/toolbar/funclstPreferences.ico"
|
||||||
|
|
|
@ -3253,6 +3253,12 @@ namespace NppDarkMode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TreeViewStyle getTreeViewStyle()
|
||||||
|
{
|
||||||
|
const auto style = g_treeViewStyle;
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
void setTreeViewStyle(HWND hwnd)
|
void setTreeViewStyle(HWND hwnd)
|
||||||
{
|
{
|
||||||
auto style = static_cast<long>(::GetWindowLongPtr(hwnd, GWL_STYLE));
|
auto style = static_cast<long>(::GetWindowLongPtr(hwnd, GWL_STYLE));
|
||||||
|
|
|
@ -226,6 +226,7 @@ namespace NppDarkMode
|
||||||
|
|
||||||
void disableVisualStyle(HWND hwnd, bool doDisable);
|
void disableVisualStyle(HWND hwnd, bool doDisable);
|
||||||
void calculateTreeViewStyle();
|
void calculateTreeViewStyle();
|
||||||
|
TreeViewStyle getTreeViewStyle();
|
||||||
void setTreeViewStyle(HWND hwnd);
|
void setTreeViewStyle(HWND hwnd);
|
||||||
bool isThemeDark();
|
bool isThemeDark();
|
||||||
void setBorder(HWND hwnd, bool border = true);
|
void setBorder(HWND hwnd, bool border = true);
|
||||||
|
|
|
@ -180,7 +180,12 @@ intptr_t CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
|
||||||
|
|
||||||
FileBrowser::initPopupMenus();
|
FileBrowser::initPopupMenus();
|
||||||
|
|
||||||
std::vector<int> imgIds{ IDI_FB_ROOTOPEN, IDI_FB_ROOTCLOSE, IDI_PROJECT_FOLDEROPEN, IDI_PROJECT_FOLDERCLOSE, IDI_PROJECT_FILE };
|
std::vector<int> imgIds = _treeView.getImageIds(
|
||||||
|
{ IDI_FB_ROOTOPEN, IDI_FB_ROOTCLOSE, IDI_PROJECT_FOLDEROPEN, IDI_PROJECT_FOLDERCLOSE, IDI_PROJECT_FILE }
|
||||||
|
, { IDI_FB_ROOTOPEN_DM, IDI_FB_ROOTCLOSE_DM, IDI_PROJECT_FOLDEROPEN_DM, IDI_PROJECT_FOLDERCLOSE_DM, IDI_PROJECT_FILE_DM }
|
||||||
|
, { IDI_FB_ROOTOPEN2, IDI_FB_ROOTCLOSE2, IDI_PROJECT_FOLDEROPEN2, IDI_PROJECT_FOLDERCLOSE2, IDI_PROJECT_FILE2 }
|
||||||
|
);
|
||||||
|
|
||||||
_treeView.init(_hInst, _hSelf, ID_FILEBROWSERTREEVIEW);
|
_treeView.init(_hInst, _hSelf, ID_FILEBROWSERTREEVIEW);
|
||||||
_treeView.setImageList(imgIds);
|
_treeView.setImageList(imgIds);
|
||||||
|
|
||||||
|
@ -213,6 +218,15 @@ intptr_t CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
|
||||||
::SendMessage(_hToolbarMenu, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(_iconListVector.at(NppDarkMode::isEnabled() ? 1 : 0)));
|
::SendMessage(_hToolbarMenu, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(_iconListVector.at(NppDarkMode::isEnabled() ? 1 : 0)));
|
||||||
}
|
}
|
||||||
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
||||||
|
|
||||||
|
std::vector<int> imgIds = _treeView.getImageIds(
|
||||||
|
{ IDI_FB_ROOTOPEN, IDI_FB_ROOTCLOSE, IDI_PROJECT_FOLDEROPEN, IDI_PROJECT_FOLDERCLOSE, IDI_PROJECT_FILE }
|
||||||
|
, { IDI_FB_ROOTOPEN_DM, IDI_FB_ROOTCLOSE_DM, IDI_PROJECT_FOLDEROPEN_DM, IDI_PROJECT_FOLDERCLOSE_DM, IDI_PROJECT_FILE_DM }
|
||||||
|
, { IDI_FB_ROOTOPEN2, IDI_FB_ROOTCLOSE2, IDI_PROJECT_FOLDEROPEN2, IDI_PROJECT_FOLDERCLOSE2, IDI_PROJECT_FILE2 }
|
||||||
|
);
|
||||||
|
|
||||||
|
_treeView.setImageList(imgIds);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -837,7 +837,7 @@ intptr_t CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LP
|
||||||
{
|
{
|
||||||
FunctionListPanel::initPreferencesMenu();
|
FunctionListPanel::initPreferencesMenu();
|
||||||
|
|
||||||
NppParameters& nppParams = NppParameters::getInstance();
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
|
|
||||||
setDpi();
|
setDpi();
|
||||||
const int editWidth = _dpiManager.scale(100);
|
const int editWidth = _dpiManager.scale(100);
|
||||||
|
@ -919,7 +919,7 @@ intptr_t CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LP
|
||||||
ShowWindow(_hToolbarMenu, SW_SHOW);
|
ShowWindow(_hToolbarMenu, SW_SHOW);
|
||||||
|
|
||||||
// tips text for toolbar buttons
|
// tips text for toolbar buttons
|
||||||
NativeLangSpeaker *pNativeSpeaker = nppParams.getNativeLangSpeaker();
|
NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
|
||||||
_sortTipStr = pNativeSpeaker->getAttrNameStr(_sortTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_SORTLOCALNODENAME);
|
_sortTipStr = pNativeSpeaker->getAttrNameStr(_sortTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_SORTLOCALNODENAME);
|
||||||
_reloadTipStr = pNativeSpeaker->getAttrNameStr(_reloadTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_RELOADLOCALNODENAME);
|
_reloadTipStr = pNativeSpeaker->getAttrNameStr(_reloadTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_RELOADLOCALNODENAME);
|
||||||
_preferenceTipStr = pNativeSpeaker->getAttrNameStr(_preferenceTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_PREFERENCESLOCALNODENAME);
|
_preferenceTipStr = pNativeSpeaker->getAttrNameStr(_preferenceTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_PREFERENCESLOCALNODENAME);
|
||||||
|
@ -943,7 +943,12 @@ intptr_t CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LP
|
||||||
::SendMessage(_hSearchEdit, WM_SETFONT, reinterpret_cast<WPARAM>(_hFontSearchEdit), MAKELPARAM(TRUE, 0));
|
::SendMessage(_hSearchEdit, WM_SETFONT, reinterpret_cast<WPARAM>(_hFontSearchEdit), MAKELPARAM(TRUE, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> imgIds{ IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF };
|
std::vector<int> imgIds = _treeView.getImageIds(
|
||||||
|
{ IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF }
|
||||||
|
, { IDI_FUNCLIST_ROOT_DM, IDI_FUNCLIST_NODE_DM, IDI_FUNCLIST_LEAF_DM }
|
||||||
|
, { IDI_FUNCLIST_ROOT2, IDI_FUNCLIST_NODE2, IDI_FUNCLIST_LEAF2 }
|
||||||
|
);
|
||||||
|
|
||||||
_treeView.init(_hInst, _hSelf, IDC_LIST_FUNCLIST);
|
_treeView.init(_hInst, _hSelf, IDC_LIST_FUNCLIST);
|
||||||
_treeView.setImageList(imgIds);
|
_treeView.setImageList(imgIds);
|
||||||
_treeViewSearchResult.init(_hInst, _hSelf, IDC_LIST_FUNCLIST_AUX);
|
_treeViewSearchResult.init(_hInst, _hSelf, IDC_LIST_FUNCLIST_AUX);
|
||||||
|
@ -967,6 +972,16 @@ intptr_t CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LP
|
||||||
::SendMessage(_hToolbarMenu, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(_iconListVector.at(NppDarkMode::isEnabled() ? 1 : 0)));
|
::SendMessage(_hToolbarMenu, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(_iconListVector.at(NppDarkMode::isEnabled() ? 1 : 0)));
|
||||||
}
|
}
|
||||||
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
||||||
|
|
||||||
|
std::vector<int> imgIds = _treeView.getImageIds(
|
||||||
|
{ IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF }
|
||||||
|
, { IDI_FUNCLIST_ROOT_DM, IDI_FUNCLIST_NODE_DM, IDI_FUNCLIST_LEAF_DM }
|
||||||
|
, { IDI_FUNCLIST_ROOT2, IDI_FUNCLIST_NODE2, IDI_FUNCLIST_LEAF2 }
|
||||||
|
);
|
||||||
|
|
||||||
|
_treeView.setImageList(imgIds);
|
||||||
|
_treeViewSearchResult.setImageList(imgIds);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,8 @@ intptr_t CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||||
|
|
||||||
TBBUTTON tbButtons[2]{};
|
TBBUTTON tbButtons[2]{};
|
||||||
|
|
||||||
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
|
NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
|
||||||
wstring workspace_entry = pNativeSpeaker->getProjectPanelLangMenuStr("Entries", 0, PM_WORKSPACEMENUENTRY);
|
wstring workspace_entry = pNativeSpeaker->getProjectPanelLangMenuStr("Entries", 0, PM_WORKSPACEMENUENTRY);
|
||||||
wstring edit_entry = pNativeSpeaker->getProjectPanelLangMenuStr("Entries", 1, PM_EDITMENUENTRY);
|
wstring edit_entry = pNativeSpeaker->getProjectPanelLangMenuStr("Entries", 1, PM_EDITMENUENTRY);
|
||||||
|
|
||||||
|
@ -77,7 +78,12 @@ intptr_t CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||||
SendMessage(_hToolbarMenu, TB_AUTOSIZE, 0, 0);
|
SendMessage(_hToolbarMenu, TB_AUTOSIZE, 0, 0);
|
||||||
ShowWindow(_hToolbarMenu, SW_SHOW);
|
ShowWindow(_hToolbarMenu, SW_SHOW);
|
||||||
|
|
||||||
std::vector<int> imgIds{ IDI_PROJECT_WORKSPACE, IDI_PROJECT_WORKSPACEDIRTY, IDI_PROJECT_PROJECT, IDI_PROJECT_FOLDEROPEN, IDI_PROJECT_FOLDERCLOSE, IDI_PROJECT_FILE, IDI_PROJECT_FILEINVALID };
|
std::vector<int> imgIds = _treeView.getImageIds(
|
||||||
|
{ IDI_PROJECT_WORKSPACE, IDI_PROJECT_WORKSPACEDIRTY, IDI_PROJECT_PROJECT, IDI_PROJECT_FOLDEROPEN, IDI_PROJECT_FOLDERCLOSE, IDI_PROJECT_FILE, IDI_PROJECT_FILEINVALID }
|
||||||
|
, { IDI_PROJECT_WORKSPACE_DM, IDI_PROJECT_WORKSPACEDIRTY_DM, IDI_PROJECT_PROJECT_DM, IDI_PROJECT_FOLDEROPEN_DM, IDI_PROJECT_FOLDERCLOSE_DM, IDI_PROJECT_FILE_DM, IDI_PROJECT_FILEINVALID_DM }
|
||||||
|
, { IDI_PROJECT_WORKSPACE2, IDI_PROJECT_WORKSPACEDIRTY2, IDI_PROJECT_PROJECT2, IDI_PROJECT_FOLDEROPEN2, IDI_PROJECT_FOLDERCLOSE2, IDI_PROJECT_FILE2, IDI_PROJECT_FILEINVALID2 }
|
||||||
|
);
|
||||||
|
|
||||||
_treeView.init(_hInst, _hSelf, ID_PROJECTTREEVIEW);
|
_treeView.init(_hInst, _hSelf, ID_PROJECTTREEVIEW);
|
||||||
_treeView.setImageList(imgIds);
|
_treeView.setImageList(imgIds);
|
||||||
|
|
||||||
|
@ -105,6 +111,15 @@ intptr_t CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||||
NppDarkMode::autoThemeChildControls(_hSelf);
|
NppDarkMode::autoThemeChildControls(_hSelf);
|
||||||
}
|
}
|
||||||
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
||||||
|
|
||||||
|
std::vector<int> imgIds = _treeView.getImageIds(
|
||||||
|
{ IDI_PROJECT_WORKSPACE, IDI_PROJECT_WORKSPACEDIRTY, IDI_PROJECT_PROJECT, IDI_PROJECT_FOLDEROPEN, IDI_PROJECT_FOLDERCLOSE, IDI_PROJECT_FILE, IDI_PROJECT_FILEINVALID }
|
||||||
|
, { IDI_PROJECT_WORKSPACE_DM, IDI_PROJECT_WORKSPACEDIRTY_DM, IDI_PROJECT_PROJECT_DM, IDI_PROJECT_FOLDEROPEN_DM, IDI_PROJECT_FOLDERCLOSE_DM, IDI_PROJECT_FILE_DM, IDI_PROJECT_FILEINVALID_DM }
|
||||||
|
, { IDI_PROJECT_WORKSPACE2, IDI_PROJECT_WORKSPACEDIRTY2, IDI_PROJECT_PROJECT2, IDI_PROJECT_FOLDEROPEN2, IDI_PROJECT_FOLDERCLOSE2, IDI_PROJECT_FILE2, IDI_PROJECT_FILEINVALID2 }
|
||||||
|
);
|
||||||
|
|
||||||
|
_treeView.setImageList(imgIds);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -289,27 +289,77 @@ bool TreeView::setImageList(const std::vector<int>& imageIds, int imgSize)
|
||||||
|
|
||||||
// Creation of image list
|
// Creation of image list
|
||||||
int dpiImgSize = DPIManagerV2::scale(imgSize, _hParent);
|
int dpiImgSize = DPIManagerV2::scale(imgSize, _hParent);
|
||||||
if ((_hImaLst = ::ImageList_Create(dpiImgSize, dpiImgSize, ILC_COLOR32 | ILC_MASK, nbImage, 0)) == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Add the ico into the list
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
for (const int& id : imageIds)
|
const bool useStdIcons = nppParam.getNppGUI()._toolBarStatus == TB_STANDARD;
|
||||||
|
|
||||||
|
if (_hImaLst != nullptr)
|
||||||
{
|
{
|
||||||
HICON hIcon = nullptr;
|
int prevImageSize = 0;
|
||||||
DPIManagerV2::loadIcon(_hInst, MAKEINTRESOURCE(id), dpiImgSize, dpiImgSize, &hIcon, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
|
::ImageList_GetIconSize(_hImaLst, &prevImageSize, nullptr);
|
||||||
if (hIcon == nullptr)
|
if ((prevImageSize != dpiImgSize) || (!(useStdIcons && _tvStyleType == NppDarkMode::TreeViewStyle::classic) && _tvStyleType != NppDarkMode::getTreeViewStyle()))
|
||||||
|
{
|
||||||
|
::ImageList_Destroy(_hImaLst);
|
||||||
|
_hImaLst = nullptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_hImaLst == nullptr)
|
||||||
|
{
|
||||||
|
if ((_hImaLst = ::ImageList_Create(dpiImgSize, dpiImgSize, ILC_COLOR32 | ILC_MASK, nbImage, 0)) == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
::ImageList_AddIcon(_hImaLst, hIcon);
|
// Add the ico into the list
|
||||||
::DestroyIcon(hIcon);
|
for (const int& id : imageIds)
|
||||||
|
{
|
||||||
|
HICON hIcon = nullptr;
|
||||||
|
DPIManagerV2::loadIcon(_hInst, MAKEINTRESOURCE(id), dpiImgSize, dpiImgSize, &hIcon, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
|
||||||
|
if (hIcon == nullptr)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
::ImageList_AddIcon(_hImaLst, hIcon);
|
||||||
|
::DestroyIcon(hIcon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set image list to the tree view
|
// Set image list to the tree view
|
||||||
TreeView_SetImageList(_hSelf, _hImaLst, TVSIL_NORMAL);
|
TreeView_SetImageList(_hSelf, _hImaLst, TVSIL_NORMAL);
|
||||||
|
_tvStyleType = useStdIcons ? NppDarkMode::TreeViewStyle::classic : NppDarkMode::getTreeViewStyle();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<int> TreeView::getImageIds(std::vector<int> stdIds, std::vector<int> darkIds, std::vector<int> lightIds)
|
||||||
|
{
|
||||||
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
|
const bool useStdIcons = nppParam.getNppGUI()._toolBarStatus == TB_STANDARD;
|
||||||
|
if (useStdIcons)
|
||||||
|
{
|
||||||
|
return stdIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (NppDarkMode::getTreeViewStyle())
|
||||||
|
{
|
||||||
|
case NppDarkMode::TreeViewStyle::light:
|
||||||
|
{
|
||||||
|
return lightIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
case NppDarkMode::TreeViewStyle::dark:
|
||||||
|
{
|
||||||
|
return darkIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
case NppDarkMode::TreeViewStyle::classic:
|
||||||
|
{
|
||||||
|
return stdIds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stdIds;
|
||||||
|
}
|
||||||
|
|
||||||
void TreeView::cleanSubEntries(HTREEITEM hTreeItem)
|
void TreeView::cleanSubEntries(HTREEITEM hTreeItem)
|
||||||
{
|
{
|
||||||
for (HTREEITEM hItem = getChildFrom(hTreeItem); hItem != NULL; hItem = getNextSibling(hItem))
|
for (HTREEITEM hItem = getChildFrom(hTreeItem); hItem != NULL; hItem = getNextSibling(hItem))
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
#include "NppDarkMode.h"
|
||||||
|
|
||||||
struct TreeStateNode {
|
struct TreeStateNode {
|
||||||
std::wstring _label;
|
std::wstring _label;
|
||||||
|
@ -117,9 +118,11 @@ public:
|
||||||
void sort(HTREEITEM hTreeItem, bool isRecusive);
|
void sort(HTREEITEM hTreeItem, bool isRecusive);
|
||||||
void customSorting(HTREEITEM hTreeItem, PFNTVCOMPARE sortingCallbackFunc, LPARAM lParam, bool isRecursive);
|
void customSorting(HTREEITEM hTreeItem, PFNTVCOMPARE sortingCallbackFunc, LPARAM lParam, bool isRecursive);
|
||||||
bool setImageList(const std::vector<int>& imageIds, int imgSize = 0);
|
bool setImageList(const std::vector<int>& imageIds, int imgSize = 0);
|
||||||
|
std::vector<int> getImageIds(std::vector<int> stdIds, std::vector<int>darkIds, std::vector<int> lightIds);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HIMAGELIST _hImaLst = nullptr;
|
HIMAGELIST _hImaLst = nullptr;
|
||||||
|
NppDarkMode::TreeViewStyle _tvStyleType = NppDarkMode::TreeViewStyle::classic;
|
||||||
LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
|
LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
static LRESULT CALLBACK staticProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData);
|
static LRESULT CALLBACK staticProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData);
|
||||||
|
@ -141,4 +144,3 @@ protected:
|
||||||
bool canDragOut(HTREEITEM targetItem);
|
bool canDragOut(HTREEITEM targetItem);
|
||||||
bool canDropIn(HTREEITEM targetItem);
|
bool canDropIn(HTREEITEM targetItem);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 619 B |
After Width: | Height: | Size: 655 B |
After Width: | Height: | Size: 473 B |
After Width: | Height: | Size: 606 B |
After Width: | Height: | Size: 720 B |
After Width: | Height: | Size: 771 B |
After Width: | Height: | Size: 626 B |
After Width: | Height: | Size: 693 B |
After Width: | Height: | Size: 748 B |
After Width: | Height: | Size: 661 B |
After Width: | Height: | Size: 663 B |
|
@ -276,28 +276,57 @@
|
||||||
#define IDI_PROJECT_FILEINVALID 607
|
#define IDI_PROJECT_FILEINVALID 607
|
||||||
#define IDI_FB_ROOTOPEN 608
|
#define IDI_FB_ROOTOPEN 608
|
||||||
#define IDI_FB_ROOTCLOSE 609
|
#define IDI_FB_ROOTCLOSE 609
|
||||||
#define IDI_FB_SELECTCURRENTFILE 610
|
|
||||||
#define IDI_FB_FOLDALL 611
|
#define IDI_PROJECT_WORKSPACE_DM 611
|
||||||
#define IDI_FB_EXPANDALL 612
|
#define IDI_PROJECT_WORKSPACEDIRTY_DM 612
|
||||||
#define IDI_FB_SELECTCURRENTFILE_DM 613
|
#define IDI_PROJECT_PROJECT_DM 613
|
||||||
#define IDI_FB_FOLDALL_DM 614
|
#define IDI_PROJECT_FOLDEROPEN_DM 614
|
||||||
#define IDI_FB_EXPANDALL_DM 615
|
#define IDI_PROJECT_FOLDERCLOSE_DM 615
|
||||||
|
#define IDI_PROJECT_FILE_DM 616
|
||||||
|
#define IDI_PROJECT_FILEINVALID_DM 617
|
||||||
|
#define IDI_FB_ROOTOPEN_DM 618
|
||||||
|
#define IDI_FB_ROOTCLOSE_DM 619
|
||||||
|
|
||||||
|
#define IDI_PROJECT_WORKSPACE2 621
|
||||||
|
#define IDI_PROJECT_WORKSPACEDIRTY2 622
|
||||||
|
#define IDI_PROJECT_PROJECT2 623
|
||||||
|
#define IDI_PROJECT_FOLDEROPEN2 624
|
||||||
|
#define IDI_PROJECT_FOLDERCLOSE2 625
|
||||||
|
#define IDI_PROJECT_FILE2 626
|
||||||
|
#define IDI_PROJECT_FILEINVALID2 627
|
||||||
|
#define IDI_FB_ROOTOPEN2 628
|
||||||
|
#define IDI_FB_ROOTCLOSE2 629
|
||||||
|
|
||||||
|
#define IDI_FB_SELECTCURRENTFILE 630
|
||||||
|
#define IDI_FB_FOLDALL 631
|
||||||
|
#define IDI_FB_EXPANDALL 632
|
||||||
|
#define IDI_FB_SELECTCURRENTFILE_DM 633
|
||||||
|
#define IDI_FB_FOLDALL_DM 634
|
||||||
|
#define IDI_FB_EXPANDALL_DM 635
|
||||||
|
|
||||||
#define IDI_FUNCLIST_ROOT IDI_PROJECT_FILE // using same file
|
#define IDI_FUNCLIST_ROOT IDI_PROJECT_FILE // using same file
|
||||||
#define IDI_FUNCLIST_NODE 621
|
#define IDI_FUNCLIST_NODE 641
|
||||||
#define IDI_FUNCLIST_LEAF 622
|
#define IDI_FUNCLIST_LEAF 642
|
||||||
|
|
||||||
#define IDI_FUNCLIST_SORTBUTTON 631
|
#define IDI_FUNCLIST_ROOT_DM IDI_PROJECT_FILE_DM // using same file
|
||||||
#define IDI_FUNCLIST_RELOADBUTTON 632
|
#define IDI_FUNCLIST_NODE_DM 644
|
||||||
#define IDI_FUNCLIST_PREFERENCEBUTTON 633
|
#define IDI_FUNCLIST_LEAF_DM 645
|
||||||
#define IDI_FUNCLIST_SORTBUTTON_DM 634
|
|
||||||
#define IDI_FUNCLIST_RELOADBUTTON_DM 635
|
#define IDI_FUNCLIST_ROOT2 IDI_PROJECT_FILE2 // using same file
|
||||||
#define IDI_FUNCLIST_PREFERENCEBUTTON_DM 636
|
#define IDI_FUNCLIST_NODE2 647
|
||||||
|
#define IDI_FUNCLIST_LEAF2 648
|
||||||
|
|
||||||
|
#define IDI_FUNCLIST_SORTBUTTON 651
|
||||||
|
#define IDI_FUNCLIST_RELOADBUTTON 652
|
||||||
|
#define IDI_FUNCLIST_PREFERENCEBUTTON 653
|
||||||
|
#define IDI_FUNCLIST_SORTBUTTON_DM 654
|
||||||
|
#define IDI_FUNCLIST_RELOADBUTTON_DM 655
|
||||||
|
#define IDI_FUNCLIST_PREFERENCEBUTTON_DM 656
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define IDI_GET_INFO_FROM_TOOLTIP 641
|
#define IDI_GET_INFO_FROM_TOOLTIP 661
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|