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

Last change on this file since 164 was 159, checked in by umoeller, 23 years ago

Lots of dialog rework, plus other fixes.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 37.8 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 #define PLF_SMART 0x0001
664
665 BOOL winhPlaceBesides(HWND hwnd,
666 HWND hwndRelative,
667 ULONG fl);
668
669 HWND XWPENTRY winhFindWindowBelow(HWND hwndFind);
670
671 /* ******************************************************************
672 *
673 * Presparams helpers
674 *
675 ********************************************************************/
676
677 PSZ XWPENTRY winhQueryWindowFont(HWND hwnd);
678 typedef PSZ XWPENTRY WINHQUERYWINDOWFONT(HWND hwnd);
679 typedef WINHQUERYWINDOWFONT *PWINHQUERYWINDOWFONT;
680
681 BOOL XWPENTRY winhSetWindowFont(HWND hwnd, const char *pcszFont);
682 typedef BOOL XWPENTRY WINHSETWINDOWFONT(HWND hwnd, const char *pcszFont);
683 typedef WINHSETWINDOWFONT *PWINHSETWINDOWFONT;
684
685 /*
686 *@@ winhSetDlgItemFont:
687 * invokes winhSetWindowFont on a dialog
688 * item.
689 *
690 * Returns TRUE if successful or FALSE otherwise.
691 *
692 *@@added V0.9.0
693 */
694
695 #define winhSetDlgItemFont(hwnd, usId, pszFont) \
696 (winhSetWindowFont(WinWindowFromID(hwnd, usId), pszFont))
697
698 ULONG XWPENTRY winhSetControlsFont(HWND hwndDlg, SHORT usIDMin, SHORT usIDMax, const char *pcszFont);
699
700 #ifdef INCL_WINSYS
701 BOOL XWPENTRY winhStorePresParam(PPRESPARAMS *pppp,
702 ULONG ulAttrType,
703 ULONG cbData,
704 PVOID pData);
705 #endif
706
707 LONG XWPENTRY winhQueryPresColor(HWND hwnd, ULONG ulPP, BOOL fInherit, LONG lSysColor);
708 typedef LONG XWPENTRY WINHQUERYPRESCOLOR(HWND hwnd, ULONG ulPP, BOOL fInherit, LONG lSysColor);
709 typedef WINHQUERYPRESCOLOR *PWINHQUERYPRESCOLOR;
710
711 BOOL XWPENTRY winhSetPresColor(HWND hwnd, ULONG ulIndex, LONG lColor);
712
713 /* ******************************************************************
714 *
715 * Help instance helpers
716 *
717 ********************************************************************/
718
719 #ifdef INCL_WINHELP
720 HWND XWPENTRY winhCreateHelp(HWND hwndFrame,
721 const char *pcszFileName,
722 HMODULE hmod,
723 PHELPTABLE pHelpTable,
724 const char *pcszWindowTitle);
725
726 ULONG winhDisplayHelpPanel(HWND hwndHelpInstance,
727 ULONG ulHelpPanel);
728
729 void XWPENTRY winhDestroyHelp(HWND hwndHelp, HWND hwndFrame);
730 #endif
731
732 /* ******************************************************************
733 *
734 * Application control
735 *
736 ********************************************************************/
737
738 BOOL XWPENTRY winhAnotherInstance(const char *pcszSemName, BOOL fSwitch);
739
740 HSWITCH XWPENTRY winhAddToTasklist(HWND hwnd, HPOINTER hIcon);
741
742 /* ******************************************************************
743 *
744 * Miscellaneous
745 *
746 ********************************************************************/
747
748 VOID XWPENTRY winhFree(PVOID p);
749 typedef VOID XWPENTRY WINHFREE(PVOID p);
750 typedef WINHFREE *PWINHFREE;
751
752 HAB XWPENTRY winhMyAnchorBlock(VOID);
753 typedef HAB XWPENTRY WINHMYANCHORBLOCK(VOID);
754 typedef WINHMYANCHORBLOCK *PWINHMYANCHORBLOCK;
755
756 VOID XWPENTRY winhSleep(ULONG ulSleep);
757
758 #define WINH_FOD_SAVEDLG 0x0001
759 #define WINH_FOD_INILOADDIR 0x0010
760 #define WINH_FOD_INISAVEDIR 0x0020
761
762 BOOL XWPENTRY winhFileDlg(HWND hwndOwner,
763 PSZ pszFile,
764 ULONG flFlags,
765 HINI hini,
766 const char *pcszApplication,
767 const char *pcszKey);
768
769 HPOINTER XWPENTRY winhSetWaitPointer(VOID);
770
771 PSZ XWPENTRY winhQueryWindowText(HWND hwnd);
772
773 BOOL XWPENTRY winhSetWindowText(HWND hwnd,
774 const char *pcszFormat,
775 ...);
776
777 /*
778 *@@ winhQueryDlgItemText:
779 * like winhQueryWindowText, but for the dialog item
780 * in hwnd which has the ID usItemID.
781 */
782
783 #define winhQueryDlgItemText(hwnd, usItemID) winhQueryWindowText(WinWindowFromID(hwnd, usItemID))
784
785 BOOL XWPENTRY winhReplaceWindowText(HWND hwnd,
786 const char *pcszSearch,
787 const char *pcszReplaceWith);
788
789 ULONG XWPENTRY winhCenteredDlgBox(HWND hwndParent, HWND hwndOwner,
790 PFNWP pfnDlgProc, HMODULE hmod, ULONG idDlg, PVOID pCreateParams);
791 typedef ULONG XWPENTRY WINHCENTEREDDLGBOX(HWND hwndParent, HWND hwndOwner,
792 PFNWP pfnDlgProc, HMODULE hmod, ULONG idDlg, PVOID pCreateParams);
793 typedef WINHCENTEREDDLGBOX *PWINHCENTEREDDLGBOX;
794
795 ULONG XWPENTRY winhEnableControls(HWND hwndDlg,
796 USHORT usIDFirst,
797 USHORT usIDLast,
798 BOOL fEnable);
799
800 HWND XWPENTRY winhCreateStdWindow(HWND hwndFrameParent,
801 PSWP pswpFrame,
802 ULONG flFrameCreateFlags,
803 ULONG ulFrameStyle,
804 const char *pcszFrameTitle,
805 ULONG ulResourcesID,
806 const char *pcszClassClient,
807 ULONG flStyleClient,
808 ULONG ulID,
809 PVOID pClientCtlData,
810 PHWND phwndClient);
811
812 HWND XWPENTRY winhCreateObjectWindow(const char *pcszWindowClass,
813 PVOID pvCreateParam);
814
815 HWND XWPENTRY winhCreateControl(HWND hwndParentAndOwner,
816 const char *pcszClass,
817 const char *pcszText,
818 ULONG ulStyle,
819 ULONG ulID);
820
821 VOID XWPENTRY winhRepaintWindows(HWND hwndParent);
822
823 HMQ XWPENTRY winhFindMsgQueue(PID pid, TID tid, HAB* phab);
824
825 VOID XWPENTRY winhFindPMErrorWindows(HWND *phwndHardError, HWND *phwndSysError);
826
827 HWND XWPENTRY winhCreateFakeDesktop(HWND hwndSibling);
828
829 BOOL XWPENTRY winhAssertWarp4Notebook(HWND hwndDlg,
830 USHORT usIdThreshold);
831
832 ULONG XWPENTRY winhDrawFormattedText(HPS hps, PRECTL prcl, const char *pcszText, ULONG flCmd);
833
834 #ifdef INCL_WINSWITCHLIST
835 PSWBLOCK XWPENTRY winhQuerySwitchList(HAB hab);
836 typedef PSWBLOCK XWPENTRY WINHQUERYSWITCHLIST(HAB hab);
837 typedef WINHQUERYSWITCHLIST *PWINHQUERYSWITCHLIST;
838
839 HSWITCH XWPENTRY winhHSWITCHfromHAPP(HAPP happ);
840 #endif
841
842 HWND XWPENTRY winhQueryTasklistWindow(VOID);
843 typedef HWND XWPENTRY WINHQUERYTASKLISTWINDOW(VOID);
844 typedef WINHQUERYTASKLISTWINDOW *PWINHQUERYTASKLISTWINDOW;
845
846 VOID XWPENTRY winhKillTasklist(VOID);
847
848 ULONG XWPENTRY winhQueryPendingSpoolJobs(VOID);
849
850 VOID XWPENTRY winhSetNumLock(BOOL fState);
851
852 /*
853 *@@ winhQueryScreenCX:
854 * helper macro for getting the screen width.
855 */
856
857 #define winhQueryScreenCX() (WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))
858
859 /*
860 *@@ winhQueryScreenCY:
861 * helper macro for getting the screen height.
862 */
863
864 #define winhQueryScreenCY() (WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN))
865
866 /* ******************************************************************
867 *
868 * Extended frame
869 *
870 ********************************************************************/
871
872 #define XFCF_STATUSBAR 0x0001
873
874 #define FID_STATUSBAR 0x8100
875
876 /*
877 *@@ EXTFRAMECDATA:
878 *
879 *@@added V0.9.16 (2001-09-29) [umoeller]
880 */
881
882 typedef struct _EXTFRAMECDATA
883 {
884 PSWP pswpFrame; // in: frame wnd pos
885 ULONG flFrameCreateFlags; // in: FCF_* flags
886 ULONG flExtFlags; // in: XFCF_* flags
887 ULONG ulFrameStyle; // in: WS_* flags (e.g. WS_VISIBLE, WS_ANIMATE)
888 const char *pcszFrameTitle; // in: frame title (title bar)
889 ULONG ulResourcesID; // in: according to FCF_* flags
890 const char *pcszClassClient; // in: client class name
891 ULONG flStyleClient; // in: client style
892 ULONG ulID; // in: frame window ID
893 PVOID pClientCtlData; // in: pCtlData structure pointer for client
894 } EXTFRAMECDATA, *PEXTFRAMECDATA;
895
896 /*
897 *@@ EXTFRAMEDATA:
898 *
899 *@@added V0.9.16 (2001-09-29) [umoeller]
900 */
901
902 typedef struct _EXTFRAMEDATA
903 {
904 EXTFRAMECDATA CData;
905
906 PFNWP pfnwpOrig; // original frame wnd proc from subclassing
907
908 PVOID pvUser; // more data for user (e.g. for additional subclassing)
909
910 } EXTFRAMEDATA, *PEXTFRAMEDATA;
911
912 HWND winhCreateStatusBar(HWND hwndFrame,
913 HWND hwndOwner,
914 const char *pcszText,
915 const char *pcszFont,
916 LONG lColor);
917
918 HWND winhCreateExtStdWindow(PEXTFRAMECDATA pData,
919 PHWND phwndClient);
920
921 /* ******************************************************************
922 *
923 * WPS Class List helpers
924 *
925 ********************************************************************/
926
927 PBYTE XWPENTRY winhQueryWPSClassList(VOID);
928
929 PBYTE XWPENTRY winhQueryWPSClass(PBYTE pObjClass, const char *pszClass);
930
931 APIRET XWPENTRY winhRegisterClass(const char* pcszClassName,
932 const char* pcszModule,
933 PSZ pszBuf,
934 ULONG cbBuf);
935
936 BOOL XWPENTRY winhIsClassRegistered(const char *pcszClass);
937
938 ULONG XWPENTRY winhResetWPS(HAB hab);
939
940#endif
941
942#if __cplusplus
943}
944#endif
945
Note: See TracBrowser for help on using the repository browser.