* New version 2.21.999
[alpine.git] / pico / osdep / mswin_tw.h
blob0e4435d57ad28f3a7843a218f8def72a8c3ac5ba
1 /*
2 * ========================================================================
3 * Copyright 2006-2007 University of Washington
4 * Copyright 2013-2018 Eduardo Chappa
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * ========================================================================
14 typedef struct MSWIN_TEXTWINDOW MSWIN_TEXTWINDOW;
15 typedef void (MSWIN_TW_CALLBACK)(MSWIN_TEXTWINDOW *mswin_tw);
17 typedef struct MSWIN_TEXTWINDOW
19 // User should set these fields before calling mswin_tw_create()
20 UINT id; // Caller can use to determine which
21 // textwindow this is (Ie: IDM_OPT_NEWMAILWIN)
22 HANDLE hInstance;
23 RECT rcSize; // Window position
25 MSWIN_TW_CALLBACK *print_callback; // Print menu selected callback routine.
26 MSWIN_TW_CALLBACK *close_callback; // Callback for when window is closed.
27 MSWIN_TW_CALLBACK *clear_callback; // Callback after text is cleared.
29 LPCTSTR out_file; // Save edit contents on close to this file.
30 BOOL out_file_ret; // TRUE - out_file written, FALSE - nope.
32 // internal fields
33 HWND hwnd; // hwnd for this mswin textwindow.
34 HWND hwnd_edit;
35 } MSWIN_TEXTWINDOW;
37 int mswin_tw_create(MSWIN_TEXTWINDOW *mswin_tw, LPCTSTR title);
38 void mswin_tw_close(MSWIN_TEXTWINDOW *mswin_tw);
40 void mswin_tw_showwindow(MSWIN_TEXTWINDOW *mswin_tw, int nCmdShow);
42 BOOL mswin_tw_fill_from_file(MSWIN_TEXTWINDOW *mswin_tw, LPCTSTR file);
43 BOOL mswin_tw_write_to_file(MSWIN_TEXTWINDOW *mswin_tw, LPCTSTR file);
45 void mswin_tw_setfont(MSWIN_TEXTWINDOW *mswin_tw, HFONT hfont);
46 void mswin_tw_setcolor(MSWIN_TEXTWINDOW *mswin_tw,
47 COLORREF TextColor, COLORREF BackColor);
49 int mswin_tw_puts_lptstr(MSWIN_TEXTWINDOW *mswin_tw, LPTSTR msg);
50 int mswin_tw_printf(MSWIN_TEXTWINDOW *mswin_tw, LPCTSTR fmt, ...);
52 UINT mswin_tw_gettext(MSWIN_TEXTWINDOW *mswin_tw, LPTSTR lptstr_ret, int lptstr_len);
53 UINT mswin_tw_gettextlength(MSWIN_TEXTWINDOW *mswin_tw);
55 void mswin_tw_setsel(MSWIN_TEXTWINDOW *mswin_tw, LONG min, LONG max);
56 void mswin_tw_clear(MSWIN_TEXTWINDOW *mswin_tw);
58 void mswin_set_readonly(MSWIN_TEXTWINDOW *mswin_tw, BOOL read_only);