merge generic_func_idea from git

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@433 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
IoIxD
2025-10-20 21:55:30 +00:00
parent 65f5942f9d
commit ebc674f403
29 changed files with 499 additions and 234 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,9 +160,9 @@ 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;
@@ -219,25 +219,7 @@ static void prop_change(MwWidget handle, const char* key) {
}
}
MwClassRec MwScrollBarClassRec = {
create, /* create */
destroy, /* destroy */
draw, /* draw */
NULL, /* click */
NULL, /* parent_resize */
prop_change, /* prop_change */
mouse_move, /* mouse_move */
MwForceRender2, /* mouse_up */
mouse_down, /* mouse_down */
NULL, /* key */
NULL,
NULL,
NULL,
NULL,
NULL};
MwClass MwScrollBarClass = &MwScrollBarClassRec;
int MwScrollBarGetVisibleLength(MwWidget handle) {
static int mwScrollBarGetVisibleLengthImpl(MwWidget handle) {
int ww = MwGetInteger(handle, MwNwidth);
int wh = MwGetInteger(handle, MwNheight);
int or = MwGetInteger(handle, MwNorientation);
@@ -253,3 +235,29 @@ int MwScrollBarGetVisibleLength(MwWidget handle) {
}
return s - tri - MwDefaultBorderWidth * 2;
}
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
(void)va;
if(strcmp(name, "mwScrollBarGetVisibleLength") == 0) {
*(int*)out = mwScrollBarGetVisibleLengthImpl(handle);
}
}
MwClassRec MwScrollBarClassRec = {
create, /* create */
destroy, /* destroy */
draw, /* draw */
NULL, /* click */
NULL, /* parent_resize */
prop_change, /* prop_change */
mouse_move, /* mouse_move */
MwForceRender2, /* mouse_up */
mouse_down, /* mouse_down */
NULL, /* key */
func_handler, /* custom */
NULL,
NULL,
NULL,
NULL};
MwClass MwScrollBarClass = &MwScrollBarClassRec;