Process Hacker Discussion Forum

 
wfunction
Member
Posts: 147
Joined: 19 Mar 2011 20:17

OpenThemeData LISTVIEW

02 Feb 2013 20:07

A tiny feature request... would it be possible for you to use OpenThemeData("LISTVIEW") here, instead of TREEVIEW?

http://sourceforge.net/p/processhacker/ ... ew.c#l2030

It looks a lot better when people have custom visual styles that don't display the same thing for both. :)

Thanks!
 
User avatar
dmex
Admin
Posts: 1698
Joined: 17 Jan 2011 05:43

Re: OpenThemeData LISTVIEW

03 Feb 2013 07:48

wfunction wrote:
A tiny feature request... would it be possible for you to use OpenThemeData("LISTVIEW") here, instead of TREEVIEW?
Nope, the Listview style doesn't include the treeview glyphs ;)

You always could modify the theme file?
 
wfunction
Member
Posts: 147
Joined: 19 Mar 2011 20:17

Re: OpenThemeData LISTVIEW

03 Feb 2013 20:39

lol, I think you took my question too literally xD

How about this -- could you guys maybe integrate this diff into the source code? :D

It shouldn't affect the built-in visual styles in Windows, but it looks a heck of a lot better with some custom visual styles. :)
Especially since a treelistview is more like a listview than a treeview after all.
Index: treenew.c
===================================================================
--- treenew.c   (revision 5276)
+++ treenew.c   (working copy)
@@ -368,6 +368,9 @@
     if (Context->ThemeData)
         CloseThemeData_I(Context->ThemeData);

+    if (Context->ThemeDataLV)
+        CloseThemeData_I(Context->ThemeDataLV);
+
     if (Context->SearchString)
         PhFree(Context->SearchString);

@@ -2027,7 +2031,14 @@
             Context->ThemeData = NULL;
         }

+        if (Context->ThemeDataLV)
+        {
+            CloseThemeData_I(Context->ThemeDataLV);
+            Context->ThemeDataLV = NULL;
+        }
+
         Context->ThemeData = OpenThemeData_I(Context->Handle, L"TREEVIEW");
+       Context->ThemeDataLV = OpenThemeData_I(Context->Handle, L"LISTVIEW");

         if (Context->ThemeData)
         {
@@ -2045,6 +2056,7 @@
     else
     {
         Context->ThemeData = NULL;
+        Context->ThemeDataLV = NULL;
         Context->ThemeActive = FALSE;
         Context->ThemeHasItemBackground = FALSE;
         Context->ThemeHasGlyph = FALSE;
@@ -4945,16 +4957,16 @@
             if (node->Selected)
             {
                 if (i == Context->HotNodeIndex)
-                    stateId = TREIS_HOTSELECTED;
+                    stateId = LISS_HOTSELECTED;
                 else if (!Context->HasFocus)
-                    stateId = TREIS_SELECTEDNOTFOCUS;
+                    stateId = LISS_SELECTEDNOTFOCUS;
                 else
-                    stateId = TREIS_SELECTED;
+                    stateId = LISS_SELECTED;
             }
             else
             {
                 if (i == Context->HotNodeIndex)
-                    stateId = TREIS_HOT;
+                    stateId = LISS_HOT;
                 else
                     stateId = -1;
             }
@@ -4967,9 +4979,9 @@
                 }

                 DrawThemeBackground_I(
-                    Context->ThemeData,
+                    Context->ThemeDataLV,
                     hdc,
-                    TVP_TREEITEM,
+                    LVP_LISTITEM,
                     stateId,
                     &rowRect,
                     PaintRect
@@ -5581,7 +5593,7 @@
     ExcludeClipRect(hdc, clientRect.left, clientRect.top, clientRect.right, clientRect.bottom);

     // Draw the themed border.
-    DrawThemeBackground_I(Context->ThemeData, hdc, 0, 0, &windowRect, NULL);
+    DrawThemeBackground_I(Context->ThemeDataLV, hdc, 0, 0, &windowRect, NULL);

     // Calculate the size of the border we just drew, and fill in the rest of the space if we didn't
     // fully paint the region.