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

Last change on this file since 208 was 206, checked in by umoeller, 23 years ago

Minor updates.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 39.6 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 HWND XWPENTRY winhQuerySubmenu(HWND hMenu, SHORT sID);
194
195 /*
196 * winhCreateEmptyMenu:
197 * this macro creates an empty menu, which can
198 * be used with winhInsertMenuItem etc. later.
199 * Useful for creating popup menus on the fly.
200 * Note that even though HWND_DESKTOP is specified
201 * here as both the parent and the owner, the
202 * actual owner and parent are specified later
203 * with WinPopupMenu.
204 */
205
206 #define winhCreateEmptyMenu() \
207 WinCreateWindow(HWND_DESKTOP, WC_MENU, "", 0, 0, 0, 0, 0, \
208 HWND_DESKTOP, HWND_TOP, 0, 0, 0)
209
210 SHORT XWPENTRY winhInsertMenuItem(HWND hwndMenu,
211 SHORT iPosition,
212 SHORT sItemId,
213 const char *pcszItemTitle,
214 SHORT afStyle,
215 SHORT afAttr);
216 typedef SHORT XWPENTRY WINHINSERTMENUITEM(HWND hwndMenu,
217 SHORT iPosition,
218 SHORT sItemId,
219 const char *pcszItemTitle,
220 SHORT afStyle,
221 SHORT afAttr);
222 typedef WINHINSERTMENUITEM *PWINHINSERTMENUITEM;
223
224 HWND XWPENTRY winhInsertSubmenu(HWND hwndMenu,
225 ULONG iPosition,
226 SHORT sMenuId,
227 const char *pcszSubmenuTitle,
228 USHORT afMenuStyle,
229 SHORT sItemId,
230 const char *pcszItemTitle,
231 USHORT afItemStyle,
232 USHORT afAttribute);
233 typedef HWND XWPENTRY WINHINSERTSUBMENU(HWND hwndMenu,
234 ULONG iPosition,
235 SHORT sMenuId,
236 const char *pcszSubmenuTitle,
237 USHORT afMenuStyle,
238 SHORT sItemId,
239 const char *pcszItemTitle,
240 USHORT afItemStyle,
241 USHORT afAttribute);
242 typedef WINHINSERTSUBMENU *PWINHINSERTSUBMENU;
243
244 BOOL XWPENTRY winhSetMenuCondCascade(HWND hwndMenu,
245 LONG lDefaultItem);
246
247 /*
248 *@@ winhRemoveMenuItem:
249 * removes a menu item (SHORT) from the
250 * given menu (HWND). Returns the no. of
251 * remaining menu items (SHORT).
252 *
253 * This works for whole submenus too.
254 */
255
256 #define winhRemoveMenuItem(hwndMenu, sItemID) \
257 (SHORT)WinSendMsg(hwndMenu, MM_REMOVEITEM, MPFROM2SHORT(sItemID, FALSE), 0)
258
259 BOOL XWPENTRY winhRemoveMenuItems(HWND hwndMenu,
260 const SHORT *asItemIDs,
261 ULONG cItemIDs);
262
263 /*
264 *@@ winhDeleteMenuItem:
265 * deleted a menu item (SHORT) from the
266 * given menu (HWND). Returns the no. of
267 * remaining menu items (SHORT).
268 *
269 * As opposed to MM_REMOVEITEM, MM_DELETEITEM
270 * frees submenus and bitmaps also.
271 *
272 * This works for whole submenus too.
273 */
274
275 #define winhDeleteMenuItem(hwndMenu, sItemId) \
276 (SHORT)WinSendMsg(hwndMenu, MM_DELETEITEM, MPFROM2SHORT(sItemId, FALSE), 0)
277
278 SHORT XWPENTRY winhInsertMenuSeparator(HWND hMenu,
279 SHORT iPosition,
280 SHORT sId);
281
282 #define COPYFL_STRIPTABS 0x0001
283
284 BOOL XWPENTRY winhCopyMenuItem2(HWND hmenuTarget,
285 HWND hmenuSource,
286 USHORT usID,
287 SHORT sTargetPosition,
288 ULONG fl);
289
290 BOOL XWPENTRY winhCopyMenuItem(HWND hmenuTarget,
291 HWND hmenuSource,
292 USHORT usID,
293 SHORT sTargetPosition);
294 typedef BOOL XWPENTRY WINHCOPYMENUITEM(HWND hmenuTarget,
295 HWND hmenuSource,
296 USHORT usID,
297 SHORT sTargetPosition);
298 typedef WINHCOPYMENUITEM *PWINHCOPYMENUITEM;
299
300 HWND XWPENTRY winhMergeIntoSubMenu(HWND hmenuTarget,
301 SHORT sTargetPosition,
302 const char *pcszTitle,
303 SHORT sID,
304 HWND hmenuSource);
305 typedef HWND XWPENTRY WINHMERGEINTOSUBMENU(HWND hmenuTarget,
306 SHORT sTargetPosition,
307 const char *pcszTitle,
308 SHORT sID,
309 HWND hmenuSource);
310 typedef WINHMERGEINTOSUBMENU *PWINHMERGEINTOSUBMENU;
311
312 ULONG XWPENTRY winhMergeMenus(HWND hmenuTarget,
313 SHORT sTargetPosition,
314 HWND hmenuSource,
315 ULONG fl);
316 typedef ULONG XWPENTRY WINHMERGEMENUS(HWND hmenuTarget,
317 SHORT sTargetPosition,
318 HWND hmenuSource,
319 ULONG fl);
320 typedef WINHMERGEMENUS *PWINHMERGEMENUS;
321
322 PSZ XWPENTRY winhQueryMenuItemText(HWND hwndMenu,
323 USHORT usItemID);
324
325 BOOL XWPENTRY winhAppend2MenuItemText(HWND hwndMenu,
326 USHORT usItemID,
327 const char *pcszAppend,
328 BOOL fTab);
329
330 VOID XWPENTRY winhMenuRemoveEllipse(HWND hwndMenu,
331 USHORT usItemId);
332
333 SHORT XWPENTRY winhQueryItemUnderMouse(HWND hwndMenu, POINTL *pptlMouse, RECTL *prtlItem);
334
335 /* ******************************************************************
336 *
337 * Slider helpers
338 *
339 ********************************************************************/
340
341 HWND XWPENTRY winhReplaceWithLinearSlider(HWND hwndParent,
342 HWND hwndOwner,
343 HWND hwndInsertAfter,
344 ULONG ulID,
345 ULONG ulSliderStyle,
346 ULONG ulTickCount);
347
348 BOOL XWPENTRY winhSetSliderTicks(HWND hwndSlider,
349 MPARAM mpEveryOther1,
350 ULONG ulPixels1,
351 MPARAM mpEveryOther2,
352 ULONG ulPixels2);
353 typedef BOOL XWPENTRY WINHSETSLIDERTICKS(HWND hwndSlider,
354 MPARAM mpEveryOther1,
355 ULONG ulPixels1,
356 MPARAM mpEveryOther2,
357 ULONG ulPixels2);
358 typedef WINHSETSLIDERTICKS *PWINHSETSLIDERTICKS;
359
360 /*
361 * winhSetSliderArmPosition:
362 * this moves the slider arm in a given
363 * linear slider.
364 *
365 * usMode can be one of the following:
366 * -- SMA_RANGEVALUE: usOffset is in pixels
367 * from the slider's home position.
368 * -- SMA_INCREMENTVALUE: usOffset is in
369 * units of the slider's primary scale.
370 */
371
372 #define winhSetSliderArmPosition(hwndSlider, usMode, usOffset) \
373 WinSendMsg(hwndSlider, SLM_SETSLIDERINFO, \
374 MPFROM2SHORT(SMA_SLIDERARMPOSITION, \
375 usMode), \
376 MPFROMSHORT(usOffset))
377
378 /*
379 * winhQuerySliderArmPosition:
380 * reverse to the previous, this returns a
381 * slider arm position (as a LONG value).
382 */
383
384 #define winhQuerySliderArmPosition(hwndSlider, usMode) \
385 (LONG)(WinSendMsg(hwndSlider, \
386 SLM_QUERYSLIDERINFO, \
387 MPFROM2SHORT(SMA_SLIDERARMPOSITION, \
388 usMode), \
389 0))
390
391 HWND XWPENTRY winhReplaceWithCircularSlider(HWND hwndParent,
392 HWND hwndOwner,
393 HWND hwndInsertAfter,
394 ULONG ulID,
395 ULONG ulSliderStyle,
396 SHORT sMin,
397 SHORT sMax,
398 USHORT usIncrement,
399 USHORT usTicksEvery);
400
401 /* ******************************************************************
402 *
403 * Spin button helpers
404 *
405 ********************************************************************/
406
407 VOID XWPENTRY winhSetDlgItemSpinData(HWND hwndDlg,
408 ULONG idSpinButton,
409 ULONG min,
410 ULONG max,
411 ULONG current);
412 typedef VOID XWPENTRY WINHSETDLGITEMSPINDATA(HWND hwndDlg,
413 ULONG idSpinButton,
414 ULONG min,
415 ULONG max,
416 ULONG current);
417 typedef WINHSETDLGITEMSPINDATA *PWINHSETDLGITEMSPINDATA;
418
419 LONG XWPENTRY winhAdjustDlgItemSpinData(HWND hwndDlg,
420 USHORT usItemID,
421 LONG lGrid,
422 USHORT usNotifyCode);
423 typedef LONG XWPENTRY WINHADJUSTDLGITEMSPINDATA(HWND hwndDlg,
424 USHORT usItemID,
425 LONG lGrid,
426 USHORT usNotifyCode);
427 typedef WINHADJUSTDLGITEMSPINDATA *PWINHADJUSTDLGITEMSPINDATA;
428
429 /* ******************************************************************
430 *
431 * Entry field helpers
432 *
433 ********************************************************************/
434
435 /*
436 * winhSetEntryFieldLimit:
437 * sets the maximum length for the entry field
438 * (EM_SETTEXTLIMIT message).
439 *
440 * PMREF doesn't say this, but the limit does
441 * _not_ include the null-terminator. That is,
442 * if you specify "12" characters here, you can
443 * really enter 12 characters.
444 *
445 * The default length is 30 characters, I think.
446 */
447
448 #define winhSetEntryFieldLimit(hwndEntryField, usLength) \
449 WinSendMsg(hwndEntryField, EM_SETTEXTLIMIT, (MPARAM)(usLength), (MPARAM)0)
450
451 /*
452 *@@ winhEntryFieldSelectAll:
453 * this selects the entire text in the entry field.
454 * Useful when the thing gets the focus.
455 */
456
457 #define winhEntryFieldSelectAll(hwndEntryField) \
458 WinSendMsg(hwndEntryField, EM_SETSEL, MPFROM2SHORT(0, 10000), MPNULL)
459
460 /*
461 *@@ winhHasEntryFieldChanged:
462 * this queries whether the entry field's contents
463 * have changed (EM_QUERYCHANGED message).
464 *
465 * This returns TRUE if changes have occured since
466 * the last time this message or WM_QUERYWINDOWPARAMS
467 * (WinQueryWindowText) was received.
468 */
469
470 #define winhHasEntryFieldChanged(hwndEntryField) \
471 (BOOL)WinSendMsg(hwndEntryField, EM_QUERYCHANGED, (MPARAM)0, (MPARAM)0)
472
473 /* ******************************************************************
474 *
475 * List box helpers
476 *
477 ********************************************************************/
478
479 /* The following macros are defined in the OS/2 headers for
480 list boxes:
481
482 LONG WinQueryLboxCount(HWND hwndLbox);
483 // wrapper around LM_QUERYITEMCOUNT;
484 // list box item count
485
486 SHORT WinQueryLboxItemTextLength(HWND hwndLbox,
487 SHORT index); // item index, starting from 0
488 // wrapper around LM_QUERYITEMTEXTLENGTH;
489 // returns length of item text, excluding NULL character
490
491 LONG WinQueryLboxItemText(HWND hwndLbox,
492 SHORT index, // item index, starting from 0
493 PSZ psz, // buffer
494 PSZ cchMax); // size of buffer, incl. null
495 // wrapper around LM_QUERYITEMTEXT;
496 // returns length of item text, excluding NULL character
497
498 BOOL WinSetLboxItemText(HWND hwndLbox,
499 LONG index,
500 PSZ psz);
501 // wrapper around LM_SETITEMTEXT
502
503 LONG WinInsertLboxItem(HWND hwndLbox,
504 LONG index, // new item index, starting from 0
505 // or LIT_END
506 // or LIT_SORTASCENDING
507 // or LIT_SORTDESCENDING
508 PSZ psz)
509 // wrapper around LM_INSERTITEM;
510 // returns LIT_MEMERROR, LIT_ERROR, or zero-based index
511
512 LONG WinDeleteLboxItem(HWND hwndLbox,
513 LONG index); // item index, starting from 0
514
515 LONG WinQueryLboxSelectedItem(HWND hwndLbox);
516 // wrapper around LM_QUERYSELECTION;
517 // works with single selection only,
518 // use winhQueryLboxSelectedItem instead
519 */
520
521 /*
522 * winhQueryLboxItemCount:
523 * returns the no. of items in the listbox
524 * as a SHORT.
525 *
526 *added V0.9.1 (99-12-14) [umoeller]
527 */
528
529 // #define winhQueryLboxItemCount(hwndListBox)
530 // (SHORT)WinSendMsg(hwndListBox, LM_QUERYITEMCOUNT, 0, 0)
531
532 // removed, use WinQueryLboxCount
533
534 /*
535 *@@ winhDeleteAllItems:
536 * deletes all list box items. Returns
537 * a BOOL.
538 *
539 *@@added V0.9.1 (99-12-14) [umoeller]
540 */
541
542 #define winhDeleteAllItems(hwndListBox) \
543 (BOOL)WinSendMsg(hwndListBox, \
544 LM_DELETEALL, 0, 0)
545 /*
546 *@@ winhQueryLboxSelectedItem:
547 * this queries the next selected list box item.
548 * For the first call, set sItemStart to LIT_FIRST;
549 * then repeat the call with sItemStart set to
550 * the previous return value until this returns
551 * LIT_NONE.
552 *
553 * Example:
554 + SHORT sItemStart = LIT_FIRST;
555 + while (TRUE)
556 + {
557 + sItemStart = winhQueryLboxSelectedItem(hwndListBox,
558 + sItemStart)
559 + if (sItemStart == LIT_NONE)
560 + break;
561 + ...
562 + }
563 *
564 * To have the cursored item returned, use LIT_CURSOR.
565 *
566 * For single selection, you can also use
567 * WinQueryLboxSelectedItem from the OS/2 PM headers.
568 */
569
570 #define winhQueryLboxSelectedItem(hwndListBox, sItemStart) \
571 SHORT1FROMMR(WinSendMsg(hwndListBox, \
572 LM_QUERYSELECTION, \
573 (MPARAM)(sItemStart), \
574 MPNULL))
575
576 /*
577 *@@ winhSetLboxSelectedItem:
578 * selects a list box item.
579 * This works for both single-selection and
580 * multiple-selection listboxes.
581 * In single-selection listboxes, if an item
582 * is selected (fSelect == TRUE), the previous
583 * item is automatically deselected.
584 * Note that (BOOL)fSelect is ignored if
585 * sItemIndex == LIT_NONE.
586 */
587
588 #define winhSetLboxSelectedItem(hwndListBox, sItemIndex, fSelect) \
589 (BOOL)(WinSendMsg(hwndListBox, \
590 LM_SELECTITEM, \
591 (MPARAM)(sItemIndex), \
592 (MPARAM)(fSelect)))
593
594 ULONG XWPENTRY winhLboxSelectAll(HWND hwndListBox, BOOL fSelect);
595
596 /*
597 * winhSetLboxItemHandle:
598 * sets the "item handle" for the specified sItemIndex.
599 * See LM_SETITEMHANDLE in PMREF for details.
600 */
601
602 #define winhSetLboxItemHandle(hwndListBox, sItemIndex, ulHandle) \
603 (BOOL)(WinSendMsg(hwndListBox, LM_SETITEMHANDLE, \
604 (MPARAM)(sItemIndex), \
605 (MPARAM)ulHandle))
606
607 /*
608 * winhQueryLboxItemHandle:
609 * the reverse to the previous. Returns a ULONG.
610 */
611
612 #define winhQueryLboxItemHandle(hwndListBox, sItemIndex) \
613 (ULONG)WinSendMsg(hwndListBox, LM_QUERYITEMHANDLE, \
614 MPFROMSHORT(sItemIndex), (MPARAM)NULL)
615
616 PSZ XWPENTRY winhQueryLboxItemText(HWND hwndListbox, SHORT sIndex);
617
618 BOOL XWPENTRY winhMoveLboxItem(HWND hwndSource,
619 SHORT sSourceIndex,
620 HWND hwndTarget,
621 SHORT sTargetIndex,
622 BOOL fSelectTarget);
623
624 ULONG XWPENTRY winhLboxFindItemFromHandle(HWND hwndListBox,
625 ULONG ulHandle);
626
627 /* ******************************************************************
628 *
629 * Scroll bar helpers
630 *
631 ********************************************************************/
632
633 BOOL XWPENTRY winhUpdateScrollBar(HWND hwndScrollBar,
634 ULONG ulWinPels,
635 ULONG ulViewportPels,
636 ULONG ulCurUnitOfs,
637 BOOL fAutoHide);
638
639 BOOL XWPENTRY winhHandleScrollMsg(HWND hwnd2Scroll,
640 HWND hwndScrollBar,
641 PULONG pulCurPelsOfs,
642 PRECTL prcl2Scroll,
643 LONG ulViewportPels,
644 USHORT usLineStepUnits,
645 ULONG msg,
646 MPARAM mp2);
647
648 BOOL XWPENTRY winhProcessScrollChars(HWND hwndClient,
649 HWND hwndVScroll,
650 HWND hwndHScroll,
651 MPARAM mp1,
652 MPARAM mp2,
653 ULONG ulVertMax,
654 ULONG ulHorzMax);
655
656 /* ******************************************************************
657 *
658 * Window positioning helpers
659 *
660 ********************************************************************/
661
662 BOOL XWPENTRY winhSaveWindowPos(HWND hwnd, HINI hIni, const char *pcszApp, const char *pcszKey);
663
664 BOOL XWPENTRY winhRestoreWindowPos(HWND hwnd, HINI hIni, const char *pcszApp, const char *pcszKey, ULONG fl);
665
666 #define XAC_MOVEX 0x0001
667 #define XAC_MOVEY 0x0002
668 #define XAC_SIZEX 0x0004
669 #define XAC_SIZEY 0x0008
670
671 /*
672 *@@ XADJUSTCTRLS:
673 *
674 */
675
676 typedef struct _XADJUSTCTRLS
677 {
678 BOOL fInitialized;
679 SWP swpMain; // SWP for main window
680 SWP *paswp; // pointer to array of control SWP structs
681 } XADJUSTCTRLS, *PXADJUSTCTRLS;
682
683 BOOL XWPENTRY winhAdjustControls(HWND hwndDlg,
684 const MPARAM *pmpFlags,
685 ULONG ulCount,
686 PSWP pswpNew,
687 PXADJUSTCTRLS pxac);
688
689 void XWPENTRY winhCenterWindow(HWND hwnd);
690 typedef void XWPENTRY WINHCENTERWINDOW(HWND hwnd);
691 typedef WINHCENTERWINDOW *PWINHCENTERWINDOW;
692
693 #define PLF_SMART 0x0001
694
695 BOOL winhPlaceBesides(HWND hwnd,
696 HWND hwndRelative,
697 ULONG fl);
698
699 HWND XWPENTRY winhFindWindowBelow(HWND hwndFind);
700
701 /* ******************************************************************
702 *
703 * Presparams helpers
704 *
705 ********************************************************************/
706
707 PSZ XWPENTRY winhQueryWindowFont(HWND hwnd);
708 typedef PSZ XWPENTRY WINHQUERYWINDOWFONT(HWND hwnd);
709 typedef WINHQUERYWINDOWFONT *PWINHQUERYWINDOWFONT;
710
711 BOOL XWPENTRY winhSetWindowFont(HWND hwnd, const char *pcszFont);
712 typedef BOOL XWPENTRY WINHSETWINDOWFONT(HWND hwnd, const char *pcszFont);
713 typedef WINHSETWINDOWFONT *PWINHSETWINDOWFONT;
714
715 /*
716 *@@ winhSetDlgItemFont:
717 * invokes winhSetWindowFont on a dialog
718 * item.
719 *
720 * Returns TRUE if successful or FALSE otherwise.
721 *
722 *@@added V0.9.0
723 */
724
725 #define winhSetDlgItemFont(hwnd, usId, pszFont) \
726 (winhSetWindowFont(WinWindowFromID(hwnd, usId), pszFont))
727
728 ULONG XWPENTRY winhSetControlsFont(HWND hwndDlg, SHORT usIDMin, SHORT usIDMax, const char *pcszFont);
729
730 #ifdef INCL_WINSYS
731 BOOL XWPENTRY winhStorePresParam(PPRESPARAMS *pppp,
732 ULONG ulAttrType,
733 ULONG cbData,
734 PVOID pData);
735 #endif
736
737 LONG XWPENTRY winhQueryPresColor(HWND hwnd, ULONG ulPP, BOOL fInherit, LONG lSysColor);
738 typedef LONG XWPENTRY WINHQUERYPRESCOLOR(HWND hwnd, ULONG ulPP, BOOL fInherit, LONG lSysColor);
739 typedef WINHQUERYPRESCOLOR *PWINHQUERYPRESCOLOR;
740
741 LONG XWPENTRY winhQueryPresColor2(HWND hwnd,
742 ULONG ulppRGB,
743 ULONG ulppIndex,
744 BOOL fInherit,
745 LONG lSysColor);
746
747 BOOL XWPENTRY winhSetPresColor(HWND hwnd, ULONG ulIndex, LONG lColor);
748
749 /* ******************************************************************
750 *
751 * Help instance helpers
752 *
753 ********************************************************************/
754
755 #ifdef INCL_WINHELP
756 HWND XWPENTRY winhCreateHelp(HWND hwndFrame,
757 const char *pcszFileName,
758 HMODULE hmod,
759 PHELPTABLE pHelpTable,
760 const char *pcszWindowTitle);
761
762 ULONG winhDisplayHelpPanel(HWND hwndHelpInstance,
763 ULONG ulHelpPanel);
764
765 void XWPENTRY winhDestroyHelp(HWND hwndHelp, HWND hwndFrame);
766 #endif
767
768 /* ******************************************************************
769 *
770 * Application control
771 *
772 ********************************************************************/
773
774 BOOL XWPENTRY winhAnotherInstance(const char *pcszSemName, BOOL fSwitch);
775
776 HSWITCH XWPENTRY winhAddToTasklist(HWND hwnd, HPOINTER hIcon);
777
778 /* ******************************************************************
779 *
780 * Miscellaneous
781 *
782 ********************************************************************/
783
784 VOID XWPENTRY winhFree(PVOID p);
785 typedef VOID XWPENTRY WINHFREE(PVOID p);
786 typedef WINHFREE *PWINHFREE;
787
788 HAB XWPENTRY winhMyAnchorBlock(VOID);
789 typedef HAB XWPENTRY WINHMYANCHORBLOCK(VOID);
790 typedef WINHMYANCHORBLOCK *PWINHMYANCHORBLOCK;
791
792 VOID XWPENTRY winhSleep(ULONG ulSleep);
793
794 #define WINH_FOD_SAVEDLG 0x0001
795 #define WINH_FOD_INILOADDIR 0x0010
796 #define WINH_FOD_INISAVEDIR 0x0020
797
798 BOOL XWPENTRY winhFileDlg(HWND hwndOwner,
799 PSZ pszFile,
800 ULONG flFlags,
801 HINI hini,
802 const char *pcszApplication,
803 const char *pcszKey);
804
805 HPOINTER XWPENTRY winhSetWaitPointer(VOID);
806
807 PSZ XWPENTRY winhQueryWindowText(HWND hwnd);
808
809 BOOL XWPENTRY winhSetWindowText(HWND hwnd,
810 const char *pcszFormat,
811 ...);
812
813 /*
814 *@@ winhQueryDlgItemText:
815 * like winhQueryWindowText, but for the dialog item
816 * in hwnd which has the ID usItemID.
817 */
818
819 #define winhQueryDlgItemText(hwnd, usItemID) winhQueryWindowText(WinWindowFromID(hwnd, usItemID))
820
821 BOOL XWPENTRY winhReplaceWindowText(HWND hwnd,
822 const char *pcszSearch,
823 const char *pcszReplaceWith);
824
825 ULONG XWPENTRY winhCenteredDlgBox(HWND hwndParent, HWND hwndOwner,
826 PFNWP pfnDlgProc, HMODULE hmod, ULONG idDlg, PVOID pCreateParams);
827 typedef ULONG XWPENTRY WINHCENTEREDDLGBOX(HWND hwndParent, HWND hwndOwner,
828 PFNWP pfnDlgProc, HMODULE hmod, ULONG idDlg, PVOID pCreateParams);
829 typedef WINHCENTEREDDLGBOX *PWINHCENTEREDDLGBOX;
830
831 ULONG XWPENTRY winhEnableControls(HWND hwndDlg,
832 USHORT usIDFirst,
833 USHORT usIDLast,
834 BOOL fEnable);
835
836 ULONG winhEnableControls2(HWND hwndDlg,
837 const ULONG *paulIDs,
838 ULONG cIDs,
839 BOOL fEnable);
840
841 HWND XWPENTRY winhCreateStdWindow(HWND hwndFrameParent,
842 PSWP pswpFrame,
843 ULONG flFrameCreateFlags,
844 ULONG ulFrameStyle,
845 const char *pcszFrameTitle,
846 ULONG ulResourcesID,
847 const char *pcszClassClient,
848 ULONG flStyleClient,
849 ULONG ulID,
850 PVOID pClientCtlData,
851 PHWND phwndClient);
852
853 HWND XWPENTRY winhCreateObjectWindow(const char *pcszWindowClass,
854 PVOID pvCreateParam);
855
856 HWND XWPENTRY winhCreateControl(HWND hwndParentAndOwner,
857 const char *pcszClass,
858 const char *pcszText,
859 ULONG ulStyle,
860 ULONG ulID);
861
862 VOID XWPENTRY winhRepaintWindows(HWND hwndParent);
863
864 HMQ XWPENTRY winhFindMsgQueue(PID pid, TID tid, HAB* phab);
865
866 VOID XWPENTRY winhFindPMErrorWindows(HWND *phwndHardError, HWND *phwndSysError);
867
868 HWND XWPENTRY winhCreateFakeDesktop(HWND hwndSibling);
869
870 BOOL XWPENTRY winhAssertWarp4Notebook(HWND hwndDlg,
871 USHORT usIdThreshold);
872
873 ULONG XWPENTRY winhDrawFormattedText(HPS hps, PRECTL prcl, const char *pcszText, ULONG flCmd);
874
875 #ifdef INCL_WINSWITCHLIST
876 PSWBLOCK XWPENTRY winhQuerySwitchList(HAB hab);
877 typedef PSWBLOCK XWPENTRY WINHQUERYSWITCHLIST(HAB hab);
878 typedef WINHQUERYSWITCHLIST *PWINHQUERYSWITCHLIST;
879
880 HSWITCH XWPENTRY winhHSWITCHfromHAPP(HAPP happ);
881 #endif
882
883 HWND XWPENTRY winhQueryTasklistWindow(VOID);
884 typedef HWND XWPENTRY WINHQUERYTASKLISTWINDOW(VOID);
885 typedef WINHQUERYTASKLISTWINDOW *PWINHQUERYTASKLISTWINDOW;
886
887 VOID XWPENTRY winhKillTasklist(VOID);
888
889 ULONG XWPENTRY winhQueryPendingSpoolJobs(VOID);
890
891 VOID XWPENTRY winhSetNumLock(BOOL fState);
892
893 /*
894 *@@ winhQueryScreenCX:
895 * helper macro for getting the screen width.
896 */
897
898 #define winhQueryScreenCX() (WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))
899
900 /*
901 *@@ winhQueryScreenCY:
902 * helper macro for getting the screen height.
903 */
904
905 #define winhQueryScreenCY() (WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN))
906
907 /* ******************************************************************
908 *
909 * Extended frame
910 *
911 ********************************************************************/
912
913 #define XFCF_STATUSBAR 0x0001
914
915 #define FID_STATUSBAR 0x8100
916
917 /*
918 *@@ EXTFRAMECDATA:
919 *
920 *@@added V0.9.16 (2001-09-29) [umoeller]
921 */
922
923 typedef struct _EXTFRAMECDATA
924 {
925 PSWP pswpFrame; // in: frame wnd pos
926 ULONG flFrameCreateFlags; // in: FCF_* flags
927 ULONG flExtFlags; // in: XFCF_* flags
928 ULONG ulFrameStyle; // in: WS_* flags (e.g. WS_VISIBLE, WS_ANIMATE)
929 const char *pcszFrameTitle; // in: frame title (title bar)
930 ULONG ulResourcesID; // in: according to FCF_* flags
931 const char *pcszClassClient; // in: client class name
932 ULONG flStyleClient; // in: client style
933 ULONG ulID; // in: frame window ID
934 PVOID pClientCtlData; // in: pCtlData structure pointer for client
935 } EXTFRAMECDATA, *PEXTFRAMECDATA;
936
937 /*
938 *@@ EXTFRAMEDATA:
939 *
940 *@@added V0.9.16 (2001-09-29) [umoeller]
941 */
942
943 typedef struct _EXTFRAMEDATA
944 {
945 EXTFRAMECDATA CData;
946
947 PFNWP pfnwpOrig; // original frame wnd proc from subclassing
948
949 PVOID pvUser; // more data for user (e.g. for additional subclassing)
950
951 } EXTFRAMEDATA, *PEXTFRAMEDATA;
952
953 HWND winhCreateStatusBar(HWND hwndFrame,
954 HWND hwndOwner,
955 const char *pcszText,
956 const char *pcszFont,
957 LONG lColor);
958
959 HWND winhCreateExtStdWindow(PEXTFRAMECDATA pData,
960 PHWND phwndClient);
961
962 /* ******************************************************************
963 *
964 * WPS Class List helpers
965 *
966 ********************************************************************/
967
968 PBYTE XWPENTRY winhQueryWPSClassList(VOID);
969
970 PBYTE XWPENTRY winhQueryWPSClass(PBYTE pObjClass, const char *pszClass);
971
972 APIRET XWPENTRY winhRegisterClass(const char* pcszClassName,
973 const char* pcszModule,
974 PSZ pszBuf,
975 ULONG cbBuf);
976
977 BOOL XWPENTRY winhIsClassRegistered(const char *pcszClass);
978
979 ULONG XWPENTRY winhResetWPS(HAB hab);
980
981#endif
982
983#if __cplusplus
984}
985#endif
986
Note: See TracBrowser for help on using the repository browser.