source: branches/branch-1-0/include/helpers/winh.h@ 256

Last change on this file since 256 was 256, checked in by umoeller, 22 years ago

Buncha fixes.

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