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

Last change on this file since 406 was 354, checked in by pr, 18 years ago

Add winhSetPresColor typedefs. Bug 994.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 41.9 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-2007 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 occurred 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 // V1.0.6 (2006-10-28) [pr]
676 // V1.0.7 (2006-12-16) [pr]: Named screen width/height parameters
677
678 /*
679 *@@ STOREPOS:
680 *
681 */
682
683 #pragma pack(2)
684 typedef struct _STOREPOS
685 {
686 USHORT usMagic; // Always 0x7B6A (???)
687 ULONG ulFlags;
688 USHORT usXPos;
689 USHORT usYPos;
690 USHORT usWidth;
691 USHORT usHeight;
692 ULONG ulRes1; // Always 1 (???)
693 USHORT usRestoreXPos;
694 USHORT usRestoreYPos;
695 USHORT usRestoreWidth;
696 USHORT usRestoreHeight;
697 ULONG ulRes2; // Always 1 (???)
698 USHORT usMinXPos;
699 USHORT usMinYPos;
700 ULONG ulScreenWidth;
701 ULONG ulScreenHeight;
702 ULONG ulRes3; // Always 0xFFFFFFFF (???)
703 ULONG ulRes4; // Always 0xFFFFFFFF (???)
704 ULONG ulPPLen; // Presentation Parameters length
705 } STOREPOS, *PSTOREPOS;
706 #pragma pack()
707
708 #pragma import(WinGetFrameTreePPSize, , "PMWIN", 972)
709 #pragma import(WinGetFrameTreePPs, , "PMWIN", 973)
710
711 ULONG APIENTRY WinGetFrameTreePPSize(HWND hwnd);
712 ULONG APIENTRY WinGetFrameTreePPs(HWND hwnd, ULONG cchMax, PCH pch);
713
714 BOOL XWPENTRY winhStoreWindowPos(HWND hwnd, HINI hIni, const char *pcszApp, const char *pcszKey);
715
716 #define XAC_MOVEX 0x0001
717 #define XAC_MOVEY 0x0002
718 #define XAC_SIZEX 0x0004
719 #define XAC_SIZEY 0x0008
720
721 /*
722 *@@ XADJUSTCTRLS:
723 *
724 */
725
726 typedef struct _XADJUSTCTRLS
727 {
728 BOOL fInitialized;
729 SWP swpMain; // SWP for main window
730 SWP *paswp; // pointer to array of control SWP structs
731 } XADJUSTCTRLS, *PXADJUSTCTRLS;
732
733 BOOL XWPENTRY winhAdjustControls(HWND hwndDlg,
734 const MPARAM *pmpFlags,
735 ULONG ulCount,
736 PSWP pswpNew,
737 PXADJUSTCTRLS pxac);
738
739 void XWPENTRY winhCenterWindow(HWND hwnd);
740 typedef void XWPENTRY WINHCENTERWINDOW(HWND hwnd);
741 typedef WINHCENTERWINDOW *PWINHCENTERWINDOW;
742
743 #define PLF_SMART 0x0001
744
745 BOOL winhPlaceBesides(HWND hwnd,
746 HWND hwndRelative,
747 ULONG fl);
748
749 HWND XWPENTRY winhFindWindowBelow(HWND hwndFind);
750
751 /* ******************************************************************
752 *
753 * Presparams helpers
754 *
755 ********************************************************************/
756
757 PSZ XWPENTRY winhQueryWindowFont(HWND hwnd);
758 typedef PSZ XWPENTRY WINHQUERYWINDOWFONT(HWND hwnd);
759 typedef WINHQUERYWINDOWFONT *PWINHQUERYWINDOWFONT;
760
761 BOOL XWPENTRY winhSetWindowFont(HWND hwnd, const char *pcszFont);
762 typedef BOOL XWPENTRY WINHSETWINDOWFONT(HWND hwnd, const char *pcszFont);
763 typedef WINHSETWINDOWFONT *PWINHSETWINDOWFONT;
764
765 /*
766 *@@ winhSetDlgItemFont:
767 * invokes winhSetWindowFont on a dialog
768 * item.
769 *
770 * Returns TRUE if successful or FALSE otherwise.
771 *
772 *@@added V0.9.0
773 */
774
775 #define winhSetDlgItemFont(hwnd, usId, pszFont) \
776 (winhSetWindowFont(WinWindowFromID(hwnd, usId), pszFont))
777
778 ULONG XWPENTRY winhSetControlsFont(HWND hwndDlg, SHORT usIDMin, SHORT usIDMax, const char *pcszFont);
779
780 #ifdef INCL_WINSYS
781 BOOL XWPENTRY winhStorePresParam(PPRESPARAMS *pppp,
782 ULONG ulAttrType,
783 ULONG cbData,
784 PVOID pData);
785 #endif
786
787 LONG XWPENTRY winhQueryPresColor(HWND hwnd, ULONG ulPP, BOOL fInherit, LONG lSysColor);
788 typedef LONG XWPENTRY WINHQUERYPRESCOLOR(HWND hwnd, ULONG ulPP, BOOL fInherit, LONG lSysColor);
789 typedef WINHQUERYPRESCOLOR *PWINHQUERYPRESCOLOR;
790
791 LONG XWPENTRY winhQueryPresColor2(HWND hwnd,
792 ULONG ulppRGB,
793 ULONG ulppIndex,
794 BOOL fInherit,
795 LONG lSysColor);
796
797 BOOL XWPENTRY winhSetPresColor(HWND hwnd, ULONG ulIndex, LONG lColor);
798 // XWP V1.0.8 (2007-05-08) [pr]
799 typedef BOOL XWPENTRY WINHSETPRESCOLOR(HWND hwnd, ULONG ulIndex, LONG lColor);
800 typedef WINHSETPRESCOLOR *PWINHSETPRESCOLOR;
801
802 /* ******************************************************************
803 *
804 * Help instance helpers
805 *
806 ********************************************************************/
807
808 #ifdef INCL_WINHELP
809 HWND XWPENTRY winhCreateHelp(HWND hwndFrame,
810 const char *pcszFileName,
811 HMODULE hmod,
812 PHELPTABLE pHelpTable,
813 const char *pcszWindowTitle);
814
815 ULONG winhDisplayHelpPanel(HWND hwndHelpInstance,
816 ULONG ulHelpPanel);
817
818 void XWPENTRY winhDestroyHelp(HWND hwndHelp, HWND hwndFrame);
819 #endif
820
821 /* ******************************************************************
822 *
823 * Application control
824 *
825 ********************************************************************/
826
827 BOOL XWPENTRY winhAnotherInstance(const char *pcszSemName, BOOL fSwitch);
828
829 HSWITCH XWPENTRY winhAddToTasklist(HWND hwnd, HPOINTER hIcon);
830
831 /* ******************************************************************
832 *
833 * Miscellaneous
834 *
835 ********************************************************************/
836
837 VOID XWPENTRY winhFree(PVOID p);
838 typedef VOID XWPENTRY WINHFREE(PVOID p);
839 typedef WINHFREE *PWINHFREE;
840
841 HAB XWPENTRY winhMyAnchorBlock(VOID);
842 typedef HAB XWPENTRY WINHMYANCHORBLOCK(VOID);
843 typedef WINHMYANCHORBLOCK *PWINHMYANCHORBLOCK;
844
845 VOID XWPENTRY winhSleep(ULONG ulSleep);
846
847 #define WINH_FOD_SAVEDLG 0x0001
848 #define WINH_FOD_INILOADDIR 0x0010
849 #define WINH_FOD_INISAVEDIR 0x0020
850
851 BOOL XWPENTRY winhFileDlg(HWND hwndOwner,
852 PSZ pszFile,
853 ULONG flFlags,
854 HINI hini,
855 const char *pcszApplication,
856 const char *pcszKey);
857
858 HPOINTER XWPENTRY winhSetWaitPointer(VOID);
859
860 PSZ XWPENTRY winhQueryWindowText(HWND hwnd);
861
862 BOOL XWPENTRY winhSetWindowText(HWND hwnd,
863 const char *pcszFormat,
864 ...);
865
866 /*
867 *@@ winhQueryDlgItemText:
868 * like winhQueryWindowText, but for the dialog item
869 * in hwnd which has the ID usItemID.
870 */
871
872 #define winhQueryDlgItemText(hwnd, usItemID) winhQueryWindowText(WinWindowFromID(hwnd, usItemID))
873
874 BOOL XWPENTRY winhReplaceWindowText(HWND hwnd,
875 const char *pcszSearch,
876 const char *pcszReplaceWith);
877
878 ULONG XWPENTRY winhCenteredDlgBox(HWND hwndParent, HWND hwndOwner,
879 PFNWP pfnDlgProc, HMODULE hmod, ULONG idDlg, PVOID pCreateParams);
880 typedef ULONG XWPENTRY WINHCENTEREDDLGBOX(HWND hwndParent, HWND hwndOwner,
881 PFNWP pfnDlgProc, HMODULE hmod, ULONG idDlg, PVOID pCreateParams);
882 typedef WINHCENTEREDDLGBOX *PWINHCENTEREDDLGBOX;
883
884 ULONG XWPENTRY winhEnableControls(HWND hwndDlg,
885 USHORT usIDFirst,
886 USHORT usIDLast,
887 BOOL fEnable);
888
889 ULONG winhEnableControls2(HWND hwndDlg,
890 const ULONG *paulIDs,
891 ULONG cIDs,
892 BOOL fEnable);
893
894 HWND XWPENTRY winhCreateStdWindow(HWND hwndFrameParent,
895 PSWP pswpFrame,
896 ULONG flFrameCreateFlags,
897 ULONG ulFrameStyle,
898 const char *pcszFrameTitle,
899 ULONG ulResourcesID,
900 const char *pcszClassClient,
901 ULONG flStyleClient,
902 ULONG ulID,
903 PVOID pClientCtlData,
904 PHWND phwndClient);
905
906 HWND XWPENTRY winhCreateObjectWindow(const char *pcszWindowClass,
907 PVOID pvCreateParam);
908
909 HWND XWPENTRY winhCreateControl(HWND hwndParent,
910 HWND hwndOwner,
911 const char *pcszClass,
912 const char *pcszText,
913 ULONG ulStyle,
914 ULONG ulID);
915
916 VOID XWPENTRY winhRepaintWindows(HWND hwndParent);
917
918 HMQ XWPENTRY winhFindMsgQueue(PID pid, TID tid, HAB* phab);
919
920 VOID XWPENTRY winhFindPMErrorWindows(HWND *phwndHardError, HWND *phwndSysError);
921
922 HWND XWPENTRY winhCreateFakeDesktop(HWND hwndSibling);
923
924 // Warp 4 notebook button style
925 #ifndef BS_NOTEBOOKBUTTON
926 #define BS_NOTEBOOKBUTTON 8L
927 #endif
928
929 BOOL XWPENTRY winhAssertWarp4Notebook(HWND hwndDlg,
930 USHORT usIdThreshold);
931
932 ULONG XWPENTRY winhDrawFormattedText(HPS hps, PRECTL prcl, const char *pcszText, ULONG flCmd);
933
934 #ifdef INCL_WINSWITCHLIST
935 PSWBLOCK XWPENTRY winhQuerySwitchList(HAB hab);
936 typedef PSWBLOCK XWPENTRY WINHQUERYSWITCHLIST(HAB hab);
937 typedef WINHQUERYSWITCHLIST *PWINHQUERYSWITCHLIST;
938
939 HSWITCH XWPENTRY winhHSWITCHfromHAPP(HAPP happ);
940 #endif
941
942 HWND XWPENTRY winhQueryTasklistWindow(VOID);
943 typedef HWND XWPENTRY WINHQUERYTASKLISTWINDOW(VOID);
944 typedef WINHQUERYTASKLISTWINDOW *PWINHQUERYTASKLISTWINDOW;
945
946 VOID XWPENTRY winhKillTasklist(VOID);
947
948 ULONG XWPENTRY winhQueryPendingSpoolJobs(VOID);
949
950 VOID XWPENTRY winhSetNumLock(BOOL fState);
951
952 BOOL XWPENTRY winhSetClipboardText(HAB hab,
953 PCSZ pcsz,
954 ULONG cbSize);
955
956 /*
957 *@@ winhQueryScreenCX:
958 * helper macro for getting the screen width.
959 */
960
961 #define winhQueryScreenCX() (WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))
962
963 /*
964 *@@ winhQueryScreenCY:
965 * helper macro for getting the screen height.
966 */
967
968 #define winhQueryScreenCY() (WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN))
969
970 /* ******************************************************************
971 *
972 * Extended frame
973 *
974 ********************************************************************/
975
976 #define XFCF_STATUSBAR 0x0001
977
978 #define FID_STATUSBAR 0x8100
979
980 VOID winhCalcExtFrameRect(MPARAM mp1,
981 MPARAM mp2,
982 LONG lStatusBarHeight);
983
984 /*
985 *@@ EXTFRAMECDATA:
986 *
987 *@@added V0.9.16 (2001-09-29) [umoeller]
988 */
989
990 typedef struct _EXTFRAMECDATA
991 {
992 PSWP pswpFrame; // in: frame wnd pos
993 ULONG flFrameCreateFlags; // in: FCF_* flags
994 ULONG flExtFlags; // in: XFCF_* flags
995 ULONG ulFrameStyle; // in: WS_* flags (e.g. WS_VISIBLE, WS_ANIMATE)
996 const char *pcszFrameTitle; // in: frame title (title bar)
997 ULONG ulResourcesID; // in: according to FCF_* flags
998 const char *pcszClassClient; // in: client class name
999 ULONG flStyleClient; // in: client style
1000 ULONG ulID; // in: frame window ID
1001 PVOID pClientCtlData; // in: pCtlData structure pointer for client
1002 } EXTFRAMECDATA, *PEXTFRAMECDATA;
1003
1004 /*
1005 *@@ EXTFRAMEDATA:
1006 *
1007 *@@added V0.9.16 (2001-09-29) [umoeller]
1008 */
1009
1010 typedef struct _EXTFRAMEDATA
1011 {
1012 EXTFRAMECDATA CData;
1013
1014 PFNWP pfnwpOrig; // original frame wnd proc from subclassing
1015
1016 PVOID pvUser; // more data for user (e.g. for additional subclassing)
1017
1018 } EXTFRAMEDATA, *PEXTFRAMEDATA;
1019
1020 HWND winhCreateStatusBar(HWND hwndFrame,
1021 HWND hwndOwner,
1022 const char *pcszText,
1023 const char *pcszFont,
1024 LONG lColor);
1025
1026 HWND winhCreateExtStdWindow(PEXTFRAMECDATA pData,
1027 PHWND phwndClient);
1028
1029 /* ******************************************************************
1030 *
1031 * WPS Class List helpers
1032 *
1033 ********************************************************************/
1034
1035 PBYTE XWPENTRY winhQueryWPSClassList(VOID);
1036
1037 PBYTE XWPENTRY winhQueryWPSClass(PBYTE pObjClass, const char *pszClass);
1038
1039 APIRET XWPENTRY winhRegisterClass(const char* pcszClassName,
1040 const char* pcszModule,
1041 PSZ pszBuf,
1042 ULONG cbBuf);
1043
1044 BOOL XWPENTRY winhIsClassRegistered(const char *pcszClass);
1045
1046 extern BOOL32 APIENTRY WinRestartWorkplace(void);
1047
1048 ULONG XWPENTRY winhResetWPS(HAB hab);
1049
1050#endif
1051
1052#if __cplusplus
1053}
1054#endif
1055
Note: See TracBrowser for help on using the repository browser.