This commit is contained in:
parent
39a458d80f
commit
7c2ab989fa
3 changed files with 39 additions and 38 deletions
|
|
@ -274,7 +274,7 @@ struct _MwClass {
|
|||
MwHandlerChildrenProp children_prop_change;
|
||||
MwHandlerClipboardReceived clipboard;
|
||||
MwHandlerProps props_change;
|
||||
MwHandler drag_and_drop;
|
||||
MwHandler drag_and_drop;
|
||||
void* reserved2;
|
||||
void* reserved3;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
|
|||
|
||||
switch(msg) {
|
||||
case WM_INITDIALOG:
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
|
|
@ -168,25 +168,26 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
|
|||
MwLLDispatch(u->ll, up, &p);
|
||||
break;
|
||||
}
|
||||
case WM_DROPFILES: {
|
||||
HDROP hDrop = (HDROP)wp;
|
||||
UINT count;
|
||||
UINT i, n;
|
||||
HRESULT hr;
|
||||
case WM_DROPFILES:
|
||||
{
|
||||
HDROP hDrop = (HDROP)wp;
|
||||
UINT count;
|
||||
UINT i, n;
|
||||
HRESULT hr;
|
||||
|
||||
count = wsymtbl.DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0);
|
||||
count = wsymtbl.DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0);
|
||||
|
||||
for(i = 0; i < count; i++) {
|
||||
wchar_t wpath[MAX_PATH];
|
||||
char path[MAX_PATH];
|
||||
wsymtbl.DragQueryFileW(hDrop, i, wpath, MAX_PATH);
|
||||
for(i = 0; i < count; i++) {
|
||||
wchar_t wpath[MAX_PATH];
|
||||
char path[MAX_PATH];
|
||||
wsymtbl.DragQueryFileW(hDrop, i, wpath, MAX_PATH);
|
||||
|
||||
memset(path, 0, sizeof(path));
|
||||
WideCharToMultiByte(CP_UTF8, 0, wpath, -1, path, sizeof(path) - 1, NULL, NULL);
|
||||
memset(path, 0, sizeof(path));
|
||||
WideCharToMultiByte(CP_UTF8, 0, wpath, -1, path, sizeof(path) - 1, NULL, NULL);
|
||||
|
||||
MwLLDispatch(u->ll, drag_and_drop, path);
|
||||
}
|
||||
wsymtbl.DragFinish(hDrop);
|
||||
}
|
||||
wsymtbl.DragFinish(hDrop);
|
||||
break;
|
||||
}
|
||||
case WM_MOUSEMOVE:
|
||||
|
|
@ -612,9 +613,9 @@ static void MwLLNextEventImpl(MwLL handle) {
|
|||
handle->gdi.get_darktheme = 0;
|
||||
}
|
||||
while(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
|
||||
if(GetMessage(&msg, NULL, 0, 0)) {
|
||||
if(GetMessage(&msg, NULL, 0, 0)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
40
src/core.c
40
src/core.c
|
|
@ -145,8 +145,9 @@ static void llclosehandler(MwLL handle, void* data) {
|
|||
}
|
||||
|
||||
static void llmovehandler(MwLL handle, void* data) {
|
||||
MwWidget h = (MwWidget)handle->common.user;
|
||||
MwPoint* p = data;
|
||||
MwWidget h = (MwWidget)handle->common.user;
|
||||
MwPoint* p = data;
|
||||
|
||||
h->mouse_point.x = p->x;
|
||||
h->mouse_point.y = p->y;
|
||||
|
||||
|
|
@ -193,15 +194,13 @@ static void llclipboardhandler(MwLL handle, void* data) {
|
|||
}
|
||||
|
||||
static void lldraganddrophandler(MwLL handle, void* data) {
|
||||
MwWidget h = (MwWidget)handle->common.user;
|
||||
const char * p = data;
|
||||
MwWidget h = (MwWidget)handle->common.user;
|
||||
const char* p = data;
|
||||
if(MwGetInteger(h, MwNdisabled) == 1) return;
|
||||
|
||||
printf("%s\n",p);
|
||||
MwDispatchUserHandler(h, MwNdragAndDropHandler, data);
|
||||
}
|
||||
|
||||
|
||||
/* if both of them are true
|
||||
* 1. widget class is not NULL
|
||||
* 2. parent is NULL
|
||||
|
|
@ -282,20 +281,20 @@ static MwWidget MwCreateWidget_Internal(MwClass widget_class, const char* name,
|
|||
if(parent == NULL) h->top_step = 1;
|
||||
|
||||
if(h->lowlevel != NULL) {
|
||||
h->lowlevel->common.user = h;
|
||||
h->lowlevel->common.handler->draw = lldrawhandler;
|
||||
h->lowlevel->common.handler->up = lluphandler;
|
||||
h->lowlevel->common.handler->down = lldownhandler;
|
||||
h->lowlevel->common.handler->resize = llresizehandler;
|
||||
h->lowlevel->common.handler->close = llclosehandler;
|
||||
h->lowlevel->common.handler->move = llmovehandler;
|
||||
h->lowlevel->common.handler->key = llkeyhandler;
|
||||
h->lowlevel->common.handler->key_released = llkeyrelhandler;
|
||||
h->lowlevel->common.handler->focus_in = llfocusinhandler;
|
||||
h->lowlevel->common.handler->focus_out = llfocusouthandler;
|
||||
h->lowlevel->common.handler->clipboard = llclipboardhandler;
|
||||
h->lowlevel->common.handler->dark_theme = lldarkthemehandler;
|
||||
h->lowlevel->common.handler->drag_and_drop = lldraganddrophandler;
|
||||
h->lowlevel->common.user = h;
|
||||
h->lowlevel->common.handler->draw = lldrawhandler;
|
||||
h->lowlevel->common.handler->up = lluphandler;
|
||||
h->lowlevel->common.handler->down = lldownhandler;
|
||||
h->lowlevel->common.handler->resize = llresizehandler;
|
||||
h->lowlevel->common.handler->close = llclosehandler;
|
||||
h->lowlevel->common.handler->move = llmovehandler;
|
||||
h->lowlevel->common.handler->key = llkeyhandler;
|
||||
h->lowlevel->common.handler->key_released = llkeyrelhandler;
|
||||
h->lowlevel->common.handler->focus_in = llfocusinhandler;
|
||||
h->lowlevel->common.handler->focus_out = llfocusouthandler;
|
||||
h->lowlevel->common.handler->clipboard = llclipboardhandler;
|
||||
h->lowlevel->common.handler->dark_theme = lldarkthemehandler;
|
||||
h->lowlevel->common.handler->drag_and_drop = lldraganddrophandler;
|
||||
}
|
||||
|
||||
if(parent != NULL) arrput(parent->children, h);
|
||||
|
|
@ -573,6 +572,7 @@ int MwStep(MwWidget handle) {
|
|||
MwFreeWidget(handle);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue