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

Last change on this file since 154 was 147, checked in by umoeller, 23 years ago

Misc updates for Unicode.

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