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

Last change on this file since 175 was 166, checked in by umoeller, 23 years ago

Bunch of fixes.

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