Skip to content

Commit

Permalink
Minor modification.
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacsv committed Nov 1, 2020
1 parent 4b7b6e9 commit d2fffa0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions Sources/WindowsAppSupport/WAS_NodeTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace WAS
NodeTreeView::NodeTreeView () :
treeHandle (NULL),
imageList (NULL),
groupClosedBitmap (-1),
groupOpenedBitmap (-1),
closedBitmapIndex (-1),
openedBitmapIndex (-1),
groups ()
{

Expand All @@ -36,7 +36,7 @@ bool NodeTreeView::Init (HWND parentHandle, int x, int y, int width, int height)
return true;
}

bool NodeTreeView::InitImageList (HBITMAP closedBitmap, HBITMAP openedBitmap)
bool NodeTreeView::InitImageList (HBITMAP groupClosedBitmap, HBITMAP groupOpenedBitmap)
{
if (DBGERROR (imageList != NULL)) {
return false;
Expand All @@ -45,8 +45,8 @@ bool NodeTreeView::InitImageList (HBITMAP closedBitmap, HBITMAP openedBitmap)
if (DBGERROR (imageList == NULL)) {
return false;
}
groupClosedBitmap = ImageList_Add (imageList, closedBitmap, NULL);
groupOpenedBitmap = ImageList_Add (imageList, openedBitmap, NULL);
closedBitmapIndex = ImageList_Add (imageList, groupClosedBitmap, NULL);
openedBitmapIndex = ImageList_Add (imageList, groupOpenedBitmap, NULL);
TreeView_SetImageList (treeHandle, imageList, TVSIL_NORMAL);
return true;
}
Expand Down Expand Up @@ -82,8 +82,8 @@ void NodeTreeView::AddGroup (const std::wstring& group)

if (imageList != NULL) {
tvInsertStruct.item.mask |= TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvInsertStruct.item.iImage = groupClosedBitmap;
tvInsertStruct.item.iSelectedImage = groupClosedBitmap;
tvInsertStruct.item.iImage = closedBitmapIndex;
tvInsertStruct.item.iSelectedImage = closedBitmapIndex;
}

HTREEITEM groupItem = (HTREEITEM) SendMessage (treeHandle, TVM_INSERTITEM, 0, (LPARAM) &tvInsertStruct);
Expand Down Expand Up @@ -120,11 +120,11 @@ void NodeTreeView::GroupExpanded (const TVITEMW& group)
{
TVITEM newGroup = group;
if (group.state & TVIS_EXPANDED) {
newGroup.iImage = groupOpenedBitmap;
newGroup.iSelectedImage = groupOpenedBitmap;
newGroup.iImage = openedBitmapIndex;
newGroup.iSelectedImage = openedBitmapIndex;
} else {
newGroup.iImage = groupClosedBitmap;
newGroup.iSelectedImage = groupClosedBitmap;
newGroup.iImage = closedBitmapIndex;
newGroup.iSelectedImage = closedBitmapIndex;
}
TreeView_SetItem (treeHandle, &newGroup);
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/WindowsAppSupport/WAS_NodeTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class NodeTreeView
~NodeTreeView ();

bool Init (HWND parentHandle, int x, int y, int width, int height);
bool InitImageList (HBITMAP closedBitmap, HBITMAP openedBitmap);
bool InitImageList (HBITMAP groupClosedBitmap, HBITMAP groupOpenedBitmap);
void Resize (int x, int y, int width, int height);

bool HasGroup (const std::wstring& group) const;
Expand All @@ -28,8 +28,8 @@ class NodeTreeView
private:
HWND treeHandle;
HIMAGELIST imageList;
int groupClosedBitmap;
int groupOpenedBitmap;
int closedBitmapIndex;
int openedBitmapIndex;
std::unordered_map<std::wstring, HTREEITEM> groups;
};

Expand Down

0 comments on commit d2fffa0

Please sign in to comment.