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

Function LayoutCmdWindow

outdated/sys/wince/mhcmd.c:825–909  ·  view source on GitHub ↗

-------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

823}
824/*-------------------------------------------------------------------------*/
825void
826LayoutCmdWindow(HWND hWnd)
827{
828 RECT clrt;
829 SIZE windowSize;
830 PNHCmdWindow data;
831 int i, j;
832 int x, y;
833 LOGFONT lgfnt;
834 int index;
835
836 GetClientRect(hWnd, &clrt);
837 if (IsRectEmpty(&clrt))
838 return;
839
840 data = (PNHCmdWindow) GetWindowLong(hWnd, GWL_USERDATA);
841 if (!data->layout_current)
842 return;
843
844 /* calculate cell size */
845 windowSize.cx = clrt.right - clrt.left;
846 windowSize.cy = clrt.bottom - clrt.top;
847 CalculateCellSize(hWnd, &data->cell_size, &windowSize);
848
849 /* initialize display cells aray */
850 x = 0;
851 y = 0;
852 for (i = 0, index = 0; i < nhcmdlayout_rows(data->layout_current); i++) {
853 for (j = 0; j < nhcmdlayout_columns(data->layout_current);
854 j++, index++) {
855 data->cells[index].orig.x = x;
856 data->cells[index].orig.y = y;
857 data->cells[index].type =
858 nhcmdlayout_cell_direct(data->layout_current, index)->type;
859
860 switch (data->cells[index].type) {
861 case NH_CELL_CTRL:
862 data->cells[index].state = data->is_ctrl ? NH_CST_CHECKED : 0;
863 break;
864 case NH_CELL_CAP:
865 data->cells[index].state = data->is_caps ? NH_CST_CHECKED : 0;
866 break;
867 case NH_CELL_SHIFT:
868 data->cells[index].state =
869 data->is_shift ? NH_CST_CHECKED : 0;
870 break;
871 default:
872 data->cells[index].state = 0;
873 }
874
875 x += data->cell_size.cx
876 * nhcmdlayout_cell_direct(data->layout_current, index)->mult;
877 }
878 x = 0;
879 y += data->cell_size.cy;
880 }
881
882 /* create font for display cell text */

Callers 2

NHCommandWndProcFunction · 0.85
SetCmdWindowLayoutFunction · 0.85

Calls 1

CalculateCellSizeFunction · 0.85

Tested by

no test coverage detected