add color picker example

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@381 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
IoIxD
2025-10-16 22:12:06 +00:00
parent caf2d110d1
commit e5c41d7295
4 changed files with 169 additions and 12 deletions

View File

@@ -132,7 +132,7 @@ static void draw(MwWidget handle) {
}
static void mouse_move(MwWidget handle) {
int or = MwGetInteger(handle, MwNorientation);
int or = MwGetInteger(handle, MwNorientation);
scrollbar_t* scr = handle->internal;
if(!handle->pressed) return;
@@ -160,31 +160,35 @@ static void mouse_move(MwWidget handle) {
}
static void mouse_down(MwWidget handle, void* ptr) {
int ww = MwGetInteger(handle, MwNwidth);
int wh = MwGetInteger(handle, MwNheight);
int or = MwGetInteger(handle, MwNorientation);
int ww = MwGetInteger(handle, MwNwidth);
int wh = MwGetInteger(handle, MwNheight);
int or = MwGetInteger(handle, MwNorientation);
scrollbar_t* scr = handle->internal;
MwLLMouse* m = ptr;
if(m->button == MwLLMouseWheelUp) {
int min = MwGetInteger(handle, MwNminValue);
int val = MwGetInteger(handle, MwNvalue);
int min = MwGetInteger(handle, MwNminValue);
int val = MwGetInteger(handle, MwNvalue);
int diff = MwGetInteger(handle, MwNareaShown);
val -= MwGetInteger(handle, MwNareaShown);
val -= diff;
if(val < min) val = min;
MwSetInteger(handle, MwNvalue, val);
MwSetInteger(handle, MwNchangedBy, -diff);
MwDispatchUserHandler(handle, MwNchangedHandler, NULL);
} else if(m->button == MwLLMouseWheelDown) {
int max = MwGetInteger(handle, MwNmaxValue);
int val = MwGetInteger(handle, MwNvalue);
int max = MwGetInteger(handle, MwNmaxValue);
int val = MwGetInteger(handle, MwNvalue);
int diff = MwGetInteger(handle, MwNareaShown);
val += MwGetInteger(handle, MwNareaShown);
val += diff;
if(val > max) val = max;
MwSetInteger(handle, MwNvalue, val);
MwSetInteger(handle, MwNchangedBy, diff);
MwDispatchUserHandler(handle, MwNchangedHandler, NULL);
}
if(m->button != MwLLMouseLeft) return;