MCPcopy Create free account
hub / github.com/NetHack/NetHack / LayoutMenu

Function LayoutMenu

outdated/sys/wince/mhmenu.c:651–706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

649}
650
651void
652LayoutMenu(HWND hWnd)
653{
654 PNHMenuWindow data;
655 HWND menu_ok;
656 HWND menu_cancel;
657 RECT clrt, rt;
658 POINT pt_elem, pt_ok, pt_cancel;
659 SIZE sz_elem, sz_ok, sz_cancel;
660
661 data = (PNHMenuWindow) GetWindowLong(hWnd, GWL_USERDATA);
662 menu_ok = GetDlgItem(hWnd, IDOK);
663 menu_cancel = GetDlgItem(hWnd, IDCANCEL);
664
665 /* get window coordinates */
666 GetClientRect(hWnd, &clrt);
667
668 /* set window placements */
669 if (IsWindow(menu_ok)) {
670 GetWindowRect(menu_ok, &rt);
671 sz_ok.cx = (clrt.right - clrt.left) / 2 - 2 * MENU_MARGIN;
672 sz_ok.cy = rt.bottom - rt.top;
673 pt_ok.x = clrt.left + MENU_MARGIN;
674 pt_ok.y = clrt.bottom - MENU_MARGIN - sz_ok.cy;
675 MoveWindow(menu_ok, pt_ok.x, pt_ok.y, sz_ok.cx, sz_ok.cy, TRUE);
676 } else {
677 pt_ok.x = 0;
678 pt_ok.y = clrt.bottom;
679 sz_ok.cx = sz_ok.cy = 0;
680 }
681
682 if (IsWindow(menu_cancel)) {
683 GetWindowRect(menu_cancel, &rt);
684 sz_cancel.cx = (clrt.right - clrt.left) / 2 - 2 * MENU_MARGIN;
685 sz_cancel.cy = rt.bottom - rt.top;
686 pt_cancel.x = (clrt.left + clrt.right) / 2 + MENU_MARGIN;
687 pt_cancel.y = clrt.bottom - MENU_MARGIN - sz_cancel.cy;
688 MoveWindow(menu_cancel, pt_cancel.x, pt_cancel.y, sz_cancel.cx,
689 sz_cancel.cy, TRUE);
690 } else {
691 pt_cancel.x = 0;
692 pt_cancel.y = clrt.bottom;
693 sz_cancel.cx = sz_cancel.cy = 0;
694 }
695
696 pt_elem.x = clrt.left + MENU_MARGIN;
697 pt_elem.y = clrt.top + MENU_MARGIN;
698 sz_elem.cx = (clrt.right - clrt.left) - 2 * MENU_MARGIN;
699 sz_elem.cy = min(pt_cancel.y, pt_ok.y) - MENU_MARGIN - pt_elem.y;
700 MoveWindow(GetMenuControl(hWnd), pt_elem.x, pt_elem.y, sz_elem.cx,
701 sz_elem.cy, TRUE);
702
703 /* reformat text for the text menu */
704 if (data && data->type == MENU_TYPE_TEXT && data->text.text)
705 mswin_render_text(data->text.text, GetMenuControl(hWnd));
706}
707
708void

Callers 2

MenuWndProcFunction · 0.70
SetMenuTypeFunction · 0.70

Calls 2

mswin_render_textFunction · 0.85
GetMenuControlFunction · 0.70

Tested by

no test coverage detected