Hooked up the Windows menu event system and fixed some bugs in it. Still need to define menu events in general...
This commit is contained in:
parent
dc386a599e
commit
ac8e59c004
|
@ -93,7 +93,7 @@ HMENU makeMenubar(void)
|
||||||
// this is slow, but it will do for now
|
// this is slow, but it will do for now
|
||||||
// TODO investigate faster options
|
// TODO investigate faster options
|
||||||
|
|
||||||
static const uiMenuItem *lookupID(const uiMenu *items, UINT_PTR *cur, UINT_PTR id)
|
static const uiMenuItem *lookupID(const uiMenuItem *items, UINT_PTR *cur, UINT_PTR id)
|
||||||
{
|
{
|
||||||
const uiMenuItem *i;
|
const uiMenuItem *i;
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ const uiMenuItem *menuIDToItem(UINT_PTR id)
|
||||||
|
|
||||||
cur = 100;
|
cur = 100;
|
||||||
for (m = options.Menu; m->Name != NULL; m++) {
|
for (m = options.Menu; m->Name != NULL; m++) {
|
||||||
item = lookupID(m, &cur, id);
|
item = lookupID(m->Items, &cur, id);
|
||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ static LRESULT CALLBACK uiWindowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPA
|
||||||
WINDOWPOS *wp = (WINDOWPOS *) lParam;
|
WINDOWPOS *wp = (WINDOWPOS *) lParam;
|
||||||
RECT r;
|
RECT r;
|
||||||
HWND contenthwnd;
|
HWND contenthwnd;
|
||||||
|
const uiMenuItem *item;
|
||||||
|
|
||||||
w = (struct window *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
|
w = (struct window *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
|
||||||
if (w == NULL) {
|
if (w == NULL) {
|
||||||
|
@ -30,6 +31,18 @@ static LRESULT CALLBACK uiWindowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPA
|
||||||
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
|
case WM_COMMAND:
|
||||||
|
// not a menu
|
||||||
|
if (lParam != 0)
|
||||||
|
break;
|
||||||
|
if (HIWORD(wParam) != 0)
|
||||||
|
break;
|
||||||
|
item = menuIDToItem(LOWORD(wParam));
|
||||||
|
printf("%d", item->Type);
|
||||||
|
if (item->Type == uiMenuItemTypeCommand)
|
||||||
|
printf(" %s", item->Name);
|
||||||
|
printf("\n");
|
||||||
|
return 0;
|
||||||
case WM_WINDOWPOSCHANGED:
|
case WM_WINDOWPOSCHANGED:
|
||||||
if ((wp->flags & SWP_NOSIZE) != 0)
|
if ((wp->flags & SWP_NOSIZE) != 0)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue