Properly sized the explorer bar now.
This commit is contained in:
parent
a5fb198558
commit
c25831ec66
|
@ -610,14 +610,25 @@ void repositionButtons(HWND hwnd)
|
||||||
{
|
{
|
||||||
HDWP dwp;
|
HDWP dwp;
|
||||||
int buttonx, buttony;
|
int buttonx, buttony;
|
||||||
|
HDC dc;
|
||||||
|
int dpiX;
|
||||||
|
int dpiY;
|
||||||
struct buttonMetrics m;
|
struct buttonMetrics m;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
dc = GetDC(hwnd);
|
||||||
|
if (dc == NULL)
|
||||||
|
diele("GetDC()");
|
||||||
|
dpiX = GetDeviceCaps(dc, LOGPIXELSX);
|
||||||
|
dpiY = GetDeviceCaps(dc, LOGPIXELSY);
|
||||||
|
// TODO check error
|
||||||
|
ReleaseDC(hwnd, dc);
|
||||||
|
|
||||||
dwp = BeginDeferWindowPos(5);
|
dwp = BeginDeferWindowPos(5);
|
||||||
if (dwp == NULL)
|
if (dwp == NULL)
|
||||||
diele("BeginDeferWindowPos()");
|
diele("BeginDeferWindowPos()");
|
||||||
buttonx = 5;
|
buttonx = dipsToX(cmsp->folderBarMarginsLeftDIP(), dpiX);
|
||||||
buttony = 5;
|
buttony = dipsToY(cmsp->folderBarMarginsTopDIP(), dpiY);
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
cms->buttonMetrics(cmsp, leftButtons[i], NULL, &m);
|
cms->buttonMetrics(cmsp, leftButtons[i], NULL, &m);
|
||||||
dwp = DeferWindowPos(dwp, leftButtons[i], NULL,
|
dwp = DeferWindowPos(dwp, leftButtons[i], NULL,
|
||||||
|
@ -631,6 +642,33 @@ void repositionButtons(HWND hwnd)
|
||||||
diele("EndDeferWindowPos()");
|
diele("EndDeferWindowPos()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO check errors
|
||||||
|
void folderBarRect(HWND hwnd, HDC dc, RECT *r)
|
||||||
|
{
|
||||||
|
int dpiX;
|
||||||
|
int dpiY;
|
||||||
|
RECT child;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
dpiX = GetDeviceCaps(dc, LOGPIXELSX);
|
||||||
|
dpiY = GetDeviceCaps(dc, LOGPIXELSY);
|
||||||
|
|
||||||
|
GetClientRect(hwnd, r);
|
||||||
|
r->right -= r->left;
|
||||||
|
r->left = 0;
|
||||||
|
r->top = 0;
|
||||||
|
r->bottom = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < 5; i++) {
|
||||||
|
GetWindowRect(leftButtons[i], &child);
|
||||||
|
if (r->bottom < (child.bottom - child.top))
|
||||||
|
r->bottom = (child.bottom - child.top);
|
||||||
|
}
|
||||||
|
|
||||||
|
r->bottom += dipsToY(cmsp->folderBarMarginsTopDIP(), dpiY);
|
||||||
|
r->bottom += dipsToY(cmsp->folderBarMarginsBottomDIP(), dpiY);
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// TODO check errors
|
// TODO check errors
|
||||||
void handleEvents(HWND hwnd, WPARAM wParam)
|
void handleEvents(HWND hwnd, WPARAM wParam)
|
||||||
|
@ -745,13 +783,14 @@ LRESULT CALLBACK wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
// TODO check errors
|
// TODO check errors
|
||||||
dc = BeginPaint(hwnd, &ps);
|
dc = BeginPaint(hwnd, &ps);
|
||||||
{RECT w;
|
{RECT w;
|
||||||
GetClientRect(hwnd,&w);
|
folderBarRect(hwnd, dc, &w);
|
||||||
cms->drawFolderBar(cmsp, dc, &w, &(ps.rcPaint));}
|
cms->drawFolderBar(cmsp, dc, &w, &(ps.rcPaint));}
|
||||||
EndPaint(hwnd, &ps);
|
EndPaint(hwnd, &ps);
|
||||||
return 0;
|
return 0;
|
||||||
case WM_PRINTCLIENT:
|
case WM_PRINTCLIENT:
|
||||||
{RECT w;
|
{RECT w, paint;
|
||||||
GetClientRect(hwnd,&w);
|
folderBarRect(hwnd, (HDC) wParam, &w);
|
||||||
|
GetClientRect(hwnd,&paint);
|
||||||
cms->drawFolderBar(cmsp, (HDC) wParam, &w, &w);}
|
cms->drawFolderBar(cmsp, (HDC) wParam, &w, &w);}
|
||||||
return 0;
|
return 0;
|
||||||
#if 0
|
#if 0
|
||||||
|
|
Loading…
Reference in New Issue