[REGEDIT] Improve arrow button visual (#2133)
authorKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Sat, 7 Dec 2019 01:09:44 +0000 (10:09 +0900)
committerGitHub <noreply@github.com>
Sat, 7 Dec 2019 01:09:44 +0000 (10:09 +0900)
Add IDI_ARROW resource icon and use it for the arrow button.

base/applications/regedit/childwnd.c
base/applications/regedit/main.h
base/applications/regedit/regedit.rc
base/applications/regedit/res/arrow.ico [new file with mode: 0644]
base/applications/regedit/resource.h

index 836145d..d02fb2d 100644 (file)
@@ -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);
index e36600e..084b62c 100644 (file)
@@ -61,6 +61,7 @@ typedef struct
     HWND    hListWnd;
     HWND    hAddressBarWnd;
     HWND    hAddressBtnWnd;
+    HICON   hArrowIcon;
     int     nFocusPanel;      /* 0: left  1: right */
     int     nSplitPos;
     WINDOWPLACEMENT pos;
index 216d495..58810fb 100644 (file)
@@ -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 (file)
index 0000000..0ad4359
Binary files /dev/null and b/base/applications/regedit/res/arrow.ico differ
index c73c6ae..8ada616 100644 (file)
@@ -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