https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4c5b21f06c545a3b5dcafb8dbf732e2787882089

commit 4c5b21f06c545a3b5dcafb8dbf732e2787882089
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Sat Dec 7 10:09:44 2019 +0900
Commit:     GitHub <[email protected]>
CommitDate: Sat Dec 7 10:09:44 2019 +0900

    [REGEDIT] Improve arrow button visual (#2133)
    
    Add IDI_ARROW resource icon and use it for the arrow button.
---
 base/applications/regedit/childwnd.c    |  15 +++++++++++++--
 base/applications/regedit/main.h        |   1 +
 base/applications/regedit/regedit.rc    |   1 +
 base/applications/regedit/res/arrow.ico | Bin 0 -> 542 bytes
 base/applications/regedit/resource.h    |   1 +
 5 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/base/applications/regedit/childwnd.c 
b/base/applications/regedit/childwnd.c
index 836145dd0c7..d02fb2da14d 100644
--- a/base/applications/regedit/childwnd.c
+++ b/base/applications/regedit/childwnd.c
@@ -394,6 +394,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, 
WPARAM wParam, LPARAM lPa
         WNDPROC oldproc;
         HFONT hFont;
         WCHAR buffer[MAX_PATH];
+        DWORD style;
 
         /* Load "My Computer" string */
         LoadStringW(hInst, IDS_MY_COMPUTER, buffer, COUNT_OF(buffer));
@@ -404,12 +405,21 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, 
WPARAM wParam, LPARAM lPa
         wcsncpy(g_pChildWnd->szPath, buffer, MAX_PATH);
         g_pChildWnd->nSplitPos = 190;
         g_pChildWnd->hWnd = hWnd;
-        g_pChildWnd->hAddressBarWnd = CreateWindowExW(WS_EX_CLIENTEDGE, 
L"Edit", NULL, WS_CHILD | WS_VISIBLE | WS_CHILDWINDOW | WS_TABSTOP,
+
+        style = WS_CHILD | WS_VISIBLE | WS_TABSTOP;
+        g_pChildWnd->hAddressBarWnd = CreateWindowExW(WS_EX_CLIENTEDGE, 
L"Edit", NULL, style,
                                                       CW_USEDEFAULT, 
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                                                       hWnd, (HMENU)0, hInst, 
0);
-        g_pChildWnd->hAddressBtnWnd = CreateWindowExW(0, L"Button", L"\x00BB", 
WS_CHILD | WS_VISIBLE | WS_CHILDWINDOW | WS_TABSTOP | BS_TEXT | BS_CENTER | 
BS_VCENTER | BS_FLAT | BS_DEFPUSHBUTTON,
+
+        style = WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_ICON | BS_CENTER |
+                BS_VCENTER | BS_FLAT | BS_DEFPUSHBUTTON;
+        g_pChildWnd->hAddressBtnWnd = CreateWindowExW(0, L"Button", L"\x00BB", 
style,
                                                       CW_USEDEFAULT, 
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                                                       hWnd, (HMENU)0, hInst, 
0);
+        g_pChildWnd->hArrowIcon = (HICON)LoadImageW(hInst, 
MAKEINTRESOURCEW(IDI_ARROW),
+                                                    IMAGE_ICON, 12, 12, 0);
+        SendMessageW(g_pChildWnd->hAddressBtnWnd, BM_SETIMAGE, IMAGE_ICON, 
(LPARAM)g_pChildWnd->hArrowIcon);
+
         GetClientRect(hWnd, &rc);
         g_pChildWnd->hTreeWnd = CreateTreeView(hWnd, g_pChildWnd->szPath, 
(HMENU) TREE_WINDOW);
         g_pChildWnd->hListWnd = CreateListView(hWnd, (HMENU) LIST_WINDOW, 
rc.right - g_pChildWnd->nSplitPos);
@@ -462,6 +472,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, 
WPARAM wParam, LPARAM lPa
         DestroyListView(g_pChildWnd->hListWnd);
         DestroyTreeView(g_pChildWnd->hTreeWnd);
         DestroyMainMenu();
+        DestroyIcon(g_pChildWnd->hArrowIcon);
         HeapFree(GetProcessHeap(), 0, g_pChildWnd);
         g_pChildWnd = NULL;
         PostQuitMessage(0);
diff --git a/base/applications/regedit/main.h b/base/applications/regedit/main.h
index e36600e1a20..084b62cf304 100644
--- a/base/applications/regedit/main.h
+++ b/base/applications/regedit/main.h
@@ -61,6 +61,7 @@ typedef struct
     HWND    hListWnd;
     HWND    hAddressBarWnd;
     HWND    hAddressBtnWnd;
+    HICON   hArrowIcon;
     int     nFocusPanel;      /* 0: left  1: right */
     int     nSplitPos;
     WINDOWPLACEMENT pos;
diff --git a/base/applications/regedit/regedit.rc 
b/base/applications/regedit/regedit.rc
index 216d4956bd8..58810fb3ced 100644
--- a/base/applications/regedit/regedit.rc
+++ b/base/applications/regedit/regedit.rc
@@ -40,6 +40,7 @@ IDI_STRING ICON "res/string.ico"
 IDI_BIN ICON "res/bin.ico"
 IDI_REGEDIT ICON "res/regedit.ico"
 IDI_REGFILE ICON "res/regfile.ico"
+IDI_ARROW ICON "res/arrow.ico"
 
 /* UTF-8 */
 #pragma code_page(65001)
diff --git a/base/applications/regedit/res/arrow.ico 
b/base/applications/regedit/res/arrow.ico
new file mode 100644
index 00000000000..0ad4359db42
Binary files /dev/null and b/base/applications/regedit/res/arrow.ico differ
diff --git a/base/applications/regedit/resource.h 
b/base/applications/regedit/resource.h
index c73c6aeae03..8ada616b95e 100644
--- a/base/applications/regedit/resource.h
+++ b/base/applications/regedit/resource.h
@@ -34,6 +34,7 @@
 #define IDS_APP_TITLE                 103
 #define IDI_REGEDIT                   100
 #define IDI_REGFILE                   101
+#define IDI_ARROW                     102
 #define IDI_SMALL                     108
 #define IDC_REGEDIT                   109
 #define IDC_REGEDIT_FRAME             110

Reply via email to