2025-09-29 00:10:20 +00:00
|
|
|
#include <Mw/Milsko.h>
|
2025-09-28 08:37:12 +00:00
|
|
|
|
2025-10-04 13:57:28 +00:00
|
|
|
static int create(MwWidget handle) {
|
2025-09-29 00:04:04 +00:00
|
|
|
MwSetDefault(handle);
|
2025-10-04 13:57:28 +00:00
|
|
|
|
2025-11-15 20:57:23 +00:00
|
|
|
MwSetInteger(handle, MwNhasBorder, 0);
|
|
|
|
|
MwSetInteger(handle, MwNinverted, 1);
|
|
|
|
|
|
2025-10-04 13:57:28 +00:00
|
|
|
return 0;
|
2025-09-28 13:28:17 +00:00
|
|
|
}
|
|
|
|
|
|
2025-09-29 00:04:04 +00:00
|
|
|
static void draw(MwWidget handle) {
|
|
|
|
|
MwLLColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
2025-09-29 00:10:20 +00:00
|
|
|
MwRect r;
|
2025-09-28 09:55:42 +00:00
|
|
|
|
2025-09-28 13:46:18 +00:00
|
|
|
r.x = 0;
|
|
|
|
|
r.y = 0;
|
2025-09-29 00:04:04 +00:00
|
|
|
r.width = MwGetInteger(handle, MwNwidth);
|
|
|
|
|
r.height = MwGetInteger(handle, MwNheight);
|
2025-09-28 10:01:59 +00:00
|
|
|
|
2026-04-14 13:34:49 -07:00
|
|
|
if(MwGetInteger(handle, MwNhasBorder)) MwDrawFrame(handle, &r, c, MwGetInteger(handle, MwNinverted));
|
2025-11-15 20:57:23 +00:00
|
|
|
|
2025-09-29 00:04:04 +00:00
|
|
|
MwDrawRect(handle, &r, c);
|
2025-09-28 09:55:42 +00:00
|
|
|
|
2025-09-29 00:04:04 +00:00
|
|
|
MwLLFreeColor(c);
|
2025-09-28 09:50:28 +00:00
|
|
|
}
|
2025-11-15 20:57:23 +00:00
|
|
|
|
|
|
|
|
static void prop_change(MwWidget handle, const char* key) {
|
|
|
|
|
if(strcmp(key, MwNhasBorder) == 0 || strcmp(key, MwNinverted) == 0) MwForceRender(handle);
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-20 21:55:30 +00:00
|
|
|
static void mwWindowMakeBorderlessImpl(MwWidget handle, int toggle) {
|
2025-11-14 12:13:31 +00:00
|
|
|
MwLLBeginStateChange(handle->lowlevel);
|
2025-10-20 21:55:30 +00:00
|
|
|
MwLLMakeBorderless(handle->lowlevel, toggle);
|
2025-11-14 12:13:31 +00:00
|
|
|
MwLLEndStateChange(handle->lowlevel);
|
2025-10-20 21:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
|
|
|
|
(void)out;
|
2025-09-28 09:50:28 +00:00
|
|
|
|
2025-10-20 21:55:30 +00:00
|
|
|
if(strcmp(name, "mwWindowMakeBorderless") == 0) {
|
|
|
|
|
int toggle = va_arg(va, int);
|
|
|
|
|
mwWindowMakeBorderlessImpl(handle, toggle);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-09-29 00:04:04 +00:00
|
|
|
MwClassRec MwWindowClassRec = {
|
2025-10-20 21:55:30 +00:00
|
|
|
create, /* create */
|
|
|
|
|
NULL, /* destroy */
|
|
|
|
|
draw, /* draw */
|
|
|
|
|
NULL, /* click */
|
|
|
|
|
NULL, /* parent_resize */
|
2025-11-15 20:57:23 +00:00
|
|
|
prop_change, /* prop_change */
|
2025-10-20 21:55:30 +00:00
|
|
|
NULL, /* mouse_move */
|
|
|
|
|
NULL, /* mouse_up */
|
|
|
|
|
NULL, /* mouse_down */
|
|
|
|
|
NULL, /* key */
|
2025-10-30 23:16:03 +00:00
|
|
|
func_handler, /* execute */
|
2025-11-04 02:43:38 +00:00
|
|
|
NULL, /* tick */
|
2025-12-15 14:09:30 +09:00
|
|
|
NULL, /* resize */
|
|
|
|
|
NULL, /* children_update */
|
|
|
|
|
NULL, /* children_prop_change */
|
2025-12-31 04:35:10 +09:00
|
|
|
NULL, /* clipboard */
|
2025-12-15 14:09:30 +09:00
|
|
|
NULL,
|
2025-10-08 18:03:46 +00:00
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL};
|
2025-09-29 00:04:04 +00:00
|
|
|
MwClass MwWindowClass = &MwWindowClassRec;
|