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

Last change on this file since 111 was 111, checked in by umoeller, 24 years ago

misc changes

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