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

Last change on this file since 337 was 337, checked in by pr, 19 years ago

Add winhStoreWindowPos. Bug 458.

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