menu widget

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@132 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-02 02:50:28 +00:00
parent 81c47a9733
commit ef4ce2a5f3
6 changed files with 42 additions and 8 deletions

View File

@@ -22,11 +22,11 @@ static void lluphandler(MwLL handle, void* data) {
}
static void lldownhandler(MwLL handle, void* data) {
MwWidget h = (MwWidget)handle->user;
MwPoint* p = data;
h->pressed = 1;
h->pressed_point.x = p->x;
h->pressed_point.y = p->y;
MwWidget h = (MwWidget)handle->user;
MwPoint* p = data;
h->pressed = 1;
h->mouse_point.x = p->x;
h->mouse_point.y = p->y;
}
static void llresizehandler(MwLL handle, void* data) {
@@ -49,6 +49,13 @@ static void llclosehandler(MwLL handle, void* data) {
h->close = 1;
}
static void llmovehandler(MwLL handle, void* data) {
MwWidget h = (MwWidget)handle->user;
MwPoint* p = data;
h->mouse_point.x = p->x;
h->mouse_point.y = p->y;
}
MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height) {
MwWidget h = malloc(sizeof(*h));
@@ -72,6 +79,7 @@ MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent,
h->lowlevel->handler->down = lldownhandler;
h->lowlevel->handler->resize = llresizehandler;
h->lowlevel->handler->close = llclosehandler;
h->lowlevel->handler->move = llmovehandler;
if(parent != NULL) arrput(parent->children, h);