[REGEDIT] Improve arrow button visual (#2133)

Add IDI_ARROW resource icon and use it for the arrow button.
This commit is contained in:
Katayama Hirofumi MZ 2019-12-07 10:09:44 +09:00 committed by GitHub
parent 007f32a223
commit 4c5b21f06c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 2 deletions

View 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);

View 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;

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

View 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