source: trunk/include/helpers/winh.h@ 198

Last change on this file since 198 was 195, checked in by umoeller, 23 years ago

Misc fixes.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 38.5 KB
Line 
1
2/*
3 *@@sourcefile winh.h:
4 * header file for winh.c (PM helper funcs). See remarks there.
5 *
6 * Special #define's which this thing reacts to:
7 *
8 * -- If WINH_STANDARDWRAPPERS is defined to anything, this include
9 * file maps a number of freqently API calls (such as WinSendMsg)
10 * to winh* equivalents to reduce the amount of fixup records
11 * in the final executable.
12 *
13 * Note: Version numbering in this file relates to XWorkplace version
14 * numbering.
15 */
16
17/* Copyright (C) 1997-2000 Ulrich M”ller.
18 * This file is part of the "XWorkplace helpers" source package.
19 * This is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published
21 * by the Free Software Foundation, in version 2 as it comes in the
22 * "COPYING" file of the XWorkplace main distribution.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 *@@include #define INCL_WINWINDOWMGR
29 *@@include #define INCL_WINMESSAGEMGR
30 *@@include #define INCL_WINSYS // for winhStorePresParam
31 *@@include #define INCL_WINDIALOGS
32 *@@include #define INCL_WINMENUS // for menu helpers
33 *@@include #define INCL_WINENTRYFIELDS // for entry field helpers
34 *@@include #define INCL_WINBUTTONS // for button/check box helpers
35 *@@include #define INCL_WINLISTBOXES // for list box helpers
36 *@@include #define INCL_WINSTDSPIN // for spin button helpers
37 *@@include #define INCL_WINSTDSLIDER // for slider helpers
38 *@@include #define INCL_WININPUT
39 *@@include #define INCL_WINSYS
40 *@@include #define INCL_WINSHELLDATA
41 *@@include #define INCL_WINSWITCHLIST // for winhQuerySwitchList
42 *@@include #define INCL_WINPROGRAMLIST // for appStartApp
43 *@@include #define INCL_WINHELP // for help manager helpers
44 *@@include #include <os2.h>
45 *@@include #include "helpers\winh.h"
46 */
47
48#if __cplusplus
49extern "C" {
50#endif
51
52#ifndef WINH_HEADER_INCLUDED
53 #define WINH_HEADER_INCLUDED
54
55 #ifndef XWPENTRY
56 #error You must define XWPENTRY to contain the standard linkage for the XWPHelpers.
57 #endif
58
59 /* ******************************************************************
60 *
61 * Declarations
62 *
63 ********************************************************************/
64
65 #define MPNULL (MPFROMP(NULL))
66 #define MPZERO (MPFROMSHORT(0))
67 #define MRTRUE (MRFROMSHORT((SHORT) TRUE))
68 #define MRFALSE (MRFROMSHORT((SHORT) FALSE))
69 #define BM_UNCHECKED 0 // for checkboxes: disabled
70 #define BM_CHECKED 1 // for checkboses: enabled
71 #define BM_INDETERMINATE 2 // for tri-state checkboxes: indeterminate
72
73 /* ******************************************************************
74 *
75 * Wrappers
76 *
77 ********************************************************************/
78
79 // if WINH_STANDARDWRAPPERS is #define'd before including winh.h,
80 // all the following Win* API calls are redirected to the winh*
81 // counterparts
82
83 #ifdef WINH_STANDARDWRAPPERS
84
85 MRESULT XWPENTRY winhSendMsg(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
86 #define WinSendMsg(a,b,c,d) winhSendMsg((a),(b),(c),(d))
87
88 MRESULT XWPENTRY winhSendDlgItemMsg(HWND hwnd, ULONG id, ULONG msg, MPARAM mp1, MPARAM mp2);
89 #define WinSendDlgItemMsg(a,b,c,d,e) winhSendDlgItemMsg((a),(b),(c),(d),(e))
90
91 BOOL XWPENTRY winhPostMsg(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
92 #define WinPostMsg(a,b,c,d) winhPostMsg((a),(b),(c),(d))
93
94 HWND XWPENTRY winhWindowFromID(HWND hwnd, ULONG id);
95 #define WinWindowFromID(a,b) winhWindowFromID((a),(b))
96
97 HWND XWPENTRY winhQueryWindow(HWND hwnd, LONG lCode);
98 #define WinQueryWindow(a,b) winhQueryWindow((a),(b))
99
100 PVOID XWPENTRY winhQueryWindowPtr(HWND hwnd, LONG index);
101 #define WinQueryWindowPtr(a,b) winhQueryWindowPtr((a),(b))
102
103 BOOL XWPENTRY winhSetWindowText2(HWND hwnd, const char *pcsz);
104 #define WinSetWindowText(a,b) winhSetWindowText2((a),(b))
105
106 BOOL XWPENTRY winhSetDlgItemText(HWND hwnd, ULONG id, const char *pcsz);
107 #define WinSetDlgItemText(a,b,c) winhSetDlgItemText((a),(b),(c))
108
109 // pmwin.h defines the WinEnableControl macro; turn this into our function call
110 #ifdef WinEnableControl
111 #undef WinEnableControl
112 #endif
113 #define WinEnableControl(hwndDlg, id, fEnable) winhEnableDlgItem((hwndDlg), (id), (fEnable))
114
115 #ifdef INCL_WINMESSAGEMGR
116 APIRET XWPENTRY winhRequestMutexSem(HMTX hmtx, ULONG ulTimeout);
117 #define WinRequestMutexSem(a, b) winhRequestMutexSem((a), (b))
118 #endif
119 #endif
120
121 /* ******************************************************************
122 *
123 * Macros
124 *
125 ********************************************************************/
126
127 /*
128 * Here come some monster macros for
129 * frequently needed functions.
130 */
131
132 #define winhDebugBox(hwndOwner, title, text) \
133 WinMessageBox(HWND_DESKTOP, hwndOwner, ((PSZ)text), ((PSZ)title), 0, MB_OK | MB_ICONEXCLAMATION | MB_MOVEABLE)
134
135 #define winhYesNoBox(title, text) \
136 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, ((PSZ)text), ((PSZ)title), 0, MB_YESNO | MB_ICONQUESTION | MB_MOVEABLE)
137
138 #define winhSetDlgItemChecked(hwnd, id, bCheck) \
139 WinSendDlgItemMsg((hwnd), (id), BM_SETCHECK, MPFROMSHORT(bCheck), MPNULL)
140 #define winhIsDlgItemChecked(hwnd, id) \
141 (SHORT1FROMMR(WinSendDlgItemMsg((hwnd), (id), BM_QUERYCHECK, MPNULL, MPNULL)))
142
143 #define winhSetMenuItemChecked(hwndMenu, usId, bCheck) \
144 WinSendMsg(hwndMenu, MM_SETITEMATTR, MPFROM2SHORT(usId, TRUE), \
145 MPFROM2SHORT(MIA_CHECKED, (((bCheck)) ? MIA_CHECKED : FALSE)))
146
147 #define winhShowDlgItem(hwnd, id, show) \
148 WinShowWindow(WinWindowFromID(hwnd, id), show)
149
150 // made these functions V0.9.12 (2001-05-18) [umoeller]
151 /* #define winhEnableDlgItem(hwndDlg, ulId, Enable) \
152 WinEnableWindow(WinWindowFromID(hwndDlg, ulId), Enable)
153 #define winhIsDlgItemEnabled(hwndDlg, ulId) \
154 WinIsWindowEnabled(WinWindowFromID(hwndDlg, ulId))
155 */
156
157 #define winhSetDlgItemFocus(hwndDlg, ulId) \
158 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwndDlg, ulId))
159
160 /* ******************************************************************
161 *
162 * Rectangle helpers
163 *
164 ********************************************************************/
165
166 VOID XWPENTRY winhOffsetRect(PRECTL prcl, LONG lx, LONG ly);
167
168 /* ******************************************************************
169 *
170 * Generics
171 *
172 ********************************************************************/
173
174 ULONG XWPENTRY winhQueryWindowStyle(HWND hwnd);
175
176 BOOL XWPENTRY winhEnableDlgItem(HWND hwndDlg, SHORT id, BOOL fEnable);
177
178 BOOL XWPENTRY winhIsDlgItemEnabled(HWND hwndDlg, SHORT id);
179
180 /* ******************************************************************
181 *
182 * Menu helpers
183 *
184 ********************************************************************/
185
186 #ifdef INCL_WINMENUS
187 BOOL XWPENTRY winhQueryMenuItem(HWND hwndMenu,
188 USHORT usItemID,
189 BOOL fSearchSubmenus,
190 PMENUITEM pmi);
191 #endif
192
193 /*
194 * winhCreateEmptyMenu:
195 * this macro creates an empty menu, which can
196 * be used with winhInsertMenuItem etc. later.
197 * Useful for creating popup menus on the fly.
198 * Note that even though HWND_DESKTOP is specified
199 * here as both the parent and the owner, the
200 * actual owner and parent are specified later
201 * with WinPopupMenu.
202 */
203
204 #define winhCreateEmptyMenu() \
205 WinCreateWindow(HWND_DESKTOP, WC_MENU, "", 0, 0, 0, 0, 0, \
206 HWND_DESKTOP, HWND_TOP, 0, 0, 0)
207
208 SHORT XWPENTRY winhInsertMenuItem(HWND hwndMenu,
209 SHORT iPosition,
210 SHORT sItemId,
211 const char *pcszItemTitle,
212 SHORT afStyle,
213 SHORT afAttr);
214 typedef SHORT XWPENTRY WINHINSERTMENUITEM(HWND hwndMenu,
215 SHORT iPosition,
216 SHORT sItemId,
217 const char *pcszItemTitle,
218 SHORT afStyle,
219 SHORT afAttr);
220 typedef WINHINSERTMENUITEM *PWINHINSERTMENUITEM;
221
222 HWND XWPENTRY winhInsertSubmenu(HWND hwndMenu,
223 ULONG iPosition,
224 SHORT sMenuId,
225 const char *pcszSubmenuTitle,
226 USHORT afMenuStyle,
227 SHORT sItemId,
228 const char *pcszItemTitle,
229 USHORT afItemStyle,
230 USHORT afAttribute);
231 typedef HWND XWPENTRY WINHINSERTSUBMENU(HWND hwndMenu,
232 ULONG iPosition,
233 SHORT sMenuId,
234 const char *pcszSubmenuTitle,
235 USHORT afMenuStyle,
236 SHORT sItemId,
237 const char *pcszItemTitle,
238 USHORT afItemStyle,
239 USHORT afAttribute);
240 typedef WINHINSERTSUBMENU *PWINHINSERTSUBMENU;
241
242 BOOL XWPENTRY winhSetMenuCondCascade(HWND hwndMenu,
243 LONG lDefaultItem);
244
245 /*
246 *@@ winhRemoveMenuItem:
247 * removes a menu item (SHORT) from the
248 * given menu (HWND). Returns the no. of
249 * remaining menu items (SHORT).
250 *
251 * This works for whole submenus too.
252 */
253
254 #define winhRemoveMenuItem(hwndMenu, sItemId) \
255 (SHORT)WinSendMsg(hwndMenu, MM_REMOVEITEM, MPFROM2SHORT(sItemId, FALSE), 0)
256
257 /*
258 *@@ winhDeleteMenuItem:
259 * deleted a menu item (SHORT) from the
260 * given menu (HWND). Returns the no. of
261 * remaining menu items (SHORT).
262 *
263 * As opposed to MM_REMOVEITEM, MM_DELETEITEM
264 * frees submenus and bitmaps also.
265 *
266 * This works for whole submenus too.
267 */
268
269 #define winhDeleteMenuItem(hwndMenu, sItemId) \
270 (SHORT)WinSendMsg(hwndMenu, MM_DELETEITEM, MPFROM2SHORT(sItemId, FALSE), 0)
271
272 SHORT XWPENTRY winhInsertMenuSeparator(HWND hMenu,
273 SHORT iPosition,
274 SHORT sId);
275
276 BOOL XWPENTRY winhCopyMenuItem(HWND hmenuTarget,
277 HWND hmenuSource,
278 USHORT usID,
279 SHORT sTargetPosition);
280 typedef BOOL XWPENTRY WINHCOPYMENUITEM(HWND hmenuTarget,
281 HWND hmenuSource,
282 USHORT usID,
283 SHORT sTargetPosition);
284 typedef WINHCOPYMENUITEM *PWINHCOPYMENUITEM;
285
286 HWND XWPENTRY winhMergeIntoSubMenu(HWND hmenuTarget,
287 SHORT sTargetPosition,
288 const char *pcszTitle,
289 SHORT sID,
290 HWND hmenuSource);
291 typedef HWND XWPENTRY WINHMERGEINTOSUBMENU(HWND hmenuTarget,
292 SHORT sTargetPosition,
293 const char *pcszTitle,
294 SHORT sID,
295 HWND hmenuSource);
296 typedef WINHMERGEINTOSUBMENU *PWINHMERGEINTOSUBMENU;
297
298 PSZ XWPENTRY winhQueryMenuItemText(HWND hwndMenu,
299 USHORT usItemID);
300
301 BOOL XWPENTRY winhAppend2MenuItemText(HWND hwndMenu,
302 USHORT usItemID,
303 const char *pcszAppend,
304 BOOL fTab);
305
306 VOID XWPENTRY winhMenuRemoveEllipse(HWND hwndMenu,
307 USHORT usItemId);
308
309 SHORT XWPENTRY winhQueryItemUnderMouse(HWND hwndMenu, POINTL *pptlMouse, RECTL *prtlItem);
310
311 /* ******************************************************************
312 *
313 * Slider helpers
314 *
315 ********************************************************************/
316
317 HWND XWPENTRY winhReplaceWithLinearSlider(HWND hwndParent,
318 HWND hwndOwner,
319 HWND hwndInsertAfter,
320 ULONG ulID,
321 ULONG ulSliderStyle,
322 ULONG ulTickCount);
323
324 BOOL XWPENTRY winhSetSliderTicks(HWND hwndSlider,
325 MPARAM mpEveryOther1,
326 ULONG ulPixels1,
327 MPARAM mpEveryOther2,
328 ULONG ulPixels2);
329 typedef BOOL XWPENTRY WINHSETSLIDERTICKS(HWND hwndSlider,
330 MPARAM mpEveryOther1,
331 ULONG ulPixels1,
332 MPARAM mpEveryOther2,
333 ULONG ulPixels2);
334 typedef WINHSETSLIDERTICKS *PWINHSETSLIDERTICKS;
335
336 /*
337 * winhSetSliderArmPosition:
338 * this moves the slider arm in a given
339 * linear slider.
340 *
341 * usMode can be one of the following:
342 * -- SMA_RANGEVALUE: usOffset is in pixels
343 * from the slider's home position.
344 * -- SMA_INCREMENTVALUE: usOffset is in
345 * units of the slider's primary scale.
346 */
347
348 #define winhSetSliderArmPosition(hwndSlider, usMode, usOffset) \
349 WinSendMsg(hwndSlider, SLM_SETSLIDERINFO, \
350 MPFROM2SHORT(SMA_SLIDERARMPOSITION, \
351 usMode), \
352 MPFROMSHORT(usOffset))
353
354 /*
355 * winhQuerySliderArmPosition:
356 * reverse to the previous, this returns a
357 * slider arm position (as a LONG value).
358 */
359
360 #define winhQuerySliderArmPosition(hwndSlider, usMode) \
361 (LONG)(WinSendMsg(hwndSlider, \
362 SLM_QUERYSLIDERINFO, \
363 MPFROM2SHORT(SMA_SLIDERARMPOSITION, \
364 usMode), \
365 0))
366
367 HWND XWPENTRY winhReplaceWithCircularSlider(HWND hwndParent,
368 HWND hwndOwner,
369 HWND hwndInsertAfter,
370 ULONG ulID,
371 ULONG ulSliderStyle,
372 SHORT sMin,
373 SHORT sMax,
374 USHORT usIncrement,
375 USHORT usTicksEvery);
376
377 /* ******************************************************************
378 *
379 * Spin button helpers
380 *
381 ********************************************************************/
382
383 VOID XWPENTRY winhSetDlgItemSpinData(HWND hwndDlg,
384 ULONG idSpinButton,
385 ULONG min,
386 ULONG max,
387 ULONG current);
388 typedef VOID XWPENTRY WINHSETDLGITEMSPINDATA(HWND hwndDlg,
389 ULONG idSpinButton,
390 ULONG min,
391 ULONG max,
392 ULONG current);
393 typedef WINHSETDLGITEMSPINDATA *PWINHSETDLGITEMSPINDATA;
394
395 LONG XWPENTRY winhAdjustDlgItemSpinData(HWND hwndDlg,
396 USHORT usItemID,
397 LONG lGrid,
398 USHORT usNotifyCode);
399 typedef LONG XWPENTRY WINHADJUSTDLGITEMSPINDATA(HWND hwndDlg,
400 USHORT usItemID,
401 LONG lGrid,
402 USHORT usNotifyCode);
403 typedef WINHADJUSTDLGITEMSPINDATA *PWINHADJUSTDLGITEMSPINDATA;
404
405 /* ******************************************************************
406 *
407 * Entry field helpers
408 *
409 ********************************************************************/
410
411 /*
412 * winhSetEntryFieldLimit:
413 * sets the maximum length for the entry field
414 * (EM_SETTEXTLIMIT message).
415 *
416 * PMREF doesn't say this, but the limit does
417 * _not_ include the null-terminator. That is,
418 * if you specify "12" characters here, you can
419 * really enter 12 characters.
420 *
421 * The default length is 30 characters, I think.
422 */
423
424 #define winhSetEntryFieldLimit(hwndEntryField, usLength) \
425 WinSendMsg(hwndEntryField, EM_SETTEXTLIMIT, (MPARAM)(usLength), (MPARAM)0)
426
427 /*
428 *@@ winhEntryFieldSelectAll:
429 * this selects the entire text in the entry field.
430 * Useful when the thing gets the focus.
431 */
432
433 #define winhEntryFieldSelectAll(hwndEntryField) \
434 WinSendMsg(hwndEntryField, EM_SETSEL, MPFROM2SHORT(0, 10000), MPNULL)
435
436 /*
437 *@@ winhHasEntryFieldChanged:
438 * this queries whether the entry field's contents
439 * have changed (EM_QUERYCHANGED message).
440 *
441 * This returns TRUE if changes have occured since
442 * the last time this message or WM_QUERYWINDOWPARAMS
443 * (WinQueryWindowText) was received.
444 */
445
446 #define winhHasEntryFieldChanged(hwndEntryField) \
447 (BOOL)WinSendMsg(hwndEntryField, EM_QUERYCHANGED, (MPARAM)0, (MPARAM)0)
448
449 /* ******************************************************************
450 *
451 * List box helpers
452 *
453 ********************************************************************/
454
455 /* The following macros are defined in the OS/2 headers for
456 list boxes:
457
458 LONG WinQueryLboxCount(HWND hwndLbox);
459 // wrapper around LM_QUERYITEMCOUNT;
460 // list box item count
461
462 SHORT WinQueryLboxItemTextLength(HWND hwndLbox,
463 SHORT index); // item index, starting from 0
464 // wrapper around LM_QUERYITEMTEXTLENGTH;
465 // returns length of item text, excluding NULL character
466
467 LONG WinQueryLboxItemText(HWND hwndLbox,
468 SHORT index, // item index, starting from 0
469 PSZ psz, // buffer
470 PSZ cchMax); // size of buffer, incl. null
471 // wrapper around LM_QUERYITEMTEXT;
472 // returns length of item text, excluding NULL character
473
474 BOOL WinSetLboxItemText(HWND hwndLbox,
475 LONG index,
476 PSZ psz);
477 // wrapper around LM_SETITEMTEXT
478
479 LONG WinInsertLboxItem(HWND hwndLbox,
480 LONG index, // new item index, starting from 0
481 // or LIT_END
482 // or LIT_SORTASCENDING
483 // or LIT_SORTDESCENDING
484 PSZ psz)
485 // wrapper around LM_INSERTITEM;
486 // returns LIT_MEMERROR, LIT_ERROR, or zero-based index
487
488 LONG WinDeleteLboxItem(HWND hwndLbox,
489 LONG index); // item index, starting from 0
490
491 LONG WinQueryLboxSelectedItem(HWND hwndLbox);
492 // wrapper around LM_QUERYSELECTION;
493 // works with single selection only,
494 // use winhQueryLboxSelectedItem instead
495 */
496
497 /*
498 * winhQueryLboxItemCount:
499 * returns the no. of items in the listbox
500 * as a SHORT.
501 *
502 *added V0.9.1 (99-12-14) [umoeller]
503 */
504
505 // #define winhQueryLboxItemCount(hwndListBox)
506 // (SHORT)WinSendMsg(hwndListBox, LM_QUERYITEMCOUNT, 0, 0)
507
508 // removed, use WinQueryLboxCount
509
510 /*
511 *@@ winhDeleteAllItems:
512 * deletes all list box items. Returns
513 * a BOOL.
514 *
515 *@@added V0.9.1 (99-12-14) [umoeller]
516 */
517
518 #define winhDeleteAllItems(hwndListBox) \
519 (BOOL)WinSendMsg(hwndListBox, \
520 LM_DELETEALL, 0, 0)
521 /*
522 *@@ winhQueryLboxSelectedItem:
523 * this queries the next selected list box item.
524 * For the first call, set sItemStart to LIT_FIRST;
525 * then repeat the call with sItemStart set to
526 * the previous return value until this returns
527 * LIT_NONE.
528 *
529 * Example:
530 + SHORT sItemStart = LIT_FIRST;
531 + while (TRUE)
532 + {
533 + sItemStart = winhQueryLboxSelectedItem(hwndListBox,
534 + sItemStart)
535 + if (sItemStart == LIT_NONE)
536 + break;
537 + ...
538 + }
539 *
540 * To have the cursored item returned, use LIT_CURSOR.
541 *
542 * For single selection, you can also use
543 * WinQueryLboxSelectedItem from the OS/2 PM headers.
544 */
545
546 #define winhQueryLboxSelectedItem(hwndListBox, sItemStart) \
547 SHORT1FROMMR(WinSendMsg(hwndListBox, \
548 LM_QUERYSELECTION, \
549 (MPARAM)(sItemStart), \
550 MPNULL))
551
552 /*
553 *@@ winhSetLboxSelectedItem:
554 * selects a list box item.
555 * This works for both single-selection and
556 * multiple-selection listboxes.
557 * In single-selection listboxes, if an item
558 * is selected (fSelect == TRUE), the previous
559 * item is automatically deselected.
560 * Note that (BOOL)fSelect is ignored if
561 * sItemIndex == LIT_NONE.
562 */
563
564 #define winhSetLboxSelectedItem(hwndListBox, sItemIndex, fSelect) \
565 (BOOL)(WinSendMsg(hwndListBox, \
566 LM_SELECTITEM, \
567 (MPARAM)(sItemIndex), \
568 (MPARAM)(fSelect)))
569
570 ULONG XWPENTRY winhLboxSelectAll(HWND hwndListBox, BOOL fSelect);
571
572 /*
573 * winhSetLboxItemHandle:
574 * sets the "item handle" for the specified sItemIndex.
575 * See LM_SETITEMHANDLE in PMREF for details.
576 */
577
578 #define winhSetLboxItemHandle(hwndListBox, sItemIndex, ulHandle) \
579 (BOOL)(WinSendMsg(hwndListBox, LM_SETITEMHANDLE, \
580 (MPARAM)(sItemIndex), \
581 (MPARAM)ulHandle))
582
583 /*
584 * winhQueryLboxItemHandle:
585 * the reverse to the previous. Returns a ULONG.
586 */
587
588 #define winhQueryLboxItemHandle(hwndListBox, sItemIndex) \
589 (ULONG)WinSendMsg(hwndListBox, LM_QUERYITEMHANDLE, \
590 MPFROMSHORT(sItemIndex), (MPARAM)NULL)
591
592 PSZ XWPENTRY winhQueryLboxItemText(HWND hwndListbox, SHORT sIndex);
593
594 BOOL XWPENTRY winhMoveLboxItem(HWND hwndSource,
595 SHORT sSourceIndex,
596 HWND hwndTarget,
597 SHORT sTargetIndex,
598 BOOL fSelectTarget);
599
600 ULONG XWPENTRY winhLboxFindItemFromHandle(HWND hwndListBox,
601 ULONG ulHandle);
602
603 /* ******************************************************************
604 *
605 * Scroll bar helpers
606 *
607 ********************************************************************/
608
609 BOOL XWPENTRY winhUpdateScrollBar(HWND hwndScrollBar,
610 ULONG ulWinPels,
611 ULONG ulViewportPels,
612 ULONG ulCurUnitOfs,
613 BOOL fAutoHide);
614
615 BOOL XWPENTRY winhHandleScrollMsg(HWND hwnd2Scroll,
616 HWND hwndScrollBar,
617 PULONG pulCurPelsOfs,
618 PRECTL prcl2Scroll,
619 LONG ulViewportPels,
620 USHORT usLineStepUnits,
621 ULONG msg,
622 MPARAM mp2);
623
624 BOOL XWPENTRY winhProcessScrollChars(HWND hwndClient,
625 HWND hwndVScroll,
626 HWND hwndHScroll,
627 MPARAM mp1,
628 MPARAM mp2,
629 ULONG ulVertMax,
630 ULONG ulHorzMax);
631
632 /* ******************************************************************
633 *
634 * Window positioning helpers
635 *
636 ********************************************************************/
637
638 BOOL XWPENTRY winhSaveWindowPos(HWND hwnd, HINI hIni, const char *pcszApp, const char *pcszKey);
639
640 BOOL XWPENTRY winhRestoreWindowPos(HWND hwnd, HINI hIni, const char *pcszApp, const char *pcszKey, ULONG fl);
641
642 #define XAC_MOVEX 0x0001
643 #define XAC_MOVEY 0x0002
644 #define XAC_SIZEX 0x0004
645 #define XAC_SIZEY 0x0008
646
647 /*
648 *@@ XADJUSTCTRLS:
649 *
650 */
651
652 typedef struct _XADJUSTCTRLS
653 {
654 BOOL fInitialized;
655 SWP swpMain; // SWP for main window
656 SWP *paswp; // pointer to array of control SWP structs
657 } XADJUSTCTRLS, *PXADJUSTCTRLS;
658
659 BOOL XWPENTRY winhAdjustControls(HWND hwndDlg,
660 const MPARAM *pmpFlags,
661 ULONG ulCount,
662 PSWP pswpNew,
663 PXADJUSTCTRLS pxac);
664
665 void XWPENTRY winhCenterWindow(HWND hwnd);
666 typedef void XWPENTRY WINHCENTERWINDOW(HWND hwnd);
667 typedef WINHCENTERWINDOW *PWINHCENTERWINDOW;
668
669 #define PLF_SMART 0x0001
670
671 BOOL winhPlaceBesides(HWND hwnd,
672 HWND hwndRelative,
673 ULONG fl);
674
675 HWND XWPENTRY winhFindWindowBelow(HWND hwndFind);
676
677 /* ******************************************************************
678 *
679 * Presparams helpers
680 *
681 ********************************************************************/
682
683 PSZ XWPENTRY winhQueryWindowFont(HWND hwnd);
684 typedef PSZ XWPENTRY WINHQUERYWINDOWFONT(HWND hwnd);
685 typedef WINHQUERYWINDOWFONT *PWINHQUERYWINDOWFONT;
686
687 BOOL XWPENTRY winhSetWindowFont(HWND hwnd, const char *pcszFont);
688 typedef BOOL XWPENTRY WINHSETWINDOWFONT(HWND hwnd, const char *pcszFont);
689 typedef WINHSETWINDOWFONT *PWINHSETWINDOWFONT;
690
691 /*
692 *@@ winhSetDlgItemFont:
693 * invokes winhSetWindowFont on a dialog
694 * item.
695 *
696 * Returns TRUE if successful or FALSE otherwise.
697 *
698 *@@added V0.9.0
699 */
700
701 #define winhSetDlgItemFont(hwnd, usId, pszFont) \
702 (winhSetWindowFont(WinWindowFromID(hwnd, usId), pszFont))
703
704 ULONG XWPENTRY winhSetControlsFont(HWND hwndDlg, SHORT usIDMin, SHORT usIDMax, const char *pcszFont);
705
706 #ifdef INCL_WINSYS
707 BOOL XWPENTRY winhStorePresParam(PPRESPARAMS *pppp,
708 ULONG ulAttrType,
709 ULONG cbData,
710 PVOID pData);
711 #endif
712
713 LONG XWPENTRY winhQueryPresColor(HWND hwnd, ULONG ulPP, BOOL fInherit, LONG lSysColor);
714 typedef LONG XWPENTRY WINHQUERYPRESCOLOR(HWND hwnd, ULONG ulPP, BOOL fInherit, LONG lSysColor);
715 typedef WINHQUERYPRESCOLOR *PWINHQUERYPRESCOLOR;
716
717 LONG XWPENTRY winhQueryPresColor2(HWND hwnd,
718 ULONG ulppRGB,
719 ULONG ulppIndex,
720 BOOL fInherit,
721 LONG lSysColor);
722
723 BOOL XWPENTRY winhSetPresColor(HWND hwnd, ULONG ulIndex, LONG lColor);
724
725 /* ******************************************************************
726 *
727 * Help instance helpers
728 *
729 ********************************************************************/
730
731 #ifdef INCL_WINHELP
732 HWND XWPENTRY winhCreateHelp(HWND hwndFrame,
733 const char *pcszFileName,
734 HMODULE hmod,
735 PHELPTABLE pHelpTable,
736 const char *pcszWindowTitle);
737
738 ULONG winhDisplayHelpPanel(HWND hwndHelpInstance,
739 ULONG ulHelpPanel);
740
741 void XWPENTRY winhDestroyHelp(HWND hwndHelp, HWND hwndFrame);
742 #endif
743
744 /* ******************************************************************
745 *
746 * Application control
747 *
748 ********************************************************************/
749
750 BOOL XWPENTRY winhAnotherInstance(const char *pcszSemName, BOOL fSwitch);
751
752 HSWITCH XWPENTRY winhAddToTasklist(HWND hwnd, HPOINTER hIcon);
753
754 /* ******************************************************************
755 *
756 * Miscellaneous
757 *
758 ********************************************************************/
759
760 VOID XWPENTRY winhFree(PVOID p);
761 typedef VOID XWPENTRY WINHFREE(PVOID p);
762 typedef WINHFREE *PWINHFREE;
763
764 HAB XWPENTRY winhMyAnchorBlock(VOID);
765 typedef HAB XWPENTRY WINHMYANCHORBLOCK(VOID);
766 typedef WINHMYANCHORBLOCK *PWINHMYANCHORBLOCK;
767
768 VOID XWPENTRY winhSleep(ULONG ulSleep);
769
770 #define WINH_FOD_SAVEDLG 0x0001
771 #define WINH_FOD_INILOADDIR 0x0010
772 #define WINH_FOD_INISAVEDIR 0x0020
773
774 BOOL XWPENTRY winhFileDlg(HWND hwndOwner,
775 PSZ pszFile,
776 ULONG flFlags,
777 HINI hini,
778 const char *pcszApplication,
779 const char *pcszKey);
780
781 HPOINTER XWPENTRY winhSetWaitPointer(VOID);
782
783 PSZ XWPENTRY winhQueryWindowText(HWND hwnd);
784
785 BOOL XWPENTRY winhSetWindowText(HWND hwnd,
786 const char *pcszFormat,
787 ...);
788
789 /*
790 *@@ winhQueryDlgItemText:
791 * like winhQueryWindowText, but for the dialog item
792 * in hwnd which has the ID usItemID.
793 */
794
795 #define winhQueryDlgItemText(hwnd, usItemID) winhQueryWindowText(WinWindowFromID(hwnd, usItemID))
796
797 BOOL XWPENTRY winhReplaceWindowText(HWND hwnd,
798 const char *pcszSearch,
799 const char *pcszReplaceWith);
800
801 ULONG XWPENTRY winhCenteredDlgBox(HWND hwndParent, HWND hwndOwner,
802 PFNWP pfnDlgProc, HMODULE hmod, ULONG idDlg, PVOID pCreateParams);
803 typedef ULONG XWPENTRY WINHCENTEREDDLGBOX(HWND hwndParent, HWND hwndOwner,
804 PFNWP pfnDlgProc, HMODULE hmod, ULONG idDlg, PVOID pCreateParams);
805 typedef WINHCENTEREDDLGBOX *PWINHCENTEREDDLGBOX;
806
807 ULONG XWPENTRY winhEnableControls(HWND hwndDlg,
808 USHORT usIDFirst,
809 USHORT usIDLast,
810 BOOL fEnable);
811
812 ULONG winhEnableControls2(HWND hwndDlg,
813 const ULONG *paulIDs,
814 ULONG cIDs,
815 BOOL fEnable);
816
817 HWND XWPENTRY winhCreateStdWindow(HWND hwndFrameParent,
818 PSWP pswpFrame,
819 ULONG flFrameCreateFlags,
820 ULONG ulFrameStyle,
821 const char *pcszFrameTitle,
822 ULONG ulResourcesID,
823 const char *pcszClassClient,
824 ULONG flStyleClient,
825 ULONG ulID,
826 PVOID pClientCtlData,
827 PHWND phwndClient);
828
829 HWND XWPENTRY winhCreateObjectWindow(const char *pcszWindowClass,
830 PVOID pvCreateParam);
831
832 HWND XWPENTRY winhCreateControl(HWND hwndParentAndOwner,
833 const char *pcszClass,
834 const char *pcszText,
835 ULONG ulStyle,
836 ULONG ulID);
837
838 VOID XWPENTRY winhRepaintWindows(HWND hwndParent);
839
840 HMQ XWPENTRY winhFindMsgQueue(PID pid, TID tid, HAB* phab);
841
842 VOID XWPENTRY winhFindPMErrorWindows(HWND *phwndHardError, HWND *phwndSysError);
843
844 HWND XWPENTRY winhCreateFakeDesktop(HWND hwndSibling);
845
846 BOOL XWPENTRY winhAssertWarp4Notebook(HWND hwndDlg,
847 USHORT usIdThreshold);
848
849 ULONG XWPENTRY winhDrawFormattedText(HPS hps, PRECTL prcl, const char *pcszText, ULONG flCmd);
850
851 #ifdef INCL_WINSWITCHLIST
852 PSWBLOCK XWPENTRY winhQuerySwitchList(HAB hab);
853 typedef PSWBLOCK XWPENTRY WINHQUERYSWITCHLIST(HAB hab);
854 typedef WINHQUERYSWITCHLIST *PWINHQUERYSWITCHLIST;
855
856 HSWITCH XWPENTRY winhHSWITCHfromHAPP(HAPP happ);
857 #endif
858
859 HWND XWPENTRY winhQueryTasklistWindow(VOID);
860 typedef HWND XWPENTRY WINHQUERYTASKLISTWINDOW(VOID);
861 typedef WINHQUERYTASKLISTWINDOW *PWINHQUERYTASKLISTWINDOW;
862
863 VOID XWPENTRY winhKillTasklist(VOID);
864
865 ULONG XWPENTRY winhQueryPendingSpoolJobs(VOID);
866
867 VOID XWPENTRY winhSetNumLock(BOOL fState);
868
869 /*
870 *@@ winhQueryScreenCX:
871 * helper macro for getting the screen width.
872 */
873
874 #define winhQueryScreenCX() (WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))
875
876 /*
877 *@@ winhQueryScreenCY:
878 * helper macro for getting the screen height.
879 */
880
881 #define winhQueryScreenCY() (WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN))
882
883 /* ******************************************************************
884 *
885 * Extended frame
886 *
887 ********************************************************************/
888
889 #define XFCF_STATUSBAR 0x0001
890
891 #define FID_STATUSBAR 0x8100
892
893 /*
894 *@@ EXTFRAMECDATA:
895 *
896 *@@added V0.9.16 (2001-09-29) [umoeller]
897 */
898
899 typedef struct _EXTFRAMECDATA
900 {
901 PSWP pswpFrame; // in: frame wnd pos
902 ULONG flFrameCreateFlags; // in: FCF_* flags
903 ULONG flExtFlags; // in: XFCF_* flags
904 ULONG ulFrameStyle; // in: WS_* flags (e.g. WS_VISIBLE, WS_ANIMATE)
905 const char *pcszFrameTitle; // in: frame title (title bar)
906 ULONG ulResourcesID; // in: according to FCF_* flags
907 const char *pcszClassClient; // in: client class name
908 ULONG flStyleClient; // in: client style
909 ULONG ulID; // in: frame window ID
910 PVOID pClientCtlData; // in: pCtlData structure pointer for client
911 } EXTFRAMECDATA, *PEXTFRAMECDATA;
912
913 /*
914 *@@ EXTFRAMEDATA:
915 *
916 *@@added V0.9.16 (2001-09-29) [umoeller]
917 */
918
919 typedef struct _EXTFRAMEDATA
920 {
921 EXTFRAMECDATA CData;
922
923 PFNWP pfnwpOrig; // original frame wnd proc from subclassing
924
925 PVOID pvUser; // more data for user (e.g. for additional subclassing)
926
927 } EXTFRAMEDATA, *PEXTFRAMEDATA;
928
929 HWND winhCreateStatusBar(HWND hwndFrame,
930 HWND hwndOwner,
931 const char *pcszText,
932 const char *pcszFont,
933 LONG lColor);
934
935 HWND winhCreateExtStdWindow(PEXTFRAMECDATA pData,
936 PHWND phwndClient);
937
938 /* ******************************************************************
939 *
940 * WPS Class List helpers
941 *
942 ********************************************************************/
943
944 PBYTE XWPENTRY winhQueryWPSClassList(VOID);
945
946 PBYTE XWPENTRY winhQueryWPSClass(PBYTE pObjClass, const char *pszClass);
947
948 APIRET XWPENTRY winhRegisterClass(const char* pcszClassName,
949 const char* pcszModule,
950 PSZ pszBuf,
951 ULONG cbBuf);
952
953 BOOL XWPENTRY winhIsClassRegistered(const char *pcszClass);
954
955 ULONG XWPENTRY winhResetWPS(HAB hab);
956
957#endif
958
959#if __cplusplus
960}
961#endif
962
Note: See TracBrowser for help on using the repository browser.