mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-09 19:03:29 +00:00
works on gdi too
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@279 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -47,8 +47,10 @@ enum MwLLKeyEnum {
|
|||||||
|
|
||||||
enum MwLLMouseEnum {
|
enum MwLLMouseEnum {
|
||||||
MwLLMouseLeft = 1,
|
MwLLMouseLeft = 1,
|
||||||
MwLLMouseMiddle = 2,
|
MwLLMouseMiddle,
|
||||||
MwLLMouseRight = 3
|
MwLLMouseRight,
|
||||||
|
MwLLMouseWheelUp,
|
||||||
|
MwLLMouseWheelDown
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MwLLMouse {
|
struct _MwLLMouse {
|
||||||
|
|||||||
@@ -72,6 +72,20 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
|
|||||||
|
|
||||||
SetCapture(NULL);
|
SetCapture(NULL);
|
||||||
MwLLDispatch(u->ll, up, &p);
|
MwLLDispatch(u->ll, up, &p);
|
||||||
|
} else if(msg == WM_MOUSEWHEEL) {
|
||||||
|
int d = GET_WHEEL_DELTA_WPARAM(wp);
|
||||||
|
MwLLMouse p;
|
||||||
|
p.point.x = LOWORD(lp);
|
||||||
|
p.point.y = HIWORD(lp);
|
||||||
|
|
||||||
|
if(d > 0) {
|
||||||
|
p.button = MwLLMouseWheelUp;
|
||||||
|
} else if(d < 0) {
|
||||||
|
p.button = MwLLMouseWheelDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
MwLLDispatch(u->ll, down, &p);
|
||||||
|
MwLLDispatch(u->ll, up, &p);
|
||||||
} else if(msg == WM_MOUSEMOVE) {
|
} else if(msg == WM_MOUSEMOVE) {
|
||||||
MwPoint p;
|
MwPoint p;
|
||||||
p.x = LOWORD(lp);
|
p.x = LOWORD(lp);
|
||||||
|
|||||||
@@ -172,6 +172,10 @@ void MwLLNextEvent(MwLL handle) {
|
|||||||
p.button = MwLLMouseMiddle;
|
p.button = MwLLMouseMiddle;
|
||||||
} else if(ev.xbutton.button == Button3) {
|
} else if(ev.xbutton.button == Button3) {
|
||||||
p.button = MwLLMouseRight;
|
p.button = MwLLMouseRight;
|
||||||
|
} else if(ev.xbutton.button == Button4) {
|
||||||
|
p.button = MwLLMouseWheelUp;
|
||||||
|
} else if(ev.xbutton.button == Button5) {
|
||||||
|
p.button = MwLLMouseWheelDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
MwLLDispatch(handle, down, &p);
|
MwLLDispatch(handle, down, &p);
|
||||||
@@ -187,6 +191,10 @@ void MwLLNextEvent(MwLL handle) {
|
|||||||
p.button = MwLLMouseMiddle;
|
p.button = MwLLMouseMiddle;
|
||||||
} else if(ev.xbutton.button == Button3) {
|
} else if(ev.xbutton.button == Button3) {
|
||||||
p.button = MwLLMouseRight;
|
p.button = MwLLMouseRight;
|
||||||
|
} else if(ev.xbutton.button == Button4) {
|
||||||
|
p.button = MwLLMouseWheelUp;
|
||||||
|
} else if(ev.xbutton.button == Button5) {
|
||||||
|
p.button = MwLLMouseWheelDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
MwLLDispatch(handle, up, &p);
|
MwLLDispatch(handle, up, &p);
|
||||||
|
|||||||
@@ -164,8 +164,30 @@ static void mouse_down(MwWidget handle, void* ptr) {
|
|||||||
int wh = MwGetInteger(handle, MwNheight);
|
int wh = MwGetInteger(handle, MwNheight);
|
||||||
int or = MwGetInteger(handle, MwNorientation);
|
int or = MwGetInteger(handle, MwNorientation);
|
||||||
scrollbar_t* scr = handle->internal;
|
scrollbar_t* scr = handle->internal;
|
||||||
|
MwLLMouse* m = ptr;
|
||||||
|
|
||||||
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
|
if(m->button == MwLLMouseWheelUp) {
|
||||||
|
int min = MwGetInteger(handle, MwNminValue);
|
||||||
|
int val = MwGetInteger(handle, MwNvalue);
|
||||||
|
|
||||||
|
val -= MwGetInteger(handle, MwNareaShown);
|
||||||
|
|
||||||
|
if(val < min) val = min;
|
||||||
|
|
||||||
|
MwSetInteger(handle, MwNvalue, val);
|
||||||
|
MwDispatchUserHandler(handle, MwNchangedHandler, NULL);
|
||||||
|
} else if(m->button == MwLLMouseWheelDown) {
|
||||||
|
int max = MwGetInteger(handle, MwNmaxValue);
|
||||||
|
int val = MwGetInteger(handle, MwNvalue);
|
||||||
|
|
||||||
|
val += MwGetInteger(handle, MwNareaShown);
|
||||||
|
|
||||||
|
if(val > max) val = max;
|
||||||
|
|
||||||
|
MwSetInteger(handle, MwNvalue, val);
|
||||||
|
MwDispatchUserHandler(handle, MwNchangedHandler, NULL);
|
||||||
|
}
|
||||||
|
if(m->button != MwLLMouseLeft) return;
|
||||||
|
|
||||||
scr->point = handle->mouse_point;
|
scr->point = handle->mouse_point;
|
||||||
scr->drag = 0;
|
scr->drag = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user