2025-09-29 14:29:34 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
#include <Mw/Milsko.h>
|
|
|
|
|
|
2025-10-04 13:57:28 +00:00
|
|
|
static int create(MwWidget handle) {
|
2025-09-29 14:29:34 +00:00
|
|
|
MwSetDefault(handle);
|
2025-10-04 13:57:28 +00:00
|
|
|
|
2025-11-14 16:14:01 +00:00
|
|
|
MwSetInteger(handle, MwNhasBorder, 0);
|
2025-11-14 16:16:08 +00:00
|
|
|
MwSetInteger(handle, MwNinverted, 1);
|
2025-11-14 16:14:01 +00:00
|
|
|
|
2025-10-04 13:57:28 +00:00
|
|
|
return 0;
|
2025-09-29 14:29:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void draw(MwWidget handle) {
|
2025-10-16 23:20:45 +00:00
|
|
|
MwRect fr;
|
|
|
|
|
MwRect rr;
|
2025-09-29 14:29:34 +00:00
|
|
|
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
2025-11-14 16:33:45 +00:00
|
|
|
int inverted;
|
2025-09-29 14:29:34 +00:00
|
|
|
|
2025-11-14 16:14:01 +00:00
|
|
|
if(MwGetInteger(handle, MwNhasBorder)) {
|
2025-10-16 23:20:45 +00:00
|
|
|
inverted = MwGetInteger(handle, MwNinverted);
|
|
|
|
|
fr.x = 0;
|
|
|
|
|
fr.y = 0;
|
|
|
|
|
fr.width = MwGetInteger(handle, MwNwidth);
|
|
|
|
|
fr.height = MwGetInteger(handle, MwNheight);
|
|
|
|
|
MwDrawFrame(handle, &fr, base, inverted);
|
|
|
|
|
|
2025-10-30 23:16:03 +00:00
|
|
|
rr.x = MwDefaultBorderWidth(handle);
|
|
|
|
|
rr.y = MwDefaultBorderWidth(handle);
|
|
|
|
|
rr.width = MwGetInteger(handle, MwNwidth) - (MwDefaultBorderWidth(handle) * 2);
|
|
|
|
|
rr.height = MwGetInteger(handle, MwNheight) - (MwDefaultBorderWidth(handle) * 2);
|
2025-10-16 23:20:45 +00:00
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
rr.x = 0;
|
|
|
|
|
rr.y = 0;
|
|
|
|
|
rr.width = MwGetInteger(handle, MwNwidth);
|
|
|
|
|
rr.height = MwGetInteger(handle, MwNheight);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MwDrawRect(handle, &rr, base);
|
2025-09-29 14:29:34 +00:00
|
|
|
|
|
|
|
|
MwLLFreeColor(base);
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-14 17:34:07 +00:00
|
|
|
static void prop_change(MwWidget handle, const char* key) {
|
|
|
|
|
if(strcmp(key, MwNhasBorder) == 0 || strcmp(key, MwNinverted) == 0) MwForceRender(handle);
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-29 14:29:34 +00:00
|
|
|
MwClassRec MwFrameClassRec = {
|
2025-11-14 18:19:07 +00:00
|
|
|
create, /* create */
|
|
|
|
|
NULL, /* destroy */
|
|
|
|
|
draw, /* draw */
|
|
|
|
|
NULL, /* click */
|
|
|
|
|
NULL, /* parent_resize */
|
|
|
|
|
prop_change, /* prop_change */
|
|
|
|
|
NULL, /* mouse_move */
|
|
|
|
|
NULL, /* mouse_up */
|
|
|
|
|
NULL, /* mouse_down */
|
|
|
|
|
NULL, /* key */
|
|
|
|
|
NULL, /* execute */
|
|
|
|
|
NULL, /* tick */
|
2025-10-08 18:03:46 +00:00
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL};
|
2025-09-29 14:29:34 +00:00
|
|
|
MwClass MwFrameClass = &MwFrameClassRec;
|