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

Function mswin_init_message_window

win/win32/mhmsgwnd.c:67–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65#endif
66
67HWND
68mswin_init_message_window(void)
69{
70 static int run_once = 0;
71 HWND ret;
72 DWORD style;
73 RECT rt;
74
75 if (!run_once) {
76 register_message_window_class();
77 run_once = 1;
78 }
79
80 /* get window position */
81 if (GetNHApp()->bAutoLayout) {
82 SetRect(&rt, 0, 0, 0, 0);
83 } else {
84 mswin_get_window_placement(NHW_MESSAGE, &rt);
85 }
86
87#ifdef MSG_WRAP_TEXT
88 style = WS_CHILD | WS_CLIPSIBLINGS | WS_VSCROLL | WS_SIZEBOX;
89#else
90 style = WS_CHILD | WS_CLIPSIBLINGS | WS_VSCROLL | WS_HSCROLL | WS_SIZEBOX;
91#endif
92
93 ret = CreateWindowEx(
94 WS_EX_CLIENTEDGE, szMessageWindowClass, /* registered class name */
95 NULL, /* window name */
96 style, /* window style */
97 rt.left, /* horizontal position of window */
98 rt.top, /* vertical position of window */
99 rt.right - rt.left, /* window width */
100 rt.bottom - rt.top, /* window height */
101 GetNHApp()->hMainWnd, /* handle to parent or owner window */
102 NULL, /* menu handle or child identifier */
103 GetNHApp()->hApp, /* handle to application instance */
104 NULL); /* window-creation data */
105
106 if (!ret)
107 panic("Cannot create message window");
108
109 /* Set window caption */
110 SetWindowText(ret, "Messages");
111
112 mswin_apply_window_style(ret);
113
114 return ret;
115}
116
117void
118register_message_window_class(void)

Callers 1

mswin_create_nhwindowFunction · 0.70

Calls 5

mswin_apply_window_styleFunction · 0.85
GetNHAppFunction · 0.70
panicFunction · 0.50

Tested by

no test coverage detected