fixed disabling of dialog items in a scroll window

added mouse wheel support to the scroll window
minor cleanups
TODO: update workspace files, scroll window support for wx
This commit is contained in:
Volker Ruppert 2013-03-19 17:44:19 +00:00
parent 25733b4387
commit 900ac609c7
2 changed files with 29 additions and 5 deletions

View File

@ -25,11 +25,12 @@ LRESULT CALLBACK ScrollWinProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
{
SCROLLINFO si;
BOOL pull = FALSE, redraw = FALSE;
static int vsize = 0, wsize = 0;
static int starty = 0, scrolly = 0;
int oldy = 0;
static int vsize = 0, wsize = 0, starty = 0;
int scrolly, oldy = 0;
short delta;
RECT R;
oldy = starty;
switch (msg) {
case WM_CREATE:
GetClientRect(hwnd, &R);
@ -44,7 +45,6 @@ LRESULT CALLBACK ScrollWinProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
break;
case WM_VSCROLL:
oldy = starty;
switch (LOWORD(wParam)) {
case SB_LINEDOWN:
if (starty < (vsize - wsize)) {
@ -93,8 +93,28 @@ LRESULT CALLBACK ScrollWinProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
pull = TRUE;
redraw = (starty != oldy);
break;
}
break;
case WM_MOUSEWHEEL:
delta = (short)HIWORD(wParam);
if (delta < 0) {
if (starty < (vsize - wsize)) {
starty += 3;
if (starty > (vsize - wsize)) {
starty = vsize - wsize;
}
redraw = TRUE;
break;
}
break;
} else if (delta > 0) {
if (starty > 0) {
starty -= 3;
if (starty < 0) starty = 0;
redraw = TRUE;
break;
}
}
return 0;
case WM_USER:
if (wParam == 0x1234) {
vsize = (int)lParam;

View File

@ -613,6 +613,10 @@ void EnableParam(HWND hDlg, UINT cid, bx_param_c *param, BOOL val)
cid = findDlgIDFromParam(param);
}
if (param->get_type() != BXT_LIST) {
bx_list_c *list = (bx_list_c*)param->get_parent();
if (list->get_options() & list->USE_SCROLL_WINDOW) {
hDlg = FindWindowEx(hDlg, NULL, "ScrollWin", NULL);
}
EnableWindow(GetDlgItem(hDlg, ID_LABEL + cid), val);
EnableWindow(GetDlgItem(hDlg, ID_PARAM + cid), val);
Button = GetDlgItem(hDlg, ID_BROWSE + cid);