better property handling

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@226 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-08 15:42:57 +00:00
parent 84a4efa57e
commit 7450b17bcf
8 changed files with 64 additions and 22 deletions

View File

@@ -61,13 +61,17 @@ static void click(MwWidget handle) {
MwDispatchUserHandler(handle, MwNactivateHandler, NULL);
}
static void prop_change(MwWidget handle, const char* key) {
if(strcmp(key, MwNtext) == 0 || strcmp(key, MwNpixmap) == 0) MwForceRender(handle);
}
MwClassRec MwButtonClassRec = {
create, /* create */
NULL, /* destroy */
draw, /* draw */
click, /* click */
NULL, /* parent_resize */
NULL, /* prop_change */
prop_change, /* prop_change */
NULL, /* mouse_move */
MwForceRender, /* mouse_up */
MwForceRender /* mouse_down */

View File

@@ -33,13 +33,17 @@ static void click(MwWidget handle) {
MwDispatchUserHandler(handle, MwNchangedHandler, NULL);
}
static void prop_change(MwWidget handle, const char* key) {
if(strcmp(key, MwNchecked) == 0) MwForceRender(handle);
}
MwClassRec MwCheckBoxClassRec = {
create, /* create */
NULL, /* destroy */
draw, /* draw */
click, /* click */
NULL, /* parent_resize */
NULL, /* prop_change */
prop_change, /* prop_change */
NULL, /* mouse_move */
MwForceRender, /* mouse_up */
MwForceRender /* mouse_down */

View File

@@ -20,15 +20,19 @@ static void draw(MwWidget handle) {
}
}
static void prop_change(MwWidget handle, const char* key) {
if(strcmp(key, MwNpixmap) == 0) MwForceRender(handle);
}
MwClassRec MwImageClassRec = {
create, /* create */
NULL, /* destroy */
draw, /* draw */
NULL, /* click */
NULL, /* parent_resize */
NULL, /* prop_change */
NULL, /* mouse_move */
NULL, /* mouse_up */
NULL /* mouse_down */
create, /* create */
NULL, /* destroy */
draw, /* draw */
NULL, /* click */
NULL, /* parent_resize */
prop_change, /* prop_change */
NULL, /* mouse_move */
NULL, /* mouse_up */
NULL /* mouse_down */
};
MwClass MwImageClass = &MwImageClassRec;

View File

@@ -40,15 +40,19 @@ static void draw(MwWidget handle) {
MwLLFreeColor(base);
}
static void prop_change(MwWidget handle, const char* key) {
if(strcmp(key, MwNtext) == 0 || strcmp(key, MwNalignment) == 0) MwForceRender(handle);
}
MwClassRec MwLabelClassRec = {
create, /* create */
NULL, /* destroy */
draw, /* draw */
NULL, /* click */
NULL, /* parent_resize */
NULL, /* prop_change */
NULL, /* mouse_move */
NULL, /* mouse_up */
NULL /* mouse_down */
create, /* create */
NULL, /* destroy */
draw, /* draw */
NULL, /* click */
NULL, /* parent_resize */
prop_change, /* prop_change */
NULL, /* mouse_move */
NULL, /* mouse_up */
NULL /* mouse_down */
};
MwClass MwLabelClass = &MwLabelClassRec;

View File

@@ -181,13 +181,17 @@ static void mouse_down(MwWidget handle) {
MwForceRender(handle);
}
static void prop_change(MwWidget handle, const char* key) {
if(strcmp(key, MwNminValue) == 0 || strcmp(key, MwNvalue) == 0 || strcmp(key, MwNmaxValue) == 0 || strcmp(key, MwNareaShown) == 0) MwForceRender(handle);
}
MwClassRec MwScrollBarClassRec = {
create, /* create */
destroy, /* destroy */
draw, /* draw */
NULL, /* click */
NULL, /* parent_resize */
NULL, /* prop_change */
prop_change, /* prop_change */
mouse_move, /* mouse_move */
MwForceRender, /* mouse_up */
mouse_down /* mouse_down */