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

Last change on this file since 231 was 218, checked in by umoeller, 23 years ago

Misc changes.

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