source: trunk/src/helpers/comctl.c@ 117

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

More updates.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 50.1 KB
Line 
1
2/*
3 *@@sourcefile comctl.c:
4 * contains various window procedures for implementing
5 * common controls. The source file name has nothing to do
6 * with the Windoze DLL of the same name.
7 *
8 * Usage: All PM programs.
9 *
10 * Function prefixes (new with V0.81):
11 * -- ctl* common control helper functions
12 *
13 * The functionality of this code is accessed with the use
14 * of a special helper function. Sometimes that function
15 * registers a new window class, sometimes a static control
16 * needs to be subclassed. See the respective functions for
17 * details.
18 *
19 * In detail, we have:
20 *
21 * -- a "menu button" control, which displays a menu when
22 * pressed (see ctlMakeMenuButton for details);
23 *
24 * -- progress bar support (see ctlProgressBarFromStatic for
25 * details);
26 *
27 * -- a "chart" control for displaying pie charts (all new
28 * with V0.9.0; see ctlChartFromStatic for details);
29 *
30 * -- split windows support (all new with V0.9.0; see
31 * ctlCreateSplitWindow for details);
32 *
33 * -- a subclassed static control for enhanced bitmap and
34 * and icon display (see ctl_fnwpBitmapStatic for details).
35 * This used to be in animate.c and has been enhanced
36 * with V0.9.0;
37 *
38 * -- a "tooltip" control, which shows fly-over ("bubble")
39 * help over any window, including controls. This is
40 * largely API-compatible with the Win95 tooltip control.
41 * See ctl_fnwpTooltip for details;
42 *
43 * -- a "checkbox container" control, which is a subclassed
44 * container which uses checkboxes as record icons.
45 * See ctlMakeCheckboxContainer for details.
46 *
47 * Note: Version numbering in this file relates to XWorkplace version
48 * numbering.
49 *
50 *@@header "helpers\comctl.h"
51 */
52
53/*
54 * Copyright (C) 1997-2000 Ulrich M”ller.
55 * This file is part of the "XWorkplace helpers" source package.
56 * This is free software; you can redistribute it and/or modify
57 * it under the terms of the GNU General Public License as published
58 * by the Free Software Foundation, in version 2 as it comes in the
59 * "COPYING" file of the XWorkplace main distribution.
60 * This program is distributed in the hope that it will be useful,
61 * but WITHOUT ANY WARRANTY; without even the implied warranty of
62 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63 * GNU General Public License for more details.
64 */
65
66#define OS2EMX_PLAIN_CHAR
67 // this is needed for "os2emx.h"; if this is defined,
68 // emx will define PSZ as _signed_ char, otherwise
69 // as unsigned char
70
71#define INCL_DOSEXCEPTIONS
72#define INCL_DOSPROCESS
73#define INCL_DOSSEMAPHORES
74#define INCL_DOSERRORS
75
76#define INCL_WINWINDOWMGR
77#define INCL_WINFRAMEMGR
78#define INCL_WINMESSAGEMGR
79#define INCL_WININPUT
80#define INCL_WINPOINTERS
81#define INCL_WINTRACKRECT
82#define INCL_WINTIMER
83#define INCL_WINSYS
84
85#define INCL_WINRECTANGLES /// xxx temporary
86
87#define INCL_WINMENUS
88#define INCL_WINSTATICS
89#define INCL_WINBUTTONS
90#define INCL_WINSTDCNR
91
92#define INCL_GPIPRIMITIVES
93#define INCL_GPILOGCOLORTABLE
94#define INCL_GPILCIDS
95#define INCL_GPIPATHS
96#define INCL_GPIREGIONS
97#define INCL_GPIBITMAPS // added V0.9.1 (2000-01-04) [umoeller]: needed for EMX headers
98#include <os2.h>
99
100#include <stdlib.h>
101#include <stdio.h>
102#include <string.h>
103#include <setjmp.h> // needed for except.h
104#include <assert.h> // needed for except.h
105
106#include "setup.h" // code generation and debugging options
107
108#include "helpers\cnrh.h"
109#include "helpers\except.h" // exception handling
110#include "helpers\gpih.h"
111#include "helpers\linklist.h"
112#include "helpers\winh.h"
113
114#include "helpers\comctl.h"
115
116#pragma hdrstop
117
118/* ******************************************************************
119 *
120 * "XButton" control
121 *
122 ********************************************************************/
123
124/*
125 *@@ ctlPaintXButton:
126 * paints an X-button control. Can be called externally
127 * for just painting a button even if this is not really
128 * a window.
129 *
130 * WARNING: this is work in progress and will change into
131 * the future. Eventually this will turn into a full
132 * button control replacement.
133 *
134 *@@added V0.9.13 (2001-06-21) [umoeller]
135 *@@changed V0.9.16 (2001-10-24) [umoeller]: fixed wrong hatch color and paint offset
136 *@@changed V0.9.16 (2001-10-28) [umoeller]: added bitmap support, fixed bad clip rectangle
137 */
138
139VOID ctlPaintXButton(HPS hps, // in: presentation space (RGB mode)
140 ULONG fl, // in: XBF_* flags
141 PXBUTTONDATA pxbd) // in: button data
142{
143 ULONG ulBorder = 0,
144 cx,
145 cy,
146 ulOfs = 0;
147 LONG lLeft,
148 lRight;
149 RECTL rclWin;
150 memcpy(&rclWin, &pxbd->rcl, sizeof(RECTL));
151
152 if (0 == (fl & XBF_FLAT))
153 ulBorder = 2;
154
155 gpihSwitchToRGB(hps);
156
157 if (fl & XBF_PRESSED)
158 {
159 // paint button "down":
160 lLeft = pxbd->lcol3DDark;
161 lRight = pxbd->lcol3DLight;
162 // add offset for icon painting at the bottom
163 ulOfs += 1;
164 if (ulBorder == 0)
165 ulBorder = 1;
166 }
167 else
168 {
169 lLeft = pxbd->lcol3DLight;
170 lRight = pxbd->lcol3DDark;
171 }
172
173 if (ulBorder)
174 {
175 // button border:
176 // now paint button frame
177
178 // make rcl inclusive
179 rclWin.xRight--;
180 rclWin.yTop--;
181 gpihDraw3DFrame(hps,
182 &rclWin, // inclusive
183 ulBorder,
184 lLeft,
185 lRight);
186
187 // now paint button middle
188 rclWin.xLeft += ulBorder;
189 rclWin.yBottom += ulBorder;
190 rclWin.xRight -= ulBorder - 1; // make exclusive again
191 rclWin.yTop -= ulBorder - 1; // make exclusive again
192 }
193
194 if (fl & XBF_BACKGROUND)
195 WinFillRect(hps,
196 &rclWin, // exclusive
197 pxbd->lMiddle);
198
199 // get icon
200 if (pxbd->hptr)
201 {
202 // calculate x and y to be centered in rectangle
203 POINTL ptl;
204
205 cx = rclWin.xRight - rclWin.xLeft;
206 cy = rclWin.yTop - rclWin.yBottom;
207
208 ptl.x = rclWin.xLeft + ((cx - pxbd->cxIconOrBitmap) / 2);
209 ptl.y = rclWin.yBottom + ((cy - pxbd->cyIconOrBitmap) / 2);
210
211 if (fl & XBF_INUSE)
212 {
213 // caller wants in-use (hatched) emphasis:
214 // draw a box then
215 POINTL ptl2;
216 ptl2.x = ptl.x - 2;
217 ptl2.y = ptl.y - 2;
218 GpiMove(hps,
219 &ptl2); // &ptl
220 // duh, typo V0.9.16 (2001-10-24) [umoeller]
221 GpiSetPattern(hps, PATSYM_DIAG1);
222 GpiSetColor(hps, RGBCOL_BLACK); // V0.9.16 (2001-10-24) [umoeller]
223 ptl2.x = ptl.x + pxbd->cxIconOrBitmap + 1; // inclusive!
224 ptl2.y = ptl.y + pxbd->cyIconOrBitmap + 1; // inclusive!
225 GpiBox(hps,
226 DRO_FILL,
227 &ptl2,
228 0,
229 0);
230 }
231
232 // now paint icon
233
234 // make rcl inclusive // V0.9.16 (2001-10-28) [umoeller]
235 rclWin.xRight--;
236 rclWin.yTop--;
237 GpiIntersectClipRectangle(hps,
238 &rclWin); // inclusive!
239
240 // center this in remaining rectl
241 ptl.x += ulOfs;
242 ptl.y -= ulOfs;
243 if (fl & XBF_BITMAP)
244 // V0.9.16 (2001-10-28) [umoeller]
245 WinDrawBitmap(hps,
246 pxbd->hptr, // a bitmap really
247 NULL, // entire bitmap
248 &ptl,
249 0,
250 0,
251 DBM_NORMAL);
252 else
253 WinDrawPointer(hps,
254 // center this in remaining rectl
255 ptl.x + ulOfs,
256 ptl.y - ulOfs,
257 pxbd->hptr,
258 DP_MINI);
259 }
260}
261
262/*
263 *@@category: Helpers\PM helpers\Window classes\Menu buttons
264 * See comctl.c and ctlMakeMenuButton.
265 */
266
267/* ******************************************************************
268 *
269 * "Menu button" control
270 *
271 ********************************************************************/
272
273/*
274 *@@ MENUBUTTONDATA:
275 * internal data for "menu button"
276 *
277 *@@added V0.9.0 [umoeller]
278 */
279
280typedef struct _MENUBUTTONDATA
281{
282 PFNWP pfnwpButtonOriginal;
283 HMODULE hmodMenu;
284 ULONG idMenu;
285 BOOL fMouseCaptured, // TRUE if WinSetCapture
286 fMouseButton1Down, // TRUE in between WM_BUTTON1DOWN and WM_BUTTON1UP
287 fButtonSunk; // toggle state of the button
288 HWND hwndMenu;
289} MENUBUTTONDATA, *PMENUBUTTONDATA;
290
291/*
292 *@@ ctlDisplayButtonMenu:
293 * displays the specified menu above the button.
294 *
295 *@@added V0.9.7 (2000-11-29) [umoeller]
296 */
297
298VOID ctlDisplayButtonMenu(HWND hwndButton,
299 HWND hwndMenu)
300{
301 SWP swpButton;
302 POINTL ptlMenu;
303 WinQueryWindowPos(hwndButton, &swpButton);
304 ptlMenu.x = swpButton.x;
305 ptlMenu.y = swpButton.y;
306
307 // ptlMenu now has button coordinates
308 // relative to the button's parent;
309 // convert this to screen coordinates:
310 WinMapWindowPoints(WinQueryWindow(hwndButton, QW_PARENT),
311 HWND_DESKTOP,
312 &ptlMenu,
313 1);
314
315 // now show the menu on top of the button
316 WinPopupMenu(HWND_DESKTOP, // menu parent
317 hwndButton, // owner
318 hwndMenu,
319 (SHORT)(ptlMenu.x),
320 (SHORT)(ptlMenu.y + swpButton.cy - 1),
321 0, // ID
322 PU_NONE
323 | PU_MOUSEBUTTON1
324 | PU_KEYBOARD
325 | PU_HCONSTRAIN
326 | PU_VCONSTRAIN);
327}
328
329/*
330 *@@ ctl_fnwpSubclassedMenuButton:
331 * subclassed window proc for "menu button".
332 * See ctlMakeMenuButton for details.
333 *
334 *@@added V0.9.0 [umoeller]
335 *@@changed V0.9.2 (2000-02-28) [umoeller]: menu was displayed even if button was disabled; fixed
336 *@@changed V0.9.14 (2001-07-31) [umoeller]: fixed WM_MENUEND submenu quirk
337 */
338
339MRESULT EXPENTRY ctl_fnwpSubclassedMenuButton(HWND hwndButton, ULONG msg, MPARAM mp1, MPARAM mp2)
340{
341 MRESULT mrc = 0;
342 PMENUBUTTONDATA pmbd = (PMENUBUTTONDATA)WinQueryWindowULong(hwndButton, QWL_USER);
343
344 switch (msg)
345 {
346 /*
347 * WM_BUTTON1DOWN:
348 * WM_BUTTON1UP:
349 * these show/hide the menu.
350 *
351 * Showing the menu follows these steps:
352 * a) first WM_BUTTON1DOWN hilites the button;
353 * b) first WM_BUTTON1UP shows the menu.
354 *
355 * When the button is pressed again, the open
356 * menu loses focus, which results in WM_MENUEND
357 * and destroys the window automatically.
358 */
359
360 case WM_BUTTON1DOWN:
361 case WM_BUTTON1DBLCLK:
362 // only do this if the button is enabled
363 // V0.9.2 (2000-02-28) [umoeller]
364 if (WinIsWindowEnabled(hwndButton))
365 {
366 // _Pmpf(("WM_BUTTON1DOWN"));
367 // since we're not passing the message
368 // to WinDefWndProc, we need to give
369 // ourselves the focus
370 WinSetFocus(HWND_DESKTOP, hwndButton);
371
372 if (!pmbd->fMouseCaptured)
373 {
374 // capture mouse events while the
375 // mouse button is down
376 WinSetCapture(HWND_DESKTOP, hwndButton);
377 pmbd->fMouseCaptured = TRUE;
378 }
379
380 pmbd->fMouseButton1Down = TRUE;
381
382 if (!pmbd->fButtonSunk)
383 {
384 // button not hilited yet (first click):
385 // do it now
386 // _Pmpf((" Sinking menu WM_BUTTON1DOWN "));
387 pmbd->fButtonSunk = TRUE;
388 WinSendMsg(hwndButton,
389 BM_SETHILITE,
390 (MPARAM)TRUE,
391 (MPARAM)0);
392 }
393
394 // else: the menu has just been destroyed
395 // (WM_MENUEND below)
396 }
397
398 mrc = (MPARAM)TRUE; // message processed
399 break;
400
401 /*
402 * WM_BUTTON1UP:
403 *
404 */
405
406 case WM_BUTTON1UP:
407 // only do this if the button is enabled
408 // V0.9.2 (2000-02-28) [umoeller]
409 if (WinIsWindowEnabled(hwndButton))
410 {
411 // _Pmpf(("WM_BUTTON1UP sunk %d hwndMenu 0x%lX", pmbd->fButtonSunk, pmbd->hwndMenu));
412
413 // un-capture the mouse first
414 if (pmbd->fMouseCaptured)
415 {
416 WinSetCapture(HWND_DESKTOP, NULLHANDLE);
417 pmbd->fMouseCaptured = FALSE;
418 }
419
420 pmbd->fMouseButton1Down = FALSE;
421
422 if ( (pmbd->fButtonSunk) // set by WM_BUTTON1DOWN above
423 && (pmbd->hwndMenu) // menu currently showing
424 )
425 {
426 // button currently depressed:
427 // un-hilite button
428 // _Pmpf((" Unsinking menu WM_BUTTON1UP 1"));
429 pmbd->fButtonSunk = FALSE;
430 WinSendMsg(hwndButton,
431 BM_SETHILITE,
432 (MPARAM)FALSE,
433 (MPARAM)0);
434 }
435 else
436 {
437 // first button up:
438 // show menu
439
440 if (pmbd->idMenu)
441 {
442 // _Pmpf((" Loading menu hmod %lX id %lX", pmbd->hmodMenu, pmbd->idMenu));
443 // menu specified: load from
444 // specified resources
445 pmbd->hwndMenu = WinLoadMenu(hwndButton,
446 pmbd->hmodMenu,
447 pmbd->idMenu);
448 }
449 else
450 {
451 HWND hwndOwner = WinQueryWindow(hwndButton, QW_OWNER);
452 // _Pmpf((" Querying menu WM_COMMAND from owner 0x%lX", hwndOwner));
453 // send WM_COMMAND to owner
454 pmbd->hwndMenu
455 = (HWND)WinSendMsg(hwndOwner,
456 WM_COMMAND,
457 (MPARAM)(ULONG)WinQueryWindowUShort(hwndButton,
458 QWS_ID),
459 (MPARAM)0);
460 }
461
462 // _Pmpf((" Loaded menu, hwnd: 0x%lX", pmbd->hwndMenu));
463
464 if (pmbd->hwndMenu)
465 {
466 // menu successfully loaded:
467 // find out where to put it
468 ctlDisplayButtonMenu(hwndButton,
469 pmbd->hwndMenu);
470 } // end if (pmbd->hwndMenu)
471 else
472 {
473 // menu not loaded:
474 // _Pmpf((" Unsinking menu WM_BUTTON1UP 2"));
475 pmbd->fButtonSunk = FALSE;
476 WinSendMsg(hwndButton,
477 BM_SETHILITE,
478 (MPARAM)FALSE,
479 (MPARAM)0);
480 }
481 }
482 }
483
484 mrc = (MPARAM)TRUE; // message processed
485 break;
486
487 /*
488 * WM_BUTTON1CLICK:
489 * swallow this
490 */
491
492 case WM_BUTTON1CLICK:
493 mrc = (MPARAM)TRUE;
494 break;
495
496 /*
497 * WM_SETFOCUS:
498 * swallow this, the button keeps painting
499 * itself otherwise
500 */
501
502 case WM_SETFOCUS:
503 break;
504
505 /*
506 * WM_MENUEND:
507 * menu is destroyed; we get this
508 * because we're the owner
509 */
510
511 case WM_MENUEND:
512 {
513 if ((HWND)mp2 == pmbd->hwndMenu) // V0.9.14 (2001-07-31) [umoeller]
514 {
515 BOOL fUnHilite = TRUE;
516 // _Pmpf(("WM_MENUEND"));
517 // At this point, the menu has been
518 // destroyed already.
519 // Since WM_BUTTON1UP handles the
520 // default case that the user presses
521 // the menu button a second time while
522 // the menu is open, we only need
523 // to handle the case that the user
524 // c) presses some key on the menu (ESC, menu selection) or
525 // a) selects a menu item (which
526 // dismisses the menu) or
527 // b) clicks anywhere else.
528
529 // Case a) if mouse button 1 is not currently down
530 if ((WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000) == 0)
531 // button 1 _not_ down:
532 // must be keyboard
533 fUnHilite = TRUE;
534 else
535 // button 1 _is_ down:
536 // query window under mouse pointer
537 ;
538
539 if (fUnHilite)
540 {
541 // _Pmpf((" Unsinking menu WM_MENUEND"));
542 pmbd->fButtonSunk = FALSE;
543 WinSendMsg(hwndButton,
544 BM_SETHILITE,
545 (MPARAM)FALSE,
546 (MPARAM)0);
547 }
548 pmbd->hwndMenu = NULLHANDLE;
549 } // end if ((HWND)mp1 == pmbd->pmbd->hwndMenu) // V0.9.14 (2001-07-31) [umoeller]
550 break; }
551
552 /*
553 * WM_COMMAND:
554 * this must be from the menu, so
555 * forward this to the button's owner
556 */
557
558 case WM_COMMAND:
559 WinPostMsg(WinQueryWindow(hwndButton, QW_OWNER),
560 msg,
561 mp1,
562 mp2);
563 break;
564
565 /*
566 * WM_DESTROY:
567 * clean up allocated data
568 */
569
570 case WM_DESTROY:
571 mrc = (*(pmbd->pfnwpButtonOriginal))(hwndButton, msg, mp1, mp2);
572 free(pmbd);
573 break;
574
575 default:
576 mrc = (*(pmbd->pfnwpButtonOriginal))(hwndButton, msg, mp1, mp2);
577 }
578
579 return (mrc);
580}
581
582/*
583 *@@ ctlMakeMenuButton:
584 * this turns the specified button into a "menu button",
585 * which shows a popup menu when the button is depressed.
586 * This is done by subclassing the menu button with
587 * ctl_fnwpSubclassedMenuButton.
588 *
589 * Simply call this function upon any button, and it'll
590 * turn in to a menu button.
591 *
592 * When the user presses the button, the specified menu
593 * is loaded from the resources. The button will then
594 * be set as the owner, but it will forward all WM_COMMAND
595 * messages from the menu to its own owner (probably your
596 * dialog), so you can handle WM_COMMAND messages just as
597 * if the menu was owned by your dialog.
598 *
599 * Alternatively, if you don't want to load a menu from
600 * the resources, you can specify idMenu == 0. In that case,
601 * when the menu button is pressed, it sends (!) a WM_COMMAND
602 * message to its owner with its ID in mp1 (as usual). The
603 * difference is that the return value from that message will
604 * be interpreted as a menu handle (HWND) to use for the button
605 * menu.
606 *
607 * The subclassed button also handles menu destruction etc.
608 * by itself.
609 *
610 *@@added V0.9.0 [umoeller]
611 */
612
613BOOL ctlMakeMenuButton(HWND hwndButton, // in: button to subclass
614 HMODULE hmodMenu, // in: resource module (can be NULLHANDLE for
615 // current EXE)
616 ULONG idMenu) // in: resource menu ID (or 0)
617{
618 BOOL brc = FALSE;
619 PMENUBUTTONDATA pmbd = (PMENUBUTTONDATA)malloc(sizeof(MENUBUTTONDATA));
620 if (pmbd)
621 {
622 memset(pmbd, 0, sizeof(MENUBUTTONDATA));
623 pmbd->pfnwpButtonOriginal = WinSubclassWindow(hwndButton,
624 ctl_fnwpSubclassedMenuButton);
625 if (pmbd->pfnwpButtonOriginal)
626 {
627 pmbd->hmodMenu = hmodMenu;
628 pmbd->idMenu = idMenu;
629 WinSetWindowULong(hwndButton, QWL_USER, (ULONG)pmbd);
630 brc = TRUE;
631 }
632 else
633 free(pmbd);
634 }
635 return (brc);
636}
637
638/*
639 *@@category: Helpers\PM helpers\Window classes\Static bitmaps
640 * See comctl.c and ctl_fnwpBitmapStatic.
641 */
642
643/* ******************************************************************
644 *
645 * Subclassed Static Bitmap Control
646 *
647 ********************************************************************/
648
649/*
650 *@@ ctl_fnwpBitmapStatic:
651 * subclassed wnd proc for both static controls which
652 * should display icons and stretched bitmaps.
653 *
654 * This is not a stand-alone window procedure, but must only
655 * be used with static controls subclassed by the functions
656 * listed below.
657 *
658 * This is now (V0.9.0) used in two contexts:
659 * -- when subclassed from ctlPrepareStaticIcon,
660 * this displays transparent icons properly
661 * (for regular icons or icon animations);
662 * -- when subclassed from ctlPrepareStretchedBitmap,
663 * this displays a stretched bitmap.
664 *
665 * The behavior depends on ANIMATIONDATA.ulFlags,
666 * which is set by both of these functions (either to
667 * ANF_ICON or ANF_BITMAP).
668 *
669 * Only one msg is of interest to the "user" application
670 * of this control, which is SM_SETHANDLE,
671 * the normal message sent to a static icon control to change
672 * its icon or bitmap.
673 * The new handle (HPOINTER or HBITMAP) is
674 * in mp1; mp2 must be null.
675 *
676 * Depending on ANIMATIONDATA.ulFlags, we do the following:
677 *
678 * -- ANF_ICON: Unfortunately, the
679 * standard static control paints garbage if
680 * the icons contain transparent areas, and the
681 * display often flickers too.
682 * We improve this by creating one bitmap from
683 * the icon that we were given which we can then
684 * simply copy to the screen in one step in
685 * WM_PAINT.
686 *
687 * -- ANF_BITMAP: we create a bitmap which is
688 * stretched to the size of the static control,
689 * using gpihStretchBitmap.
690 *
691 * In any case, a new bitmap is produced internally and
692 * stored so that it can easily be painted when WM_PAINT
693 * comes in. The source icon/bitmap can therefore
694 * be safely destroyed by the caller after sending
695 * SM_SETHANDLE. This bitmap is automatically deleted when
696 * the window is destroyed.
697 *
698 *@@changed V0.9.0 [umoeller]: function renamed
699 *@@changed V0.9.0 [umoeller]: added support for stretched bitmaps
700 *@@changed V0.9.0 [umoeller]: added halftoned display for WS_DISABLED
701 *@@changed V0.9.0 [umoeller]: exported gpihIcon2Bitmap function to gpih.c
702 *@@changed V0.9.0 [umoeller]: fixed paint errors when SM_SETHANDLE had NULL argument in mp1
703 *@@changed V0.9.16 (2001-10-15) [umoeller]: now centering icon in static properly
704 *@@changed V0.9.16 (2001-10-15) [umoeller]: this always used the presparam colors of the parent instead of its own ones
705 */
706
707MRESULT EXPENTRY ctl_fnwpBitmapStatic(HWND hwndStatic, ULONG msg, MPARAM mp1, MPARAM mp2)
708{
709 PANIMATIONDATA pa = (PANIMATIONDATA)WinQueryWindowULong(hwndStatic, QWL_USER);
710 // animation data which was stored in window words
711
712 PFNWP OldStaticProc = NULL;
713 MRESULT mrc = NULL;
714
715 if (pa)
716 {
717 OldStaticProc = pa->OldStaticProc;
718
719 switch(msg)
720 {
721 /*
722 * WM_TIMER:
723 * this timer is started by the ctl* funcs
724 * below. Proceed to the next animation step.
725 *
726 * Note: this timer is only used with
727 * ANF_ICON, and even then, it
728 * is not necessarily running.
729 */
730
731 case WM_TIMER:
732 {
733 pa->usAniCurrent++;
734 if (pa->usAniCurrent >= pa->usAniCount)
735 pa->usAniCurrent = 0;
736
737 WinSendMsg(hwndStatic,
738 SM_SETHANDLE,
739 (MPARAM)pa->ahptrAniIcons[pa->usAniCurrent],
740 (MPARAM)NULL);
741 break; }
742
743 /*
744 * SM_SETHANDLE:
745 *
746 */
747
748 case SM_SETHANDLE:
749 {
750 HDC hdcMem;
751 HPS hpsMem;
752 SIZEL szlPage;
753
754 LONG lBkgndColor
755 /* = winhQueryPresColor(WinQueryWindow(hwndStatic, QW_PARENT),
756 PP_BACKGROUNDCOLOR,
757 FALSE,
758 SYSCLR_DIALOGBACKGROUND); */
759 // fixed this... V0.9.16 (2001-10-15) [umoeller]
760 = winhQueryPresColor(hwndStatic,
761 PP_BACKGROUNDCOLOR,
762 TRUE,
763 SYSCLR_DIALOGBACKGROUND);
764
765 HPS hps = WinGetPS(hwndStatic);
766
767 // if we have created bitmaps previously, delete them
768 if (pa->hbm)
769 {
770 GpiDeleteBitmap(pa->hbm);
771 pa->hbm = NULLHANDLE;
772 }
773 if (pa->hbmHalftoned)
774 {
775 GpiDeleteBitmap(pa->hbmHalftoned);
776 pa->hbmHalftoned = NULLHANDLE;
777 }
778
779 // switch to RGB mode
780 gpihSwitchToRGB(hps);
781
782 // create a memory PS
783 szlPage.cx = pa->rclIcon.xRight - pa->rclIcon.xLeft;
784 szlPage.cy = pa->rclIcon.yTop - pa->rclIcon.yBottom;
785 if (gpihCreateMemPS(pa->hab,
786 &szlPage,
787 &hdcMem,
788 &hpsMem))
789 {
790 // switch the memory PS to RGB mode too
791 gpihSwitchToRGB(hpsMem);
792
793 // create a suitable bitmap w/ the size of the
794 // static control
795 if ((pa->hbm = gpihCreateBitmap(hpsMem,
796 szlPage.cx,
797 szlPage.cy)))
798 {
799 // associate the bit map with the memory PS
800 if (GpiSetBitmap(hpsMem, pa->hbm) != HBM_ERROR)
801 {
802 // fill the bitmap with the current static
803 // background color
804 POINTL ptl = {0, 0};
805 GpiMove(hpsMem, &ptl);
806 ptl.x = pa->rclIcon.xRight;
807 ptl.y = pa->rclIcon.yTop;
808 GpiSetColor(hpsMem,
809 lBkgndColor);
810 GpiBox(hpsMem,
811 DRO_FILL, // interior only
812 &ptl,
813 0, 0); // no corner rounding
814
815 /*
816 * ANF_ICON:
817 *
818 */
819
820 if (pa->ulFlags & ANF_ICON)
821 {
822 // store new icon in our own structure
823 pa->hptr = (HPOINTER)mp1;
824
825 if (pa->hptr)
826 {
827 // center the icon in the bitmap
828 // V0.9.16 (2001-10-15) [umoeller]
829 POINTL ptlOfs;
830 ptlOfs.x = ( (pa->rclIcon.xRight - pa->rclIcon.xLeft)
831 - pa->lIconSize
832 ) / 2;
833 ptlOfs.y = ( (pa->rclIcon.yTop - pa->rclIcon.yBottom)
834 - pa->lIconSize
835 ) / 2;
836
837 // paint icon into bitmap
838 gpihIcon2Bitmap(hpsMem,
839 pa->hptr,
840 lBkgndColor,
841 &ptlOfs,
842 pa->lIconSize);
843 }
844
845 } // end if (pa->ulFlags & ANF_ICON)
846
847 /*
848 * ANF_BITMAP:
849 *
850 */
851
852 else if (pa->ulFlags & ANF_BITMAP)
853 {
854 // store passed bitmap
855 HBITMAP hbmSource = (HBITMAP)mp1;
856
857 if (hbmSource)
858 gpihStretchBitmap(hpsMem, // target
859 hbmSource, // source
860 NULL, // use size of bitmap
861 &pa->rclIcon,
862 ((pa->ulFlags & ANF_PROPORTIONAL)
863 != 0));
864
865 } // end if (pa->ulFlags & ANF_BITMAP)
866
867 } // end if (GpiSetBitmap(...
868 } // if (pa->hbm = gpihCreateBitmap(hpsMem, &(pa->rclIcon)))
869
870 // in any case, clean up now
871 GpiDestroyPS(hpsMem);
872 DevCloseDC(hdcMem);
873 } // end if (gpihCreateMemPS(hab, &hdcMem, &hpsMem))
874
875 WinReleasePS(hps);
876
877 // enforce WM_PAINT
878 WinInvalidateRect(hwndStatic, NULL, FALSE);
879
880 break; }
881
882 /*
883 * WM_PAINT:
884 * "normal" paint; this only arrives here if the
885 * icon needs to be repainted. We simply paint
886 * the bitmap we created in WM_SETHANDLE.
887 */
888
889 case WM_PAINT:
890 {
891 RECTL rcl;
892 HPS hps = WinBeginPaint(hwndStatic, NULLHANDLE, &rcl);
893 POINTL ptl = {0, 0};
894
895 if (pa->hbm)
896 {
897 if (WinQueryWindowULong(hwndStatic, QWL_STYLE)
898 & WS_DISABLED)
899 {
900 // if the control is currently disabled,
901 // draw in half-toned (grayed)
902
903 LONG lBkgndColor = winhQueryPresColor(
904 WinQueryWindow(hwndStatic, QW_PARENT),
905 PP_BACKGROUNDCOLOR,
906 FALSE,
907 SYSCLR_DIALOGBACKGROUND);
908
909 // 1) check if we created the half-tone
910 // bitmap already (WinDrawBitmap doesn't
911 // work with half-toned color bitmaps, so
912 // here's yet another thing we have to do
913 // all alone)
914 if (pa->hbmHalftoned == NULLHANDLE)
915 pa->hbmHalftoned = gpihCreateHalftonedBitmap(pa->hab,
916 pa->hbm,
917 lBkgndColor);
918
919 if (pa->hbmHalftoned)
920 WinDrawBitmap(hps,
921 pa->hbmHalftoned,
922 NULL, // whole bmp
923 &ptl, // lower left corner
924 0, 0, // no colors
925 DBM_NORMAL);
926 }
927 else
928 {
929 // not disabled: draw regular bitmap
930 // we created previously
931 // draw the bitmap that we created previously
932 WinDrawBitmap(hps,
933 pa->hbm,
934 NULL, // whole bmp
935 &ptl, // lower left corner
936 0, 0, // no colors
937 DBM_NORMAL);
938 }
939 }
940
941 WinEndPaint(hps);
942 break; }
943
944 /*
945 * WM_DESTROY:
946 * clean up.
947 */
948
949 case WM_DESTROY:
950 {
951 // undo subclassing in case more WM_TIMERs come in
952 WinSubclassWindow(hwndStatic, OldStaticProc);
953
954 if (pa->hbm)
955 GpiDeleteBitmap(pa->hbm);
956 if (pa->hbmHalftoned)
957 GpiDeleteBitmap(pa->hbm);
958
959 // clean up ANIMATIONDATA struct
960 WinSetWindowULong(hwndStatic, QWL_USER, (ULONG)NULL);
961 free(pa);
962
963 mrc = OldStaticProc(hwndStatic, msg, mp1, mp2);
964 break; }
965
966 default:
967 mrc = OldStaticProc(hwndStatic, msg, mp1, mp2);
968 }
969 }
970 return (mrc);
971}
972
973/* ******************************************************************
974 *
975 * Icon animation
976 *
977 ********************************************************************/
978
979/*
980 *@@ CreateAnimationData:
981 *
982 *@@added V0.9.16 (2001-10-15) [umoeller]
983 */
984
985PANIMATIONDATA CreateAnimationData(HWND hwndStatic,
986 USHORT cAnimations)
987{
988 PANIMATIONDATA pa = NULL;
989
990 if (cAnimations >= 1)
991 {
992 // create the ANIMATIONDATA structure,
993 // initialize some fields,
994 // and store it in QWL_USER of the static control
995 ULONG cbStruct = sizeof(ANIMATIONDATA)
996 + ((cAnimations - 1) * sizeof(HPOINTER));
997
998 if (pa = (PANIMATIONDATA)malloc(cbStruct))
999 {
1000 memset(pa, 0, cbStruct);
1001
1002 WinSetWindowULong(hwndStatic, QWL_USER, (ULONG)pa);
1003
1004 pa->hab = WinQueryAnchorBlock(hwndStatic);
1005 WinQueryWindowRect(hwndStatic, &pa->rclIcon);
1006 pa->OldStaticProc = WinSubclassWindow(hwndStatic, ctl_fnwpBitmapStatic);
1007 pa->lIconSize = WinQuerySysValue(HWND_DESKTOP, SV_CXICON);
1008 }
1009 }
1010
1011 return (pa);
1012}
1013
1014/*
1015 *@@ ctlPrepareStaticIcon:
1016 * turns a static control into one which properly
1017 * displays transparent icons when given a
1018 * SM_SETHANDLE msg.
1019 * This is done by subclassing the static control
1020 * with ctl_fnwpBitmapStatic.
1021 *
1022 * This function gets called automatically by
1023 * ctlPrepareAnimation, so you need not call it
1024 * independently for animations. See the notes there
1025 * how this can be done.
1026 *
1027 * You can, however, call this function if you
1028 * have some static control with transparent icons
1029 * which is not animated but changes sometimes
1030 * (because you have the same repaint problems there).
1031 *
1032 * This func does _not_ start an animation yet.
1033 *
1034 * To change the icon being displayed, send the control
1035 * a SM_SETHANDLE msg with the icon handle in (HPOINTER)mp1.
1036 *
1037 * Returns a PANIMATIONDATA if subclassing succeeded or
1038 * NULL upon errors. If you only call this function, you
1039 * do not need this structure; it is needed by
1040 * ctlPrepareAnimation though.
1041 *
1042 * The subclassed static icon func above automatically
1043 * cleans up resources, so you don't have to worry about
1044 * that either.
1045 *
1046 *@@changed V0.9.0 [umoeller]: adjusted for ctl_fnwpBitmapStatic changes
1047 */
1048
1049PANIMATIONDATA ctlPrepareStaticIcon(HWND hwndStatic,
1050 USHORT usAnimCount) // needed for allocating extra memory,
1051 // this must be at least 1
1052{
1053 PANIMATIONDATA pa;
1054
1055 if (pa = CreateAnimationData(hwndStatic,
1056 usAnimCount))
1057 {
1058 // switch static to icon mode
1059 pa->ulFlags = ANF_ICON;
1060 }
1061
1062 return (pa);
1063}
1064
1065/*
1066 *@@ ctlPrepareAnimation:
1067 * this function turns a regular static icon
1068 * control an animated one. This is the one-shot
1069 * function for animating static icon controls.
1070 *
1071 * It calls ctlPrepareStaticIcon first, then uses
1072 * the passed parameters to prepare an animation:
1073 *
1074 * pahptr must point to an array of HPOINTERs
1075 * which must contain usAnimCount icon handles.
1076 * If (fStartAnimation == TRUE), the animation
1077 * is started already. Otherwise you'll have
1078 * to call ctlStartAnimation yourself.
1079 *
1080 * To create an animated icon, simply create a static
1081 * control with the dialog editor (can be any static,
1082 * e.g. a text control). Then do the following in your code:
1083 *
1084 * 1) load the dlg box template (using WinLoadDlg);
1085 *
1086 * 2) load all the icons for the animation in an array of
1087 * HPOINTERs (check xsdLoadAnimation in shutdown.c for an
1088 * example);
1089 *
1090 * 3) call ctlPrepareAnimation, e.g.:
1091 + ctlPrepareAnimation(WinWindowFromID(hwndDlg, ID_ICON), // get icon hwnd
1092 + 8, // no. of icons for the anim
1093 + &ahptr[0], // ptr to first icon in the array
1094 + 150, // delay
1095 + TRUE); // start animation now
1096 *
1097 * 4) call WinProcessDlg(hwndDlg);
1098 *
1099 * 5) stop the animation, e.g.:
1100 + ctlStopAnimation(WinWindowFromID(hwndDlg, ID_ICON));
1101 *
1102 * 6) destroy the dlg window;
1103 *
1104 * 7) free all the HPOINTERS loaded above (check xsdFreeAnimation
1105 * in shutdown.c for an example).
1106 *
1107 * When the icon control is destroyed, the
1108 * subclassed window proc (ctl_fnwpBitmapStatic)
1109 * automatically cleans up resources. However,
1110 * the icons in *pahptr are not freed.
1111 */
1112
1113BOOL ctlPrepareAnimation(HWND hwndStatic, // icon hwnd
1114 USHORT usAnimCount, // no. of anim steps
1115 HPOINTER *pahptr, // array of HPOINTERs
1116 ULONG ulDelay, // delay per anim step (in ms)
1117 BOOL fStartAnimation) // TRUE: start animation now
1118{
1119 PANIMATIONDATA paNew = ctlPrepareStaticIcon(hwndStatic, usAnimCount);
1120 if (paNew)
1121 {
1122 paNew->ulDelay = ulDelay;
1123 // paNew->OldStaticProc already set
1124 paNew->hptr = NULLHANDLE;
1125 // paNew->rclIcon already set
1126 paNew->usAniCurrent = 0;
1127 paNew->usAniCount = usAnimCount;
1128 memcpy(&paNew->ahptrAniIcons,
1129 pahptr,
1130 (usAnimCount * sizeof(HPOINTER)));
1131
1132 if (fStartAnimation)
1133 {
1134 WinStartTimer(WinQueryAnchorBlock(hwndStatic), hwndStatic,
1135 1, ulDelay);
1136 WinPostMsg(hwndStatic, WM_TIMER, NULL, NULL);
1137 }
1138 }
1139 return (paNew != NULL);
1140}
1141
1142/*
1143 *@@ ctlStartAnimation:
1144 * starts an animation that not currently running. You
1145 * must prepare the animation by calling ctlPrepareAnimation
1146 * first.
1147 */
1148
1149BOOL ctlStartAnimation(HWND hwndStatic)
1150{
1151 BOOL brc = FALSE;
1152 PANIMATIONDATA pa = (PANIMATIONDATA)WinQueryWindowULong(hwndStatic, QWL_USER);
1153 if (pa)
1154 if (WinStartTimer(WinQueryAnchorBlock(hwndStatic), hwndStatic,
1155 1, pa->ulDelay))
1156 {
1157 brc = TRUE;
1158 WinPostMsg(hwndStatic, WM_TIMER, NULL, NULL);
1159 }
1160 return (brc);
1161}
1162
1163/*
1164 *@@ ctlStopAnimation:
1165 * stops an animation that is currently running.
1166 * This does not free any resources.
1167 */
1168
1169BOOL ctlStopAnimation(HWND hwndStatic)
1170{
1171 return (WinStopTimer(WinQueryAnchorBlock(hwndStatic), hwndStatic, 1));
1172}
1173
1174/*
1175 *@@category: Helpers\PM helpers\Window classes\Stretched bitmaps
1176 * See comctl.c and ctlPrepareStretchedBitmap.
1177 */
1178
1179/* ******************************************************************
1180 *
1181 * Bitmap functions
1182 *
1183 ********************************************************************/
1184
1185/*
1186 *@@ ctlPrepareStretchedBitmap:
1187 * turns a static control into a bitmap control
1188 * which stretches the bitmap to the size of the
1189 * control when given an SM_SETHANDLE msg.
1190 *
1191 * If (fPreserveProportions == TRUE), the control
1192 * will size the bitmap proportionally only. Otherwise,
1193 * it will always stretch the bitmap to the whole
1194 * size of the static control (possibly distorting
1195 * the proportions). See gpihStretchBitmap for
1196 * details.
1197 *
1198 * This function subclasses the static control
1199 * with ctl_fnwpBitmapStatic, setting the flags as
1200 * necessary. However, this does not set the bitmap
1201 * to display yet.
1202 * To have a bitmap displayed, send the control
1203 * a SM_SETHANDLE message with the bitmap to be
1204 * displayed in (HBITMAP)mp1 after having used this
1205 * function.
1206 *
1207 * ctl_fnwpBitmapStatic will then create a private
1208 * copy of that bitmap, stretched to its own size.
1209 * You can therefore delete the "source" bitmap
1210 * after sending SM_SETHANDLE.
1211 *
1212 * You can also send SM_SETHANDLE several times.
1213 * The control will then readjust itself and delete
1214 * its old bitmap.
1215 * But note that GpiWCBitBlt is invoked on that new
1216 * bitmap with every new message, so this is not
1217 * terribly fast.
1218 *
1219 * Also note that you should not resize the static
1220 * control after creation, because the bitmap will
1221 * _not_ be adjusted.
1222 *
1223 * This returns a PANIMATIONDATA if subclassing succeeded or
1224 * NULL upon errors. You do not need to save this structure;
1225 * it is cleaned up automatically when the control is destroyed.
1226 *
1227 *@@added V0.9.0 [umoeller]
1228 *@@changed V0.9.16 (2001-10-15) [umoeller]: some cleanup
1229 */
1230
1231PANIMATIONDATA ctlPrepareStretchedBitmap(HWND hwndStatic,
1232 BOOL fPreserveProportions)
1233{
1234 PANIMATIONDATA pa;
1235
1236 if (pa = CreateAnimationData(hwndStatic, 1))
1237 {
1238 // switch static to bitmap mode
1239 pa->ulFlags = ANF_BITMAP;
1240 if (fPreserveProportions)
1241 pa->ulFlags |= ANF_PROPORTIONAL;
1242 }
1243
1244 return (pa);
1245}
1246
1247/*
1248 *@@category: Helpers\PM helpers\Window classes\Hotkey entry field
1249 * See comctl.c and ctl_fnwpObjectHotkeyEntryField.
1250 */
1251
1252/* ******************************************************************
1253 *
1254 * Hotkey entry field
1255 *
1256 ********************************************************************/
1257
1258/*
1259 *@@ ctl_fnwpHotkeyEntryField:
1260 * this is the window proc for a subclassed entry
1261 * field which displays a description of a keyboard
1262 * combination upon receiving WM_CHAR.
1263 *
1264 * Use ctlMakeHotkeyEntryField to turn any existing
1265 * entry field into such an "hotkey entry field".
1266 *
1267 * The entry field is deleted on every WM_CHAR that
1268 * comes in.
1269 *
1270 * For this to work, this window proc needs the
1271 * cooperation of its owner. Whenever a WM_CHAR
1272 * message is received by the entry field which
1273 * looks like a meaningful key or key combination
1274 * (some filtering is done by this func), then
1275 * the owner of the entry field receives a WM_CONTROL
1276 * message with the new EN_HOTKEY notification code
1277 * (see comctl.h for details).
1278 *
1279 * It is then the responsibility of the owner to
1280 * check whether the HOTKEYNOTIFY structure pointed
1281 * to by WM_CONTROL's mp2 is a meaningful keyboard
1282 * combination.
1283 *
1284 * If not, the owner must return FALSE, and the
1285 * entry field's contents are deleted.
1286 *
1287 * If yes however, the owner must fill the szDescription
1288 * field with a description of the keyboard combination
1289 * (e.g. "Shift+Alt+C") and return TRUE. The entry field
1290 * will then be set to that description.
1291 *
1292 *@@added V0.9.1 (99-12-19) [umoeller]
1293 */
1294
1295MRESULT EXPENTRY ctl_fnwpObjectHotkeyEntryField(HWND hwndEdit, ULONG msg, MPARAM mp1, MPARAM mp2)
1296{
1297 MRESULT mrc = (MPARAM)FALSE; // WM_CHAR not-processed flag
1298
1299 // get object window data; this was stored in QWL_USER by
1300 // WM_INITDLG of obj_fnwpSettingsObjDetails
1301 // PXFOBJWINDATA pWinData = (PXFOBJWINDATA)WinQueryWindowULong(hwndEdit, QWL_USER);
1302 PFNWP pfnwpOrig = (PFNWP)WinQueryWindowULong(hwndEdit, QWL_USER);
1303
1304 switch (msg)
1305 {
1306 case WM_CHAR:
1307 {
1308 /*
1309 #define KC_CHAR 0x0001
1310 #define KC_VIRTUALKEY 0x0002
1311 #define KC_SCANCODE 0x0004
1312 #define KC_SHIFT 0x0008
1313 #define KC_CTRL 0x0010
1314 #define KC_ALT 0x0020
1315 #define KC_KEYUP 0x0040
1316 #define KC_PREVDOWN 0x0080
1317 #define KC_LONEKEY 0x0100
1318 #define KC_DEADKEY 0x0200
1319 #define KC_COMPOSITE 0x0400
1320 #define KC_INVALIDCOMP 0x0800
1321 */
1322
1323 /*
1324 Examples: usFlags usKeyCode
1325 F3 02 22
1326 Ctrl+F4 12 23
1327 Ctrl+Shift+F4 1a 23
1328 Ctrl 12 0a
1329 Alt 22 0b
1330 Shift 0a 09
1331 */
1332
1333 // USHORT usCommand;
1334 // USHORT usKeyCode;
1335 USHORT usFlags = SHORT1FROMMP(mp1);
1336 // UCHAR ucRepeat = CHAR3FROMMP(mp1);
1337 UCHAR ucScanCode = CHAR4FROMMP(mp1);
1338 USHORT usch = SHORT1FROMMP(mp2);
1339 USHORT usvk = SHORT2FROMMP(mp2);
1340
1341 if (
1342 // process only key-down messages
1343 ((usFlags & KC_KEYUP) == 0)
1344 // check flags:
1345 // filter out those ugly composite key (accents etc.)
1346 && ((usFlags & (KC_DEADKEY | KC_COMPOSITE | KC_INVALIDCOMP)) == 0)
1347 )
1348 {
1349 HOTKEYNOTIFY hkn;
1350 ULONG flReturned;
1351 HWND hwndOwner = WinQueryWindow(hwndEdit, QW_OWNER);
1352
1353 usFlags &= (KC_VIRTUALKEY | KC_CTRL | KC_ALT | KC_SHIFT);
1354
1355 hkn.usFlags = usFlags;
1356 hkn.usvk = usvk;
1357 hkn.usch = usch;
1358 hkn.ucScanCode = ucScanCode;
1359
1360 if (usFlags & KC_VIRTUALKEY)
1361 hkn.usKeyCode = usvk;
1362 else
1363 hkn.usKeyCode = usch;
1364
1365 hkn.szDescription[0] = 0;
1366
1367 flReturned = (ULONG)WinSendMsg(hwndOwner,
1368 WM_CONTROL,
1369 MPFROM2SHORT(WinQueryWindowUShort(hwndEdit,
1370 QWS_ID),
1371 EN_HOTKEY), // new notification code
1372 (MPARAM)&hkn);
1373 if (flReturned & HEFL_SETTEXT)
1374 WinSetWindowText(hwndEdit, hkn.szDescription);
1375 else
1376 WinSetWindowText(hwndEdit, "");
1377
1378 if (flReturned & HEFL_FORWARD2OWNER)
1379 WinPostMsg(hwndOwner,
1380 WM_CHAR,
1381 mp1, mp2);
1382
1383 mrc = (MPARAM)TRUE; // WM_CHAR processed flag;
1384 }
1385 break; }
1386
1387 default:
1388 mrc = pfnwpOrig(hwndEdit, msg, mp1, mp2);
1389 }
1390 return (mrc);
1391}
1392
1393/*
1394 *@@ ctlMakeHotkeyEntryField:
1395 * this turns any entry field into a "hotkey entry field"
1396 * by subclassing it with ctl_fnwpObjectHotkeyEntryField.
1397 * See remarks there for details.
1398 *
1399 * Returns FALSE upon errors, TRUE otherwise.
1400 *
1401 *@@added V0.9.1 (99-12-19) [umoeller]
1402 */
1403
1404BOOL ctlMakeHotkeyEntryField(HWND hwndHotkeyEntryField)
1405{
1406 PFNWP pfnwpOrig = WinSubclassWindow(hwndHotkeyEntryField,
1407 ctl_fnwpObjectHotkeyEntryField);
1408 if (pfnwpOrig)
1409 {
1410 WinSetWindowPtr(hwndHotkeyEntryField, QWL_USER, (PVOID)pfnwpOrig);
1411 return (TRUE);
1412 }
1413
1414 return (FALSE);
1415}
1416
Note: See TracBrowser for help on using the repository browser.