1 |
|
---|
2 | /*
|
---|
3 | *@@sourcefile winh.h:
|
---|
4 | * header file for winh.c (PM helper funcs). See remarks there.
|
---|
5 | *
|
---|
6 | * Note: Version numbering in this file relates to XWorkplace version
|
---|
7 | * numbering.
|
---|
8 | */
|
---|
9 |
|
---|
10 | /* Copyright (C) 1997-2000 Ulrich Mller.
|
---|
11 | * This file is part of the "XWorkplace helpers" source package.
|
---|
12 | * This is free software; you can redistribute it and/or modify
|
---|
13 | * it under the terms of the GNU General Public License as published
|
---|
14 | * by the Free Software Foundation, in version 2 as it comes in the
|
---|
15 | * "COPYING" file of the XWorkplace main distribution.
|
---|
16 | * This program is distributed in the hope that it will be useful,
|
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | * GNU General Public License for more details.
|
---|
20 | *
|
---|
21 | *@@include #define INCL_WINWINDOWMGR
|
---|
22 | *@@include #define INCL_WINMESSAGEMGR
|
---|
23 | *@@include #define INCL_WINSYS // for winhStorePresParam
|
---|
24 | *@@include #define INCL_WINDIALOGS
|
---|
25 | *@@include #define INCL_WINMENUS // for menu helpers
|
---|
26 | *@@include #define INCL_WINENTRYFIELDS // for entry field helpers
|
---|
27 | *@@include #define INCL_WINBUTTONS // for button/check box helpers
|
---|
28 | *@@include #define INCL_WINLISTBOXES // for list box helpers
|
---|
29 | *@@include #define INCL_WINSTDSPIN // for spin button helpers
|
---|
30 | *@@include #define INCL_WINSTDSLIDER // for slider helpers
|
---|
31 | *@@include #define INCL_WININPUT
|
---|
32 | *@@include #define INCL_WINSYS
|
---|
33 | *@@include #define INCL_WINSHELLDATA
|
---|
34 | *@@include #define INCL_WINSWITCHLIST // for winhQuerySwitchList
|
---|
35 | *@@include #define INCL_WINPROGRAMLIST // for winhStartApp
|
---|
36 | *@@include #define INCL_WINHELP // for help manager helpers
|
---|
37 | *@@include #include <os2.h>
|
---|
38 | *@@include #include "winh.h"
|
---|
39 | */
|
---|
40 |
|
---|
41 | #if __cplusplus
|
---|
42 | extern "C" {
|
---|
43 | #endif
|
---|
44 |
|
---|
45 | #ifndef WINH_HEADER_INCLUDED
|
---|
46 | #define WINH_HEADER_INCLUDED
|
---|
47 |
|
---|
48 | #ifndef XWPENTRY
|
---|
49 | #error You must define XWPENTRY to contain the standard linkage for the XWPHelpers.
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | /* ******************************************************************
|
---|
53 | *
|
---|
54 | * Declarations
|
---|
55 | *
|
---|
56 | ********************************************************************/
|
---|
57 |
|
---|
58 | #define MPNULL (MPFROMP(NULL))
|
---|
59 | #define MPZERO (MPFROMSHORT(0))
|
---|
60 | #define MRTRUE (MRFROMSHORT((SHORT) TRUE))
|
---|
61 | #define MRFALSE (MRFROMSHORT((SHORT) FALSE))
|
---|
62 | #define BM_UNCHECKED 0 // for checkboxes: disabled
|
---|
63 | #define BM_CHECKED 1 // for checkboses: enabled
|
---|
64 | #define BM_INDETERMINATE 2 // for tri-state checkboxes: indeterminate
|
---|
65 |
|
---|
66 | /* ******************************************************************
|
---|
67 | *
|
---|
68 | * Macros
|
---|
69 | *
|
---|
70 | ********************************************************************/
|
---|
71 |
|
---|
72 | /*
|
---|
73 | * Here come some monster macros for
|
---|
74 | * frequently needed functions.
|
---|
75 | */
|
---|
76 |
|
---|
77 | #define winhDebugBox(hwndOwner, title, text) \
|
---|
78 | WinMessageBox(HWND_DESKTOP, hwndOwner, ((PSZ)text), ((PSZ)title), 0, MB_OK | MB_ICONEXCLAMATION | MB_MOVEABLE)
|
---|
79 |
|
---|
80 | #define winhYesNoBox(title, text) \
|
---|
81 | WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, ((PSZ)text), ((PSZ)title), 0, MB_YESNO | MB_ICONQUESTION | MB_MOVEABLE)
|
---|
82 |
|
---|
83 | #define winhSetDlgItemChecked(hwnd, id, bCheck) \
|
---|
84 | WinSendDlgItemMsg((hwnd), (id), BM_SETCHECK, MPFROMSHORT(bCheck), MPNULL)
|
---|
85 |
|
---|
86 | #define winhIsDlgItemChecked(hwnd, id) \
|
---|
87 | (SHORT1FROMMR(WinSendDlgItemMsg((hwnd), (id), BM_QUERYCHECK, MPNULL, MPNULL)))
|
---|
88 |
|
---|
89 | #define winhSetMenuItemChecked(hwndMenu, usId, bCheck) \
|
---|
90 | WinSendMsg(hwndMenu, MM_SETITEMATTR, MPFROM2SHORT(usId, TRUE), \
|
---|
91 | MPFROM2SHORT(MIA_CHECKED, (((bCheck)) ? MIA_CHECKED : FALSE)))
|
---|
92 |
|
---|
93 | #define winhShowDlgItem(hwnd, id, show) \
|
---|
94 | WinShowWindow(WinWindowFromID(hwnd, id), show)
|
---|
95 |
|
---|
96 | #define winhEnableDlgItem(hwndDlg, ulId, Enable) \
|
---|
97 | WinEnableWindow(WinWindowFromID(hwndDlg, ulId), Enable)
|
---|
98 |
|
---|
99 | #define winhIsDlgItemEnabled(hwndDlg, ulId) \
|
---|
100 | WinIsWindowEnabled(WinWindowFromID(hwndDlg, ulId))
|
---|
101 |
|
---|
102 | #define winhSetDlgItemFocus(hwndDlg, ulId) \
|
---|
103 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwndDlg, ulId))
|
---|
104 |
|
---|
105 | /* ******************************************************************
|
---|
106 | *
|
---|
107 | * Menu helpers
|
---|
108 | *
|
---|
109 | ********************************************************************/
|
---|
110 |
|
---|
111 | /*
|
---|
112 | * winhCreateEmptyMenu:
|
---|
113 | * this macro creates an empty menu, which can
|
---|
114 | * be used with winhInsertMenuItem etc. later.
|
---|
115 | * Useful for creating popup menus on the fly.
|
---|
116 | * Note that even though HWND_DESKTOP is specified
|
---|
117 | * here as both the parent and the owner, the
|
---|
118 | * actual owner and parent are specified later
|
---|
119 | * with WinPopupMenu.
|
---|
120 | */
|
---|
121 |
|
---|
122 | #define winhCreateEmptyMenu() \
|
---|
123 | WinCreateWindow(HWND_DESKTOP, WC_MENU, "", 0, 0, 0, 0, 0, \
|
---|
124 | HWND_DESKTOP, HWND_TOP, 0, 0, 0)
|
---|
125 |
|
---|
126 | SHORT XWPENTRY winhInsertMenuItem(HWND hwndMenu,
|
---|
127 | SHORT iPosition,
|
---|
128 | SHORT sItemId,
|
---|
129 | const char *pcszItemTitle,
|
---|
130 | SHORT afStyle,
|
---|
131 | SHORT afAttr);
|
---|
132 |
|
---|
133 | HWND XWPENTRY winhInsertSubmenu(HWND hwndMenu,
|
---|
134 | ULONG iPosition,
|
---|
135 | SHORT sMenuId,
|
---|
136 | const char *pcszSubmenuTitle,
|
---|
137 | USHORT afMenuStyle,
|
---|
138 | SHORT sItemId,
|
---|
139 | const char *pcszItemTitle,
|
---|
140 | USHORT afItemStyle,
|
---|
141 | USHORT afAttribute);
|
---|
142 |
|
---|
143 | /*
|
---|
144 | *@@ winhRemoveMenuItem:
|
---|
145 | * removes a menu item (SHORT) from the
|
---|
146 | * given menu (HWND). Returns the no. of
|
---|
147 | * remaining menu items (SHORT).
|
---|
148 | *
|
---|
149 | * This works for whole submenus too.
|
---|
150 | */
|
---|
151 |
|
---|
152 | #define winhRemoveMenuItem(hwndMenu, sItemId) \
|
---|
153 | (SHORT)WinSendMsg(hwndMenu, MM_REMOVEITEM, MPFROM2SHORT(sItemId, FALSE), 0)
|
---|
154 |
|
---|
155 | /*
|
---|
156 | *@@ winhDeleteMenuItem:
|
---|
157 | * deleted a menu item (SHORT) from the
|
---|
158 | * given menu (HWND). Returns the no. of
|
---|
159 | * remaining menu items (SHORT).
|
---|
160 | *
|
---|
161 | * As opposed to MM_REMOVEITEM, MM_DELETEITEM
|
---|
162 | * frees submenus and bitmaps also.
|
---|
163 | *
|
---|
164 | * This works for whole submenus too.
|
---|
165 | */
|
---|
166 |
|
---|
167 | #define winhDeleteMenuItem(hwndMenu, sItemId) \
|
---|
168 | (SHORT)WinSendMsg(hwndMenu, MM_DELETEITEM, MPFROM2SHORT(sItemId, FALSE), 0)
|
---|
169 |
|
---|
170 | SHORT XWPENTRY winhInsertMenuSeparator(HWND hMenu,
|
---|
171 | SHORT iPosition,
|
---|
172 | SHORT sId);
|
---|
173 |
|
---|
174 | BOOL XWPENTRY winhCopyMenuItem(HWND hmenuTarget,
|
---|
175 | HWND hmenuSource,
|
---|
176 | USHORT usID,
|
---|
177 | SHORT sTargetPosition);
|
---|
178 | typedef BOOL XWPENTRY WINHCOPYMENUITEM(HWND hmenuTarget,
|
---|
179 | HWND hmenuSource,
|
---|
180 | USHORT usID,
|
---|
181 | SHORT sTargetPosition);
|
---|
182 | typedef WINHCOPYMENUITEM *PWINHCOPYMENUITEM;
|
---|
183 |
|
---|
184 | HWND XWPENTRY winhMergeIntoSubMenu(HWND hmenuTarget,
|
---|
185 | SHORT sTargetPosition,
|
---|
186 | const char *pcszTitle,
|
---|
187 | SHORT sID,
|
---|
188 | HWND hmenuSource);
|
---|
189 | typedef HWND XWPENTRY WINHMERGEINTOSUBMENU(HWND hmenuTarget,
|
---|
190 | SHORT sTargetPosition,
|
---|
191 | const char *pcszTitle,
|
---|
192 | SHORT sID,
|
---|
193 | HWND hmenuSource);
|
---|
194 | typedef WINHMERGEINTOSUBMENU *PWINHMERGEINTOSUBMENU;
|
---|
195 |
|
---|
196 | PSZ XWPENTRY winhQueryMenuItemText(HWND hwndMenu,
|
---|
197 | USHORT usItemID);
|
---|
198 |
|
---|
199 | BOOL XWPENTRY winhAppend2MenuItemText(HWND hwndMenu,
|
---|
200 | USHORT usItemID,
|
---|
201 | const char *pcszAppend,
|
---|
202 | BOOL fTab);
|
---|
203 |
|
---|
204 | VOID XWPENTRY winhMenuRemoveEllipse(HWND hwndMenu,
|
---|
205 | USHORT usItemId);
|
---|
206 |
|
---|
207 | SHORT XWPENTRY winhQueryItemUnderMouse(HWND hwndMenu, POINTL *pptlMouse, RECTL *prtlItem);
|
---|
208 |
|
---|
209 | /* ******************************************************************
|
---|
210 | *
|
---|
211 | * Slider helpers
|
---|
212 | *
|
---|
213 | ********************************************************************/
|
---|
214 |
|
---|
215 | HWND XWPENTRY winhReplaceWithLinearSlider(HWND hwndParent,
|
---|
216 | HWND hwndOwner,
|
---|
217 | HWND hwndInsertAfter,
|
---|
218 | ULONG ulID,
|
---|
219 | ULONG ulSliderStyle,
|
---|
220 | ULONG ulTickCount);
|
---|
221 |
|
---|
222 | BOOL winhSetSliderTicks(HWND hwndSlider,
|
---|
223 | MPARAM mpEveryOther1,
|
---|
224 | ULONG ulPixels1,
|
---|
225 | MPARAM mpEveryOther2,
|
---|
226 | ULONG ulPixels2);
|
---|
227 |
|
---|
228 | /*
|
---|
229 | * winhSetSliderArmPosition:
|
---|
230 | * this moves the slider arm in a given
|
---|
231 | * linear slider.
|
---|
232 | *
|
---|
233 | * usMode can be one of the following:
|
---|
234 | * -- SMA_RANGEVALUE: usOffset is in pixels
|
---|
235 | * from the slider's home position.
|
---|
236 | * -- SMA_INCREMENTVALUE: usOffset is in
|
---|
237 | * units of the slider's primary scale.
|
---|
238 | */
|
---|
239 |
|
---|
240 | #define winhSetSliderArmPosition(hwndSlider, usMode, usOffset) \
|
---|
241 | WinSendMsg(hwndSlider, SLM_SETSLIDERINFO, \
|
---|
242 | MPFROM2SHORT(SMA_SLIDERARMPOSITION, \
|
---|
243 | usMode), \
|
---|
244 | MPFROMSHORT(usOffset))
|
---|
245 |
|
---|
246 | /*
|
---|
247 | * winhQuerySliderArmPosition:
|
---|
248 | * reverse to the previous, this returns a
|
---|
249 | * slider arm position (as a LONG value).
|
---|
250 | */
|
---|
251 |
|
---|
252 | #define winhQuerySliderArmPosition(hwndSlider, usMode) \
|
---|
253 | (LONG)(WinSendMsg(hwndSlider, \
|
---|
254 | SLM_QUERYSLIDERINFO, \
|
---|
255 | MPFROM2SHORT(SMA_SLIDERARMPOSITION, \
|
---|
256 | usMode), \
|
---|
257 | 0))
|
---|
258 |
|
---|
259 | HWND XWPENTRY winhReplaceWithCircularSlider(HWND hwndParent,
|
---|
260 | HWND hwndOwner,
|
---|
261 | HWND hwndInsertAfter,
|
---|
262 | ULONG ulID,
|
---|
263 | ULONG ulSliderStyle,
|
---|
264 | SHORT sMin,
|
---|
265 | SHORT sMax,
|
---|
266 | USHORT usIncrement,
|
---|
267 | USHORT usTicksEvery);
|
---|
268 |
|
---|
269 | /* ******************************************************************
|
---|
270 | *
|
---|
271 | * Spin button helpers
|
---|
272 | *
|
---|
273 | ********************************************************************/
|
---|
274 |
|
---|
275 | VOID XWPENTRY winhSetDlgItemSpinData(HWND hwndDlg,
|
---|
276 | ULONG idSpinButton,
|
---|
277 | ULONG min,
|
---|
278 | ULONG max,
|
---|
279 | ULONG current);
|
---|
280 |
|
---|
281 | LONG XWPENTRY winhAdjustDlgItemSpinData(HWND hwndDlg,
|
---|
282 | USHORT usItemID,
|
---|
283 | LONG lGrid,
|
---|
284 | USHORT usNotifyCode);
|
---|
285 |
|
---|
286 | /* ******************************************************************
|
---|
287 | *
|
---|
288 | * Entry field helpers
|
---|
289 | *
|
---|
290 | ********************************************************************/
|
---|
291 |
|
---|
292 | /*
|
---|
293 | * winhSetEntryFieldLimit:
|
---|
294 | * sets the maximum length for the entry field
|
---|
295 | * (EM_SETTEXTLIMIT message).
|
---|
296 | *
|
---|
297 | * PMREF doesn't say this, but the limit does
|
---|
298 | * _not_ include the null-terminator. That is,
|
---|
299 | * if you specify "12" characters here, you can
|
---|
300 | * really enter 12 characters.
|
---|
301 | *
|
---|
302 | * The default length is 30 characters, I think.
|
---|
303 | */
|
---|
304 |
|
---|
305 | #define winhSetEntryFieldLimit(hwndEntryField, usLength) \
|
---|
306 | WinSendMsg(hwndEntryField, EM_SETTEXTLIMIT, (MPARAM)(usLength), (MPARAM)0)
|
---|
307 |
|
---|
308 | /*
|
---|
309 | *@@ winhEntryFieldSelectAll:
|
---|
310 | * this selects the entire text in the entry field.
|
---|
311 | * Useful when the thing gets the focus.
|
---|
312 | */
|
---|
313 |
|
---|
314 | #define winhEntryFieldSelectAll(hwndEntryField) \
|
---|
315 | WinSendMsg(hwndEntryField, EM_SETSEL, MPFROM2SHORT(0, 10000), MPNULL)
|
---|
316 |
|
---|
317 | /*
|
---|
318 | *@@ winhHasEntryFieldChanged:
|
---|
319 | * this queries whether the entry field's contents
|
---|
320 | * have changed (EM_QUERYCHANGED message).
|
---|
321 | *
|
---|
322 | * This returns TRUE if changes have occured since
|
---|
323 | * the last time this message or WM_QUERYWINDOWPARAMS
|
---|
324 | * (WinQueryWindowText) was received.
|
---|
325 | */
|
---|
326 |
|
---|
327 | #define winhHasEntryFieldChanged(hwndEntryField) \
|
---|
328 | (BOOL)WinSendMsg(hwndEntryField, EM_QUERYCHANGED, (MPARAM)0, (MPARAM)0)
|
---|
329 |
|
---|
330 | /* ******************************************************************
|
---|
331 | *
|
---|
332 | * List box helpers
|
---|
333 | *
|
---|
334 | ********************************************************************/
|
---|
335 |
|
---|
336 | /* The following macros are defined in the OS/2 headers for
|
---|
337 | list boxes:
|
---|
338 |
|
---|
339 | LONG WinQueryLboxCount(HWND hwndLbox);
|
---|
340 | // wrapper around LM_QUERYITEMCOUNT;
|
---|
341 | // list box item count
|
---|
342 |
|
---|
343 | SHORT WinQueryLboxItemTextLength(HWND hwndLbox,
|
---|
344 | SHORT index); // item index, starting from 0
|
---|
345 | // wrapper around LM_QUERYITEMTEXTLENGTH;
|
---|
346 | // returns length of item text, excluding NULL character
|
---|
347 |
|
---|
348 | LONG WinQueryLboxItemText(HWND hwndLbox,
|
---|
349 | SHORT index, // item index, starting from 0
|
---|
350 | PSZ psz, // buffer
|
---|
351 | PSZ cchMax); // size of buffer, incl. null
|
---|
352 | // wrapper around LM_QUERYITEMTEXT;
|
---|
353 | // returns length of item text, excluding NULL character
|
---|
354 |
|
---|
355 | BOOL WinSetLboxItemText(HWND hwndLbox,
|
---|
356 | LONG index,
|
---|
357 | PSZ psz);
|
---|
358 | // wrapper around LM_SETITEMTEXT
|
---|
359 |
|
---|
360 | LONG WinInsertLboxItem(HWND hwndLbox,
|
---|
361 | LONG index, // new item index, starting from 0
|
---|
362 | // or LIT_END
|
---|
363 | // or LIT_SORTASCENDING
|
---|
364 | // or LIT_SORTDESCENDING
|
---|
365 | PSZ psz)
|
---|
366 | // wrapper around LM_INSERTITEM;
|
---|
367 | // returns LIT_MEMERROR, LIT_ERROR, or zero-based index
|
---|
368 |
|
---|
369 | LONG WinDeleteLboxItem(HWND hwndLbox,
|
---|
370 | LONG index); // item index, starting from 0
|
---|
371 |
|
---|
372 | LONG WinQueryLboxSelectedItem(HWND hwndLbox);
|
---|
373 | // wrapper around LM_QUERYSELECTION;
|
---|
374 | // works with single selection only,
|
---|
375 | // use winhQueryLboxSelectedItem instead
|
---|
376 | */
|
---|
377 |
|
---|
378 | /*
|
---|
379 | * winhQueryLboxItemCount:
|
---|
380 | * returns the no. of items in the listbox
|
---|
381 | * as a SHORT.
|
---|
382 | *
|
---|
383 | *added V0.9.1 (99-12-14) [umoeller]
|
---|
384 | */
|
---|
385 |
|
---|
386 | // #define winhQueryLboxItemCount(hwndListBox)
|
---|
387 | // (SHORT)WinSendMsg(hwndListBox, LM_QUERYITEMCOUNT, 0, 0)
|
---|
388 |
|
---|
389 | // removed, use WinQueryLboxCount
|
---|
390 |
|
---|
391 | /*
|
---|
392 | *@@ winhDeleteAllItems:
|
---|
393 | * deletes all list box items. Returns
|
---|
394 | * a BOOL.
|
---|
395 | *
|
---|
396 | *@@added V0.9.1 (99-12-14) [umoeller]
|
---|
397 | */
|
---|
398 |
|
---|
399 | #define winhDeleteAllItems(hwndListBox) \
|
---|
400 | (BOOL)WinSendMsg(hwndListBox, \
|
---|
401 | LM_DELETEALL, 0, 0)
|
---|
402 | /*
|
---|
403 | *@@ winhQueryLboxSelectedItem:
|
---|
404 | * this queries the next selected list box item.
|
---|
405 | * For the first call, set sItemStart to LIT_FIRST;
|
---|
406 | * then repeat the call with sItemStart set to
|
---|
407 | * the previous return value until this returns
|
---|
408 | * LIT_NONE.
|
---|
409 | *
|
---|
410 | * Example:
|
---|
411 | + SHORT sItemStart = LIT_FIRST;
|
---|
412 | + while (TRUE)
|
---|
413 | + {
|
---|
414 | + sItemStart = winhQueryLboxSelectedItem(hwndListBox,
|
---|
415 | + sItemStart)
|
---|
416 | + if (sItemStart == LIT_NONE)
|
---|
417 | + break;
|
---|
418 | + ...
|
---|
419 | + }
|
---|
420 | *
|
---|
421 | * To have the cursored item returned, use LIT_CURSOR.
|
---|
422 | *
|
---|
423 | * For single selection, you can also use
|
---|
424 | * WinQueryLboxSelectedItem from the OS/2 PM headers.
|
---|
425 | */
|
---|
426 |
|
---|
427 | #define winhQueryLboxSelectedItem(hwndListBox, sItemStart) \
|
---|
428 | (SHORT)(WinSendMsg(hwndListBox, \
|
---|
429 | LM_QUERYSELECTION, \
|
---|
430 | (MPARAM)(sItemStart), \
|
---|
431 | MPNULL))
|
---|
432 |
|
---|
433 | /*
|
---|
434 | *@@ winhSetLboxSelectedItem:
|
---|
435 | * selects a list box item.
|
---|
436 | * This works for both single-selection and
|
---|
437 | * multiple-selection listboxes.
|
---|
438 | * In single-selection listboxes, if an item
|
---|
439 | * is selected (fSelect == TRUE), the previous
|
---|
440 | * item is automatically deselected.
|
---|
441 | * Note that (BOOL)fSelect is ignored if
|
---|
442 | * sItemIndex == LIT_NONE.
|
---|
443 | */
|
---|
444 |
|
---|
445 | #define winhSetLboxSelectedItem(hwndListBox, sItemIndex, fSelect) \
|
---|
446 | (BOOL)(WinSendMsg(hwndListBox, \
|
---|
447 | LM_SELECTITEM, \
|
---|
448 | (MPARAM)(sItemIndex), \
|
---|
449 | (MPARAM)(fSelect)))
|
---|
450 |
|
---|
451 | ULONG XWPENTRY winhLboxSelectAll(HWND hwndListBox, BOOL fSelect);
|
---|
452 |
|
---|
453 | /*
|
---|
454 | * winhSetLboxItemHandle:
|
---|
455 | * sets the "item handle" for the specified sItemIndex.
|
---|
456 | * See LM_SETITEMHANDLE in PMREF for details.
|
---|
457 | */
|
---|
458 |
|
---|
459 | #define winhSetLboxItemHandle(hwndListBox, sItemIndex, ulHandle) \
|
---|
460 | (BOOL)(WinSendMsg(hwndListBox, LM_SETITEMHANDLE, \
|
---|
461 | (MPARAM)(sItemIndex), \
|
---|
462 | (MPARAM)ulHandle))
|
---|
463 |
|
---|
464 | /*
|
---|
465 | * winhQueryLboxItemHandle:
|
---|
466 | * the reverse to the previous. Returns a ULONG.
|
---|
467 | */
|
---|
468 |
|
---|
469 | #define winhQueryLboxItemHandle(hwndListBox, sItemIndex) \
|
---|
470 | (ULONG)WinSendMsg(hwndListBox, LM_QUERYITEMHANDLE, \
|
---|
471 | MPFROMSHORT(sItemIndex), (MPARAM)NULL)
|
---|
472 |
|
---|
473 | PSZ XWPENTRY winhQueryLboxItemText(HWND hwndListbox, SHORT sIndex);
|
---|
474 |
|
---|
475 | BOOL XWPENTRY winhMoveLboxItem(HWND hwndSource,
|
---|
476 | SHORT sSourceIndex,
|
---|
477 | HWND hwndTarget,
|
---|
478 | SHORT sTargetIndex,
|
---|
479 | BOOL fSelectTarget);
|
---|
480 |
|
---|
481 | /* ******************************************************************
|
---|
482 | *
|
---|
483 | * Scroll bar helpers
|
---|
484 | *
|
---|
485 | ********************************************************************/
|
---|
486 |
|
---|
487 | BOOL XWPENTRY winhUpdateScrollBar(HWND hwndScrollBar,
|
---|
488 | ULONG ulWinPels,
|
---|
489 | ULONG ulViewportPels,
|
---|
490 | ULONG ulCurUnitOfs,
|
---|
491 | BOOL fAutoHide);
|
---|
492 |
|
---|
493 | BOOL XWPENTRY winhHandleScrollMsg(HWND hwnd2Scroll,
|
---|
494 | HWND hwndScrollBar,
|
---|
495 | PULONG pulCurPelsOfs,
|
---|
496 | PRECTL prcl2Scroll,
|
---|
497 | LONG ulViewportPels,
|
---|
498 | USHORT usLineStepUnits,
|
---|
499 | ULONG msg,
|
---|
500 | MPARAM mp2);
|
---|
501 |
|
---|
502 | BOOL XWPENTRY winhProcessScrollChars(HWND hwndClient,
|
---|
503 | HWND hwndVScroll,
|
---|
504 | HWND hwndHScroll,
|
---|
505 | MPARAM mp1,
|
---|
506 | MPARAM mp2,
|
---|
507 | ULONG ulVertMax,
|
---|
508 | ULONG ulHorzMax);
|
---|
509 |
|
---|
510 | /* ******************************************************************
|
---|
511 | *
|
---|
512 | * Window positioning helpers
|
---|
513 | *
|
---|
514 | ********************************************************************/
|
---|
515 |
|
---|
516 | BOOL XWPENTRY winhSaveWindowPos(HWND hwnd, HINI hIni, const char *pcszApp, const char *pcszKey);
|
---|
517 |
|
---|
518 | BOOL XWPENTRY winhRestoreWindowPos(HWND hwnd, HINI hIni, const char *pcszApp, const char *pcszKey, ULONG fl);
|
---|
519 |
|
---|
520 | #define XAC_MOVEX 0x0001
|
---|
521 | #define XAC_MOVEY 0x0002
|
---|
522 | #define XAC_SIZEX 0x0004
|
---|
523 | #define XAC_SIZEY 0x0008
|
---|
524 |
|
---|
525 | /*
|
---|
526 | *@@ XADJUSTCTRLS:
|
---|
527 | *
|
---|
528 | */
|
---|
529 |
|
---|
530 | typedef struct _XADJUSTCTRLS
|
---|
531 | {
|
---|
532 | BOOL fInitialized;
|
---|
533 | SWP swpMain; // SWP for main window
|
---|
534 | SWP *paswp; // pointer to array of control SWP structs
|
---|
535 | } XADJUSTCTRLS, *PXADJUSTCTRLS;
|
---|
536 |
|
---|
537 | BOOL XWPENTRY winhAdjustControls(HWND hwndDlg,
|
---|
538 | MPARAM *pmpFlags,
|
---|
539 | ULONG ulCount,
|
---|
540 | PSWP pswpNew,
|
---|
541 | PXADJUSTCTRLS pxac);
|
---|
542 |
|
---|
543 | void XWPENTRY winhCenterWindow(HWND hwnd);
|
---|
544 | typedef void XWPENTRY WINHCENTERWINDOW(HWND hwnd);
|
---|
545 | typedef WINHCENTERWINDOW *PWINHCENTERWINDOW;
|
---|
546 |
|
---|
547 | HWND XWPENTRY winhFindWindowBelow(HWND hwndFind);
|
---|
548 |
|
---|
549 | /* ******************************************************************
|
---|
550 | *
|
---|
551 | * Presparams helpers
|
---|
552 | *
|
---|
553 | ********************************************************************/
|
---|
554 |
|
---|
555 | PSZ XWPENTRY winhQueryWindowFont(HWND hwnd);
|
---|
556 | typedef PSZ XWPENTRY WINHQUERYWINDOWFONT(HWND hwnd);
|
---|
557 | typedef WINHQUERYWINDOWFONT *PWINHQUERYWINDOWFONT;
|
---|
558 |
|
---|
559 | BOOL XWPENTRY winhSetWindowFont(HWND hwnd, const char *pcszFont);
|
---|
560 | typedef BOOL XWPENTRY WINHSETWINDOWFONT(HWND hwnd, const char *pcszFont);
|
---|
561 | typedef WINHSETWINDOWFONT *PWINHSETWINDOWFONT;
|
---|
562 |
|
---|
563 | /*
|
---|
564 | *@@ winhSetDlgItemFont:
|
---|
565 | * invokes winhSetWindowFont on a dialog
|
---|
566 | * item.
|
---|
567 | *
|
---|
568 | * Returns TRUE if successful or FALSE otherwise.
|
---|
569 | *
|
---|
570 | *@@added V0.9.0
|
---|
571 | */
|
---|
572 |
|
---|
573 | #define winhSetDlgItemFont(hwnd, usId, pszFont) \
|
---|
574 | (winhSetWindowFont(WinWindowFromID(hwnd, usId), pszFont))
|
---|
575 |
|
---|
576 | ULONG XWPENTRY winhSetControlsFont(HWND hwndDlg, SHORT usIDMin, SHORT usIDMax, const char *pcszFont);
|
---|
577 |
|
---|
578 | #ifdef INCL_WINSYS
|
---|
579 | BOOL XWPENTRY winhStorePresParam(PPRESPARAMS *pppp,
|
---|
580 | ULONG ulAttrType,
|
---|
581 | ULONG cbData,
|
---|
582 | PVOID pData);
|
---|
583 | #endif
|
---|
584 |
|
---|
585 | LONG XWPENTRY winhQueryPresColor(HWND hwnd, ULONG ulPP, BOOL fInherit, LONG lSysColor);
|
---|
586 | typedef LONG XWPENTRY WINHQUERYPRESCOLOR(HWND hwnd, ULONG ulPP, BOOL fInherit, LONG lSysColor);
|
---|
587 | typedef WINHQUERYPRESCOLOR *PWINHQUERYPRESCOLOR;
|
---|
588 |
|
---|
589 | /* ******************************************************************
|
---|
590 | *
|
---|
591 | * Help instance helpers
|
---|
592 | *
|
---|
593 | ********************************************************************/
|
---|
594 |
|
---|
595 | #ifdef INCL_WINHELP
|
---|
596 | HWND XWPENTRY winhCreateHelp(HWND hwndFrame,
|
---|
597 | const char *pcszFileName,
|
---|
598 | HMODULE hmod,
|
---|
599 | PHELPTABLE pHelpTable,
|
---|
600 | const char *pcszWindowTitle);
|
---|
601 |
|
---|
602 | ULONG winhDisplayHelpPanel(HWND hwndHelpInstance,
|
---|
603 | ULONG ulHelpPanel);
|
---|
604 |
|
---|
605 | void XWPENTRY winhDestroyHelp(HWND hwndHelp, HWND hwndFrame);
|
---|
606 | #endif
|
---|
607 |
|
---|
608 | /* ******************************************************************
|
---|
609 | *
|
---|
610 | * Application control
|
---|
611 | *
|
---|
612 | ********************************************************************/
|
---|
613 |
|
---|
614 | #ifdef INCL_WINPROGRAMLIST
|
---|
615 | // additional PROG_* flags for winhQueryAppType
|
---|
616 | #define PROG_XWP_DLL 998 // dynamic link library
|
---|
617 |
|
---|
618 | APIRET winhQueryAppType(const char *pcszExecutable,
|
---|
619 | PULONG pulDosAppType,
|
---|
620 | PULONG pulWinAppType);
|
---|
621 |
|
---|
622 | HAPP XWPENTRY winhStartApp(HWND hwndNotify, const PROGDETAILS *pcProgDetails);
|
---|
623 | #endif
|
---|
624 |
|
---|
625 | BOOL XWPENTRY winhAnotherInstance(const char *pcszSemName, BOOL fSwitch);
|
---|
626 |
|
---|
627 | HSWITCH XWPENTRY winhAddToTasklist(HWND hwnd, HPOINTER hIcon);
|
---|
628 |
|
---|
629 | /* ******************************************************************
|
---|
630 | *
|
---|
631 | * Miscellaneous
|
---|
632 | *
|
---|
633 | ********************************************************************/
|
---|
634 |
|
---|
635 | VOID XWPENTRY winhFree(PVOID p);
|
---|
636 | typedef VOID XWPENTRY WINHFREE(PVOID p);
|
---|
637 | typedef WINHFREE *PWINHFREE;
|
---|
638 |
|
---|
639 | VOID XWPENTRY winhSleep(ULONG ulSleep);
|
---|
640 |
|
---|
641 | #define WINH_FOD_SAVEDLG 0x0001
|
---|
642 | #define WINH_FOD_INILOADDIR 0x0010
|
---|
643 | #define WINH_FOD_INISAVEDIR 0x0020
|
---|
644 |
|
---|
645 | BOOL XWPENTRY winhFileDlg(HWND hwndOwner,
|
---|
646 | PSZ pszFile,
|
---|
647 | ULONG flFlags,
|
---|
648 | HINI hini,
|
---|
649 | const char *pcszApplication,
|
---|
650 | const char *pcszKey);
|
---|
651 |
|
---|
652 | HPOINTER XWPENTRY winhSetWaitPointer(VOID);
|
---|
653 |
|
---|
654 | PSZ XWPENTRY winhQueryWindowText(HWND hwnd);
|
---|
655 |
|
---|
656 | /*
|
---|
657 | *@@ winhQueryDlgItemText:
|
---|
658 | * like winhQueryWindowText, but for the dialog item
|
---|
659 | * in hwnd which has the ID usItemID.
|
---|
660 | */
|
---|
661 |
|
---|
662 | #define winhQueryDlgItemText(hwnd, usItemID) winhQueryWindowText(WinWindowFromID(hwnd, usItemID))
|
---|
663 |
|
---|
664 | BOOL XWPENTRY winhReplaceWindowText(HWND hwnd,
|
---|
665 | const char *pcszSearch,
|
---|
666 | const char *pcszReplaceWith);
|
---|
667 |
|
---|
668 | ULONG XWPENTRY winhCenteredDlgBox(HWND hwndParent, HWND hwndOwner,
|
---|
669 | PFNWP pfnDlgProc, HMODULE hmod, ULONG idDlg, PVOID pCreateParams);
|
---|
670 | typedef ULONG XWPENTRY WINHCENTEREDDLGBOX(HWND hwndParent, HWND hwndOwner,
|
---|
671 | PFNWP pfnDlgProc, HMODULE hmod, ULONG idDlg, PVOID pCreateParams);
|
---|
672 | typedef WINHCENTEREDDLGBOX *PWINHCENTEREDDLGBOX;
|
---|
673 |
|
---|
674 | ULONG XWPENTRY winhEnableControls(HWND hwndDlg,
|
---|
675 | USHORT usIDFirst,
|
---|
676 | USHORT usIDLast,
|
---|
677 | BOOL fEnable);
|
---|
678 |
|
---|
679 | HWND XWPENTRY winhCreateStdWindow(HWND hwndFrameParent,
|
---|
680 | PSWP pswpFrame,
|
---|
681 | ULONG flFrameCreateFlags,
|
---|
682 | ULONG ulFrameStyle,
|
---|
683 | const char *pcszFrameTitle,
|
---|
684 | ULONG ulResourcesID,
|
---|
685 | const char *pcszClassClient,
|
---|
686 | ULONG flStyleClient,
|
---|
687 | ULONG ulID,
|
---|
688 | PVOID pClientCtlData,
|
---|
689 | PHWND phwndClient);
|
---|
690 |
|
---|
691 | HWND winhCreateObjectWindow(const char *pcszWindowClass,
|
---|
692 | PVOID pvCreateParam);
|
---|
693 |
|
---|
694 | VOID XWPENTRY winhRepaintWindows(HWND hwndParent);
|
---|
695 |
|
---|
696 | HMQ XWPENTRY winhFindMsgQueue(PID pid, TID tid, HAB* phab);
|
---|
697 |
|
---|
698 | VOID XWPENTRY winhFindPMErrorWindows(HWND *phwndHardError, HWND *phwndSysError);
|
---|
699 |
|
---|
700 | HWND XWPENTRY winhCreateFakeDesktop(HWND hwndSibling);
|
---|
701 |
|
---|
702 | BOOL XWPENTRY winhAssertWarp4Notebook(HWND hwndDlg,
|
---|
703 | USHORT usIdThreshold,
|
---|
704 | ULONG ulDownUnits);
|
---|
705 |
|
---|
706 | ULONG XWPENTRY winhDrawFormattedText(HPS hps, PRECTL prcl, const char *pcszText, ULONG flCmd);
|
---|
707 |
|
---|
708 | #ifdef INCL_WINSWITCHLIST
|
---|
709 | PSWBLOCK XWPENTRY winhQuerySwitchList(HAB hab);
|
---|
710 | typedef PSWBLOCK XWPENTRY WINHQUERYSWITCHLIST(HAB hab);
|
---|
711 | typedef WINHQUERYSWITCHLIST *PWINHQUERYSWITCHLIST;
|
---|
712 | #endif
|
---|
713 |
|
---|
714 | HWND XWPENTRY winhQueryTasklistWindow(VOID);
|
---|
715 | typedef HWND XWPENTRY WINHQUERYTASKLISTWINDOW(VOID);
|
---|
716 | typedef WINHQUERYTASKLISTWINDOW *PWINHQUERYTASKLISTWINDOW;
|
---|
717 |
|
---|
718 | VOID XWPENTRY winhKillTasklist(VOID);
|
---|
719 |
|
---|
720 | ULONG XWPENTRY winhQueryPendingSpoolJobs(VOID);
|
---|
721 |
|
---|
722 | VOID XWPENTRY winhSetNumLock(BOOL fState);
|
---|
723 |
|
---|
724 | /*
|
---|
725 | *@@ winhQueryScreenCX:
|
---|
726 | * helper macro for getting the screen width.
|
---|
727 | */
|
---|
728 |
|
---|
729 | #define winhQueryScreenCX() (WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))
|
---|
730 |
|
---|
731 | /*
|
---|
732 | *@@ winhQueryScreenCY:
|
---|
733 | * helper macro for getting the screen height.
|
---|
734 | */
|
---|
735 |
|
---|
736 | #define winhQueryScreenCY() (WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN))
|
---|
737 |
|
---|
738 | /* ******************************************************************
|
---|
739 | *
|
---|
740 | * WPS Class List helpers
|
---|
741 | *
|
---|
742 | ********************************************************************/
|
---|
743 |
|
---|
744 | PBYTE XWPENTRY winhQueryWPSClassList(VOID);
|
---|
745 |
|
---|
746 | PBYTE XWPENTRY winhQueryWPSClass(PBYTE pObjClass, const char *pszClass);
|
---|
747 |
|
---|
748 | APIRET XWPENTRY winhRegisterClass(const char* pcszClassName,
|
---|
749 | const char* pcszModule,
|
---|
750 | PSZ pszBuf,
|
---|
751 | ULONG cbBuf);
|
---|
752 |
|
---|
753 | BOOL XWPENTRY winhIsClassRegistered(const char *pcszClass);
|
---|
754 |
|
---|
755 | ULONG XWPENTRY winhResetWPS(HAB hab);
|
---|
756 | #endif
|
---|
757 |
|
---|
758 | #if __cplusplus
|
---|
759 | }
|
---|
760 | #endif
|
---|
761 |
|
---|