git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@400 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-17 19:11:32 +00:00
parent 7a531de084
commit 599b1ee0c8
11 changed files with 214 additions and 3 deletions

View File

@@ -90,6 +90,18 @@ static void llkeyrelhandler(MwLL handle, void* data) {
MwDispatchUserHandler(h, MwNkeyReleaseHandler, data);
}
static void llfocusinhandler(MwLL handle, void* data) {
MwWidget h = (MwWidget)handle->user;
MwDispatchUserHandler(h, MwNfocusInHandler, data);
}
static void llfocusouthandler(MwLL handle, void* data) {
MwWidget h = (MwWidget)handle->user;
MwDispatchUserHandler(h, MwNfocusOutHandler, data);
}
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));
@@ -127,6 +139,8 @@ MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent,
h->lowlevel->handler->move = llmovehandler;
h->lowlevel->handler->key = llkeyhandler;
h->lowlevel->handler->key_released = llkeyrelhandler;
h->lowlevel->handler->focus_in = llfocusinhandler;
h->lowlevel->handler->focus_out = llfocusouthandler;
}
if(parent != NULL) arrput(parent->children, h);
@@ -400,6 +414,10 @@ void MwSetDefault(MwWidget handle) {
inherit_text(handle, MwNforeground, MwDefaultForeground);
}
void MwHideCursor(MwWidget handle){
MwLLSetCursor(handle->lowlevel, &MwCursorHidden, &MwCursorHiddenMask);
}
void MwDispatchUserHandler(MwWidget handle, const char* key, void* handler_data) {
int ind = shgeti(handle->handler, key);
if(ind == -1) return;
@@ -459,3 +477,11 @@ void MwAddTickList(MwWidget handle) {
arrput(root->tick_list, handle);
}
void MwFocus(MwWidget handle){
MwLLFocus(handle->lowlevel);
}
void MwGrabPointer(MwWidget handle, int toggle){
MwLLGrabPointer(handle->lowlevel, toggle);
}