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

Function ToggleWrapStatus

outdated/sys/wince/mhtext.c:154–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154void
155ToggleWrapStatus(HWND hDlg, BOOL bWrap)
156{
157 DWORD styles;
158 PNHTextWindow data;
159 HWND control;
160 TCHAR wbuf[BUFSZ];
161
162 data = (PNHTextWindow) GetWindowLong(hDlg, GWL_USERDATA);
163
164 control = GetDlgItem(hDlg, IDC_TEXT_CONTROL);
165 if (!control) {
166 panic("cannot get text view window");
167 }
168
169 /* set horizontal scrollbar status */
170 styles = GetWindowLong(control, GWL_STYLE);
171 if (styles) {
172 SetWindowLong(control, GWL_STYLE, (bWrap ? (styles & (~WS_HSCROLL))
173 : (styles | WS_HSCROLL)));
174 SetWindowPos(control, NULL, 0, 0, 0, 0,
175 SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE
176 | SWP_NOSIZE);
177 }
178
179 /* set text wrap mode */
180 mswin_set_text_wrap(data->window_text, bWrap);
181 mswin_render_text(data->window_text, control);
182
183 /* change button status */
184 ZeroMemory(wbuf, sizeof(wbuf));
185 if (!LoadString(GetNHApp()->hApp,
186 (bWrap ? IDS_TEXT_UNWRAP : IDS_TEXT_WRAP), wbuf, BUFSZ)) {
187 panic("cannot load text window strings");
188 }
189
190#if defined(WIN_CE_SMARTPHONE)
191 {
192 TBBUTTONINFO tbbi;
193
194 ZeroMemory(&tbbi, sizeof(tbbi));
195 tbbi.cbSize = sizeof(tbbi);
196 tbbi.dwMask = TBIF_TEXT;
197 tbbi.pszText = wbuf;
198 if (!SendMessage(SHFindMenuBar(hDlg), TB_SETBUTTONINFO,
199 IDC_TEXT_TOGGLE_WRAP, (LPARAM) &tbbi)) {
200 error("Cannot update IDC_TEXT_TOGGLE_WRAP menu item.");
201 }
202 }
203#else
204 SendDlgItemMessage(hDlg, IDC_TEXT_TOGGLE_WRAP, WM_SETTEXT, (WPARAM) 0,
205 (LPARAM) wbuf);
206#endif
207}
208
209void
210LayoutText(HWND hWnd)

Callers 2

TextWndProcFunction · 0.85

Calls 5

mswin_set_text_wrapFunction · 0.85
mswin_render_textFunction · 0.85
GetNHAppFunction · 0.70
panicFunction · 0.50
errorFunction · 0.50

Tested by

no test coverage detected